You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/06/18 07:20:52 UTC

[GitHub] [flink] lirui-apache commented on a change in pull request #8636: [FLINK-12237][hive]Support Hive table stats related operations in HiveCatalog

lirui-apache commented on a change in pull request #8636: [FLINK-12237][hive]Support Hive table stats related operations in HiveCatalog
URL: https://github.com/apache/flink/pull/8636#discussion_r294636411
 
 

 ##########
 File path: flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/HiveCatalog.java
 ##########
 @@ -1060,21 +1061,73 @@ private static Function instantiateHiveFunction(ObjectPath functionPath, HiveCat
 		);
 	}
 
+	private boolean isTablePartitioned(Table hiveTable) {
+		return hiveTable.getPartitionKeysSize() != 0;
+	}
+
 	// ------ stats ------
 
 	@Override
 	public void alterTableStatistics(ObjectPath tablePath, CatalogTableStatistics tableStatistics, boolean ignoreIfNotExists) throws TableNotExistException, CatalogException {
-
+		try {
+			Table hiveTable = getHiveTable(tablePath);
+			// Set table stats
+			if (needToUpdateStatistics(tableStatistics, hiveTable.getParameters())) {
+				updateStatisticsParameters(tableStatistics, hiveTable.getParameters());
+				client.alter_table(tablePath.getDatabaseName(), tablePath.getObjectName(), hiveTable);
 
 Review comment:
   Have you tested this with Hive-1.2.1? I had some issues when I implemented this for 1.2.1 internally, and added a shim for it.

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


With regards,
Apache Git Services