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

Project to nested columns in StructType::project #353

Open
OussamaSaoudi-db opened this issue Sep 24, 2024 · 0 comments
Open

Project to nested columns in StructType::project #353

OussamaSaoudi-db opened this issue Sep 24, 2024 · 0 comments
Assignees

Comments

@OussamaSaoudi-db
Copy link
Collaborator

The current implementation of project and project_as_struct prune a schema down to a subset of its columns. However, they do not prune columns beyond the first level. Consider a checkpoint:

┌──────────────────────┬──────────────────────┬──────────────────────┬──────────────────────┬────────────────────────────────────┐
│         txn          │         add          │        remove        │       metaData       │              protocol              │
│ struct(appid varch…  │ struct(path varcha…  │ struct(path varcha…  │ struct(id varchar,…  │ struct(minreaderversion integer,…  │
├──────────────────────┼──────────────────────┼──────────────────────┼──────────────────────┼────────────────────────────────────┤
│                      │                      │ {'path': part-0000…  │                      │                                    │
│                      │ {'path': part-0000…  │                      │                      │                                    │
│                      │                      │                      │                      │ {'minReaderVersion': 1, 'minWrit…  │
│                      │                      │                      │ {'id': 84b09beb-32…  │                                    │
└──────────────────────┴──────────────────────┴──────────────────────┴──────────────────────┴────────────────────────────────────┘

The current projection would only allow you to project onto txn, add, remove, metaData, or protocol columns. We cannot project onto a nested column like metaData.id. So if we wanted to inspect or filter on a nested column like metaData.id, we could only project it to metaData. In this case, we'd be forced to fetch all the leaf columns of metaData. This is because parquet flattens logical types and only stores the leaf columns.

@OussamaSaoudi-db OussamaSaoudi-db changed the title Recursively project nested structures in StructType Project to nested columns in StructType::project Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant