beyond1920 commented on a change in pull request #9006: 
[FLINK-13107][table-planner-blink] Copy TableApi IT and UT to Blink planner
URL: https://github.com/apache/flink/pull/9006#discussion_r300904463
 
 

 ##########
 File path: 
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/types/ClassDataTypeConverter.java
 ##########
 @@ -31,6 +35,24 @@
  * Convert unknown types by {@link LegacyTypeInformationType}.
  */
 public class ClassDataTypeConverter {
+       private static final Map<String, DataType> primitiveClassDataTypes = 
new HashMap<>();
+       static {
+
+               // NOTE: this list explicitly excludes data types that need 
further parameters
+               // exclusions: DECIMAL, INTERVAL YEAR TO MONTH, MAP, MULTISET, 
ROW, NULL, ANY
+               addDefaultDataType(boolean.class, DataTypes.BOOLEAN());
 
 Review comment:
   The code is similar with `ClassDataTypeConverter` in table-common module. 
When UDF has a `eval` method explicitly return `int` type, we need convert a 
`int` to `DataType`. 
   I add code here to fix the Inconsistence between `ClassDataTypeConverter` 
with `LegacyTypeInfoDataTypeConverter`.
   `ClassDataTypeConverter` map Class to DataTypes, However, for primitive 
class, it explicit do the following logical to binds convention class:
   `private static void addDefaultDataType(Class<?> clazz, DataType rootType) {
                final DataType dataType;
                if (clazz.isPrimitive()) {
                        dataType = rootType.notNull();
                } else {
                        dataType = rootType.nullable();
                }
                defaultDataTypes.put(clazz.getName(), 
dataType.bridgedTo(clazz));
        }
   `
   So for the primitive class, for example, int.class, it's DataType binding to 
int.class, instead of Integer.class.
   The logical is not consistent with `LegacyTypeInfoDataTypeConverter`.
   the mapping in `LegacyTypeInfoDataTypeConverter` only contains 
DataTypes.INT().bridgedTo(Integer.class), not including 
DataTypes.INT().bridgedTo(int.class). 

----------------------------------------------------------------
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

Reply via email to