Arnab Karmakar has uploaded this change for review. ( 
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 set the
struct's null indicator but not the indicators of its child slots
returned stale values (0 and '') instead of NULL. The codegen'd decoder
had the same gap.

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.
- 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,
  count and filter over NULL struct fields, and a select of only id.
  Each query runs 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)
---
M be/src/exec/avro/hdfs-avro-scanner.cc
M be/src/runtime/descriptors.h
M testdata/data/README
A testdata/workloads/functional-query/queries/QueryTest/iceberg-avro-struct.test
M tests/query_test/test_iceberg.py
5 files changed, 152 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/13/25413/1
--
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: newchange
Gerrit-Change-Id: If45b48b46bf23234371ea1e774a9e6c6a06d41ad
Gerrit-Change-Number: 25413
Gerrit-PatchSet: 1
Gerrit-Owner: Arnab Karmakar <[email protected]>

Reply via email to