huaxingao commented on pull request #35669:
URL: https://github.com/apache/spark/pull/35669#issuecomment-1061424605
@stczwd
Thanks for the quick fix.
The optimization in your PR makes sense to me, but I think there is a
problem. Use this filter `(id > 0 AND p = 0) OR (id = 2 AND p = 1)` as an
example, the current physical plan is
```
*(1) Filter (((id#9L > 0) AND (p#10 = 0)) OR ((id#9L = 2) AND (p#10 = 1)))
+- *(1) ColumnarToRow
+- BatchScan[id#9L, p#10] ParquetScan DataFilters: [(((id#9L > 0) AND
(p#10 = 0)) OR ((id#9L = 2) AND (p#10 = 1)))], Format: parquet, Location:
InMemoryFileIndex(1
paths)[file:/private/var/folders/pt/_5f4sxy56x70dv9zpz032f0m0000gn/T/spark-51...,
PartitionFilters: [((p#10 = 0) OR (p#10 = 1))], PushedAggregation: [],
PushedFilters: [Or(GreaterThan(id,0),EqualTo(id,2))], PushedGroupBy: [],
ReadSchema: struct<id:bigint>, PushedFilters:
[Or(GreaterThan(id,0),EqualTo(id,2))], PushedAggregation: [], PushedGroupBy: []
RuntimeFilters: []
```
This actually looks like a bug to me. I have fixed it to
```
== Physical Plan ==
*(1) Filter ((id#9L > 0) OR (id#9L = 2))
+- *(1) ColumnarToRow
+- BatchScan[id#9L, p#10] ParquetScan DataFilters: [((id#9L > 0) OR
(id#9L = 2))], Format: parquet, Location: InMemoryFileIndex(1
paths)[file:/private/var/folders/pt/_5f4sxy56x70dv9zpz032f0m0000gn/T/spark-38...,
PartitionFilters: [((p#10 = 0) OR (p#10 = 1))], PushedAggregation: [],
PushedFilters: [Or(GreaterThan(id,0),EqualTo(id,2))], PushedGroupBy: [],
ReadSchema: struct<id:bigint>, PushedFilters:
[Or(GreaterThan(id,0),EqualTo(id,2))], PushedAggregation: [], PushedGroupBy: []
RuntimeFilters: []
```
I will submit a PR for the fix.
I think your PR needs the data filters to be ` [(((id#9L > 0) AND (p#10 =
0)) OR ((id#9L = 2) AND (p#10 = 1)))]`.
After my fix, you can still do your optimization, but need to change some
code .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]