voonhous opened a new pull request, #20648: URL: https://github.com/apache/hudi/pull/20648
### Describe the issue this Pull Request addresses Closes #20627. Part of #20625. Stacked on the benchmark PR for #20626; only the top commit is new. The Trino reader context inherited the generic record size estimator and serializer. The estimator walks each sampled record's object graph, Avro schema included, so the merge buffer saw about 13 KB per record and spilled most of a file group's log records. The inherited serializer also fails when spilling native log rows that hold tinyint or decimal values. ### Summary and Changelog - `HudiRecordSizeEstimator`: sizes key, ordering value and field values by kind; no graph walk, schema not counted. - `HudiRecordSerializer`: tagged codec for the Trino and Avro value kinds on the merge path. Unknown kinds throw. - `HudiTrinoReaderContext` returns both. Local benchmark, 300,000 log records, 3 rounds: | | before | after | |---|---|---| | estimate per record | 13,304 B | 1,618 B | | spilled records | 235,852 | 0 | | put | 11.3-11.7 us | 0.19-0.22 us | | scan `_rt` CPU (latency off) | 9.34 s | 1.31 s | ### Impact Fewer spills and less CPU on MOR snapshot reads. Spilling native log rows with tinyint or decimal columns now works. ### Risk Level medium. The spill format of the merge buffer changes; it is process-local and never persisted. Covered by a spill round-trip of every value kind and a spilled-vs-in-memory merge comparison. ### Documentation Update none ### Contributor's checklist - [x] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute) - [x] Enough context is provided in the sections above - [x] Adequate tests were added if applicable -- 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]
