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

fix: schema adapter doesn't map partial batches correctly #2735

Merged
merged 2 commits into from
Aug 6, 2024

Conversation

alexwilcoxson-rel
Copy link
Contributor

@alexwilcoxson-rel alexwilcoxson-rel commented Aug 6, 2024

Description

When pushdown_filters on DataFusion SessionConfig is enabled for Parquet, map_partial_batch on the schema adapter is called with a batch that is evaluating the RowFilter created by pushdown_filters. The batch only contains the column(s) in the predicate for the RowFilter. If table_schema contains not null column then the cast will fail.

Example error:

thread 'delta_datafusion::tests::delta_scan_supports_pushdown' panicked at crates/core/src/delta_datafusion/mod.rs:2284:41:
called `Result::unwrap()` on an `Err` value: ArrowError(ExternalError(External(SchemaError("Could not find column col_2"))), None)

This change only uses from table_schema the columns that exist in the batch.

See https://docs.rs/datafusion/latest/datafusion/datasource/schema_adapter/trait.SchemaMapper.html#tymethod.map_partial_batch

Related Issue(s)

Documentation

@github-actions github-actions bot added the binding/rust Issues for the Rust crate label Aug 6, 2024
@alexwilcoxson-rel
Copy link
Contributor Author

@HawaiianSpork FYI

@rtyler rtyler added this pull request to the merge queue Aug 6, 2024
Merged via the queue into delta-io:main with commit c552ada Aug 6, 2024
18 checks passed
@alexwilcoxson-rel alexwilcoxson-rel deleted the pushdown-fix branch August 6, 2024 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binding/rust Issues for the Rust crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants