GitHub user viirya opened a pull request:

    https://github.com/apache/spark/pull/5309

    [SPARK-6647][SQL] Make trait StringComparison as BinaryPredicate and throw 
error when Predicate can't translate to data source Filter

    Now trait `StringComparison` is a `BinaryExpression`. In fact, it should be 
a `BinaryPredicate`.
    
    By making `StringComparison` as `BinaryPredicate`, we can throw error when 
a `expressions.Predicate` can't translate to a data source `Filter` in function 
`selectFilters`.
    
    Without this modification, because we will wrap a `Filter` outside the 
scanned results in `pruneFilterProjectRaw`, we can't detect about something is 
wrong in translating predicates to filters in `selectFilters`.
    
    The unit test of #5285 demonstrates such problem. In that pr, even 
`expressions.Contains` is not properly translated to `sources.StringContains`, 
the filtering is still performed by the `Filter` and so the test passes.
    
    Of course, by doing this modification, all `expressions.Predicate` classes 
need to have its data source `Filter` correspondingly.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/viirya/spark-1 translate_predicate

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/5309.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 #5309
    
----
commit caf2347251fbb8df4eedc9e7cf49a59eb52ff8d5
Author: Liang-Chi Hsieh <[email protected]>
Date:   2015-04-01T10:59:05Z

    Make trait StringComparison as BinaryPredicate and throw error when 
Predicate can't translate to data source Filter.

----


---
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]

Reply via email to