GitHub user liancheng opened a pull request:
https://github.com/apache/spark/pull/6537
[SQL] Simplifies binary node pattern matching
This PR is a simpler version of #2764, and adds `unapply` method for the
following binary nodes for simpler pattern matching:
- `BinaryExpression`
- `BinaryComparison`
- `BinaryArithmetics`
For example, this may simplify the following pattern matching
```scala
case p: BinaryComparison if p.left.dataType == StringType &&
p.right.dataType == DateType =>
p.makeCopy(Array(p.left, Cast(p.right, StringType)))
```
to
```scala
case p @ BinaryComparison(l @ StringType(), r @ DateType()) =>
p.makeCopy(Array(l, Cast(r, StringType)))
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/liancheng/spark binary-node-patmat
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/6537.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 #6537
----
commit d4922e916d9468b0ad8ccd76f0f6ecb4c92b3737
Author: Cheng Lian <[email protected]>
Date: 2015-05-31T09:30:22Z
Simplifies binary node pattern matching
----
---
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]