GitHub user damnMeddlingKid opened a pull request:
https://github.com/apache/spark/pull/14164
Allow comparisons between UDTs and Datatypes
## What changes were proposed in this pull request?
Currently UDTs can not be compared to Datatypes even if their sqlTypes
match. this leads to errors like this
```
In [12]: thresholded = df.filter(df['udt_time'] > threshold)
---------------------------------------------------------------------------
AnalysisException Traceback (most recent call last)
/Users/franklyndsouza/dev/starscream/bin/starscream in <module>()
----> 1 thresholded = df.filter(df['tick_tock_est'] > threshold)
AnalysisException: u"cannot resolve '(`tick_tock_est` >
TIMESTAMP('2015-10-20 01:00:00.0'))' due to data typ mismatch:
'(`tick_tock_est` > TIMESTAMP('2015-10-20 01:00:00.0'))' requires (boolean or
tinyint or smallint or int or bigint or float or double or decimal or timestamp
or date or string or binary) type, not pythonuserdefined"
```
This PR adds some comparisons that allow UDTs to be correctly compared to a
Datatype.
## How was this patch tested?
Built locally and tested in the pyspark repl.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/damnMeddlingKid/spark fix-df-filtering
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/14164.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #14164
----
commit d0d31ca18c49fd24476d8b7291cb16d5f346ee6e
Author: Franklyn D'souza <[email protected]>
Date: 2016-07-12T22:17:25Z
allow comparisons between UDTs and Datatypes
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]