flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] dianfu commented on a change in pull request #16014: [FLINK-20140][docs] Add documentation of TableResult.collect for Python Table API.
Date Fri, 28 May 2021 03:34:13 GMT

dianfu commented on a change in pull request #16014:
URL: https://github.com/apache/flink/pull/16014#discussion_r641126747



##########
File path: docs/content/docs/dev/python/table/intro_to_table_api.md
##########
@@ -510,6 +510,36 @@ The result is:
 
 <span class="label label-info">Note</span> "to_pandas" is not supported by the
flink planner, and not all data types can be emitted to pandas DataFrames.
 
+### Get the result contents as a closeable row iterator
+
+You can call the "TableResult.collect"  method to emit the data as a closeable row iterator

Review comment:
       ```suggestion
   You can call the `TableResult.collect` method to emit the data as a closeable row iterator.
   ```

##########
File path: docs/content.zh/docs/dev/python/table/intro_to_table_api.md
##########
@@ -511,6 +511,37 @@ table.to_pandas()
 
 <span class="label label-info">Note</span> flink planner 不支持 "to_pandas",并且,并不是所有的数据类型都可以转换为
pandas DataFrames。
 
+### 将结果作为可关闭的行迭代器
+
+你可以使用TableResult.collect 将结果作为可关闭的行迭代器
+
+注意:为了获取本地结果,你可以调用collect()和print()。但是,他们可以不能在同一个TableResult实例上同时调用。
+
+以下代码展示了如何使用 `TableResult.collect()` 方法:
+
+```python
+
+# 准备 source 表
+t_env = self.t_env
+source = t_env.from_elements([(1, "Hi", "Hello"), (2, "Hello", "Hello")], ["a", "b", "c"])
+
+# 得到TableResult
+res = t_env.execute_sql("select a + 1, b, c from %s" % source)
+
+# 遍历 结果

Review comment:
       ```suggestion
   # 遍历结果
   ```

##########
File path: docs/content/docs/dev/python/table/intro_to_table_api.md
##########
@@ -510,6 +510,36 @@ The result is:
 
 <span class="label label-info">Note</span> "to_pandas" is not supported by the
flink planner, and not all data types can be emitted to pandas DataFrames.
 
+### Get the result contents as a closeable row iterator
+
+You can call the "TableResult.collect"  method to emit the data as a closeable row iterator
+
+note:In order to fetch result to local, you can call either collect() and print(). But,
they can not be called both on the same TableResult instance
+
+The following code shows how to use the  `TableResult.collect()` method:
+
+```python
+
+# prepare source tables 
+source = t_env.from_elements([(1, "Hi", "Hello"), (2, "Hello", "Hello")], ["a", "b", "c"])
+
+# Get TableResult
+res = t_env.execute_sql("select a + 1, b, c from %s" % source)
+
+# Traversal result
+with res.collect() as results:
+   for result in results:
+       print(result)
+

Review comment:
       ditto

##########
File path: docs/content.zh/docs/dev/python/table/intro_to_table_api.md
##########
@@ -511,6 +511,37 @@ table.to_pandas()
 
 <span class="label label-info">Note</span> flink planner 不支持 "to_pandas",并且,并不是所有的数据类型都可以转换为
pandas DataFrames。
 
+### 将结果作为可关闭的行迭代器
+
+你可以使用TableResult.collect 将结果作为可关闭的行迭代器

Review comment:
       ```suggestion
   你可以使用 `TableResult.collect` 将结果作为可关闭的行迭代器。
   ```

##########
File path: docs/content/docs/dev/python/table/intro_to_table_api.md
##########
@@ -510,6 +510,36 @@ The result is:
 
 <span class="label label-info">Note</span> "to_pandas" is not supported by the
flink planner, and not all data types can be emitted to pandas DataFrames.
 
+### Get the result contents as a closeable row iterator
+
+You can call the "TableResult.collect"  method to emit the data as a closeable row iterator
+
+note:In order to fetch result to local, you can call either collect() and print(). But,
they can not be called both on the same TableResult instance
+
+The following code shows how to use the  `TableResult.collect()` method:
+
+```python
+

Review comment:
       Remove the empty line

##########
File path: docs/content/docs/dev/python/table/intro_to_table_api.md
##########
@@ -510,6 +510,36 @@ The result is:
 
 <span class="label label-info">Note</span> "to_pandas" is not supported by the
flink planner, and not all data types can be emitted to pandas DataFrames.
 
+### Get the result contents as a closeable row iterator
+
+You can call the "TableResult.collect"  method to emit the data as a closeable row iterator
+
+note:In order to fetch result to local, you can call either collect() and print(). But,
they can not be called both on the same TableResult instance

Review comment:
       This paragraph seems could be removed. What do you think?

##########
File path: docs/content.zh/docs/dev/python/table/intro_to_table_api.md
##########
@@ -511,6 +511,37 @@ table.to_pandas()
 
 <span class="label label-info">Note</span> flink planner 不支持 "to_pandas",并且,并不是所有的数据类型都可以转换为
pandas DataFrames。
 
+### 将结果作为可关闭的行迭代器
+
+你可以使用TableResult.collect 将结果作为可关闭的行迭代器
+
+注意:为了获取本地结果,你可以调用collect()和print()。但是,他们可以不能在同一个TableResult实例上同时调用。
+
+以下代码展示了如何使用 `TableResult.collect()` 方法:
+
+```python
+
+# 准备 source 表
+t_env = self.t_env
+source = t_env.from_elements([(1, "Hi", "Hello"), (2, "Hello", "Hello")], ["a", "b", "c"])
+
+# 得到TableResult

Review comment:
       ```suggestion
   # 得到 TableResult
   ```

##########
File path: docs/content.zh/docs/dev/python/table/intro_to_table_api.md
##########
@@ -511,6 +511,37 @@ table.to_pandas()
 
 <span class="label label-info">Note</span> flink planner 不支持 "to_pandas",并且,并不是所有的数据类型都可以转换为
pandas DataFrames。
 
+### 将结果作为可关闭的行迭代器
+
+你可以使用TableResult.collect 将结果作为可关闭的行迭代器
+
+注意:为了获取本地结果,你可以调用collect()和print()。但是,他们可以不能在同一个TableResult实例上同时调用。
+
+以下代码展示了如何使用 `TableResult.collect()` 方法:
+
+```python
+
+# 准备 source 表
+t_env = self.t_env

Review comment:
       there is no such line in the English version

##########
File path: docs/content/docs/dev/python/table/intro_to_table_api.md
##########
@@ -510,6 +510,36 @@ The result is:
 
 <span class="label label-info">Note</span> "to_pandas" is not supported by the
flink planner, and not all data types can be emitted to pandas DataFrames.
 
+### Get the result contents as a closeable row iterator
+
+You can call the "TableResult.collect"  method to emit the data as a closeable row iterator
+
+note:In order to fetch result to local, you can call either collect() and print(). But,
they can not be called both on the same TableResult instance
+
+The following code shows how to use the  `TableResult.collect()` method:

Review comment:
       ```suggestion
   The following code shows how to use the `TableResult.collect()` method:
   ```

##########
File path: docs/content/docs/dev/python/table/intro_to_table_api.md
##########
@@ -510,6 +510,36 @@ The result is:
 
 <span class="label label-info">Note</span> "to_pandas" is not supported by the
flink planner, and not all data types can be emitted to pandas DataFrames.
 
+### Get the result contents as a closeable row iterator
+
+You can call the "TableResult.collect"  method to emit the data as a closeable row iterator
+
+note:In order to fetch result to local, you can call either collect() and print(). But,
they can not be called both on the same TableResult instance
+
+The following code shows how to use the  `TableResult.collect()` method:
+
+```python
+
+# prepare source tables 
+source = t_env.from_elements([(1, "Hi", "Hello"), (2, "Hello", "Hello")], ["a", "b", "c"])

Review comment:
       ```suggestion
   source = table_env.from_elements([(1, "Hi", "Hello"), (2, "Hello", "Hello")], ["a", "b",
"c"])
   ```
   
   Nit: Use `table_env` to be consistent for all the names in this page.




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



Mime
View raw message