girotomas opened a new pull request, #19327: URL: https://github.com/apache/iceberg/pull/19327
## Summary Adds JMH benchmarks for Variants: - **core** — `VariantSerializationBenchmark`: build, serialize, deserialize and round-trip across nesting depth (flat / nested / deep) and shredded-field percentage (0 / 33 / 67 / 100). - **Spark 4.1 and 4.2** — `IcebergSourceVariantIOBenchmark`: generates Avro, unshredded Parquet and shredded Parquet tables with the same variant data and compares count / filter / project operations against normal columns and variant fields. - `IcebergSourceBenchmark` — overridable `sparkMaster()` and Hadoop config propagated as `spark.hadoop.*` entries. This is a rebased continuation of #15629 by @steveloughran, who has said he is no longer set up for Java work. Relative to the original: - rebased onto current `main` - added the Spark 4.2 benchmark (4.2 is now the default; the original only had 4.1) - dropped the `jmh.gradle` `iceberg-open-api` workaround after verifying it is no longer needed on current `main` Fixes #15628. Steve is credited as co-author. Happy to hand this to a committer who wants to carry #15629 forward — opening it so the rebased work is not lost. ## Findings - Shredded Parquet has the smallest files but is significantly slower for operations on variant structs than unshredded Parquet. - Avro is fastest for variant data but requires reading the whole file, so operations on other columns are slower. - Filtering is the expensive operation; projecting a variant column (shredded or not) is as fast as projecting a normal Parquet column. Writeup: https://steveloughran.github.io/benchmarking-variants/ ## Tests - `./gradlew :iceberg-core:jmhClasses :iceberg-spark:iceberg-spark-4.1_2.13:jmhClasses :iceberg-spark:iceberg-spark-4.2_2.13:jmhClasses -DsparkVersions=4.1,4.2` - `spotlessCheck` for all three modules - Smoke runs (1 warmup / 1 measurement): - `VariantSerializationBenchmark.serialize` (flat, 100 fields, 33% shredded): ~792 µs/op - `IcebergSourceVariantIOBenchmark.count` (unshredded): ~136 ms/op (4.1), ~155 ms/op (4.2) The local machine is ARM; the benchmark Javadoc notes that representative results should be collected on x86 (`rdtscp`). ## Running the benchmarks ```bash ./gradlew :iceberg-core:jmh -PjmhIncludeRegex=VariantSerializationBenchmark ./gradlew :iceberg-spark:iceberg-spark-4.2_2.13:jmh -DsparkVersions=4.2 \ -PjmhIncludeRegex=IcebergSourceVariantIOBenchmark ``` -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
