bowenli86 commented on a change in pull request #8703: 
[FLINK-12807][hive]Support Hive table columnstats related operations in 
HiveCatalog
URL: https://github.com/apache/flink/pull/8703#discussion_r293927620
 
 

 ##########
 File path: 
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/util/HiveStatsUtil.java
 ##########
 @@ -162,38 +148,44 @@ private static CatalogColumnStatisticsDataBase 
createTableColumnStats(DataType c
                } else if (stats.isSetDoubleStats()) {
                                DoubleColumnStatsData doubleStats = 
stats.getDoubleStats();
                                return new CatalogColumnStatisticsDataDouble(
-                                               doubleStats.getLowValue(), 
doubleStats.getHighValue(),
-                                               doubleStats.getNumDVs(), 
doubleStats.getNumNulls());
+                                               doubleStats.getLowValue(),
+                                               doubleStats.getHighValue(),
+                                               doubleStats.getNumDVs(),
+                                               doubleStats.getNumNulls());
                } else if (stats.isSetLongStats()) {
                                LongColumnStatsData longColStats = 
stats.getLongStats();
                                return new CatalogColumnStatisticsDataLong(
-                                               longColStats.getLowValue(), 
longColStats.getHighValue(),
-                                               longColStats.getNumDVs(), 
longColStats.getNumNulls());
+                                               longColStats.getLowValue(),
+                                               longColStats.getHighValue(),
+                                               longColStats.getNumDVs(),
+                                               longColStats.getNumNulls());
                } else if (stats.isSetStringStats()) {
                        StringColumnStatsData stringStats = 
stats.getStringStats();
                        return new CatalogColumnStatisticsDataString(
-                                       stringStats.getMaxColLen(), 
stringStats.getAvgColLen(),
-                                       stringStats.getNumDVs(), 
stringStats.getNumNulls());
+                                       stringStats.getMaxColLen(),
+                                       stringStats.getAvgColLen(),
+                                       stringStats.getNumDVs(),
+                                       stringStats.getNumNulls());
                } else {
                        LOG.warn("Flink does not support converting 
ColumnStatisticsData '{}' for Hive column type '{}' yet.", stats, colType);
                        return null;
                }
        }
 
-
        /**
         * Convert Flink ColumnStats to Hive ColumnStatisticsData according to 
Hive column type.
         * Note we currently assume that, in Flink, the max and min of 
ColumnStats will be same type as the Flink column type.
         * For example, for SHORT and Long columns, the max and min of their 
ColumnStats should be of type SHORT and LONG.
         */
        private static ColumnStatisticsData getColumnStatisticsData(DataType 
colType, CatalogColumnStatisticsDataBase colStat) {
-               LogicalType colLogicalType = colType.getLogicalType();
-               if (colLogicalType instanceof CharType || colLogicalType 
instanceof VarCharType) {
+               LogicalTypeRoot type = colType.getLogicalType().getTypeRoot();
+               if (type.equals(LogicalTypeRoot.CHAR)
+                       || type.equals(LogicalTypeRoot.VARCHAR)) {
 
 Review comment:
   nit: one extra tab here

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