Open tustvold opened 1 year ago
This is a good proposal I think -- it would skip unecessary filtering and likely make plans faster. It will become more useful (maybe even necessary) when predicate pushdown is enabled by default -- #3463
I think it is a good idea. I confirm it would help improve performance by 30x in https://github.com/apache/arrow-datafusion/issues/5404#issuecomment-1501221831.
I am thinking to pick this up but seems the work is not as trivial as I thought. Following are my two cents' thoughts.
Related code to improve is following https://github.com/apache/arrow-datafusion/blob/7545177001b9dc04951f0c1c2008509f3895de8e/datafusion/core/src/datasource/listing/table.rs#L736-L756
- The FileFormat is parquet
This is trivial, we can match self.options.format
with ParquetFormat
- Parquet predicate pushdown is enabled
This setting could come from ParquetExec.pushdown_filters
or ConfigOptions
(more specifically, ConfigOptions.execution.parquet.pushdown_filters
)
However, when ListingTable.supports_filter_pushdown
is called, ParquetExec
is not created yet, nor does SessionState
being passed as input.
Idea: shall we add state: &SessionState
as input for ListingTable.supports_filter_pushdown
, the same as ListingTable.scan
❓
- The predicate is fully pushed down by ParquetExec (not all predicates are supported)
is it making sure the row_filter
is built from the predicate
without error? If so, seems it requires converting a logical Expr
to PhysicalExpr
first.
I wonder if it might be possible to always return exact for Parquet files, and to just manually insert a FilterExec for any predicates that can't be pushed down
Tagging @alamb and @crepererum who are more familiar with this part of the codebase
I'll try and look into this in more detail tomorrow
I wonder if it might be possible to always return exact for Parquet files, and to just manually insert a FilterExec for any predicates that can't be pushed down
That's what we want to do for InfluxDB IOx as well: https://github.com/influxdata/influxdb_iox/issues/7408
I am going to find time sometime this week
Is your feature request related to a problem or challenge? Please describe what you are trying to do. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] (This section helps Arrow developers understand the context and why for this feature, in addition to the what)
Currently even when parquet predicate pushdown is enabled, and the predicate can be fully pushed down, the physical plan still contains a
FilterExec
when usingListingTable
Describe the solution you'd like
ListingTable::supports_filter_pushdown
should returnTableProviderFilterPushDown::Exact
whenDescribe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.