Impala Public Jenkins has submitted this change and it was merged. ( https://gerrit.cloudera.org/25413 )
Change subject: IMPALA-15470/IMPALA-4061: Set fields of NULL structs to NULL in Avro scans ...................................................................... IMPALA-15470/IMPALA-4061: Set fields of NULL structs to NULL in Avro scans Iceberg tables can have Avro data files next to Parquet ones, so a STRUCT column can be read from Avro even though the planner only checks the table's default format. For a NULL struct, the Avro scanner didn't set the null indicators of the struct's fields, so they returned stale values (0 and '') instead of NULL. Changes: - The interpreted and codegen'd decoders set every materialized slot under a NULL record to NULL, including slots in nested records. - Codegen was only used for a file whose schema matched the table schema exactly. Iceberg files name their records "table" and "r2", while the reader schema uses "<db>.<tbl>", so they always fell back to the interpreted path. Replace avro_schema_equal() with SchemasMatchForCodegen(), which ignores record names and compares everything that affects decoding. - Avro files that differ from the table schema only in record names (most Iceberg Avro files, e.g. iceberg_avro_format) now use the codegen'd decoder. Files with required fields (NOT NULL columns, VARIANT) still use the interpreted decoder, because the reader schema makes every field nullable. - Nested records in codegen no longer pass an unset value to CreateCondBr(), which crashed impalad (LLVM assertion in debug builds). This also fixes IMPALA-4061 for nested records in Avro scans. Testing: - Added QueryTest/iceberg-avro-struct.test: NULL struct fields, a nested struct s2 (struct<x, t: struct<y, z>>) with NULLs at each level, count and filter over NULL struct fields, and a select of only id. The new tests runs each query with the interpreted and the codegen'd decoder. - New fixture iceberg_avro_null_struct, created with the Iceberg Java API (version 1.11.0). It is a Parquet-default table with one Avro data file. Change-Id: If45b48b46bf23234371ea1e774a9e6c6a06d41ad Assisted-by: Claude Haiku 5.5 (Cursor) Reviewed-on: https://gerrit.cloudera.org/25413 Reviewed-by: Impala Public Jenkins <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> --- M be/src/exec/avro/hdfs-avro-scanner.cc M be/src/runtime/descriptors.h M testdata/data/README A testdata/data/iceberg_test/iceberg_avro_null_struct/data/00000-0-dae80e6f-72c6-4f1e-ac84-22dff10e9bdc-1-00001.avro A testdata/data/iceberg_test/iceberg_avro_null_struct/metadata/9fbd8e0a-269c-4a87-83f2-c5b85a10ea24-m0.avro A testdata/data/iceberg_test/iceberg_avro_null_struct/metadata/snap-8945213437195086670-1-9fbd8e0a-269c-4a87-83f2-c5b85a10ea24.avro A testdata/data/iceberg_test/iceberg_avro_null_struct/metadata/v1.metadata.json A testdata/data/iceberg_test/iceberg_avro_null_struct/metadata/v2.metadata.json A testdata/data/iceberg_test/iceberg_avro_null_struct/metadata/v3.metadata.json A testdata/data/iceberg_test/iceberg_avro_null_struct/metadata/version-hint.text A testdata/workloads/functional-query/queries/QueryTest/iceberg-avro-struct.test M testdata/workloads/functional-query/queries/QueryTest/iceberg-v3-variant.test M tests/query_test/test_iceberg.py 13 files changed, 212 insertions(+), 8 deletions(-) Approvals: Impala Public Jenkins: Looks good to me, approved; Verified -- To view, visit https://gerrit.cloudera.org/25413 To unsubscribe, visit https://gerrit.cloudera.org/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: If45b48b46bf23234371ea1e774a9e6c6a06d41ad Gerrit-Change-Number: 25413 Gerrit-PatchSet: 7 Gerrit-Owner: Arnab Karmakar <[email protected]> Gerrit-Reviewer: Arnab Karmakar <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>
