voonhous commented on issue #20627: URL: https://github.com/apache/hudi/issues/20627#issuecomment-6822380218
Findings so far (local, JDK 25 without `--add-opens`, same machine for both columns; fix is on a local branch, PR to follow). **The inherited estimator throws on every walk.** JOL's `ObjectUtils.value` calls `Field.get`, catches `IllegalAccessException`, calls `setAccessible`, catches `InaccessibleObjectException` for `java.base` fields, then falls back to Unsafe. Counted with JFR `jdk.JavaExceptionThrow`: one walk of a 28-field `GenericData.Record` throws about 1,275 `InaccessibleObjectException` and 1,249 `IllegalAccessException`, all caught. The walk runs on every 100th put. **The inherited serializer cannot spill native log rows.** Rows read from native log files hold Trino objects from `Type.getObjectValue`, not Avro values. With the inherited serializer a spill of such a row fails with `AvroRuntimeException: Unknown datum type java.lang.Byte` (tinyint) and `Unknown datum type io.trino.spi.type.SqlDecimal` (decimal). So on master a table version 10 MOR table with those column types fails the query once the merge buffer spills, and with the inflated estimate it spills after about 64k log records per file group. Reusing `AvroRecordSerializer` as `HoodieAvroReaderContext` does would hit the same problem. Only log records are put into the merge buffer; base records are looked up and removed. **Fix measured.** An estimator that sizes the record from its key, ordering value and field values (no graph walk, schema not counted), and a serializer that tags each value kind and reads it back as the same kind: | | master | fix | |---|---|---| | `HudiMergeBufferBenchmark` estimate | 13,304 B/record | 1,618 B/record | | spilled | 235,852 / 300,000 | 0 / 300,000 | | put | 11.3 - 11.7 us/record | 0.19 - 0.22 us/record | | remove | 2.9 - 3.0 us/record | 0.06 - 0.09 us/record | | `HudiMorReadBenchmark` scan `_rt` CPU, latency off | 9.34 s | 1.31 s | | scan `_rt` wall, latency off | 1.36 s | 0.26 s | | scan `_rt`/`_ro` CPU | 55.9x | 8.0x | Not covered by this change: `FileGroupRecordBuffer` still passes `DefaultSizeEstimator` for the map keys, which walks the key string on every 100th put. That needs a hudi-common change. -- 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]
