Skip to content
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

Support deep schema pruning and projection #11745

Open
adragomir opened this issue Jul 31, 2024 · 3 comments
Open

Support deep schema pruning and projection #11745

adragomir opened this issue Jul 31, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@adragomir
Copy link

Is your feature request related to a problem or challenge?

At the moment, Datafusion supports top-level column pruning - we have a mechanism, projection: [usize] where we detect, and pass through all the layers a set of top-level columns to get from a schema. The columns are inferred from the input and passed through all the layers (logical -> optimize -> physical). Some implementation can also take advantage of these to minimize the data read from storage at the lowest level .

However, for deeply nested schemas (a small number of huge deeply nested top-level column, list of structs with maps etc), this optimization is not so useful, because the actual top level columns are very large.

Describe the solution you'd like

We should have a way to represent, and push through all the layers the "deep" projection of the actual leaves that we need in the query.
The schema and data returned after applying the deep schema pruning should reflect the changes (select 1 field from a struct in a list, we should get a list with a struct with a single field etc)
The feature needs to be applicable only to physical layouts that actually support it (for example Parquet and Arrow)

Describe alternatives you've considered

No response

Additional context

No response

@alamb
Copy link
Contributor

alamb commented Jul 31, 2024

Possibly related to #2581

I think there may be some useful work that was added to arrow-rs apache/arrow-rs#5148

cc @goldmedal who has been working on something similar

@alamb
Copy link
Contributor

alamb commented Jul 31, 2024

Also, maybe @jayzhan211

@jayzhan211
Copy link
Contributor

I think it is worth to figure out the efficient way to deal with nested schema on arrow side. #2581. Then it will be clear how we could leverage on it. We might not need scan_deep hash map at the end 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants