gustavodemorais commented on code in PR #27975:
URL: https://github.com/apache/flink/pull/27975#discussion_r3110509283
##########
flink-python/pyflink/table/table.py:
##########
@@ -1220,6 +1220,40 @@ def to_changelog(self, *arguments: Expression) ->
'Table':
"""
return
Table(self._j_table.toChangelog(to_expression_jarray(arguments)), self._t_env)
+ def from_changelog(self, *arguments: Expression) -> 'Table':
+ """
+ Converts this append-only table with an explicit operation code column
into a
+ dynamic table using the built-in ``FROM_CHANGELOG`` process table
function.
+
+ Each input row is expected to have a string operation code column
(default: ``op``)
+ that indicates the change operation (e.g., INSERT, UPDATE_AFTER,
UPDATE_BEFORE,
+ DELETE). The output table is a dynamic table backed by a changelog
stream.
+
+ Example:
+ ::
+
+ >>> from pyflink.table.expressions import descriptor, map_
+ >>> # Default: reads 'op' column with standard change operation
names
+ >>> result = cdc_stream.from_changelog()
Review Comment:
Same for the java docs
##########
flink-python/pyflink/table/table.py:
##########
@@ -1220,6 +1220,40 @@ def to_changelog(self, *arguments: Expression) ->
'Table':
"""
return
Table(self._j_table.toChangelog(to_expression_jarray(arguments)), self._t_env)
+ def from_changelog(self, *arguments: Expression) -> 'Table':
+ """
+ Converts this append-only table with an explicit operation code column
into a
+ dynamic table using the built-in ``FROM_CHANGELOG`` process table
function.
+
+ Each input row is expected to have a string operation code column
(default: ``op``)
+ that indicates the change operation (e.g., INSERT, UPDATE_AFTER,
UPDATE_BEFORE,
+ DELETE). The output table is a dynamic table backed by a changelog
stream.
+
+ Example:
+ ::
+
+ >>> from pyflink.table.expressions import descriptor, map_
+ >>> # Default: reads 'op' column with standard change operation
names
+ >>> result = cdc_stream.from_changelog()
Review Comment:
We use result assignment (result = cdc_stream.from_changelog()) while the
adjacent to_changelog method (line 1204) uses bare calls
(table.to_changelog()). I think I like yours better. Can you update it so both
are symmetric?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]