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_r293541119
 
 

 ##########
 File path: 
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/HiveCatalog.java
 ##########
 @@ -1069,7 +1075,22 @@ public void alterTableStatistics(ObjectPath tablePath, 
CatalogTableStatistics ta
 
        @Override
        public void alterTableColumnStatistics(ObjectPath tablePath, 
CatalogColumnStatistics columnStatistics, boolean ignoreIfNotExists) throws 
TableNotExistException, CatalogException {
-
+               try {
+                       Table hiveTable = getHiveTable(tablePath);
+                       // Set table column stats. This only works for 
non-partitioned tables.
+                       if (!isTablePartitioned(hiveTable)) {
+                               
client.updateTableColumnStatistics(HiveCatalogUtil.createTableColumnStats(hiveTable,
 columnStatistics.getColumnStatisticsData()));
+                       } else {
+                               throw new 
CatalogException(String.format("Failed to alter partition table column stats of 
table %s",
 
 Review comment:
   I'm kind of in between throwing a general `CatalogException` and throwing a 
`TablePartitionedException`. We've been using specific exception for cases like 
this in catalog impl, e.g. adding a partition to a non-partitioned table will 
throw a `TableNotPartitionException`. CatalogException is mainly used for 
runtime errors like network connection errors, and throwing it here will be a 
kind of inconsistent behavior.
   
   What do you guys think?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to