Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
1fc5d5a
[FLINK-40431][python] Support scalar UDFs in DataFrame API
auroflow Aug 26, 2026
3100ebd
[FLINK-40431][python] Centralize DataFrame UDF source resolution
auroflow Aug 27, 2026
094cc18
[FLINK-40431][python] Initialize UDF class declarations on TaskManagers
auroflow Aug 27, 2026
be9f179
[FLINK-40431][python] Fix DataFrame UDF test override signatures
auroflow Aug 27, 2026
57bd737
[FLINK-40431][python] Address DataFrame UDF review feedback
auroflow Aug 28, 2026
3777632
[FLINK-40431][python] Hide DataFrame UDF wrapper implementation
auroflow Aug 28, 2026
332c184
[FLINK-40431][python] Optimize DataFrame UDF Row normalization
auroflow Aug 28, 2026
f7eedd4
[FLINK-40431][python] Clarify DataFrame UDF type handling
auroflow Aug 28, 2026
3ee2651
[FLINK-40431][python] Fix DataFrame UDF type hint resolution
auroflow Aug 30, 2026
508a307
[FLINK-40431][python] Fix callable UDF annotation resolution
auroflow Sep 1, 2026
1adc1a8
[FLINK-40431][python] Harden callable UDF inference
auroflow Sep 1, 2026
aa356ba
[FLINK-40431][python] Clarify DataFrame UDF worker lifecycle
auroflow Sep 1, 2026
9c575b5
[FLINK-40431][python] Validate partial UDF declarations
auroflow Sep 1, 2026
47098f9
[FLINK-40431][python] Simplify UDF declaration helpers
auroflow Sep 1, 2026
ed503a5
[FLINK-40431][python] Fix callable signature type narrowing
auroflow Sep 1, 2026
58e3261
[FLINK-40431][python] Harden wrapped and async UDF declarations
auroflow Sep 1, 2026
6beb126
[FLINK-40431][python] Improve UDF declaration errors
auroflow Sep 1, 2026
ec0d673
[FLINK-40431][python] Align UDF wrapper reflection
auroflow Sep 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions flink-python/docs/reference/pyflink.dataframe/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ This page gives an overview of all public PyFlink DataFrame APIs.
:maxdepth: 1

dataframe
udf
creation
io
sql
Expand Down
41 changes: 41 additions & 0 deletions flink-python/docs/reference/pyflink.dataframe/udf.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.. ################################################################################
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
################################################################################

=============================
User-Defined Scalar Functions
=============================

Use :func:`pyflink.dataframe.udf` to apply Python code to one or more DataFrame
columns. A scalar UDF produces one logical output column and can be used in
:meth:`~pyflink.dataframe.DataFrame.with_column`,
:meth:`~pyflink.dataframe.DataFrame.with_columns`, and
:meth:`~pyflink.dataframe.DataFrame.select`.

DataFrame scalar UDFs support synchronous, asynchronous, and pandas-vectorized
callables. See :func:`pyflink.dataframe.udf` for declaration forms, type
inference, execution modes, and examples.

API Reference
=============

.. currentmodule:: pyflink.dataframe

.. autosummary::
:toctree: api/

udf
2 changes: 2 additions & 0 deletions flink-python/pyflink/dataframe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@
from pyflink.dataframe.datatype import DataType
from pyflink.dataframe.io import read_generic
from pyflink.dataframe.sql import sql
from pyflink.dataframe.udf import udf

__all__ = [
"DataFrame",
"GroupedDataFrame",
"DataType",
"col",
"lit",
"udf",
"from_arrow",
"from_dict",
"from_pandas",
Expand Down
11 changes: 10 additions & 1 deletion flink-python/pyflink/dataframe/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,19 @@ def with_column(

>>> import pyflink.dataframe as pf
>>> df = pf.from_records([{"left": 1, "right": 2}])
>>> result = df.with_column(

>>> with_expression = df.with_column(
... "total", lambda current: current["left"] + current["right"]
... )

>>> @pf.udf
... def add(left: int, right: int) -> int:
... return left + right

>>> with_udf = df.with_column(
... "total", add(pf.col("left"), pf.col("right"))
... )

.. versionadded:: 2.4.0
"""
if not isinstance(name, str):
Expand Down
Loading