xuefuz commented on a change in pull request #8329: [FLINK-12239][hive] Support 
table related operations in GenericHiveMetastoreCatalog
URL: https://github.com/apache/flink/pull/8329#discussion_r280242198
 
 

 ##########
 File path: 
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/GenericHiveMetastoreCatalog.java
 ##########
 @@ -262,13 +324,33 @@ public void alterTable(ObjectPath tableName, 
CatalogBaseTable newTable, boolean
        }
 
        @Override
-       public CatalogBaseTable getTable(ObjectPath objectPath) throws 
TableNotExistException, CatalogException {
-               throw new UnsupportedOperationException();
+       public CatalogBaseTable getTable(ObjectPath tablePath) throws 
TableNotExistException, CatalogException {
+               Table hiveTable = getHiveTable(tablePath);
+
+               return 
GenericHiveMetastoreCatalogUtil.createCatalogTable(hiveTable);
+       }
+
+       protected Table getHiveTable(ObjectPath tablePath) throws 
TableNotExistException {
+               try {
+                       return client.getTable(tablePath.getDatabaseName(), 
tablePath.getObjectName());
+               } catch (NoSuchObjectException e) {
+                       throw new TableNotExistException(catalogName, 
tablePath);
+               } catch (TException e) {
+                       throw new CatalogException(
+                               String.format("Failed to get Hive table %s", 
tablePath.getFullName()), e);
 
 Review comment:
   => Failed to get table from Hive?

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