Igniters,

Currently we have limited support of binary enums. The main problem is that
we do not store any metadata about enum names. For this reason it is
impossible to use enums in SQL even though H2 already supports it [1]. We
need to improve enum metadata support and provide some additional API to
register new enums in runtime.

Proposed API:

1) Enum mappings can be defined statically in BinaryTypeConfiguration:

class BinaryTypeConfiguration {
    boolean isEnum;                  // Old method
    *Map<String, Integer> enumValues;* // New method
}

2) New enum could be registered through IgniteBinary (e.g. we will use it
if enum is defined in CREATE TABLE statement). Elso it would be possible to
build enum using only name.

interface IgniteBinary {
    BinaryObject buildEnum(String typeName, int ordinal);              //
Old
    *BinaryObject buildEnum(String typeName, String name); *             //
New

    *BinaryType defineEnum(String typeName, Map<String, Integer> vals);* //
New
}

3) BinaryObject will have new method "enumName":

interface BinaryObject {
    enumOrdinal();     // Old
    *String enumName();* // New
}

4) It would be possible to get the list of known values from BinaryType:

interface BinaryType {
    boolean isEnum();                      // Old
    *Collection<BinaryObject> enumValues();* // New
}

Thoughts?

Vladimir.

[1] https://github.com/h2database/h2database/pull/487/commits

Reply via email to