[ https://issues.apache.org/jira/browse/HIVE-25213?focusedWorklogId=612137&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-612137 ]
ASF GitHub Bot logged work on HIVE-25213: ----------------------------------------- Author: ASF GitHub Bot Created on: 18/Jun/21 21:24 Start Date: 18/Jun/21 21:24 Worklog Time Spent: 10m Work Description: 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 Issue Time Tracking ------------------- Worklog Id: (was: 612137) Time Spent: 1h (was: 50m) > Implement List<Table> getTables() for existing connectors. > ---------------------------------------------------------- > > Key: HIVE-25213 > URL: https://issues.apache.org/jira/browse/HIVE-25213 > Project: Hive > Issue Type: Sub-task > Reporter: Naveen Gangam > Assignee: Dantong Dong > Priority: Major > Labels: pull-request-available > Time Spent: 1h > Remaining Estimate: 0h > > In the initial implementation, connector providers do not implement the > getTables(string pattern) spi. We had deferred it for later. Only > getTableNames() and getTable() were implemented. -- This message was sent by Atlassian Jira (v8.3.4#803005)