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 2020/05/06 13:51:37 UTC

[GitHub] [flink] SteNicholas opened a new pull request #12009: [FLINK-17303][python]Return TableResult for Python TableEnvironment

SteNicholas opened a new pull request #12009:
URL: https://github.com/apache/flink/pull/12009


   ## What is the purpose of the change
   
   *This pull request will introduce python `TableResult` class to make sure consistent with Java, which could get `JobClient` (to associates the submitted Flink job), or print the execution result.*
   
   
   ## Brief change log
   
     - *Add `TableResult` class consistent with Java, including `get_job_client`, `get_table_schema`, `get_result_kind` and `print` methods for the representation of the statement execution result.*
     - *Add `JobClient` class that is scoped to a specific job,  including `get_job_id`, `get_job_status`, `cancel`, `stop_with_savepoint`, `trigger_savepoint`, `get_accumulators` and `get_job_execution_result` for job execution result.*
   
   
   ## Verifying this change
   
     - *Add `test_execute_sql` method for `StreamSqlTests` to verify table result of DDL statement execution test case.*
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / no)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / no)
     - The serializers: (yes / no / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / no / don't know)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes / no / don't know)
     - The S3 file system connector: (yes / no / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
   


----------------------------------------------------------------
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



[GitHub] [flink] hequn8128 commented on a change in pull request #12009: [FLINK-17303][python]Return TableResult for Python TableEnvironment

Posted by GitBox <gi...@apache.org>.
hequn8128 commented on a change in pull request #12009:
URL: https://github.com/apache/flink/pull/12009#discussion_r422449259



##########
File path: flink-python/pyflink/common/__init__.py
##########
@@ -37,4 +40,7 @@
     'JobExecutionResult',
     'RestartStrategies',
     'RestartStrategyConfiguration',
+    'CompletableFuture',

Review comment:
       Alphabetize the classes.

##########
File path: flink-python/pyflink/table/tests/test_sql.py
##########
@@ -58,6 +56,40 @@ def test_sql_query(self):
         expected = ['2,Hi,Hello', '3,Hello,Hello']
         self.assert_equals(actual, expected)
 
+    def test_execute_sql(self):
+        t_env = self.t_env
+        table_result = t_env.execute_sql("create table tbl"
+                                         "("
+                                         "   a bigint,"
+                                         "   b int,"
+                                         "   c varchar"
+                                         ") with ("
+                                         "  'connector' = 'COLLECTION',"
+                                         "   'is-bounded' = 'false'"
+                                         ")")
+        self.assertIsNone(table_result.get_job_client())
+        self.assertIsNotNone(table_result.get_table_schema())
+        self.assertEqual(table_result.get_table_schema().get_field_count(), 1)
+        self.assertIsNotNone(table_result.get_result_kind())
+        self.assertEqual(table_result.get_result_kind(), ResultKind.SUCCESS)

Review comment:
       These tests are too weak. Maybe test more details of the result?

##########
File path: flink-python/pyflink/table/result_kind.py
##########
@@ -0,0 +1,61 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+from pyflink.java_gateway import get_gateway
+
+__all__ = ['ResultKind']
+
+
+class ResultKind(object):
+    """
+    ResultKind defines the types of the result.
+
+    :data:`SUCCESS`:
+
+    The statement (e.g. DDL, USE) executes successfully, and the result only contains a simple "OK".
+
+    :data:`SUCCESS_WITH_CONTENT`:
+
+    The statement (e.g. DML, DQL, SHOW) executes successfully, and the result contains important
+    content.
+    """
+
+    SUCCESS = 0
+    SUCCESS_WITH_CONTENT = 1
+
+    @staticmethod
+    def _from_j_result_kind(j_result_kind):
+        gateway = get_gateway()
+        JResultKind = gateway.jvm.org.apache.flink.table.api.ResultKind
+        if j_result_kind == JResultKind.SUCCESS:
+            return ResultKind.SUCCESS
+        elif j_result_kind == JResultKind.SUCCESS_WITH_CONTENT:
+            return ResultKind.SUCCESS_WITH_CONTENT
+        else:
+            raise Exception("Unsupported Java result kind: %s" % j_result_kind)
+
+    @staticmethod
+    def _to_j_result_kind(result_kind):

Review comment:
       Remove this method? It has not been used.

##########
File path: flink-python/pyflink/table/tests/test_sql.py
##########
@@ -58,6 +56,40 @@ def test_sql_query(self):
         expected = ['2,Hi,Hello', '3,Hello,Hello']
         self.assert_equals(actual, expected)
 
+    def test_execute_sql(self):
+        t_env = self.t_env
+        table_result = t_env.execute_sql("create table tbl"
+                                         "("
+                                         "   a bigint,"
+                                         "   b int,"
+                                         "   c varchar"
+                                         ") with ("
+                                         "  'connector' = 'COLLECTION',"
+                                         "   'is-bounded' = 'false'"
+                                         ")")
+        self.assertIsNone(table_result.get_job_client())
+        self.assertIsNotNone(table_result.get_table_schema())
+        self.assertEqual(table_result.get_table_schema().get_field_count(), 1)
+        self.assertIsNotNone(table_result.get_result_kind())
+        self.assertEqual(table_result.get_result_kind(), ResultKind.SUCCESS)
+        table_result.print()
+
+        table_result = t_env.execute_sql("alter table tbl set ('k1' = 'a', 'k2' = 'b')")
+        self.assertIsNone(table_result.get_job_client())
+        self.assertIsNotNone(table_result.get_table_schema())
+        self.assertEqual(table_result.get_table_schema().get_field_count(), 1)
+        self.assertIsNotNone(table_result.get_result_kind())
+        self.assertEqual(table_result.get_result_kind(), ResultKind.SUCCESS)
+        table_result.print()
+
+        table_result = t_env.execute_sql("drop table tbl")
+        self.assertIsNone(table_result.get_job_client())

Review comment:
       The result is always None here. Since Java has not implemented `getJobClient()`, we can:
   - Merge this PR after FLINK-16367.  `getJobClient()` has been implemented in this task and it seems the PR will be merged soon.
   - Remove the support of `getJobClient()` from the Python side in this PR for now and support it in another task.
   
   Which would you prefer? I would ok with both. 

##########
File path: flink-python/pyflink/table/tests/test_sql.py
##########
@@ -58,6 +56,40 @@ def test_sql_query(self):
         expected = ['2,Hi,Hello', '3,Hello,Hello']
         self.assert_equals(actual, expected)
 
+    def test_execute_sql(self):
+        t_env = self.t_env
+        table_result = t_env.execute_sql("create table tbl"
+                                         "("
+                                         "   a bigint,"
+                                         "   b int,"
+                                         "   c varchar"
+                                         ") with ("
+                                         "  'connector' = 'COLLECTION',"
+                                         "   'is-bounded' = 'false'"
+                                         ")")
+        self.assertIsNone(table_result.get_job_client())
+        self.assertIsNotNone(table_result.get_table_schema())
+        self.assertEqual(table_result.get_table_schema().get_field_count(), 1)
+        self.assertIsNotNone(table_result.get_result_kind())
+        self.assertEqual(table_result.get_result_kind(), ResultKind.SUCCESS)
+        table_result.print()

Review comment:
       Verify results.




----------------------------------------------------------------
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



[GitHub] [flink] flinkbot edited a comment on pull request #12009: [FLINK-17303][python]Return TableResult for Python TableEnvironment

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12009:
URL: https://github.com/apache/flink/pull/12009#issuecomment-624669132


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "91d92abcf29c44f6640771321f2b89a3f21722a3",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=699",
       "triggerID" : "91d92abcf29c44f6640771321f2b89a3f21722a3",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0223c1e8900dc1d98baab83e09022ae9bb7192ae",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0223c1e8900dc1d98baab83e09022ae9bb7192ae",
       "triggerType" : "PUSH"
     }, {
       "hash" : "78022a613da39b7246eade70a93a10a9896ba130",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1052",
       "triggerID" : "78022a613da39b7246eade70a93a10a9896ba130",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce1ea4f130482b8a70eccc29018c7d3dd6649a4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1063",
       "triggerID" : "2ce1ea4f130482b8a70eccc29018c7d3dd6649a4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "69a2697bef53e144252bdf85c2ec8bb7c896f7cf",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1090",
       "triggerID" : "69a2697bef53e144252bdf85c2ec8bb7c896f7cf",
       "triggerType" : "PUSH"
     }, {
       "hash" : "047ba77bd1170df42190d32db5a492caf43492a1",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1170",
       "triggerID" : "047ba77bd1170df42190d32db5a492caf43492a1",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7c70b2f55d16974d599b8acfe64702a0206f8861",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1189",
       "triggerID" : "7c70b2f55d16974d599b8acfe64702a0206f8861",
       "triggerType" : "PUSH"
     }, {
       "hash" : "5bfc2745bd865c641e1d2ad1e23ccb0ff3befff2",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1234",
       "triggerID" : "5bfc2745bd865c641e1d2ad1e23ccb0ff3befff2",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0223c1e8900dc1d98baab83e09022ae9bb7192ae UNKNOWN
   * 7c70b2f55d16974d599b8acfe64702a0206f8861 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1189) 
   * 5bfc2745bd865c641e1d2ad1e23ccb0ff3befff2 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1234) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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



