-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce ProjectionMask To Allow Nested Projection Pushdown #2581
Comments
I like the idea of a single Projection structure that understand how to select nested types.
As long as we can maintain independence for parquet (aka one can select subsets of parquet files without having to use Arrow) that is great. If we don't get the Projection into arrow-rs in time, we could also copy/paste the Projection code into DataFusion and provide a conversion back and forth during the interim period |
It gets little more indepth if the struct has members which are list of struct again. How will the schema pushdown will happen to them? Eg: Struct Employee {
name: String,
departments: Vec<Department>,
}
Struct Department {
id: u32,
name: String,
} How will the proection appear for this? |
In this case you have roots of
And leaves of
So if say you projected with leaves
Or in terms of the arrow datatype
Does that make sense? |
My question is will the projection goes to nested levels? Eg: employee.departments[*].name, employee.departments[0].name |
At least in the case of arrow and parquet, list indexing is more of a filter than a cheap projection - it requires rewriting the buffers. Perhaps we could do the common case as described here, and potentially add list index pushdown as an extension once we have workloads that stand to benefit?? Or did you have a particular suggestion on how to handle it? |
I agree with your thought process. List indexing is not push down as much as the column itself. I am guessing at some point datafusion will have support at the SQL level for the list indexing. |
@tustvold is this something you're working on already? |
This PR is slightly related, as predicates aren't being pushed down currently: |
@nl5887 I am not currently working on this, but would be happy to assist if you or someone else wanted to pick it up 😀 |
@tustvold I think quite a lot needs to be changed. Most of the code will do column selection by name, whereas the relevant data of the sql parsing (the indexed field structure) is lost. Correct me if I'm wrong, but I think the datafusion core column needs to be converted to an enum consisting of Column and IndexedField. The retrieval from the DFSchema needs to be done using the column itself instead of (qualified) name, and the required_columns shouldn't be derived from the output schema, but from the plan itself. Probably a lot more needs to be done, but this is necessary to be able to be able to push down the projections. Looking forward to your thoughts! |
As described above, list index pushdown is likely to yield limited benefits for any of the formats we currently support. As such I don't think we need to support it in projection pushdown as a first step.
I'm not sure I follow what you mean, I would have expected list indexing to just be a different type of |
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Currently projection indices are pushed down to scans as
Vec<usize>
. This creates some ambiguities:To demonstrate how these problems intertwine, consider the case of
If I project
["first.a", "second.c", "first.b"]
what is the resulting schema?Describe the solution you'd like
I would like to propose we instead pushdown a leaf column mask, where leaf columns are fields with no children, as enumerated by a depth-first-scan of the schema tree. This avoids any ordering ambiguities, whilst also being relatively straightforward to implement and interpret.
I recently introduced a similar concept to the parquet reader apache/arrow-rs#1716. We could theoretically lift this into arrow-rs, potentially adding support to RecordBatch for it, and then use this in DataFusion.
Describe alternatives you've considered
We could not support nested pushdown
Additional context
Currently pushdown for nested types in ParquetExec is broken - #2453
Thoughts @andygrove @alamb
The text was updated successfully, but these errors were encountered: