alamb commented on code in PR #21127: URL: https://github.com/apache/datafusion/pull/21127#discussion_r2991068977
########## datafusion/sqllogictest/test_files/metadata.slt: ########## @@ -139,6 +139,23 @@ ORDER BY id, name, l_name; NULL bar NULL NULL NULL l_bar +# Regression test: UNION ALL + optimize_projections pruning unused columns causes +# metadata loss when one branch has NULL literals (empty metadata) and the other +# has field metadata. The optimizer prunes unused columns, triggering recompute_schema +# which rebuilds the Union schema via intersect_metadata_for_union. Previously, this +# intersection would drop metadata when any branch had empty metadata (from NULL literals). +# See https://github.com/apache/datafusion/issues/19049 +query T +SELECT name FROM ( Review Comment: I verified that this test fails without the fix: ``` Internal error: Physical input schema should be the same as the one converted from logical input schema. Differences: - schema metadata differs: (physical) {"metadata_key": "the entire schema"} vs (logical) {} - field metadata at index 0 [name]: (physical) {"metadata_key": "the name field"} vs (logical) {}. ``` -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
