[ 
https://issues.apache.org/jira/browse/SPARK-60030?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yang Jie updated SPARK-60030:
-----------------------------
    Description: 
DECLARE VARIABLE fails with an internal error when the default contains a 
Python UDF:

DECLARE OR REPLACE VARIABLE v STRING DEFAULT py_udf(1)
[INTERNAL_ERROR] ... No plan for CreateVariable default(cast(cast(pythonUDF0#1 
as int) as string), sql='py_udf(1)'), true
+- BatchEvalPython [py_udf(1)], [pythonUDF0#1]
   +- ResolvedIdentifier ..., session.v

ExtractPythonUDFs treats the ResolvedIdentifier children of CreateVariable as 
inputs: a Python UDF without references is a subset of every child's output, so 
it wraps the child in a BatchEvalPython, and V2CommandStrategy no longer plans 
the command. `nullif(py_udf(1), '3')` fails the same way. `SELECT py_udf(1)` 
and `SET VAR v = py_udf(1)` work.

Raised in https://github.com/apache/spark/pull/59209#discussion_r4199845698


> DECLARE VARIABLE with a Python UDF in the default fails with No plan for 
> CreateVariable
> ---------------------------------------------------------------------------------------
>
>                 Key: SPARK-60030
>                 URL: https://issues.apache.org/jira/browse/SPARK-60030
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 5.0.0
>            Reporter: Yang Jie
>            Priority: Major
>
> DECLARE VARIABLE fails with an internal error when the default contains a 
> Python UDF:
> DECLARE OR REPLACE VARIABLE v STRING DEFAULT py_udf(1)
> [INTERNAL_ERROR] ... No plan for CreateVariable 
> default(cast(cast(pythonUDF0#1 as int) as string), sql='py_udf(1)'), true
> +- BatchEvalPython [py_udf(1)], [pythonUDF0#1]
>    +- ResolvedIdentifier ..., session.v
> ExtractPythonUDFs treats the ResolvedIdentifier children of CreateVariable as 
> inputs: a Python UDF without references is a subset of every child's output, 
> so it wraps the child in a BatchEvalPython, and V2CommandStrategy no longer 
> plans the command. `nullif(py_udf(1), '3')` fails the same way. `SELECT 
> py_udf(1)` and `SET VAR v = py_udf(1)` work.
> Raised in https://github.com/apache/spark/pull/59209#discussion_r4199845698



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to