[
https://issues.apache.org/jira/browse/IGNITE-4574?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sergey Kalashnikov updated IGNITE-4574:
---------------------------------------
Description:
We need a way to add custom data types in H2 without the need to modify it each
time around.
Current approach is to add new interface to H2 like the following:
{code}
public interface CustomDataTypesHandler {
DataType getDataTypeByName(String name);
DataType getDataTypeById(int type);
int getDataTypeOrder(int type);
Value convert(Value source, int targetType);
}
{code}
The H2 will instantiate the class implementing the interface by its name
provided by user via system properties.
Then, whenever H2 meets the SQL command with type name missing from its
internal type system, it will consult this new interface.
Likewise, whenever H2 needs to convert a value to unknown data type, it will
delegate the conversion to the CustomDataTypesHandler.
The ignite will then implement this interface and be able to plug-in support
for custom types like enum, etc.
Since convert operation returns object of type Value, all the possible
operations in custom datatypes can be overriden in a way we like.
was:
We need a way to add custom data types in H2 without the need to modify it each
time around.
Current approach is to add new interface to H2 like the following:
{code}
public interface CustomDataTypesHandler {
DataType getDataTypeByName(String name);
DataType getDataTypeById(int type);
int getDataTypeOrder(int type);
Value convert(Value source, int targetType);
}
{code}
The H2 will instantiate the class implementing the interface by its name
provided by user via system properties.
Then, whenever H2 meets the SQL command with type name missing from its
internal type system, it will consult this new interface.
Likewise, whenever H2 needs to convert a value to unknown data type, it will
delegate the conversion to the CustomDataTypesHandler.
The ignite will then implement this interface and necessary and be able to
plug-in support for custom types like enum, etc.
Since convert operation returns object of type Value, all the possible
operations in custom datatypes can be overriden in a way we like.
> Introduce user value types to H2 w/custom conversion logic
> ----------------------------------------------------------
>
> Key: IGNITE-4574
> URL: https://issues.apache.org/jira/browse/IGNITE-4574
> Project: Ignite
> Issue Type: Sub-task
> Components: SQL
> Reporter: Alexander Paschenko
> Assignee: Sergey Kalashnikov
> Fix For: 2.0
>
>
> We need a way to add custom data types in H2 without the need to modify it
> each time around.
> Current approach is to add new interface to H2 like the following:
> {code}
> public interface CustomDataTypesHandler {
> DataType getDataTypeByName(String name);
> DataType getDataTypeById(int type);
> int getDataTypeOrder(int type);
> Value convert(Value source, int targetType);
> }
> {code}
> The H2 will instantiate the class implementing the interface by its name
> provided by user via system properties.
> Then, whenever H2 meets the SQL command with type name missing from its
> internal type system, it will consult this new interface.
> Likewise, whenever H2 needs to convert a value to unknown data type, it will
> delegate the conversion to the CustomDataTypesHandler.
> The ignite will then implement this interface and be able to plug-in support
> for custom types like enum, etc.
> Since convert operation returns object of type Value, all the possible
> operations in custom datatypes can be overriden in a way we like.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)