dianfu commented on a change in pull request #8401: [FLINK-12407][python] Add
all table operators align Java Table API.
URL: https://github.com/apache/flink/pull/8401#discussion_r283169049
##########
File path: flink-python/pyflink/table/table.py
##########
@@ -118,3 +463,112 @@ def insert_into(self, table_name):
:param table_name: Name of the :class:`TableSink` to which the
:class:`Table` is written.
"""
self._j_table.insertInto(table_name)
+
+ def __str__(self):
+ return self._j_table.toString()
+
+
+class GroupedTable(object):
+ """
+ A table that has been grouped on a set of grouping keys.
+ """
+
+ def __init__(self, java_table):
+ self._j_table = java_table
+
+ def select(self, fields):
+ """
+ Performs a selection operation on a grouped table. Similar to an SQL
SELECT statement.
+ The field expressions can contain complex expressions and aggregations.
+
+ Example:
+ ::
+ >>> tab.group_by("key").select("key, value.avg + ' The average' as
average")
+
+
+ :param fields: Expression string that contains group keys and
aggregate function calls.
+ :return: Result table.
+ """
+ return Table(self._j_table.select(fields))
+
+
+class GroupWindowedTable(object):
+ """
+ A table that has been windowed for :class:`GroupWindow`s.
+ """
+
+ def __init__(self, java_group_windowed_table):
+ self._java_table = java_group_windowed_table
Review comment:
_java_table -> _j_group_windowed_table
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services