[GitHub] [flink] flinkbot edited a comment on pull request #12009: [FLINK-17303][python]Return TableResult for Python TableEnvironment

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12009:
URL: https://github.com/apache/flink/pull/12009#issuecomment-624669132


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "91d92abcf29c44f6640771321f2b89a3f21722a3",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=699",
       "triggerID" : "91d92abcf29c44f6640771321f2b89a3f21722a3",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 91d92abcf29c44f6640771321f2b89a3f21722a3 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=699) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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



[GitHub] [flink] SteNicholas commented on a change in pull request #12009: [FLINK-17303][python]Return TableResult for Python TableEnvironment

Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #12009:
URL: https://github.com/apache/flink/pull/12009#discussion_r422454850



##########
File path: flink-python/pyflink/table/tests/test_sql.py
##########
@@ -58,6 +56,40 @@ def test_sql_query(self):
         expected = ['2,Hi,Hello', '3,Hello,Hello']
         self.assert_equals(actual, expected)
 
+    def test_execute_sql(self):
+        t_env = self.t_env
+        table_result = t_env.execute_sql("create table tbl"
+                                         "("
+                                         "   a bigint,"
+                                         "   b int,"
+                                         "   c varchar"
+                                         ") with ("
+                                         "  'connector' = 'COLLECTION',"
+                                         "   'is-bounded' = 'false'"
+                                         ")")
+        self.assertIsNone(table_result.get_job_client())
+        self.assertIsNotNone(table_result.get_table_schema())
+        self.assertEqual(table_result.get_table_schema().get_field_count(), 1)
+        self.assertIsNotNone(table_result.get_result_kind())
+        self.assertEqual(table_result.get_result_kind(), ResultKind.SUCCESS)
+        table_result.print()
+
+        table_result = t_env.execute_sql("alter table tbl set ('k1' = 'a', 'k2' = 'b')")
+        self.assertIsNone(table_result.get_job_client())
+        self.assertIsNotNone(table_result.get_table_schema())
+        self.assertEqual(table_result.get_table_schema().get_field_count(), 1)
+        self.assertIsNotNone(table_result.get_result_kind())
+        self.assertEqual(table_result.get_result_kind(), ResultKind.SUCCESS)
+        table_result.print()
+
+        table_result = t_env.execute_sql("drop table tbl")
+        self.assertIsNone(table_result.get_job_client())

Review comment:
       I prefer the point that merge this PR after FLINK-16367. getJobClient() has been implemented in this task and it seems the PR will be merged soon.




----------------------------------------------------------------
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



[GitHub] [flink] flinkbot edited a comment on pull request #12009: [FLINK-17303][python]Return TableResult for Python TableEnvironment

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12009:
URL: https://github.com/apache/flink/pull/12009#issuecomment-624669132


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "91d92abcf29c44f6640771321f2b89a3f21722a3",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=699",
       "triggerID" : "91d92abcf29c44f6640771321f2b89a3f21722a3",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 91d92abcf29c44f6640771321f2b89a3f21722a3 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=699) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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



[GitHub] [flink] hequn8128 closed pull request #12009: [FLINK-17303][python]Return TableResult for Python TableEnvironment

Posted by GitBox <gi...@apache.org>.
hequn8128 closed pull request #12009:
URL: https://github.com/apache/flink/pull/12009


   


----------------------------------------------------------------
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



[GitHub] [flink] flinkbot edited a comment on pull request #12009: [FLINK-17303][python]Return TableResult for Python TableEnvironment

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12009:
URL: https://github.com/apache/flink/pull/12009#issuecomment-624669132


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "91d92abcf29c44f6640771321f2b89a3f21722a3",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=699",
       "triggerID" : "91d92abcf29c44f6640771321f2b89a3f21722a3",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0223c1e8900dc1d98baab83e09022ae9bb7192ae",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0223c1e8900dc1d98baab83e09022ae9bb7192ae",
       "triggerType" : "PUSH"
     }, {
       "hash" : "78022a613da39b7246eade70a93a10a9896ba130",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1052",
       "triggerID" : "78022a613da39b7246eade70a93a10a9896ba130",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce1ea4f130482b8a70eccc29018c7d3dd6649a4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1063",
       "triggerID" : "2ce1ea4f130482b8a70eccc29018c7d3dd6649a4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "69a2697bef53e144252bdf85c2ec8bb7c896f7cf",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1090",
       "triggerID" : "69a2697bef53e144252bdf85c2ec8bb7c896f7cf",
       "triggerType" : "PUSH"
     }, {
       "hash" : "047ba77bd1170df42190d32db5a492caf43492a1",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1170",
       "triggerID" : "047ba77bd1170df42190d32db5a492caf43492a1",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7c70b2f55d16974d599b8acfe64702a0206f8861",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1189",
       "triggerID" : "7c70b2f55d16974d599b8acfe64702a0206f8861",
       "triggerType" : "PUSH"
     }, {
       "hash" : "5bfc2745bd865c641e1d2ad1e23ccb0ff3befff2",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1234",
       "triggerID" : "5bfc2745bd865c641e1d2ad1e23ccb0ff3befff2",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0223c1e8900dc1d98baab83e09022ae9bb7192ae UNKNOWN
   * 5bfc2745bd865c641e1d2ad1e23ccb0ff3befff2 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1234) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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



[GitHub] [flink] flinkbot edited a comment on pull request #12009: [FLINK-17303][python]Return TableResult for Python TableEnvironment

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12009:
URL: https://github.com/apache/flink/pull/12009#issuecomment-624669132


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "91d92abcf29c44f6640771321f2b89a3f21722a3",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=699",
       "triggerID" : "91d92abcf29c44f6640771321f2b89a3f21722a3",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0223c1e8900dc1d98baab83e09022ae9bb7192ae",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0223c1e8900dc1d98baab83e09022ae9bb7192ae",
       "triggerType" : "PUSH"
     }, {
       "hash" : "78022a613da39b7246eade70a93a10a9896ba130",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1052",
       "triggerID" : "78022a613da39b7246eade70a93a10a9896ba130",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce1ea4f130482b8a70eccc29018c7d3dd6649a4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1063",
       "triggerID" : "2ce1ea4f130482b8a70eccc29018c7d3dd6649a4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "69a2697bef53e144252bdf85c2ec8bb7c896f7cf",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1090",
       "triggerID" : "69a2697bef53e144252bdf85c2ec8bb7c896f7cf",
       "triggerType" : "PUSH"
     }, {
       "hash" : "047ba77bd1170df42190d32db5a492caf43492a1",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1170",
       "triggerID" : "047ba77bd1170df42190d32db5a492caf43492a1",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7c70b2f55d16974d599b8acfe64702a0206f8861",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1189",
       "triggerID" : "7c70b2f55d16974d599b8acfe64702a0206f8861",
       "triggerType" : "PUSH"
     }, {
       "hash" : "5bfc2745bd865c641e1d2ad1e23ccb0ff3befff2",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "5bfc2745bd865c641e1d2ad1e23ccb0ff3befff2",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0223c1e8900dc1d98baab83e09022ae9bb7192ae UNKNOWN
   * 7c70b2f55d16974d599b8acfe64702a0206f8861 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1189) 
   * 5bfc2745bd865c641e1d2ad1e23ccb0ff3befff2 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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



[GitHub] [flink] hequn8128 commented on a change in pull request #12009: [FLINK-17303][python]Return TableResult for Python TableEnvironment

Posted by GitBox <gi...@apache.org>.
hequn8128 commented on a change in pull request #12009:
URL: https://github.com/apache/flink/pull/12009#discussion_r424841404



##########
File path: flink-python/pyflink/common/job_client.py
##########
@@ -0,0 +1,113 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+from pyflink.common.completable_future import CompletableFuture
+from pyflink.common.job_execution_result import JobExecutionResult
+from pyflink.common.job_status import JobStatus
+
+__all__ = ['JobClient']
+
+
+class JobClient(object):
+    """
+    A client that is scoped to a specific job.
+    """
+
+    def __init__(self, j_job_client):
+        self._j_job_client = j_job_client
+
+    def get_job_id(self):
+        """
+        Returns the JobID that uniquely identifies the job this client is scoped to.
+
+        :return: JobID, or null if the job has been executed on a runtime without JobIDs
+                 or if the execution failed.
+        """
+        return str(self._j_job_client.getJobID())

Review comment:
       Could we add a new Python JobID class and return an object of JobID? We should keep the type consistent between Java and Python, i.e., both return an instance of JobID.




----------------------------------------------------------------
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



[GitHub] [flink] SteNicholas commented on a change in pull request #12009: [FLINK-17303][python]Return TableResult for Python TableEnvironment

Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #12009:
URL: https://github.com/apache/flink/pull/12009#discussion_r424857851



##########
File path: flink-python/pyflink/common/job_client.py
##########
@@ -0,0 +1,113 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+from pyflink.common.completable_future import CompletableFuture
+from pyflink.common.job_execution_result import JobExecutionResult
+from pyflink.common.job_status import JobStatus
+
+__all__ = ['JobClient']
+
+
+class JobClient(object):
+    """
+    A client that is scoped to a specific job.
+    """
+
+    def __init__(self, j_job_client):
+        self._j_job_client = j_job_client
+
+    def get_job_id(self):
+        """
+        Returns the JobID that uniquely identifies the job this client is scoped to.
+
+        :return: JobID, or null if the job has been executed on a runtime without JobIDs
+                 or if the execution failed.
+        """
+        return str(self._j_job_client.getJobID())

Review comment:
       @hequn8128 I have add `JobID` class consistent with Java. Please review again for this. Thanks.




----------------------------------------------------------------
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



[GitHub] [flink] SteNicholas commented on a change in pull request #12009: [FLINK-17303][python]Return TableResult for Python TableEnvironment

Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #12009:
URL: https://github.com/apache/flink/pull/12009#discussion_r422454749



