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/08/05 13:31:35 UTC

[GitHub] [flink] dianfu opened a new pull request #13070: [FLINK-18831][docs][python] Improve the documentation about the operations in Python Table API

dianfu opened a new pull request #13070:
URL: https://github.com/apache/flink/pull/13070


   
   ## What is the purpose of the change
   
   *This pull request improves the documentation about the operations in Python Table API*
   
   ## Brief change log
   
     - *Updates the doc of tableApi.md about Python Table API operations*
   
   ## Verifying this change
   
   This change is a documentation rework without any test coverage.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
     - The serializers: (no)
     - The runtime per-record code paths (performance sensitive): (no)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (no)
     - The S3 file system connector: (no)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (no)
     - If yes, how is the feature documented? (not applicable)
   


----------------------------------------------------------------
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 #13070: [FLINK-18831][docs][python] Improve the documentation about the operations in Python Table API

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "9256be258c41d28df0b8e2e045a82b1f641afc1a",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5209",
       "triggerID" : "9256be258c41d28df0b8e2e045a82b1f641afc1a",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 9256be258c41d28df0b8e2e045a82b1f641afc1a Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5209) 
   
   <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] WeiZhong94 commented on a change in pull request #13070: [FLINK-18831][docs][python] Improve the documentation about the operations in Python Table API

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



##########
File path: docs/dev/table/tableApi.md
##########
@@ -1490,8 +1558,12 @@ result = left.join(right).where("a = d && rowtime1 >= rowtime2 - 1.second
         <p>Joins a table with the results of a table function. Each row of the left (outer) table is joined with all rows produced by the corresponding call of the table function. A row of the left (outer) table is dropped, if its table function call returns an empty result.
         </p>
 {% highlight python %}
-# register Java User-Defined Table Function
-table_env.register_java_function("split", "com.my.udf.MySplitUDTF")
+# register User-Defined Table Function
+@udtf(input_types=[DataTypes.BIGINT()],
+      result_types=[DataTypes.BIGINT(), DataTypes.BIGINT(), DataTypes.BIGINT()])
+def split(x):
+    return [Row(1, 2, 3)]

Review comment:
       yield Row(1, 2, 3) ?

##########
File path: docs/dev/table/tableApi.md
##########
@@ -464,6 +485,49 @@ orders = table_env.from_path("Orders")
 {% endhighlight %}
       </td>
   	</tr>
+  	<tr>
+      <td>
+            <strong>FromElements</strong><br>
+            <span class="label label-primary">Batch</span> <span class="label label-primary">Streaming</span>
+      </td>
+      <td>
+          <p>Similar to the VALUES clause in a SQL query. Produces an inline table out of the provided rows.</p>
+{% highlight python %}
+table = tEnv.from_elements([(1, 'ABC'), (2, 'ABCDE')])

Review comment:
       t_env?

##########
File path: docs/dev/table/tableApi.md
##########
@@ -101,25 +101,49 @@ val result = orders
 </div>
 <div data-lang="python" markdown="1">
 
-The Python Table API is enabled by `from pyflink.table import *`.
-
 The following example shows how a Python Table API program is constructed and how expressions are specified as strings.
 
 {% highlight python %}
 from pyflink.table import *
-from pyflink.dataset import *
 
 # environment configuration
-env = ExecutionEnvironment.get_execution_environment()
-t_env = TableEnvironment.create(env, TableConfig())
+t_env = BatchTableEnvironment.create(
+    environment_settings=EnvironmentSettings.new_instance().in_batch_mode().use_blink_planner().build())
 
 # register Orders table and Result table sink in table environment
-# ...
+source_data_path = "/path/to/source/directory/"
+result_data_path = "/path/to/result/directory/"
+source_ddl = """

Review comment:
       It would be better if we use the format strings:
   f"""
              create table Orders(
               a VARCHAR,
               b BIGINT,
               c BIGINT,
               rowtime TIMESTAMP(3),
               WATERMARK FOR rowtime AS rowtime - INTERVAL '1' SECOND
           ) with (
               'connector' = 'filesystem',
               'format' = 'csv',
               'path' = '{source_data_path}'
           )
    """

##########
File path: docs/dev/table/tableApi.md
##########
@@ -1490,8 +1558,12 @@ result = left.join(right).where("a = d && rowtime1 >= rowtime2 - 1.second
         <p>Joins a table with the results of a table function. Each row of the left (outer) table is joined with all rows produced by the corresponding call of the table function. A row of the left (outer) table is dropped, if its table function call returns an empty result.
         </p>
 {% highlight python %}
-# register Java User-Defined Table Function
-table_env.register_java_function("split", "com.my.udf.MySplitUDTF")
+# register User-Defined Table Function
+@udtf(input_types=[DataTypes.BIGINT()],

Review comment:
       input_types is unnecessary now.




----------------------------------------------------------------
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 #13070: [FLINK-18831][docs][python] Improve the documentation about the operations in Python Table API

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "9256be258c41d28df0b8e2e045a82b1f641afc1a",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "9256be258c41d28df0b8e2e045a82b1f641afc1a",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 9256be258c41d28df0b8e2e045a82b1f641afc1a 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] dianfu commented on a change in pull request #13070: [FLINK-18831][docs][python] Improve the documentation about the operations in Python Table API

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



##########
File path: docs/dev/table/tableApi.md
##########
@@ -1490,8 +1558,12 @@ result = left.join(right).where("a = d && rowtime1 >= rowtime2 - 1.second
         <p>Joins a table with the results of a table function. Each row of the left (outer) table is joined with all rows produced by the corresponding call of the table function. A row of the left (outer) table is dropped, if its table function call returns an empty result.
         </p>
 {% highlight python %}
-# register Java User-Defined Table Function
-table_env.register_java_function("split", "com.my.udf.MySplitUDTF")
+# register User-Defined Table Function
+@udtf(input_types=[DataTypes.BIGINT()],
+      result_types=[DataTypes.BIGINT(), DataTypes.BIGINT(), DataTypes.BIGINT()])
+def split(x):
+    return [Row(1, 2, 3)]

Review comment:
       array also works




----------------------------------------------------------------
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] dianfu closed pull request #13070: [FLINK-18831][docs][python] Improve the documentation about the operations in Python Table API

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


   


----------------------------------------------------------------
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 #13070: [FLINK-18831][docs][python] Improve the documentation about the operations in Python Table API

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "9256be258c41d28df0b8e2e045a82b1f641afc1a",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5209",
       "triggerID" : "9256be258c41d28df0b8e2e045a82b1f641afc1a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8b2bbd76e57f53e589e17f62aa8f1c3f625d4409",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "8b2bbd76e57f53e589e17f62aa8f1c3f625d4409",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 9256be258c41d28df0b8e2e045a82b1f641afc1a Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5209) 
   * 8b2bbd76e57f53e589e17f62aa8f1c3f625d4409 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 #13070: [FLINK-18831][docs][python] Improve the documentation about the operations in Python Table API

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


   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 9256be258c41d28df0b8e2e045a82b1f641afc1a (Wed Aug 05 13:31:59 UTC 2020)
   
    ✅no warnings
   
   <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] dianfu commented on pull request #13070: [FLINK-18831][docs][python] Improve the documentation about the operations in Python Table API

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


   @WeiZhong94 Thanks for the review. Updated the PR.


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