Skip to content

feat: add nested benchmark derived from TPC-H - #7044

Merged
andygrove merged 1 commit into
apache:mainfrom
comphead:nested-tpch-benchmark
Oct 16, 2026
Merged

andygrove merged 1 commit into
apache:mainfrom
comphead:nested-tpch-benchmark

Conversation

@comphead

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

No issue filed. Related: #6467 was found with this benchmark.

Rationale for this change

TPC-H is flat. All eight tables are normalized and every column is primitive. Real-world data is usually nested (event logs, JSON/Avro/Protobuf records, data lake tables), and nested column pruning, struct field access and array unnesting are hot paths there. The existing TPC-H derived benchmarks exercise none of them.

This adds a nested variant that keeps the TPC-H data and queries and changes only the shape, so Comet's nested-type support can be benchmarked and compared against Spark on the same data.

What changes are included in this PR?

  • benchmarks/nested/scripts/nest_tpch.scala: a spark-shell -i script that converts existing flat TPC-H data (Parquet or Iceberg, either direction) into the nested layout. Join keys and partition columns (p_brand, c_mktsegment, o_orderdate, l_shipdate) stay at the top level. All other columns move into a single-element <table>_data: array<struct<...>>. Spark is used for the conversion because the data can reach about 10 TB at SF10000.
  • benchmarks/nested/queries/q01..q22.sql: the queries rewritten for the nested schema. Each one unnests the arrays it needs with explode. The arrays hold exactly one element, so the results are identical to the flat queries.
  • benchmarks/nested/README.md: motivation, schema, usage.
  • dev/release/rat_exclude_files.txt: exclude the derived queries, like benchmarks/tpc/queries.

How are these changes tested?

Tested manually, since this is benchmark tooling and not part of the build:

  • Ran the conversion on Spark 3.5.5 with Iceberg 1.8.1 in all four directions: Parquet to Parquet, Parquet to Iceberg, Iceberg to Parquet and Iceberg to Iceberg. Ran Parquet to Parquet on Spark 4.1.1.
  • Ran all 22 nested queries on the nested output and the flat queries on the flat input, and compared the results. They matched for every query. The data was a small, TPC-H shaped local sample, not dbgen output.

Adds benchmarks/nested: a spark-shell script that converts existing flat
TPC-H data (Parquet or Iceberg) into a nested layout, where non-key,
non-partition columns move into a single-element array<struct>, and the 22
queries rewritten for that schema.
@github-actions github-actions Bot added the enhancement New feature or request label Oct 16, 2026

@andygrove andygrove left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@andygrove
andygrove added this pull request to the merge queue Oct 16, 2026
Merged via the queue into apache:main with commit c230bf4 Oct 16, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants