You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(datafusion): resolve DML predicates against execution scan schema (delta-io#4127)
# Description
After the DataFusion 52 upgrade, DELETE and UPDATE operations fail with:
`Invalid comparison operation: Utf8 == Utf8View`
Error: `Arrow error: Invalid comparison operation: Utf8 == Utf8View`
This occurs when using string equality predicates like
table.delete().with_predicate("name = 'foo'").
## Root Cause:
With DataFusion 52, Parquet string/binary columns may be represented as
view types (`Utf8View`/`BinaryView`) when
`datafusion.execution.parquet.schema_force_view_types` is enabled
(default `true`).
DELETE/UPDATE were resolving predicates and SET expressions against
`snapshot.arrow_schema()` (base `Utf8`/`Binary`), but executing against
the scan/provider schema (which can include view types). This mismatch
caused filter evaluation errors like `Utf8 == Utf8View` (and similarly
`Binary == BinaryView`).
## Fix:
Resolve predicates against DeltaScanConfig::table_schema() instead of
snapshot.arrow_schema(). This ensures predicate literals are coerced to
match the actual execution schema (view types when enabled, base types
when disabled).
## Changes:
- delete.rs: Use DeltaScanConfig::table_schema() for predicate
resolution
- update.rs: Use DeltaScanConfig::table_schema() for both SET
expressions and WHERE predicates
- expr.rs: Add ScalarValue::Dictionary support to fmt_expr_to_sql
(partition columns are dictionary-encoded in execution schema)
## Tests:
- test_delete_string_equality_utf8view_regression_4125
- test_update_string_equality_non_partition
- test_delete_partition_string_predicate_dictionary_formatting
- test_delete_binary_equality_non_partition
- test_delete_custom_session_schema_force_view_types_disabled
- Dictionary scalar formatting unit tests in expr.rs
# Related Issue(s)
- Fixesdelta-io#4125
<!---
For example:
- closes#106
--->
# Documentation
<!---
Share links to useful documentation
--->
---------
Signed-off-by: Ethan Urbanski <ethan@urbanskitech.com>
Co-authored-by: R. Tyler Croy <rtyler@brokenco.de>
0 commit comments