Class DataTypeConverter

java.lang.Object
org.elasticsearch.xpack.esql.core.type.DataTypeConverter

public final class DataTypeConverter extends Object
Conversion utility from one Elasticsearch data type to another Elasticsearch data types.
  • Method Details

    • converterFor

      public static Converter converterFor(DataType from, DataType to)
      Get the conversion from one type to another.
    • safeToByte

      public static byte safeToByte(long x)
    • safeToShort

      public static short safeToShort(long x)
    • safeToInt

      public static int safeToInt(long x)
    • safeToInt

      public static int safeToInt(double x)
    • safeDoubleToLong

      public static long safeDoubleToLong(double x)
    • safeToLong

      public static Long safeToLong(Number x)
    • safeToUnsignedLong

      public static BigInteger safeToUnsignedLong(Double x)
    • safeToUnsignedLong

      public static BigInteger safeToUnsignedLong(Long x)
    • safeToUnsignedLong

      public static BigInteger safeToUnsignedLong(String x)
    • toUnsignedLong

      public static BigInteger toUnsignedLong(Number number)
    • toInteger

      public static Number toInteger(double x, DataType dataType)
    • convertToBoolean

      public static boolean convertToBoolean(String val)
    • convert

      public static Object convert(Object value, DataType dataType)
      Converts arbitrary object to the desired data type.

      Throws InvalidArgumentException if such conversion is not possible

    • asInteger

      public static DataType asInteger(DataType dataType)