GitHub user HyukjinKwon opened a pull request:
https://github.com/apache/spark/pull/18160
[SPARK-20938][SQL] Keep/print the string representation of catalyst filters
in metadata for CatalystScan
## What changes were proposed in this pull request?
Actual pushed-down catalyst predicate expressions look not being
represented correctly (but only sources filters). For example, the below case
```scala
df.filter("cast(a as string) == '1' and a < 3").explain()
```
prints the plan as below:
```
== Physical Plan ==
*Filter (cast(a#0L as string) = 1)
+- *Scan SimpleCatalystScan(0,10) [a#0L] PushedFilters: [*LessThan(a,3)],
ReadSchema: struct<a:bigint>
```
Actual predicates via `buildScan(requiredColumns: Seq[Attribute], filters:
Seq[Expression])` are as below:
```scala
println(filters.mkString("[", ", ", "]"))
```
```
[(cast(a#0L as string) = 1), (a#0L < 3)]
```
**After**
```scala
df.filter("cast(a as string) == '1' and a < 3").explain()
```
```
== Physical Plan ==
*Filter (cast(a#0L as string) = 1)
+- *Scan SimpleCatalystScan(0,10) [a#0L] PushedCatalystFilters: [(cast(a#0L
as string) = 1), *(a#0L < 3)], ReadSchema: struct<a:bigint>
```
## How was this patch tested?
Unit tests in `FilteredScanSuite` and `CatalystScanSuite`.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/HyukjinKwon/spark catalyst-predicates
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/18160.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 #18160
----
commit 1c159d26b116ea65bfef5147f471fc520efc9a0b
Author: hyukjinkwon <[email protected]>
Date: 2017-05-31T09:18:19Z
Metadata should keep the pushed filters in
PushedFilters/PushedCatalystFilters
----
---
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]