##########
File path: flink-python/pyflink/table/tests/test_sql.py
##########
@@ -58,6 +56,40 @@ def test_sql_query(self):
         expected = ['2,Hi,Hello', '3,Hello,Hello']
         self.assert_equals(actual, expected)
 
+    def test_execute_sql(self):
+        t_env = self.t_env
+        table_result = t_env.execute_sql("create table tbl"
+                                         "("
+                                         "   a bigint,"
+                                         "   b int,"
+                                         "   c varchar"
+                                         ") with ("
+                                         "  'connector' = 'COLLECTION',"
+                                         "   'is-bounded' = 'false'"
+                                         ")")
+        self.assertIsNone(table_result.get_job_client())
+        self.assertIsNotNone(table_result.get_table_schema())
+        self.assertEqual(table_result.get_table_schema().get_field_count(), 1)
+        self.assertIsNotNone(table_result.get_result_kind())
+        self.assertEqual(table_result.get_result_kind(), ResultKind.SUCCESS)

Review comment:
       OK, I will add unit tests to verify the result.




----------------------------------------------------------------
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



[GitHub] [flink] flinkbot commented on pull request #12009: [FLINK-17303][python]Return TableResult for Python TableEnvironment

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #12009:
URL: https://github.com/apache/flink/pull/12009#issuecomment-624669132


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "91d92abcf29c44f6640771321f2b89a3f21722a3",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "91d92abcf29c44f6640771321f2b89a3f21722a3",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 91d92abcf29c44f6640771321f2b89a3f21722a3 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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



[GitHub] [flink] flinkbot commented on pull request #12009: [FLINK-17303][python]Return TableResult for Python TableEnvironment

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #12009:
URL: https://github.com/apache/flink/pull/12009#issuecomment-624663860


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 91d92abcf29c44f6640771321f2b89a3f21722a3 (Wed May 06 13:54:37 UTC 2020)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


----------------------------------------------------------------
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



[GitHub] [flink] SteNicholas commented on a change in pull request #12009: [FLINK-17303][python]Return TableResult for Python TableEnvironment

Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #12009:
URL: https://github.com/apache/flink/pull/12009#discussion_r422454850



##########
File path: flink-python/pyflink/table/tests/test_sql.py
##########
@@ -58,6 +56,40 @@ def test_sql_query(self):
         expected = ['2,Hi,Hello', '3,Hello,Hello']
         self.assert_equals(actual, expected)
 
+    def test_execute_sql(self):
+        t_env = self.t_env
+        table_result = t_env.execute_sql("create table tbl"
+                                         "("
+                                         "   a bigint,"
+                                         "   b int,"
+                                         "   c varchar"
+                                         ") with ("
+                                         "  'connector' = 'COLLECTION',"
+                                         "   'is-bounded' = 'false'"
+                                         ")")
+        self.assertIsNone(table_result.get_job_client())
+        self.assertIsNotNone(table_result.get_table_schema())
+        self.assertEqual(table_result.get_table_schema().get_field_count(), 1)
+        self.assertIsNotNone(table_result.get_result_kind())
+        self.assertEqual(table_result.get_result_kind(), ResultKind.SUCCESS)
+        table_result.print()
+
+        table_result = t_env.execute_sql("alter table tbl set ('k1' = 'a', 'k2' = 'b')")
+        self.assertIsNone(table_result.get_job_client())
+        self.assertIsNotNone(table_result.get_table_schema())
+        self.assertEqual(table_result.get_table_schema().get_field_count(), 1)
+        self.assertIsNotNone(table_result.get_result_kind())
+        self.assertEqual(table_result.get_result_kind(), ResultKind.SUCCESS)
+        table_result.print()
+
+        table_result = t_env.execute_sql("drop table tbl")
+        self.assertIsNone(table_result.get_job_client())

Review comment:
       @hequn8128 I prefer the point that merge this PR after FLINK-16367. getJobClient() has been implemented in this task and it seems the PR will be merged soon. Thanks for review.




----------------------------------------------------------------
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