hsrain3 commented on code in PR #29234:
URL: https://github.com/apache/flink/pull/29234#discussion_r4056875338


##########
flink-python/pyflink/dataframe/dataframe.py:
##########
@@ -135,6 +136,57 @@ class DataFrame:
     def __init__(self, table: Table):
         self._table = table
 
+    @PublicEvolving()
+    def flat_map(
+        self,
+        func: Union[Callable[[Dict[str, Any]], Any], "_DataFrameUDTFWrapper"],
+        *,
+        return_dtype: Optional["_DataTypeLike"] = None,
+    ) -> "DataFrame":
+        """
+        Apply a function to each row, emitting zero or more output rows.
+
+        A plain callable receives a dictionary keyed by column name. A 
declaration
+        created with :func:`pyflink.dataframe.udtf` receives a named Flink 
``Row``.
+        Output column names come from a ``TypedDict`` or an explicit named 
struct;
+        scalar outputs use ``f0``. Multi-field outputs require named fields.
+
+        :param func: Row-based callable or a declaration created with 
``pf.udtf``.
+        :param return_dtype: Emitted row type, inferred from annotations when 
omitted.
+                             Required if inference is not possible; must be 
omitted
+                             for a UDTF declaration.
+        :return: A DataFrame containing only the emitted output columns.
+
+        Example::

Review Comment:
   Agreed. Callable instances were already supported. Added support for passing 
callable classes directly to flat_map and pf.udtf.   
   Added examples for explicit return_dtype and output column names, plus 
callable class and TableFunction examples.



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

Reply via email to