Skip to content

[SPARK-13410][SQL] Support unionAll for DataFrames with UDT columns. #11333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

damnMeddlingKid
Copy link
Contributor

What changes were proposed in this pull request?

This PR adds equality operators to UDT classes so that they can be correctly tested for dataType equality during union operations.

This was previously causing "AnalysisException: u"unresolved operator 'Union;"" when trying to unionAll two dataframes with UDT columns as below.

from pyspark.sql.tests import PythonOnlyPoint, PythonOnlyUDT
from pyspark.sql import types

schema = types.StructType([types.StructField("point", PythonOnlyUDT(), True)])

a = sqlCtx.createDataFrame([[PythonOnlyPoint(1.0, 2.0)]], schema)
b = sqlCtx.createDataFrame([[PythonOnlyPoint(3.0, 4.0)]], schema)

c = a.unionAll(b)

How was the this patch tested?

Tested using two unit tests in sql/test.py and the DataFrameSuite.

Additional information here : https://issues.apache.org/jira/browse/SPARK-13410

@rxin

@davies
Copy link
Contributor

davies commented Feb 23, 2016

LGTM

@damnMeddlingKid
Copy link
Contributor Author

Hoping to get this into 1.6.1.

@SparkQA
Copy link

SparkQA commented Feb 23, 2016

Test build #2570 has finished for PR 11333 at commit c14d1ba.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@rxin
Copy link
Contributor

rxin commented Feb 23, 2016

Thanks - merging in branch-1.6.

asfgit pushed a commit that referenced this pull request Feb 23, 2016
## What changes were proposed in this pull request?

This PR adds equality operators to UDT classes so that they can be correctly tested for dataType equality during union operations.

This was previously causing `"AnalysisException: u"unresolved operator 'Union;""` when trying to unionAll two dataframes with UDT columns as below.

```
from pyspark.sql.tests import PythonOnlyPoint, PythonOnlyUDT
from pyspark.sql import types

schema = types.StructType([types.StructField("point", PythonOnlyUDT(), True)])

a = sqlCtx.createDataFrame([[PythonOnlyPoint(1.0, 2.0)]], schema)
b = sqlCtx.createDataFrame([[PythonOnlyPoint(3.0, 4.0)]], schema)

c = a.unionAll(b)
```

## How was the this patch tested?

Tested using two unit tests in sql/test.py and the DataFrameSuite.

Additional information here : https://issues.apache.org/jira/browse/SPARK-13410

rxin

Author: Franklyn D'souza <franklynd@gmail.com>

Closes #11333 from damnMeddlingKid/udt-union-patch.
@SparkQA
Copy link

SparkQA commented Feb 23, 2016

Test build #2571 has finished for PR 11333 at commit c14d1ba.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@rxin
Copy link
Contributor

rxin commented Feb 24, 2016

@damnMeddlingKid can you close the pull request? Since it was not merged in master, github won't auto close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants