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/12/09 06:39:11 UTC

[GitHub] [flink] HuangXingBo commented on a change in pull request #14317: [FLINK-20482][python] Support General Python UDF for Map Operation in Python Table API

HuangXingBo commented on a change in pull request #14317:
URL: https://github.com/apache/flink/pull/14317#discussion_r539046967



##########
File path: flink-python/pyflink/table/table.py
##########
@@ -759,6 +759,27 @@ def drop_columns(self, *fields: Union[str, Expression]) -> 'Table':
             assert isinstance(fields[0], str)
             return Table(self._j_table.dropColumns(fields[0]), self._t_env)
 
+    def map(self, func: Union[str, Expression]) -> 'Table':
+        """
+        Performs a map operation with an user-defined scalar function.
+
+        Example:
+        ::
+
+            >>> add = udf(lambda x: Row(x + 1, x *x), result_type=DataTypes.Row(
+            ... [DataTypes.FIELD("a", DataTypes.INT()), DataTypes.FIELD("b", DataTypes.INT())]))
+            >>> table_env.create_temporary_function("add", add)
+            >>> tab.map(add(tab.a)).alias("a, b")
+            >>> tab.map("add(a)").alias("a, b")

Review comment:
       Yes. Make sense.




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