voonhous opened a new issue, #19567:
URL: https://github.com/apache/hudi/issues/19567
**Describe the problem you faced**
Split out of #19556, which had two independent root causes; this issue
tracks the second one. The avro internal read path silently nulls shredded
VARIANT values during base-file rewrites. Easiest trigger: a COW table with
shredded variant files where a second INSERT bin-packs into an existing small
file group. The small-file merge reads the old base file through
HoodieAvroParquetReader, gets value=null for every shredded value, and writes
the nulls into the new file version. No error, and the loss happens on plain
inserts, no table service involved.
This is a different defect from #19556's clustering leg (fixed by #19558,
which covers the Spark reader context). Any rewrite that resolves the avro
reader context is affected.
**To Reproduce**
Spark SQL on master under the spark4.1 profile, default small-file handling:
```sql
create table t (id int, v variant, ts long) using hudi
location '/tmp/variant_smallfile_repro'
tblproperties (
primaryKey = 'id', type = 'cow', preCombineField = 'ts',
hoodie.parquet.variant.write.shredding.enabled = 'true',
hoodie.parquet.variant.force.shredding.schema.for.test = 'key string',
hoodie.index.type = 'INMEMORY'
);
insert into t values (1, parse_json('{"key":"value1"}'), 1000), (2,
parse_json('{"key":"value2"}'), 1000);
insert into t values (3, parse_json('{"key":"value3"}'), 1000), (4,
parse_json('{"key":"value4"}'), 1000);
select id, cast(v as string) from t order by id;
-- rows 1 and 2 come back null; 3 and 4 are fine
```
Confirmed by instrumentation while debugging #19556: the nulls for rows 1-2
are physically present in the file-group version written by the second commit,
before any clustering runs, and that merge read does not go through
SparkFileFormatInternalRowReaderContext (the #19558 fix point).
**Expected behavior**
Shredded variant values survive the small-file merge (and any other
avro-path rewrite).
**Suspected cause**
HoodieVariantReconstruction never engages on real files: the footer
MessageType conversion loses the variant logical type, so the avro reader falls
back to reading {metadata, value} and drops typed_value. Fixes for this exist
on the feat-18937 shredding-inference branch but are entangled with the
inference feature and unmerged.
**Environment Description**
* Hudi version: master (1.3.0-SNAPSHOT, c4b38935db04)
* Spark version: 4.1 profile (Scala 2.13, JDK 17)
* Table type: COPY_ON_WRITE, parquet base files
* Storage: local FS
* Running on Docker: no
--
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]