Repository navigation
Test image: adaptive aggregator rewrite backport and distributed read of object storage (do not merge) - #2889
Draft
arthurpassos wants to merge 15 commits into
Conversation
Backport `Faster Adaptive Aggregator` (ClickHouse#123531) with the changes it builds on: - the `Nullable` key support of the adaptive aggregator (ClickHouse#124868); - the removal of the sharded aggregator in favor of the adaptive one (ClickHouse#116532); `enable_sharding_aggregator` becomes an obsolete setting. The core aggregation files keep the 26.8 side, and only the adaptive aggregator part of the change is applied: - add the per-table aggregator tracker helpers (`switchToOwnTracker`, `aggregatorTracker`) and `Aggregator::spill`; - add `keep_table_buffer` to the bucket conversions and the finalized-rank (`uniqExact`, `uniqExactIf`) bucket Top-K conversion; - add `RowStorePointers`, `IColumn::fillFromRowStorePtrs` and `ColumnNullable::fillFromRowStorePtrs`, which the staged arguments use; - drop what 26.8 has no counterpart for: the workload spilling integration, `min_bytes_before_external_group_by`, the `all_places_are_non_null` batches; - the query plan serialization version goes from 10 to 11 for the `adaptive_aggregator_disable_thaw` plan setting; - remove the tests of features 26.8 does not have (funnel functions, workload spilling) and the hash join row store part of `05332_adaptive_aggregator_argument_gather`. On one node, q12 of the Iceberg benchmark (100M rows, 7 `Nullable(String)` keys) goes from 10.8 s to 4.9 s, with less peak memory and no spill.
The serialization and the distributed read of `ReadFromObjectStorageStep` were compiled out of this build (`CLICKHOUSE_CLOUD`), so `make_distributed_plan` refused every plan with an exchange over an object storage table (for example a `GROUP BY` over an Iceberg table). - serialize the step as the table name, the columns, the row level filter, the prewhere and the block and stream sizes, and rebuild it on the worker with `IStorage::read`, applying the prewhere as the pruning filter; - split the files into buckets by the hash of their identifier: the task of a bucket reads only its files (`bucket_id` task parameter); - register the step, and let the planner distribute the read when the table is big enough (`totalRows`). (cherry picked from commit ab07b64da17d1f3c857b2ebd46ceb440ff703f07)
…entries of this change The squashed backport carried stale entries of an older layout of the `26.8.27.20001.altinityantalya` block. Restore the history of `antalya-26.8` and add `adaptive_aggregator_disable_thaw` and the obsolete `enable_sharding_aggregator` to the newest Antalya block.
- Drop the bucket-local Top-K when the aggregation goes in order, as the upstream change does: the in-order pipeline has no two-level conversion to run it in (`05385_aggregation_bucket_top_k_in_order`). - The `clickhouse-local` of this build does not print the error of a failed query with `--ignore-error`, so `05415_adaptive_aggregator_staged_spill_free_space` and `05448_adaptive_aggregator_staged_spill_append_free_space` read no error from it. Run the failing query without the option. The check that no staged record was written before the error of `05415` needs the query to go on after the error, so it is dropped.
… have `05334_row_store_bulk_fixed_columns` sets `min_rows_ratio_for_hash_join_row_store`, a setting of the hash join row store that was not backported.
- `gtest_aggregator_adaptive_merge`: `Aggregator::Params` has no `min_bytes_before_external_group_by` in this build. - `gtest_growing_count_top_k`: `PackedStringRefHash` does not exist here, so the test declares the default string-view hash itself. CI build failure: the `unit_tests_dbms` target of the `Build ClickHouse` job (PR 2889).
The push of 37a903c did not start the `PR` workflow. Signed-off-by: Arthur Passos <arthur.ti@outlook.com>
…ya-26.8/adaptive-aggregator-and-distributed-read # Conflicts: # src/Common/FailPoint.cpp
The profile event `JoinBuildRowStoreMicroseconds` belongs to the hash join row store, which this build does not have, so the sanitizer build failed to link `clickhouse` with an undefined symbol. The adaptive aggregator only uses `RowDataStore::gatherFieldToRows`. Signed-off-by: Arthur Passos <arthur.ti@outlook.com>
…ggregate_merge_work` The variadic `uniqExact` of this build has no preparation step of the parallel merge: it came with ClickHouse#117153, which was not backported. CI: `AggregateMergeWork.VariadicAndTupleArguments` of `Unit tests (asan_ubsan)`, pull request 2889. Signed-off-by: Arthur Passos <arthur.ti@outlook.com>
…` when the pipeline is built The sets of an `IN` in the PREWHERE are placeholders until `QueryPlan::makeSets` resolves them, and `buildSetsForDAGExcludingGlobalIn` dereferenced the null set when `deserialize` applied the filter, so a distributed-plan task with such a filter killed the server (signal 11). Throw an exception instead of dereferencing a null set. Signed-off-by: Arthur Passos <arthur.ti@outlook.com> Co-authored-by: Cursor <cursoragent@cursor.com>
…NAL` A worker has no query, so `SelectQueryInfo::isFinal` dereferenced the missing AST when `optimizePrewhere` looked at a filter over a deserialized read that had no PREWHERE, and the server crashed (signal 11). Signed-off-by: Arthur Passos <arthur.ti@outlook.com> Co-authored-by: Cursor <cursoragent@cursor.com>
…ya-26.8/adaptive-aggregator-and-distributed-read Signed-off-by: Arthur Passos <arthur.ti@outlook.com> Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # src/Interpreters/AdaptiveAggregationKernels.cpp
…he adaptive aggregator The merge of `antalya-26.8` added the argument. The merge drain passes places that are never null, and the staged records of the producer can have null places for misses. The edit was left out of the merge commit `1009d3ee1f7`, which failed to build. Signed-off-by: Arthur Passos <arthur.ti@outlook.com> Co-authored-by: Cursor <cursoragent@cursor.com>
I, Arthur Passos <arthur.ti@outlook.com>, hereby add my Signed-off-by to this commit: 8c97b9f I, Arthur Passos <arthur.ti@outlook.com>, hereby add my Signed-off-by to this commit: 8fda08b I, Arthur Passos <arthur.ti@outlook.com>, hereby add my Signed-off-by to this commit: 1d7574f I, Arthur Passos <arthur.ti@outlook.com>, hereby add my Signed-off-by to this commit: d196859 I, Arthur Passos <arthur.ti@outlook.com>, hereby add my Signed-off-by to this commit: 18a6f2f I, Arthur Passos <arthur.ti@outlook.com>, hereby add my Signed-off-by to this commit: 37a903c Signed-off-by: Arthur Passos <arthur.ti@outlook.com> Co-authored-by: Cursor <cursoragent@cursor.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test pull request to get a CI image for the
vig-testdev cluster. It is not meant to be merged as it is: if the benchmark confirms the results, it will be split into two pull requests that each targetantalya-26.8.It contains two changes:
Nullablekeys in the adaptive aggregator Use the adaptive aggregator for GROUP BY over Nullable keys whose hash method packs the null map into the key ClickHouse/ClickHouse#124868, and the removal of the sharded aggregator Remove the sharded aggregator in favor of the adaptive aggregator ClickHouse/ClickHouse#116532 (enable_sharding_aggregatorbecomes an obsolete setting). On one node, q12 of the Iceberg benchmark (100M rows, 7Nullable(String)keys) goes from 10.8 s to 4.9 s with less memory and no spill. The query plan serialization version goes from 10 to 11.ReadFromObjectStorageStep, which were compiled out of this build (CLICKHOUSE_CLOUD), somake_distributed_plancan run aGROUP BYover an Iceberg table with a shuffle aggregation across nodes. It is experimental and off by default.Not done in this pull request: the Iceberg snapshot is not pinned across workers, there are no tests for the new serialization, and the workload spilling integration of the upstream change is left out.
Related: https://github.com/Altinity/iceberg-bench/blob/main/BENCHMARK.md
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Backport the faster adaptive
GROUP BYaggregator (enable_adaptive_aggregator) from upstream: it now supportsNullablekeys and spills staged records per bucket. Make the read of Iceberg and other object storage tables usable in a distributed query plan (make_distributed_plan, experimental).Documentation entry for user-facing changes
...
CI/CD Options
Exclude tests:
Regression jobs to run: