[
https://issues.apache.org/jira/browse/SPARK-61006?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Hyukjin Kwon updated SPARK-61006:
---------------------------------
Description:
In PySpark Connect, a call of a Python UDF or UDTF takes keyword arguments:
{{UserDefinedFunction.__call__(*args, **kwargs)}} and
{{UserDefinedTableFunction.__call__(*args, **kwargs)}} send each keyword
argument as a {{NamedArgumentExpression}}, so that {{plus(a=lit(1),
b=col("x"))}} calls {{plus}} with {{a}} and {{b}}, and its column is
{{Column<'plus(a => 1, b => x)'>}}. An argument of a UDTF call is a column or a
column name, so {{udtf_call("x")}} refers to the column {{x}}.
The Rust-backed Python client drops the keyword arguments of a UDF call, so the
call fails on the server with a {{PythonException}} of the missing arguments,
and its column is {{Column<'plus()'>}}; a UDTF call with keyword arguments
raises {{TypeError}}; and a UDTF call takes a string as a literal, so
{{udtf_call("x")}} returns a row of {{'x'}} where PySpark 4.3.0 raises
{{UNRESOLVED_COLUMN}}. Pass the arguments as PySpark does.
was:
In PySpark Connect, a call of a Python UDF or UDTF takes keyword arguments:
{{UserDefinedFunction.__call__(*args, **kwargs)}} and
{{UserDefinedTableFunction.__call__(*args, **kwargs)}} send each keyword
argument as a {{NamedArgumentExpression}}, so that {{plus(a=lit(1),
b=col("x"))}} calls {{plus}} with {{a}} and {{b}}, and its column is
{{Column<'plus(a => 1, b => x)'>}}.
The Rust-backed Python client drops the keyword arguments of a UDF call, so the
call fails on the server with a {{PythonException}} of the missing arguments,
and its column is {{Column<'plus()'>}}; and a UDTF call with keyword arguments
raises {{TypeError}}. Pass the named arguments as PySpark does.
Summary: Pass the arguments of Python UDF and UDTF calls of the Python
client as PySpark does (was: Pass the named arguments of Python UDF and UDTF
calls of the Python client as PySpark does)
> Pass the arguments of Python UDF and UDTF calls of the Python client as
> PySpark does
> ------------------------------------------------------------------------------------
>
> Key: SPARK-61006
> URL: https://issues.apache.org/jira/browse/SPARK-61006
> Project: Spark
> Issue Type: Bug
> Components: Connect
> Affects Versions: connect-rust-4.3.0
> Reporter: Hyukjin Kwon
> Priority: Major
> Fix For: connect-rust-4.3.0
>
>
> In PySpark Connect, a call of a Python UDF or UDTF takes keyword arguments:
> {{UserDefinedFunction.__call__(*args, **kwargs)}} and
> {{UserDefinedTableFunction.__call__(*args, **kwargs)}} send each keyword
> argument as a {{NamedArgumentExpression}}, so that {{plus(a=lit(1),
> b=col("x"))}} calls {{plus}} with {{a}} and {{b}}, and its column is
> {{Column<'plus(a => 1, b => x)'>}}. An argument of a UDTF call is a column or
> a column name, so {{udtf_call("x")}} refers to the column {{x}}.
> The Rust-backed Python client drops the keyword arguments of a UDF call, so
> the call fails on the server with a {{PythonException}} of the missing
> arguments, and its column is {{Column<'plus()'>}}; a UDTF call with keyword
> arguments raises {{TypeError}}; and a UDTF call takes a string as a literal,
> so {{udtf_call("x")}} returns a row of {{'x'}} where PySpark 4.3.0 raises
> {{UNRESOLVED_COLUMN}}. Pass the arguments as PySpark does.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]