-
Notifications
You must be signed in to change notification settings - Fork 421
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
DataFusion filter on partition column doesn't work. (when the phsical schema ordering is different to logical one) #2494
Comments
One more suggestion:
when the expr only includes partition columns, we should return |
Thanks for taking the time to write a test @Veiasai ! I'll take a look at this shortly |
hey, any updates? |
@rtyler I have a local fix for this issue - I am not sure on what the delta protocol dictates, but in some of our test tables the partitioning columns would appear in a different order in the json schema and in the partition columns array.
This is the essence of my fix fn _arrow_schema(snapshot: &Snapshot, wrap_partitions: bool) -> DeltaResult<ArrowSchemaRef> {
let meta = snapshot.metadata();
let schema = meta.schema()?;
let fields = schema
.fields()
.filter(|f| !meta.partition_columns.contains(&f.name().to_string()))
.map(|f| f.try_into())
.chain(
// keep consistent order of partitioning columns
meta.partition_columns.iter().map(|partition_col| {
let f = schema.field(partition_col).unwrap();
let field = Field::try_from(f)?;
// ... LMK if this is enough as a pointer or I should send a PR with this. |
Environment
Linux, Rust
Delta-rs version:
0.17.3
Binding:
Environment:
Bug
What happened:
The filter expr didn't return expected rows. My table is relatively big so I tried to construct a minimal test to reproduce it, see below code.
Besides, from what I see in the log, my guess is:
InExact
filter push down, so datafusion apply the same filter again, but however, the physical plan gets wrong column index.What you expected to happen:
How to reproduce it:
I wrote a unit test to check it, but it seems like I don't have permission to push it?
More details:
The text was updated successfully, but these errors were encountered: