JingsongLi commented on a change in pull request #10403: [FLINK-14645][table]
Support to keep nullability and precision when converting DataTypes to
properties
URL: https://github.com/apache/flink/pull/10403#discussion_r353625137
##########
File path:
flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java
##########
@@ -582,19 +607,26 @@ public short getShort(String key) {
final TableSchema.Builder schemaBuilder = TableSchema.builder();
for (int i = 0; i < fieldCount; i++) {
final String nameKey = key + '.' + i + '.' +
TABLE_SCHEMA_NAME;
- final String typeKey = key + '.' + i + '.' +
TABLE_SCHEMA_TYPE;
+ final String legacyTypeKey = key + '.' + i + '.' +
TABLE_SCHEMA_TYPE;
+ final String typeKey = key + '.' + i + '.' +
TABLE_SCHEMA_DATATYPE;
final String exprKey = key + '.' + i + '.' +
TABLE_SCHEMA_EXPR;
final String name =
optionalGet(nameKey).orElseThrow(exceptionSupplier(nameKey));
- final TypeInformation<?> type = optionalGet(typeKey)
- .map(TypeStringUtils::readTypeInfo)
- .orElseThrow(exceptionSupplier(typeKey));
+ final DataType type;
+ if (containsKey(typeKey)) {
+ type = getDataType(typeKey);
+ } else if (containsKey(legacyTypeKey)) {
+ type =
LegacyTypeInfoDataTypeConverter.toDataType(getType(legacyTypeKey));
Review comment:
Use `TypeConversions.***`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services