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 2022/09/21 04:30:43 UTC

[GitHub] [flink] yuzelin commented on a diff in pull request #20790: [FLINK-29228][hive] Align the schema of the HiveServer2 getMetadata with JDBC

yuzelin commented on code in PR #20790:
URL: https://github.com/apache/flink/pull/20790#discussion_r976003878


##########
flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/table/endpoint/hive/HiveServer2EndpointITCase.java:
##########
@@ -572,6 +595,107 @@ public void testGetInfo() throws Exception {
         }
     }
 
+    @Test
+    public void testExecuteStatementInSyncMode() throws Exception {
+        TCLIService.Client client = createClient();
+        TSessionHandle sessionHandle = client.OpenSession(new TOpenSessionReq()).getSessionHandle();
+        TOperationHandle operationHandle =
+                client.ExecuteStatement(new TExecuteStatementReq(sessionHandle, "SHOW CATALOGS"))
+                        .getOperationHandle();
+
+        assertThat(
+                        client.GetOperationStatus(new TGetOperationStatusReq(operationHandle))
+                                .getOperationState())
+                .isEqualTo(TOperationState.FINISHED_STATE);
+
+        RowSet rowSet =
+                RowSetFactory.create(
+                        client.FetchResults(
+                                        new TFetchResultsReq(
+                                                operationHandle,
+                                                TFetchOrientation.FETCH_NEXT,
+                                                Integer.MAX_VALUE))
+                                .getResults(),
+                        HIVE_CLI_SERVICE_PROTOCOL_V10);
+        Iterator<Object[]> iterator = rowSet.iterator();
+        List<List<Object>> actual = new ArrayList<>();
+        while (iterator.hasNext()) {
+            actual.add(new ArrayList<>(Arrays.asList(iterator.next())));
+        }
+        assertThat(actual).isEqualTo(Collections.singletonList(Collections.singletonList("hive")));
+    }

Review Comment:
   Is it necessary to call client.CloseSession?



-- 
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-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org