Repository navigation
test(scan): Support split and parallel scans - Part-5: end-to-end validation and benchmark - #1168
kamcheungting-db wants to merge 4 commits into
Conversation
da25877 to
e12240a
Compare
timothyw553
left a comment
There was a problem hiding this comment.
overall looks good, the tests are thorough and compare full rows against independent expectations. left a few comments on benchmark portability and comparison boundaries, plus a couple test gaps around RowGroupMidpoint(), PlanWith, and avro split sizes.
| add_iceberg_benchmark(mumbling_bitmap_benchmark) | ||
|
|
||
| # Reads real Parquet tables, so it needs the bundle. | ||
| if(ICEBERG_BUILD_BUNDLE) |
There was a problem hiding this comment.
this benchmark includes <sys/resource.h> and calls getrusage, which won't build on windows when ICEBERG_BUILD_BUNDLE is enabled. should we guard the target with UNIX?
-if(ICEBERG_BUILD_BUNDLE)
+if(ICEBERG_BUILD_BUNDLE AND UNIX)There was a problem hiding this comment.
Agreed. I’ll guard the target with ICEBERG_BUILD_BUNDLE AND UNIX, since it depends on getrusage.
| int64_t PeakRssKiB() { | ||
| rusage usage{}; | ||
| getrusage(RUSAGE_SELF, &usage); | ||
| return usage.ru_maxrss; |
There was a problem hiding this comment.
on macos ru_maxrss is in bytes rather than kib, so PeakRssKiB() will report 1024x too high when divided by 1024 below. should we normalize it here?
+#if defined(__APPLE__)
+ return usage.ru_maxrss / 1024;
+#else
return usage.ru_maxrss;
+#endifThere was a problem hiding this comment.
Correct. I’ll convert ru_maxrss from bytes to KiB on macOS so the later conversion to MiB is consistent with Linux.
| /*max_row_group_rows=*/200)); | ||
| ICEBERG_UNWRAP_OR_FAIL(auto starts, RowGroupStarts(*written.data_file)); | ||
| ASSERT_EQ(starts.size(), 12U); | ||
| // Valid (increasing, in-bounds) offsets that fall inside row groups, so that |
There was a problem hiding this comment.
to my understanding the parquet reader assigns row groups by RowGroupMidpoint(), not starts (and the comment at line 224 says starts too). since ExpectParallelMatches merges all contiguous ranges, wouldn't start-based assignment still pass here? should we build boundaries from RowGroupMidpoint(), including a midpoint right on a split boundary, and check which rows each split returns?
There was a problem hiding this comment.
You’re right: assignment uses midpoints, and checking the combined rows misses that distinction. I’ll correct the comments and check each split’s exact rows using midpoint-based boundaries, including a midpoint exactly on a boundary.
|
|
||
| Result<std::unique_ptr<DataTableScan>> BuildScan( | ||
| const std::shared_ptr<TableMetadata>& metadata, const ScanSettings& settings) { | ||
| ICEBERG_ASSIGN_OR_RAISE(auto builder, MakeScanBuilder<DataTableScan>(metadata)); |
There was a problem hiding this comment.
none of the tests configure PlanWith(executor_) yet. could we add an end-to-end case where planning and reading share the bounded executor_ to check that both still make progress?
There was a problem hiding this comment.
I’ll add an end-to-end case where PlanWith(executor_) and the parallel reader share the same bounded pool, verifying completion and the full expected rows.
| files.push_back(std::move(written)); | ||
| } | ||
| auto metadata = MakeMetadata(files); | ||
| ScanSettings settings{.target_split_size = files[0].data_file->file_size_in_bytes / 3}; |
There was a problem hiding this comment.
do we assert anywhere that at least one avro file is actually larger than target_split_size? if it's smaller, the planner returns early on size before checking the format, so EXPECT_FALSE(task->is_split()) would pass trivially.
There was a problem hiding this comment.
I’ll ensure at least one Avro file exceeds the split target, assert that precondition, and verify it remains unsplit while the Parquet files are split.
| const auto before = ReadCounters(); | ||
| const auto start = Clock::now(); | ||
| ICEBERG_ASSIGN_OR_RAISE(auto scan, BuildScan(table, filter)); | ||
| ICEBERG_ASSIGN_OR_RAISE(auto tasks, scan->PlanFilesStream()); |
There was a problem hiding this comment.
RunSerial uses unsplit PlanFilesStream() while RunParallel uses split and packed PlanTasksStream(), so this measures the whole pipeline change rather than parallelism alone. also read_start excludes initial planning in serial but includes first-group planning in parallel, so should we add a serial PlanTasksStream() baseline and align or drop the read-phase ratio?
There was a problem hiding this comment.
The current comparison measures the whole scan pipeline. I’ll label that explicitly, add a serial PlanTasksStream() baseline, and drop the read-phase speedup ratio because its timing boundaries differ. I’ll rerun and update the results.
| const std::shared_ptr<FileIO>& io, | ||
| const Workload& workload) { | ||
| const auto table_dir = config.dir / workload.name; | ||
| std::filesystem::remove_all(table_dir); |
There was a problem hiding this comment.
nit: running with a custom --dir deletes everything under --dir/large or --dir/small, which isn't mentioned in the usage comment. should we document that (or use a unique temp subdir per run)?
There was a problem hiding this comment.
I’ll create a unique subdirectory for each run under --dir and limit cleanup to that directory.
…idation and benchmark Plan real tables with PlanTasksStream() and read them with ParallelScanReader, comparing the rows with PlanFilesStream() and the serial FileScanTaskReader and with independently expected values, for one and four workers and format versions 1-3: - multi-row-group Parquet files split by manifest offsets, by fixed ranges when offsets are missing, and by valid offsets that fall inside row groups instead of on their canonical starts - one large row group split into several ranges - many small files packed into groups - mixed Parquet and Avro files (Avro stays whole) - case-insensitive residual filters - position deletes carried into every split - absolute _row_id and _pos values across splits (v3) - releasing the stream between callbacks while workers are busy Add parallel_scan_benchmark (bundle builds with ICEBERG_BUILD_BENCHMARKS), which writes a large-file and a small-file local table and reports paired, order-alternated serial versus parallel trials with a bootstrapped median and 95% confidence interval of the speedup, end to end and for the read phase, plus planning time, queue peaks, producer wait, and peak RSS. It is not run in CI. Co-authored-by: Isaac <[email protected]>
Use std::array for per-path samples and move main's body into the iceberg namespace instead of a using-directive. Co-authored-by: Isaac <[email protected]>
…uals - Provide a shared Arrow CPU-pool executor to the parallel scan benchmark and integration tests. - Add planned-scan regressions where a residual references a column dropped from the projection, across format versions and both case-sensitivity modes. Co-authored-by: Isaac <[email protected]>
e12240a to
b1523ba
Compare
What this PR does
Validates
PlanTasksStream()→ParallelScanReaderon real tables, and adds a benchmark comparing it withPlanFilesStream()→FileScanTaskReader.End-to-end tests
New
parallel_table_scan_test.ccin the bundledscan_test, for format versions 1–3. Each case compares the parallel rows with the serial path and with independently expected rows, for 1 and 4 workers:split_offsets_row_idand_posvalues across splits (v3)Benchmark
parallel_scan_benchmark(built withICEBERG_BUILD_BENCHMARKS=ONand the bundle; not run in CI) writes two local tables:read.split.target-size= 16 MiB (16 split tasks)It runs paired, order-alternated serial and parallel trials with the same projection, filter, and batch size, and reports the bootstrapped median and 95% confidence interval of the paired speedup, end to end (scan creation through stream release) and for the read phase. It also reports planning time, queue peaks, producer wait, bytes read, Arrow-pool allocations, and peak RSS.
--filter=all-pass(the default) adds a residual that every row passes, so it is evaluated per row;--filter=noneomits it.Results
Release build, 32 hardware threads, local disk with a warm page cache, 10 paired trials, serial versus 8 workers.
The first two rows were measured with this PR plus Part-3.5 (#1166). Before it, the per-row residual evaluator did not scale across threads (8 workers were slower than one); #1166 removes the per-row
Literalconstruction that caused it.Worker sweep, large workload with the all-pass filter: serial 0.439s, then 0.418s / 0.234s / 0.142s / 0.078s with 1 / 2 / 4 / 8 workers.
Other measurements, per scan: planning under 2 ms; serial and parallel read the same bytes (327 MiB large, 57 MiB small) with about the same Arrow-pool allocations; the queue peaked at about 1.6 MB and 8 batches, with no oversized admissions and about 2 ms of total producer wait; peak RSS about 1 GB, including writing the tables.
The plan's acceptance rule (lower bound of the 95% interval above 1.0 for the large-file workload) holds with and without a residual filter, given #1166. Timings are not asserted in CI.
Checks
The full
ctestsuite passes.pre-commitis clean.Related
Part 1 #976 · Part 2a #1002 · Part 2b #1062 · Part 2c #1065 · Part 3 #1113 · Part 3.5 #1166 · Part 4 #1167.
This pull request and its description were written by Isaac.