Class EsqlDataTypeConverter
java.lang.Object
org.elasticsearch.xpack.esql.type.EsqlDataTypeConverter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic List<EsqlDataTypeConverter.INTERVALS> static final DateFormatterstatic final DateFormatterstatic final DateFormatterstatic final Stringstatic List<EsqlDataTypeConverter.INTERVALS> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringaggregateMetricDoubleBlockToString(AggregateMetricDoubleBlock aggBlock, int index) static StringaggregateMetricDoubleLiteralToString(AggregateMetricDoubleBlockBuilder.AggregateMetricDoubleLiteral aggMetric) static longstatic longbooleanToUnsignedLong(boolean number) static longchronoToLong(long dateTime, ChronoField chronoField, ZoneId zone) static longchronoToLong(long dateTime, org.apache.lucene.util.BytesRef chronoField, ZoneId zone) static longchronoToLongNanos(long dateNanos, ChronoField chronoField, ZoneId zone) Extract the givenChronoFieldvalue from a date specified as a long number of nanoseconds since epochstatic longchronoToLongNanos(long dateNanos, org.apache.lucene.util.BytesRef chronoField, ZoneId zone) Extract the givenChronoFieldvalue from a date specified as a long number of nanoseconds since epochstatic DataTypecommonType(DataType left, DataType right) Returns the type compatible with both left and right typesstatic ObjectConverts arbitrary object to the desired data type.static ConverterconverterFor(DataType from, DataType to) converterFunctionFactory(DataType toType) static longdateNanosToLong(String dateNano) static longdateNanosToLong(String dateNano, DateFormatter formatter) static longdateTimeToLong(String dateTime) static longdateTimeToLong(String dateTime, DateFormatter formatter) static StringdateTimeToString(long dateTime) static StringdateTimeToString(long dateTime, DateFormatter formatter) static StringdateWithTypeToString(long dateTime, DataType type) static longdoubleToUnsignedLong(double number) static TemporalAmountfoldToTemporalAmount(FoldContext ctx, Expression field, String sourceText, DataType expectedType) static longintToUnsignedLong(int number) static StringipToString(org.apache.lucene.util.BytesRef field) static longlongToUnsignedLong(long number, boolean allowNegative) static TemporalAmountstatic StringnanoTimeToString(long dateTime) static StringnanoTimeToString(long dateTime, DateFormatter formatter) static org.apache.lucene.util.BytesRefnumericBooleanToString(Object field) static TemporalAmountparseTemporalAmount(Number value, String temporalUnit, Source source) static TemporalAmountparseTemporalAmount(Object val, DataType expectedType) static StringspatialToString(org.apache.lucene.util.BytesRef field) static booleanstringToBoolean(String field) static doublestringToDouble(String field) static org.apache.lucene.util.BytesRefstringToGeo(String field) static intstringToInt(String field) static NumberstringToIntegral(String field) static org.apache.lucene.util.BytesRefstringToIP(String field) static org.apache.lucene.util.BytesRefstringToIP(org.apache.lucene.util.BytesRef field) The following conversions are between String and other data types.static longstringToLong(String field) static org.apache.lucene.util.BytesRefstringToSpatial(String field) static longstringToUnsignedLong(String field) static org.apache.lucene.util.BytesRefstringToVersion(String field) static org.apache.lucene.util.BytesRefstringToVersion(org.apache.lucene.util.BytesRef field) static BigIntegerunsignedLongToBigInteger(long number) static booleanunsignedLongToBoolean(long number) static doubleunsignedLongToDouble(long number) The following conversion are between unsignedLong and other numeric data types.static intunsignedLongToInt(long number) static longunsignedLongToLong(long number) static org.apache.lucene.util.BytesRefunsignedLongToString(long number) static StringversionToString(org.apache.lucene.util.BytesRef field) static StringversionToString(org.elasticsearch.xpack.versionfield.Version field)
-
Field Details
-
DEFAULT_DATE_TIME_FORMATTER
-
DEFAULT_DATE_NANOS_FORMATTER
-
HOUR_MINUTE_SECOND
-
TIME_DURATIONS
-
DATE_PERIODS
-
INVALID_INTERVAL_ERROR
- See Also:
-
-
Constructor Details
-
EsqlDataTypeConverter
public EsqlDataTypeConverter()
-
-
Method Details
-
converterFor
-
foldToTemporalAmount
public static TemporalAmount foldToTemporalAmount(FoldContext ctx, Expression field, String sourceText, DataType expectedType) -
parseTemporalAmount
-
maybeParseTemporalAmount
-
convert
Converts arbitrary object to the desired data type.Throws QlIllegalArgumentException if such conversion is not possible
-
commonType
Returns the type compatible with both left and right typesIf one of the types is null - returns another type If both types are numeric - returns type with the highest precision int < long < float < double
-
parseTemporalAmount
public static TemporalAmount parseTemporalAmount(Number value, String temporalUnit, Source source) throws InvalidArgumentException, ArithmeticException, ParsingException -
chronoToLong
public static long chronoToLong(long dateTime, org.apache.lucene.util.BytesRef chronoField, ZoneId zone) -
chronoToLong
-
chronoToLongNanos
public static long chronoToLongNanos(long dateNanos, org.apache.lucene.util.BytesRef chronoField, ZoneId zone) Extract the givenChronoFieldvalue from a date specified as a long number of nanoseconds since epoch- Parameters:
dateNanos- - long nanoseconds since epochchronoField- - The field to extractzone- - Timezone for the given date- Returns:
- - long representing the given ChronoField value
-
chronoToLongNanos
Extract the givenChronoFieldvalue from a date specified as a long number of nanoseconds since epoch- Parameters:
dateNanos- - long nanoseconds since epochchronoField- - The field to extractzone- - Timezone for the given date- Returns:
- - long representing the given ChronoField value
-
stringToIP
public static org.apache.lucene.util.BytesRef stringToIP(org.apache.lucene.util.BytesRef field) The following conversions are between String and other data types. -
stringToIP
-
ipToString
-
stringToVersion
public static org.apache.lucene.util.BytesRef stringToVersion(org.apache.lucene.util.BytesRef field) -
stringToVersion
-
versionToString
-
versionToString
-
spatialToString
-
stringToGeo
-
stringToSpatial
-
dateTimeToLong
-
dateTimeToLong
-
dateNanosToLong
-
dateNanosToLong
-
dateWithTypeToString
-
dateTimeToString
-
nanoTimeToString
-
dateTimeToString
-
nanoTimeToString
-
numericBooleanToString
-
stringToBoolean
-
stringToInt
-
stringToLong
-
stringToDouble
-
unsignedLongToString
public static org.apache.lucene.util.BytesRef unsignedLongToString(long number) -
stringToUnsignedLong
-
stringToIntegral
-
unsignedLongToDouble
public static double unsignedLongToDouble(long number) The following conversion are between unsignedLong and other numeric data types. -
doubleToUnsignedLong
public static long doubleToUnsignedLong(double number) -
unsignedLongToInt
public static int unsignedLongToInt(long number) -
intToUnsignedLong
public static long intToUnsignedLong(int number) -
unsignedLongToLong
public static long unsignedLongToLong(long number) -
longToUnsignedLong
public static long longToUnsignedLong(long number, boolean allowNegative) -
bigIntegerToUnsignedLong
-
unsignedLongToBigInteger
-
unsignedLongToBoolean
public static boolean unsignedLongToBoolean(long number) -
booleanToUnsignedLong
public static long booleanToUnsignedLong(boolean number) -
aggregateMetricDoubleBlockToString
public static String aggregateMetricDoubleBlockToString(AggregateMetricDoubleBlock aggBlock, int index) -
aggregateMetricDoubleLiteralToString
public static String aggregateMetricDoubleLiteralToString(AggregateMetricDoubleBlockBuilder.AggregateMetricDoubleLiteral aggMetric) -
stringToAggregateMetricDoubleLiteral
public static AggregateMetricDoubleBlockBuilder.AggregateMetricDoubleLiteral stringToAggregateMetricDoubleLiteral(String s) -
converterFunctionFactory
public static BiFunction<Source,Expression, converterFunctionFactoryAbstractConvertFunction> (DataType toType)
-