aaraujo opened a new pull request, #17634: URL: https://github.com/apache/datafusion/pull/17634
Adds fallback logic to handle qualified column references when they fail to resolve directly in the schema. This commonly occurs when aggregations produce unqualified schemas but subsequent operations still reference qualified column names. The fix preserves original error messages and only applies the fallback for qualified columns that fail initial resolution. ## Which issue does this PR close? - Fixes a bug without an issue ## Rationale for this change When aggregation operations produce schemas with unqualified column names, subsequent operations that reference qualified column names (e.g., `table.column`) fail to resolve even though the underlying column exists. This breaks query execution in cases where the logical plan correctly maintains qualified references but the schema resolution cannot handle the qualification mismatch. ## What changes are included in this PR? - Modified `get_type()` and `nullable()` functions in `expr_schema.rs` to include fallback logic - Added conservative fallback that only applies to qualified columns that fail initial resolution - Preserves original error messages when both qualified and unqualified resolution fail - Added comprehensive tests covering various scenarios including edge cases ## Are these changes tested? Yes, this PR includes: - Three new test cases covering the specific fix scenarios - Edge case testing for unqualified columns and non-existent columns - All existing expr tests continue to pass (134/135, with 1 pre-existing failure unrelated to this change) - Verified with cargo fmt, clippy, and full test suite ## Are there any user-facing changes? No breaking changes. This fix resolves previously failing queries involving qualified column references after aggregation, making the behavior more consistent and intuitive for users. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org