You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/01/05 02:22:00 UTC

[GitHub] [iceberg] openinx commented on a change in pull request #1956: upgrade flink version from 1.11.0 to 1.12.0

openinx commented on a change in pull request #1956:
URL: https://github.com/apache/iceberg/pull/1956#discussion_r551679707



##########
File path: flink/src/test/java/org/apache/iceberg/flink/FlinkTestBase.java
##########
@@ -76,7 +99,7 @@ protected TableEnvironment getTableEnv() {
     TableResult tableResult = getTableEnv().executeSql(String.format(query, args));
     tableResult.getJobClient().ifPresent(c -> {
       try {
-        c.getJobExecutionResult(Thread.currentThread().getContextClassLoader()).get();
+        c.getJobExecutionResult().get();

Review comment:
       I read the javadoc about  [TableResult](https://github.com/apache/flink/blob/97bfd049951f8d52a2e0aed14265074c4255ead0/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/TableResult.java#L186) again.  The correct way to execute sql and get the results is:
   
   ```java
   TableResult result = tEnv.execute("select ...");
   // using try-with-resources statement
   try (CloseableIterator<Row> it = result.collect()) {
           it... // collect same data
   }
   ```
   
   Then I think we don't have to call `c.getJobExecutionResult().get()` here. How about removing  the line101 ~ line 106 and the following part use `try-with-resources` statement ? 




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org