You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Maciej Szymkiewicz (JIRA)" <ji...@apache.org> on 2017/02/24 14:32:44 UTC

[jira] [Created] (SPARK-19728) PythonUDF with multiple parents shouldn't be pushed down when used as a predicat

Maciej Szymkiewicz created SPARK-19728:
------------------------------------------

             Summary:  PythonUDF with multiple parents shouldn't be pushed down when used as a predicat
                 Key: SPARK-19728
                 URL: https://issues.apache.org/jira/browse/SPARK-19728
             Project: Spark
          Issue Type: Bug
          Components: PySpark, SQL
    Affects Versions: 2.1.0, 2.0.0, 2.2.0
            Reporter: Maciej Szymkiewicz


Prior to Spark 2.0 it was possible to use Python UDF output as a predicate:

{code}
from pyspark.sql.functions import udf
from pyspark.sql.types import BooleanType

df1 = sc.parallelize([(1, ), (2, )]).toDF(["col_a"])
df2 = sc.parallelize([(2, ), (3, )]).toDF(["col_b"])
pred = udf(lambda x, y: x == y, BooleanType())

df1.join(df2).where(pred("col_a", "col_b")).show()
{code}

In Spark 2.0 this is no longer possible:

{code}
spark.conf.set("spark.sql.crossJoin.enabled", True)
df1.join(df2).where(pred("col_a", "col_b")).show()

## ...
## Py4JJavaError: An error occurred while calling o731.showString.
: java.lang.RuntimeException: Invalid PythonUDF <lambda>(col_a#132L, col_b#135L), requires attributes from more than one child.
## ...
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org