[GitHub] [flink] HuangXingBo commented on a change in pull request #8916: [FLINK-12897][python][docs] Improve the Python Table API docs by adding more examples

2019-06-27 Thread GitBox
HuangXingBo commented on a change in pull request #8916: 
[FLINK-12897][python][docs] Improve the Python Table API docs by adding more 
examples
URL: https://github.com/apache/flink/pull/8916#discussion_r298435255
 
 

 ##
 File path: docs/dev/table/common.zh.md
 ##
 @@ -89,6 +89,35 @@ tapiResult.insertInto("outputTable")
 // execute
 env.execute()
 
+{% endhighlight %}
+
+
+
+{% highlight python %}
+# for batch programs use ExecutionEnvironment instead of 
StreamExecutionEnvironment
+env = StreamExecutionEnvironment.get_execution_environment()
+
+# create a TableEnvironment
+table_env = StreamTableEnvironment.create(env)
+
+# register a Table
+table_env.register_table("table1", ...)   # or
+table_env.register_table_source("table2", ...) # or
 
 Review comment:
   delete the "# or" ?


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


With regards,
Apache Git Services


[GitHub] [flink] HuangXingBo commented on a change in pull request #8916: [FLINK-12897][python][docs] Improve the Python Table API docs by adding more examples

2019-06-27 Thread GitBox
HuangXingBo commented on a change in pull request #8916: 
[FLINK-12897][python][docs] Improve the Python Table API docs by adding more 
examples
URL: https://github.com/apache/flink/pull/8916#discussion_r298435312
 
 

 ##
 File path: docs/dev/table/common.zh.md
 ##
 @@ -392,6 +486,26 @@ val revenue = orders
 
 **Note:** The Scala Table API uses Scala Symbols, which start with a single 
tick (`'`) to reference the attributes of a `Table`. The Table API uses Scala 
implicits. Make sure to import `org.apache.flink.api.scala._` and 
`org.apache.flink.table.api.scala._` in order to use Scala implicit conversions.
 
+
+
+{% highlight python %}
+# get a StreamTableEnvironment, works for BatchTableEnvironment equivalently
+table_env = StreamTableEnvironment.create(env)
+
+# register Orders table
+
+# scan registered Orders table
+orders = table_env.scan("Orders")
+# compute revenue for all customers from France
+revenue = orders \
+.filter("cCountry === 'FRANCE'")
 
 Review comment:
   Whether add \ after the method filter and groupby ?


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


With regards,
Apache Git Services


[GitHub] [flink] HuangXingBo commented on a change in pull request #8916: [FLINK-12897][python][docs] Improve the Python Table API docs by adding more examples

2019-06-27 Thread GitBox
HuangXingBo commented on a change in pull request #8916: 
[FLINK-12897][python][docs] Improve the Python Table API docs by adding more 
examples
URL: https://github.com/apache/flink/pull/8916#discussion_r298440322
 
 

 ##
 File path: docs/dev/table/functions.md
 ##
 @@ -316,7 +316,7 @@ value NOT IN (sub-query)
 
 
 
-
+
 
 Review comment:
   In line 432 "STRING.similar(STRING)" is previous wrong.Can you change it 
along the way both in this file and corresponding zh.md file?Thank you.
   STRING.similar(STRING) -> STRING1.similar(STRING2)


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


With regards,
Apache Git Services


[GitHub] [flink] HuangXingBo commented on a change in pull request #8916: [FLINK-12897][python][docs] Improve the Python Table API docs by adding more examples

2019-06-27 Thread GitBox
HuangXingBo commented on a change in pull request #8916: 
[FLINK-12897][python][docs] Improve the Python Table API docs by adding more 
examples
URL: https://github.com/apache/flink/pull/8916#discussion_r298430168
 
 

 ##
 File path: docs/dev/table/common.md
 ##
 @@ -89,6 +89,35 @@ tapiResult.insertInto("outputTable")
 // execute
 env.execute()
 
+{% endhighlight %}
+
+
+
+{% highlight python %}
+# for batch programs use ExecutionEnvironment instead of 
StreamExecutionEnvironment
+env = StreamExecutionEnvironment.get_execution_environment()
+
+# create a TableEnvironment
+table_env = StreamTableEnvironment.create(env)
+
+# register a Table
+table_env.register_table("table1", ...)   # or
+table_env.register_table_source("table2", ...) # or
 
 Review comment:
   delete the "# or" ?


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


With regards,
Apache Git Services


[GitHub] [flink] HuangXingBo commented on a change in pull request #8916: [FLINK-12897][python][docs] Improve the Python Table API docs by adding more examples

2019-06-27 Thread GitBox
HuangXingBo commented on a change in pull request #8916: 
[FLINK-12897][python][docs] Improve the Python Table API docs by adding more 
examples
URL: https://github.com/apache/flink/pull/8916#discussion_r298438156
 
 

 ##
 File path: docs/dev/table/connect.md
 ##
 @@ -170,6 +181,50 @@ tableEnvironment
 {% endhighlight %}
 
 
+
+{% highlight python %}
+table_environment \
+.connect(  # declare the external system to connect to
+ Kafka()
 
 Review comment:
   The codestyle doesn't satisfy E126 continuation line over-indented for 
hanging indent and some similar problem in other code. Is there a better 
codestyle?


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


With regards,
Apache Git Services


[GitHub] [flink] HuangXingBo commented on a change in pull request #8916: [FLINK-12897][python][docs] Improve the Python Table API docs by adding more examples

2019-06-27 Thread GitBox
HuangXingBo commented on a change in pull request #8916: 
[FLINK-12897][python][docs] Improve the Python Table API docs by adding more 
examples
URL: https://github.com/apache/flink/pull/8916#discussion_r298441273
 
 

 ##
 File path: docs/dev/table/streaming/query_configuration.md
 ##
 @@ -135,6 +160,16 @@ val qConfig: StreamQueryConfig = ???
 // set idle state retention time: min = 12 hours, max = 24 hours
 qConfig.withIdleStateRetentionTime(Time.hours(12), Time.hours(24))
 
+{% endhighlight %}
+
+
+{% highlight python %}
+
+q_config = ...
 
 Review comment:
   Add a comment description that the type of variable q_config is 
"StreamQueryConfig"


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


With regards,
Apache Git Services


[GitHub] [flink] HuangXingBo commented on a change in pull request #8916: [FLINK-12897][python][docs] Improve the Python Table API docs by adding more examples

2019-06-27 Thread GitBox
HuangXingBo commented on a change in pull request #8916: 
[FLINK-12897][python][docs] Improve the Python Table API docs by adding more 
examples
URL: https://github.com/apache/flink/pull/8916#discussion_r298435022
 
 

 ##
 File path: docs/dev/table/common.md
 ##
 @@ -392,6 +486,26 @@ val revenue = orders
 
 **Note:** The Scala Table API uses Scala Symbols, which start with a single 
tick (`'`) to reference the attributes of a `Table`. The Table API uses Scala 
implicits. Make sure to import `org.apache.flink.api.scala._` and 
`org.apache.flink.table.api.scala._` in order to use Scala implicit conversions.
 
+
+
+{% highlight python %}
+# get a StreamTableEnvironment, works for BatchTableEnvironment equivalently
+table_env = StreamTableEnvironment.create(env)
+
+# register Orders table
+
+# scan registered Orders table
+orders = table_env.scan("Orders")
+# compute revenue for all customers from France
+revenue = orders \
+.filter("cCountry === 'FRANCE'")
 
 Review comment:
   Whether add \ after the method filter and groupby ? 


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


With regards,
Apache Git Services