Class ElasticsearchGlueTypeMapper

  • All Implemented Interfaces:
    GlueFieldLexer.BaseTypeMapper

    public class ElasticsearchGlueTypeMapper
    extends Object
    implements GlueFieldLexer.BaseTypeMapper
    This class is used for mapping Glue data types to Apache Arrow. In addition to the already supported types, it also maps the new SCALED_FLOAT(..) type to BIGINT. The new type is modeled after the scaled_float Elasticsearch data type which is a representation of a floating point number displayed as a long number by multiplying it with the scaling factor and rounding the results (e.g. a floating point value of 0.765 with a scaling factor of 100 will be displayed as 77). The format of the new type is SCALED_FLOAT(double) where double represents a double value scaling factor. When constructing a new Field object for the SCALED_FLOAT data type, the scaling factor will be stored in the object's metadata map (e.g. {"scaling_factor": "100"}). This is done so that the scaled float value can be properly converted to a long value when extracted from the document.
    • Constructor Detail

      • ElasticsearchGlueTypeMapper

        public ElasticsearchGlueTypeMapper()
    • Method Detail

      • getType

        public org.apache.arrow.vector.types.pojo.ArrowType getType​(String type)
        Gets the Arrow type equivalent for the Glue type string representation using the DefaultGlueType.toArrowType conversion routine. The implementation of DefaultGlueType.toArrowType(type) invokes toLowerCase() on the type.
        Specified by:
        getType in interface GlueFieldLexer.BaseTypeMapper
        Parameters:
        type - is the string representation of a Glue data type to be converted to Apache Arrow.
        Returns:
        an Arrow data type corresponding to the Glue type using the default implementation.
      • getField

        public org.apache.arrow.vector.types.pojo.Field getField​(String name,
                                                                 String type)
        Creates a Field object based on the name and type with special logic for extracting the SCALED_FLOAT data type. When constructing a new Field object for the SCALED_FLOAT data type, the scaling factor will be stored in the object's metadata map (e.g. {"scaling_factor": "100"}). This is done so that the scaled float value can be properly converted to a long value when extracted from the document.
        Specified by:
        getField in interface GlueFieldLexer.BaseTypeMapper
        Parameters:
        name - is the name of the field.
        type - is the string representation of a Glue data type to be converted to Apache Arrow.
        Returns:
        a new Field.