org.apache.flink.table.types.logical.LogicalTypeRoot Java Examples
The following examples show how to use
org.apache.flink.table.types.logical.LogicalTypeRoot.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MySQLDialect.java From flink with Apache License 2.0 | 6 votes |
@Override public List<LogicalTypeRoot> unsupportedTypes() { // The data types used in Mysql are list at: // https://dev.mysql.com/doc/refman/8.0/en/data-types.html // TODO: We can't convert BINARY data type to // PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO in LegacyTypeInfoDataTypeConverter. return Arrays.asList( LogicalTypeRoot.BINARY, LogicalTypeRoot.TIMESTAMP_WITH_LOCAL_TIME_ZONE, LogicalTypeRoot.TIMESTAMP_WITH_TIME_ZONE, LogicalTypeRoot.INTERVAL_YEAR_MONTH, LogicalTypeRoot.INTERVAL_DAY_TIME, LogicalTypeRoot.ARRAY, LogicalTypeRoot.MULTISET, LogicalTypeRoot.MAP, LogicalTypeRoot.ROW, LogicalTypeRoot.DISTINCT_TYPE, LogicalTypeRoot.STRUCTURED_TYPE, LogicalTypeRoot.NULL, LogicalTypeRoot.RAW, LogicalTypeRoot.SYMBOL, LogicalTypeRoot.UNRESOLVED ); }
Example #2
Source File: CsvRowSchemaConverter.java From flink with Apache License 2.0 | 6 votes |
/** * Convert {@link LogicalType} to {@link CsvSchema.ColumnType} based on Jackson's categories. */ private static CsvSchema.ColumnType convertType(String fieldName, LogicalType type) { if (STRING_TYPE_ROOTS.contains(type.getTypeRoot())) { return CsvSchema.ColumnType.STRING; } else if (NUMBER_TYPE_ROOTS.contains(type.getTypeRoot())) { return CsvSchema.ColumnType.NUMBER; } else if (BOOLEAN_TYPE_ROOTS.contains(type.getTypeRoot())) { return CsvSchema.ColumnType.BOOLEAN; } else if (type.getTypeRoot() == LogicalTypeRoot.ARRAY) { validateNestedField(fieldName, ((ArrayType) type).getElementType()); return CsvSchema.ColumnType.ARRAY; } else if (type.getTypeRoot() == LogicalTypeRoot.ROW) { RowType rowType = (RowType) type; for (LogicalType fieldType : rowType.getChildren()) { validateNestedField(fieldName, fieldType); } return CsvSchema.ColumnType.ARRAY; } else { throw new IllegalArgumentException( "Unsupported type '" + type.asSummaryString() + "' for field '" + fieldName + "'."); } }
Example #3
Source File: LogicalTypeGeneralization.java From flink with Apache License 2.0 | 6 votes |
private static @Nullable LogicalType findCommonCastableType(List<LogicalType> normalizedTypes) { LogicalType resultType = normalizedTypes.get(0); for (LogicalType type : normalizedTypes) { final LogicalTypeRoot typeRoot = type.getTypeRoot(); // NULL does not affect the result of this loop if (typeRoot == NULL) { continue; } if (supportsImplicitCast(resultType, type)) { resultType = type; } else { if (!supportsImplicitCast(type, resultType)) { return null; } } } return resultType; }
Example #4
Source File: LogicalTypeGeneralization.java From flink with Apache License 2.0 | 6 votes |
private static LogicalType createCommonTimestampType(LogicalType resultType, LogicalType type) { // same types if (type.equals(resultType)) { return resultType; } final LogicalTypeRoot resultTypeRoot = resultType.getTypeRoot(); final LogicalTypeRoot typeRoot = type.getTypeRoot(); final int precision = combinePrecision(resultType, type); // same type roots if (typeRoot == resultTypeRoot) { return createTimestampType(resultTypeRoot, precision); } // generalize to zoned type if (typeRoot == TIMESTAMP_WITH_TIME_ZONE || resultTypeRoot == TIMESTAMP_WITH_TIME_ZONE) { return createTimestampType(TIMESTAMP_WITH_TIME_ZONE, precision); } else if (typeRoot == TIMESTAMP_WITH_LOCAL_TIME_ZONE || resultTypeRoot == TIMESTAMP_WITH_LOCAL_TIME_ZONE) { return createTimestampType(TIMESTAMP_WITH_LOCAL_TIME_ZONE, precision); } return createTimestampType(TIMESTAMP_WITHOUT_TIME_ZONE, precision); }
Example #5
Source File: LogicalTypeCasts.java From flink with Apache License 2.0 | 6 votes |
private static boolean supportsConstructedCasting( LogicalType sourceType, LogicalType targetType, boolean allowExplicit) { final LogicalTypeRoot sourceRoot = sourceType.getTypeRoot(); final LogicalTypeRoot targetRoot = targetType.getTypeRoot(); // all constructed types can only be casted within the same type root if (sourceRoot == targetRoot) { final List<LogicalType> sourceChildren = sourceType.getChildren(); final List<LogicalType> targetChildren = targetType.getChildren(); if (sourceChildren.size() != targetChildren.size()) { return false; } for (int i = 0; i < sourceChildren.size(); i++) { if (!supportsCasting(sourceChildren.get(i), targetChildren.get(i), allowExplicit)) { return false; } } return true; } return false; }
Example #6
Source File: LogicalTypeParser.java From flink with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") private LogicalType parseLegacyType() { nextToken(TokenType.BEGIN_PARAMETER); nextToken(TokenType.LITERAL_STRING); final String rootString = tokenAsString(); nextToken(TokenType.LIST_SEPARATOR); nextToken(TokenType.LITERAL_STRING); final String typeInfoString = tokenAsString(); nextToken(TokenType.END_PARAMETER); try { final LogicalTypeRoot root = LogicalTypeRoot.valueOf(rootString); final TypeInformation typeInfo = TypeStringUtils.readTypeInfo(typeInfoString); return new LegacyTypeInformationType<>(root, typeInfo); } catch (Throwable t) { throw parsingError( "Unable to restore the Legacy type of '" + typeInfoString + "' with " + "type root '" + rootString + "'.", t); } }
Example #7
Source File: DataTypePrecisionFixer.java From flink with Apache License 2.0 | 6 votes |
@Override public DataType visit(FieldsDataType fieldsDataType) { final List<DataType> fieldDataTypes = fieldsDataType.getChildren(); if (logicalType.getTypeRoot() == LogicalTypeRoot.ROW) { final List<String> fieldNames = getFieldNames(logicalType); DataTypes.Field[] fields = IntStream.range(0, fieldDataTypes.size()) .mapToObj(i -> { final DataType oldFieldType = fieldDataTypes.get(i); final DataType newFieldType = oldFieldType.accept( new DataTypePrecisionFixer(logicalType.getChildren().get(i))); return DataTypes.FIELD(fieldNames.get(i), newFieldType); }) .toArray(DataTypes.Field[]::new); return DataTypes.ROW(fields).bridgedTo(fieldsDataType.getConversionClass()); } throw new UnsupportedOperationException("Unsupported logical type : " + logicalType); }
Example #8
Source File: LogicalTypeMerging.java From flink with Apache License 2.0 | 6 votes |
private static LogicalType createCommonTimestampType(LogicalType resultType, LogicalType type) { // same types if (type.equals(resultType)) { return resultType; } final LogicalTypeRoot resultTypeRoot = resultType.getTypeRoot(); final LogicalTypeRoot typeRoot = type.getTypeRoot(); final int precision = combinePrecision(resultType, type); // same type roots if (typeRoot == resultTypeRoot) { return createTimestampType(resultTypeRoot, precision); } // generalize to zoned type if (typeRoot == TIMESTAMP_WITH_TIME_ZONE || resultTypeRoot == TIMESTAMP_WITH_TIME_ZONE) { return createTimestampType(TIMESTAMP_WITH_TIME_ZONE, precision); } else if (typeRoot == TIMESTAMP_WITH_LOCAL_TIME_ZONE || resultTypeRoot == TIMESTAMP_WITH_LOCAL_TIME_ZONE) { return createTimestampType(TIMESTAMP_WITH_LOCAL_TIME_ZONE, precision); } return createTimestampType(TIMESTAMP_WITHOUT_TIME_ZONE, precision); }
Example #9
Source File: LogicalTypeCasts.java From flink with Apache License 2.0 | 6 votes |
private static boolean supportsConstructedCasting( LogicalType sourceType, LogicalType targetType, boolean allowExplicit) { final LogicalTypeRoot sourceRoot = sourceType.getTypeRoot(); final LogicalTypeRoot targetRoot = targetType.getTypeRoot(); // all constructed types can only be casted within the same type root if (sourceRoot == targetRoot) { final List<LogicalType> sourceChildren = sourceType.getChildren(); final List<LogicalType> targetChildren = targetType.getChildren(); if (sourceChildren.size() != targetChildren.size()) { return false; } for (int i = 0; i < sourceChildren.size(); i++) { if (!supportsCasting(sourceChildren.get(i), targetChildren.get(i), allowExplicit)) { return false; } } return true; } return false; }
Example #10
Source File: LogicalTypeGeneralization.java From flink with Apache License 2.0 | 5 votes |
private static LogicalType createStringType(LogicalTypeRoot typeRoot, int length) { switch (typeRoot) { case CHAR: return new CharType(length); case VARCHAR: return new VarCharType(length); case BINARY: return new BinaryType(length); case VARBINARY: return new VarBinaryType(length); default: throw new IllegalArgumentException(); } }
Example #11
Source File: OperationTreeBuilder.java From flink with Apache License 2.0 | 5 votes |
public QueryOperation filter(Expression condition, QueryOperation child) { ExpressionResolver resolver = getResolver(child); ResolvedExpression resolvedExpression = resolveSingleExpression(condition, resolver); DataType conditionType = resolvedExpression.getOutputDataType(); if (!LogicalTypeChecks.hasRoot(conditionType.getLogicalType(), LogicalTypeRoot.BOOLEAN)) { throw new ValidationException("Filter operator requires a boolean expression as input," + " but $condition is of type " + conditionType); } return new FilterQueryOperation(resolvedExpression, child); }
Example #12
Source File: SchemaUtils.java From pulsar-flink with Apache License 2.0 | 5 votes |
public static org.apache.pulsar.client.api.Schema sqlType2PulsarSchema(DataType flinkType) throws IncompatibleSchemaException { if (flinkType instanceof AtomicDataType) { LogicalTypeRoot type = flinkType.getLogicalType().getTypeRoot(); switch (type) { case BOOLEAN: return BooleanSchema.of(); case VARBINARY: return BytesSchema.of(); case DATE: return DateSchema.of(); case VARCHAR: return org.apache.pulsar.client.api.Schema.STRING; case TIMESTAMP_WITHOUT_TIME_ZONE: return TimestampSchema.of(); case TINYINT: return ByteSchema.of(); case DOUBLE: return DoubleSchema.of(); case FLOAT: return FloatSchema.of(); case INTEGER: return IntSchema.of(); case BIGINT: return LongSchema.of(); case SMALLINT: return ShortSchema.of(); default: throw new IncompatibleSchemaException(String.format("%s is not supported by Pulsar yet", flinkType.toString()), null); } } else if (flinkType instanceof FieldsDataType) { return avroSchema2PulsarSchema(sqlType2AvroSchema(flinkType)); } throw new IncompatibleSchemaException(String.format("%s is not supported by Pulsar yet", flinkType.toString()), null); }
Example #13
Source File: LogicalTypeCasts.java From flink with Apache License 2.0 | 5 votes |
/** * Should be called after {@link #explicitFromFamily(LogicalTypeFamily...)} to remove previously * added types. */ CastingRuleBuilder explicitNotFromFamily(LogicalTypeFamily... sourceFamilies) { for (LogicalTypeFamily family : sourceFamilies) { for (LogicalTypeRoot root : LogicalTypeRoot.values()) { if (root.getFamilies().contains(family)) { this.explicitSourceTypes.remove(root); } } } return this; }
Example #14
Source File: LogicalTypeGeneralization.java From flink with Apache License 2.0 | 5 votes |
/** * Returns the most common type of a set of types. It determines a type to which all given types * can be casted. * * <p>For example: {@code [INT, BIGINT, DECIMAL(2, 2)]} would lead to {@code DECIMAL(21, 2)}. */ public static Optional<LogicalType> findCommonType(List<LogicalType> types) { Preconditions.checkArgument(types.size() > 0, "List of types must not be empty."); // collect statistics first boolean hasAnyType = false; boolean hasNullType = false; boolean hasNullableTypes = false; for (LogicalType type : types) { final LogicalTypeRoot typeRoot = type.getTypeRoot(); if (typeRoot == ANY) { hasAnyType = true; } else if (typeRoot == NULL) { hasNullType = true; } if (type.isNullable()) { hasNullableTypes = true; } } final List<LogicalType> normalizedTypes = types.stream() .map(t -> t.copy(true)) .collect(Collectors.toList()); LogicalType foundType = findCommonNullableType(normalizedTypes, hasAnyType, hasNullType); if (foundType == null) { foundType = findCommonCastableType(normalizedTypes); } if (foundType != null) { final LogicalType typeWithNullability = foundType.copy(hasNullableTypes); return Optional.of(typeWithNullability); } return Optional.empty(); }
Example #15
Source File: LegacyDecimalTypeTransformation.java From flink with Apache License 2.0 | 5 votes |
@Override public DataType transform(DataType typeToTransform) { LogicalType logicalType = typeToTransform.getLogicalType(); if (logicalType instanceof LegacyTypeInformationType && logicalType.getTypeRoot() == LogicalTypeRoot.DECIMAL) { DataType decimalType = DataTypes .DECIMAL(DecimalType.MAX_PRECISION, 18) .bridgedTo(typeToTransform.getConversionClass()); return logicalType.isNullable() ? decimalType : decimalType.notNull(); } return typeToTransform; }
Example #16
Source File: LogicalTypeChecksTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testHasNestedRoot() { final DataType dataType = ROW(FIELD("f0", INT()), FIELD("f1", STRING())); assertThat( LogicalTypeChecks.hasNestedRoot(dataType.getLogicalType(), LogicalTypeRoot.VARCHAR), is(true)); assertThat( LogicalTypeChecks.hasNestedRoot(dataType.getLogicalType(), LogicalTypeRoot.ROW), is(true)); assertThat( LogicalTypeChecks.hasNestedRoot(dataType.getLogicalType(), LogicalTypeRoot.BOOLEAN), is(false)); }
Example #17
Source File: LogicalTypeGeneralization.java From flink with Apache License 2.0 | 5 votes |
private static LogicalType createCommonExactNumericType(LogicalType resultType, LogicalType type) { // same EXACT_NUMERIC types if (type.equals(resultType)) { return resultType; } final LogicalTypeRoot resultTypeRoot = resultType.getTypeRoot(); final LogicalTypeRoot typeRoot = type.getTypeRoot(); // no DECIMAL types involved if (resultTypeRoot != DECIMAL && typeRoot != DECIMAL) { // type root contains order of precision if (getPrecision(type) > getPrecision(resultType)) { return type; } return resultType; } // determine DECIMAL with precision (p), scale (s) and number of whole digits (d): // d = max(p1 - s1, p2 - s2) // s <= max(s1, s2) // p = s + d final int p1 = getPrecision(resultType); final int p2 = getPrecision(type); final int s1 = getScale(resultType); final int s2 = getScale(type); final int maxPrecision = DecimalType.MAX_PRECISION; int d = Math.max(p1 - s1, p2 - s2); d = Math.min(d, maxPrecision); int s = Math.max(s1, s2); s = Math.min(s, maxPrecision - d); final int p = d + s; return new DecimalType(p, s); }
Example #18
Source File: PostgresRowConverter.java From flink with Apache License 2.0 | 5 votes |
@Override public JdbcDeserializationConverter createNullableInternalConverter(LogicalType type) { LogicalTypeRoot root = type.getTypeRoot(); if (root == LogicalTypeRoot.ARRAY) { ArrayType arrayType = (ArrayType) type; return createPostgresArrayConverter(arrayType); } else { return createPrimitiveConverter(type); } }
Example #19
Source File: AbstractJdbcRowConverter.java From flink with Apache License 2.0 | 5 votes |
protected JdbcSerializationConverter wrapIntoNullableExternalConverter(JdbcSerializationConverter jdbcSerializationConverter, LogicalType type) { final int sqlType = JdbcTypeUtil.typeInformationToSqlType(TypeConversions.fromDataTypeToLegacyInfo( TypeConversions.fromLogicalToDataType(type))); return (val, index, statement) -> { if (val == null || val.isNullAt(index) || LogicalTypeRoot.NULL.equals(type.getTypeRoot())) { statement.setNull(index + 1, sqlType); } else { jdbcSerializationConverter.serialize(val, index, statement); } }; }
Example #20
Source File: LogicalTypeGeneralization.java From flink with Apache License 2.0 | 5 votes |
private static LogicalType createTimestampType(LogicalTypeRoot typeRoot, int precision) { switch (typeRoot) { case TIMESTAMP_WITHOUT_TIME_ZONE: return new TimestampType(precision); case TIMESTAMP_WITH_TIME_ZONE: return new ZonedTimestampType(precision); case TIMESTAMP_WITH_LOCAL_TIME_ZONE: return new LocalZonedTimestampType(precision); default: throw new IllegalArgumentException(); } }
Example #21
Source File: LegacyTypeInfoDataTypeConverter.java From flink with Apache License 2.0 | 5 votes |
public static DataType toDataType(TypeInformation<?> typeInfo) { // time indicators first as their hashCode/equals is shared with those of regular timestamps if (typeInfo instanceof TimeIndicatorTypeInfo) { return convertToTimeAttributeType((TimeIndicatorTypeInfo) typeInfo); } final DataType foundDataType = typeInfoDataTypeMap.get(typeInfo); if (foundDataType != null) { return foundDataType; } if (typeInfo instanceof RowTypeInfo) { return convertToRowType((RowTypeInfo) typeInfo); } else if (typeInfo instanceof ObjectArrayTypeInfo) { return convertToArrayType( typeInfo.getTypeClass(), ((ObjectArrayTypeInfo) typeInfo).getComponentInfo()); } else if (typeInfo instanceof BasicArrayTypeInfo) { return createLegacyType(LogicalTypeRoot.ARRAY, typeInfo); } else if (typeInfo instanceof MultisetTypeInfo) { return convertToMultisetType(((MultisetTypeInfo) typeInfo).getElementTypeInfo()); } else if (typeInfo instanceof MapTypeInfo) { return convertToMapType((MapTypeInfo) typeInfo); } else if (typeInfo instanceof CompositeType) { return createLegacyType(LogicalTypeRoot.STRUCTURED_TYPE, typeInfo); } return createLegacyType(LogicalTypeRoot.RAW, typeInfo); }
Example #22
Source File: CollectionDataType.java From flink with Apache License 2.0 | 5 votes |
private static Class<?> ensureArrayConversionClass( LogicalType logicalType, DataType elementDataType, @Nullable Class<?> clazz) { // arrays are a special case because their default conversion class depends on the // conversion class of the element type if (logicalType.getTypeRoot() == LogicalTypeRoot.ARRAY && clazz == null) { return Array.newInstance(elementDataType.getConversionClass(), 0).getClass(); } return clazz; }
Example #23
Source File: ChangelogCsvDeserializer.java From flink with Apache License 2.0 | 5 votes |
private static Object parse(LogicalTypeRoot root, String value) { switch (root) { case INTEGER: return Integer.parseInt(value); case VARCHAR: return value; default: throw new IllegalArgumentException(); } }
Example #24
Source File: LogicalTypeCasts.java From flink with Apache License 2.0 | 5 votes |
CastingRuleBuilder explicitFromFamily(LogicalTypeFamily... sourceFamilies) { for (LogicalTypeFamily family : sourceFamilies) { for (LogicalTypeRoot root : LogicalTypeRoot.values()) { if (root.getFamilies().contains(family)) { this.explicitSourceTypes.add(root); } } } return this; }
Example #25
Source File: FlinkPravegaTableSource.java From flink-connectors with Apache License 2.0 | 5 votes |
/** * Declares a list of fields to be rowtime attributes. * * @param rowtimeAttributeDescriptors The descriptors of the rowtime attributes. */ protected void setRowtimeAttributeDescriptors(List<RowtimeAttributeDescriptor> rowtimeAttributeDescriptors) { // validate that all declared fields exist and are of correct type for (RowtimeAttributeDescriptor desc : rowtimeAttributeDescriptors) { String rowtimeAttribute = desc.getAttributeName(); Optional<DataType> tpe = schema.getFieldDataType(rowtimeAttribute); if (!tpe.isPresent()) { throw new ValidationException("Rowtime attribute " + rowtimeAttribute + " is not present in TableSchema."); } else if (tpe.get().getLogicalType().getTypeRoot() != LogicalTypeRoot.TIMESTAMP_WITHOUT_TIME_ZONE) { throw new ValidationException("Rowtime attribute " + rowtimeAttribute + " is not of type TIMESTAMP."); } } this.rowtimeAttributeDescriptors = rowtimeAttributeDescriptors; }
Example #26
Source File: FlinkPravegaTableSource.java From flink-connectors with Apache License 2.0 | 5 votes |
/** * Declares a field of the schema to be the processing time attribute. * * @param proctimeAttribute The name of the field that becomes the processing time field. */ protected void setProctimeAttribute(String proctimeAttribute) { if (proctimeAttribute != null) { // validate that field exists and is of correct type Optional<DataType> tpe = schema.getFieldDataType(proctimeAttribute); if (!tpe.isPresent()) { throw new ValidationException("Processing time attribute " + proctimeAttribute + " is not present in TableSchema."); } else if (tpe.get().getLogicalType().getTypeRoot() != LogicalTypeRoot.TIMESTAMP_WITHOUT_TIME_ZONE) { throw new ValidationException("Processing time attribute " + proctimeAttribute + " is not of type TIMESTAMP."); } } this.proctimeAttribute = proctimeAttribute; }
Example #27
Source File: LogicalTypeCasts.java From flink with Apache License 2.0 | 5 votes |
@Override public Boolean visit(VarCharType targetType) { if (sourceType.isNullable() && !targetType.isNullable()) { return false; } // CHAR and VARCHAR are very compatible within bounds if ((hasRoot(sourceType, LogicalTypeRoot.CHAR) || hasRoot(sourceType, LogicalTypeRoot.VARCHAR)) && getLength(sourceType) <= targetType.getLength()) { return true; } return defaultMethod(targetType); }
Example #28
Source File: LogicalTypeCasts.java From flink with Apache License 2.0 | 5 votes |
/** * Should be called after {@link #explicitFromFamily(LogicalTypeFamily...)} to remove previously * added types. */ CastingRuleBuilder explicitNotFromFamily(LogicalTypeFamily... sourceFamilies) { for (LogicalTypeFamily family : sourceFamilies) { for (LogicalTypeRoot root : LogicalTypeRoot.values()) { if (root.getFamilies().contains(family)) { this.explicitSourceTypes.remove(root); } } } return this; }
Example #29
Source File: AggregateOperationFactory.java From flink with Apache License 2.0 | 5 votes |
@Override protected Boolean defaultMethod(LogicalType logicalType) { if (logicalType.getTypeRoot() == LogicalTypeRoot.ANY) { // we don't know anything about the ANY type, we don't know if it is comparable and hashable. return false; } else if (logicalType instanceof LegacyTypeInformationType) { return ((LegacyTypeInformationType) logicalType).getTypeInformation().isKeyType(); } return logicalType.getChildren().stream().allMatch(c -> c.accept(this)); }
Example #30
Source File: IndexGeneratorFactory.java From flink with Apache License 2.0 | 5 votes |
private static DynamicFormatter createFormatFunction( LogicalType indexFieldType, LogicalTypeRoot indexFieldLogicalTypeRoot) { switch (indexFieldLogicalTypeRoot) { case DATE: return (value, dateTimeFormatter) -> { Integer indexField = (Integer) value; return LocalDate.ofEpochDay(indexField).format(dateTimeFormatter); }; case TIME_WITHOUT_TIME_ZONE: return (value, dateTimeFormatter) -> { Integer indexField = (Integer) value; return LocalTime.ofNanoOfDay(indexField * 1_000_000L) .format(dateTimeFormatter); }; case TIMESTAMP_WITHOUT_TIME_ZONE: return (value, dateTimeFormatter) -> { TimestampData indexField = (TimestampData) value; return indexField.toLocalDateTime().format(dateTimeFormatter); }; case TIMESTAMP_WITH_TIME_ZONE: throw new UnsupportedOperationException("TIMESTAMP_WITH_TIME_ZONE is not supported yet"); case TIMESTAMP_WITH_LOCAL_TIME_ZONE: return (value, dateTimeFormatter) -> { TimestampData indexField = (TimestampData) value; return indexField.toInstant().atZone(ZoneOffset.UTC).format(dateTimeFormatter); }; default: throw new TableException(String.format( "Unsupported type '%s' found in Elasticsearch dynamic index field, " + "time-related pattern only support types are: DATE,TIME,TIMESTAMP.", indexFieldType)); } }