yuzelin commented on code in PR #20401: URL: https://github.com/apache/flink/pull/20401#discussion_r938492798
########## flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/endpoint/hive/HiveServer2Endpoint.java: ########## @@ -422,7 +426,76 @@ public TGetCatalogsResp GetCatalogs(TGetCatalogsReq tGetCatalogsReq) throws TExc @Override public TGetSchemasResp GetSchemas(TGetSchemasReq tGetSchemasReq) throws TException { - throw new UnsupportedOperationException(ERROR_MESSAGE); + TGetSchemasResp resp = new TGetSchemasResp(); + try { + SessionHandle sessionHandle = toSessionHandle(tGetSchemasReq.getSessionHandle()); + OperationHandle operationHandle = + service.submitOperation( + sessionHandle, + OperationType.LIST_SCHEMAS, + () -> { + Set<String> schemaNames = + service + .listDatabases( + sessionHandle, + tGetSchemasReq.getCatalogName()) + .stream() + .filter( + name -> + name.matches( + convertNamePattern( + tGetSchemasReq + .getSchemaName()))) + .collect(Collectors.toSet()); + + return new ResultSet( + EOS, + null, + GET_SCHEMAS_SCHEMA, + schemaNames.stream() + .map( + name -> + GenericRowData.of( + StringData.fromString(name), + StringData.fromString( + tGetSchemasReq + .getCatalogName()))) + .collect(Collectors.toList())); + }); + + // TODO: Remove this + while (!service.getOperationInfo(sessionHandle, operationHandle) + .getStatus() + .isTerminalStatus()) { + Thread.sleep(1000); + } Review Comment: Removed. -- 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. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org