Repository navigation
perf(vector): avoid redundant metadata work in UnionOne - #28666
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
APPROVE at 6a61d63 against base cd8e8d9. No concrete blocker found.
Reviewed the complete two-file diff and the exact-head metadata helpers/caller contract. The fast-path predicate checks both vectors, not only the source: no provenance/source sidecar, uniform PrepareParamNone, inherited runtime string domain, and equal scalar source ownership unless the destination is empty. Under these conditions skipped preflights cannot require a new metadata representation. Direct scalar source propagation matches appendStringSourceAt, including NULL rows; marking prepareParamKindSeen matches ordinary-value propagation. prepareParamKindAppendStart is deliberately retained, preserving all-NULL-prefix semantics. Explicit text (row-domain representation), binary, mixed metadata, and source transitions remain on the existing path.
Payload/varlena copying, NULL/grouping flags and allocation paths are unchanged. FinalizeStringSourcePreflight remains on exits after successful preflight, including binary-preflight failure; Batch.UnionOne still preflights all columns and finalizes its retained state. ResetWithSameType clears the relevant provenance/domain state. No new shared state, retained references, serialized fields, or configuration is introduced.
The transition test checks every accumulated row after each append, NULL/grouping/source/kind/domain propagation, constant source selection and two reset/reuse generations, with an MPool cleanup assertion. The benchmark includes eligible ordinary and non-eligible typed-provenance cases. Additional allocator-failure or self-append controls would be supplementary, not a blocker: this optimization does not broaden the existing type/selection/ownership contract.
Validation limits: source/control-flow review only; I did not rerun native package tests, benchmarks, or large SQL workloads and did not wait for CI. Author-reported post-rebase package passes and pre-rebase Q67/TPC-H measurements remain separate evidence; no exact-head speedup or memory-limit fix is claimed by this review. Head/base were rechecked unchanged before submission.
Merge Queue Status
This pull request spent 1 minute 13 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. Tick the box to put this pull request back in the merge queue (same as
|
…#28666) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#26768. ## What this PR does / why we need it: Avoid redundant metadata work in `Vector.UnionOne` when both vectors have ordinary conversion metadata, inherited runtime string domains, no row sidecars, and matching string-source ownership (or an empty destination). In this case, metadata preflight cannot allocate or change representation. Skip the repeated lookups and prefix bitmap scans while preserving payload copying, NULL/grouping flags, source ownership, and all-NULL-prefix/reset semantics. Mixed or exceptional metadata uses the existing path. No stats assumptions, query-specific rules, new buffers, or configuration changes. Pre-rebase measurements on `9a07655c54` with this identical production patch, single-node i7-11700 / 32 GiB RAM, 128 MiB spill and automatic merge disabled on both sides: - **TPC-DS Q67 100G: 646.070s → 310.822s (51.9% less time, 2.08x speed)** with GOGC=50 on both sides. Identical results, ordinary plans, scanned rows and bytes; no OOM or sampled compiler interference. Peak sampled anonymous memory: 15.119 → 14.996 GiB. - TPC-H 1G: all 22 queries, 20 rounds per version, identical results and no observed latency regression in the repeated fresh-service control. TPC-H 100G: all 22 ordinary plans identical; this is not a 100G execution-performance claim. - With default GOGC=100, the candidate also completed Q67 100G in 321.179s with identical results and no OOM. Memory headroom is tight: separate candidate and unchanged-baseline attempts crossed the harness's 16 GiB anonymous-memory guard and were stopped. Those are not passing runs or speedup measurements; this PR does not claim to fix that memory limit or complete Q67 1T. After rebasing onto current main, full `vector`, `batch`, and `hashjoin` package tests pass. The focused metadata test covers NULL/constant/grouping rows, source/kind/domain transitions, explicit-text exclusion, and reset/reuse. Only implementation and focused tests/benchmarks are included; experiment data, fixtures and runtime settings remain outside the PR. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…#28666) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#26768. ## What this PR does / why we need it: Avoid redundant metadata work in `Vector.UnionOne` when both vectors have ordinary conversion metadata, inherited runtime string domains, no row sidecars, and matching string-source ownership (or an empty destination). In this case, metadata preflight cannot allocate or change representation. Skip the repeated lookups and prefix bitmap scans while preserving payload copying, NULL/grouping flags, source ownership, and all-NULL-prefix/reset semantics. Mixed or exceptional metadata uses the existing path. No stats assumptions, query-specific rules, new buffers, or configuration changes. Pre-rebase measurements on `9a07655c54` with this identical production patch, single-node i7-11700 / 32 GiB RAM, 128 MiB spill and automatic merge disabled on both sides: - **TPC-DS Q67 100G: 646.070s → 310.822s (51.9% less time, 2.08x speed)** with GOGC=50 on both sides. Identical results, ordinary plans, scanned rows and bytes; no OOM or sampled compiler interference. Peak sampled anonymous memory: 15.119 → 14.996 GiB. - TPC-H 1G: all 22 queries, 20 rounds per version, identical results and no observed latency regression in the repeated fresh-service control. TPC-H 100G: all 22 ordinary plans identical; this is not a 100G execution-performance claim. - With default GOGC=100, the candidate also completed Q67 100G in 321.179s with identical results and no OOM. Memory headroom is tight: separate candidate and unchanged-baseline attempts crossed the harness's 16 GiB anonymous-memory guard and were stopped. Those are not passing runs or speedup measurements; this PR does not claim to fix that memory limit or complete Q67 1T. After rebasing onto current main, full `vector`, `batch`, and `hashjoin` package tests pass. The focused metadata test covers NULL/constant/grouping rows, source/kind/domain transitions, explicit-text exclusion, and reset/reuse. Only implementation and focused tests/benchmarks are included; experiment data, fixtures and runtime settings remain outside the PR. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…#28666) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#26768. ## What this PR does / why we need it: Avoid redundant metadata work in `Vector.UnionOne` when both vectors have ordinary conversion metadata, inherited runtime string domains, no row sidecars, and matching string-source ownership (or an empty destination). In this case, metadata preflight cannot allocate or change representation. Skip the repeated lookups and prefix bitmap scans while preserving payload copying, NULL/grouping flags, source ownership, and all-NULL-prefix/reset semantics. Mixed or exceptional metadata uses the existing path. No stats assumptions, query-specific rules, new buffers, or configuration changes. Pre-rebase measurements on `9a07655c54` with this identical production patch, single-node i7-11700 / 32 GiB RAM, 128 MiB spill and automatic merge disabled on both sides: - **TPC-DS Q67 100G: 646.070s → 310.822s (51.9% less time, 2.08x speed)** with GOGC=50 on both sides. Identical results, ordinary plans, scanned rows and bytes; no OOM or sampled compiler interference. Peak sampled anonymous memory: 15.119 → 14.996 GiB. - TPC-H 1G: all 22 queries, 20 rounds per version, identical results and no observed latency regression in the repeated fresh-service control. TPC-H 100G: all 22 ordinary plans identical; this is not a 100G execution-performance claim. - With default GOGC=100, the candidate also completed Q67 100G in 321.179s with identical results and no OOM. Memory headroom is tight: separate candidate and unchanged-baseline attempts crossed the harness's 16 GiB anonymous-memory guard and were stopped. Those are not passing runs or speedup measurements; this PR does not claim to fix that memory limit or complete Q67 1T. After rebasing onto current main, full `vector`, `batch`, and `hashjoin` package tests pass. The focused metadata test covers NULL/constant/grouping rows, source/kind/domain transitions, explicit-text exclusion, and reset/reuse. Only implementation and focused tests/benchmarks are included; experiment data, fixtures and runtime settings remain outside the PR. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
Related to #26768.
What this PR does / why we need it:
Avoid redundant metadata work in
Vector.UnionOnewhen both vectors have ordinary conversion metadata, inherited runtime string domains, no row sidecars, and matching string-source ownership (or an empty destination).In this case, metadata preflight cannot allocate or change representation. Skip the repeated lookups and prefix bitmap scans while preserving payload copying, NULL/grouping flags, source ownership, and all-NULL-prefix/reset semantics. Mixed or exceptional metadata uses the existing path. No stats assumptions, query-specific rules, new buffers, or configuration changes.
Pre-rebase measurements on
9a07655c54with this identical production patch, single-node i7-11700 / 32 GiB RAM, 128 MiB spill and automatic merge disabled on both sides:After rebasing onto current main, full
vector,batch, andhashjoinpackage tests pass. The focused metadata test covers NULL/constant/grouping rows, source/kind/domain transitions, explicit-text exclusion, and reset/reuse. Only implementation and focused tests/benchmarks are included; experiment data, fixtures and runtime settings remain outside the PR.