dantongdong commented on a change in pull request #2371: URL: https://github.com/apache/hive/pull/2371#discussion_r653975366
########## File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java ########## @@ -3799,10 +3799,33 @@ public Table get_table_core(GetTableRequest getTableRequest) throws MetaExceptio @Override public GetTablesResult get_table_objects_by_name_req(GetTablesRequest req) throws TException { String catName = req.isSetCatName() ? req.getCatName() : getDefaultCatalog(conf); + if (isDatabaseRemote(req.getDbName())) { + return new GetTablesResult(getRemoteTableObjectsInternal(req.getDbName(), req.getTblNames(), req.getTablesPattern())); + } return new GetTablesResult(getTableObjectsInternal(catName, req.getDbName(), req.getTblNames(), req.getCapabilities(), req.getProjectionSpec(), req.getTablesPattern())); } + private String tableNames2regex(List<String> tableNames) { + return "/^(" + String.join("|", tableNames) + ")$/"; Review comment: After some digging around. It seems that tableNamePattern in DatabaseMetaData.getTables() is a bit different from regular regex we are using. In order to search for all tables, the regex should be "%" or null instead of ".*". And we cannot use tableNamePattern to match multiple tableNames([reference](url)). I have created another helper function to get around this issue, and it is included in the latest commit! ########## File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java ########## @@ -3799,10 +3799,33 @@ public Table get_table_core(GetTableRequest getTableRequest) throws MetaExceptio @Override public GetTablesResult get_table_objects_by_name_req(GetTablesRequest req) throws TException { String catName = req.isSetCatName() ? req.getCatName() : getDefaultCatalog(conf); + if (isDatabaseRemote(req.getDbName())) { + return new GetTablesResult(getRemoteTableObjectsInternal(req.getDbName(), req.getTblNames(), req.getTablesPattern())); + } return new GetTablesResult(getTableObjectsInternal(catName, req.getDbName(), req.getTblNames(), req.getCapabilities(), req.getProjectionSpec(), req.getTablesPattern())); } + private String tableNames2regex(List<String> tableNames) { + return "/^(" + String.join("|", tableNames) + ")$/"; Review comment: After some digging around. It seems that tableNamePattern in DatabaseMetaData.getTables() is a bit different from regular regex we are using. In order to search for all tables, the regex should be "%" or null instead of ".*". And we cannot use tableNamePattern to match multiple tableNames([reference](https://stackoverflow.com/questions/65707608/java-sql-pattern-to-find-some-tables-in-my-database)). I have created another helper function to get around this issue, and it is included in the latest commit! -- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org