Repository navigation
fix(colexec): preserve the COALESCE selection row domain - #33441
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? |
|
This pull request is merged. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 92efa7f48f6a440ecaae64050527def5e7833de7
Assessment: request_changes
The prefix view correctly preserves the selection domain and reuses the existing bitmap implementation. Focused tests and a real-worker SQL probe pass, but the repository's required maintained public SQL regression is missing.
Model: gpt-6.1-terra / max
Session: 01a2230f-39de-7f00-bf9a-e19ded95bd85 · slot 0 · generation 39
- P2
pkg/sql/colexec/external_routine_eval_test.go:240: A SQL query evaluates COALESCE with a Python-routine fallback across a full batch followed by a smaller batch containing NULLs.
Impact: The required public-path regression gate remains open. The new test invokes the expression executor with a mocked runtime, so the tracked suite does not retain coverage of the SQL planner, batch transition, and real worker together.
Evidence: The pinned mo-dev testing contract requires BVT coverage for SQL-visible behavior and defines BVT under test/distributed/cases using mo-tester. The existing udf_python/control_flow.sql case covers CASE selection but has no COALESCE shrinking-batch case. A review-only SQL probe using generate_series(1,8195) and a real Python worker fails with 'external routine selection has 8192 rows, expected 3' when the base evaluator is overlaid, and passes on the candidate. Retain an equivalent SQL and expected-result case in the existing worker-enabled BVT and run it in normal comparison mode.
Validation:
-
Private /tmp and loopback preflight passed: preflight.log and checks/1795915944119726077-3.json.
-
Focused evaluator and bitmap tests passed: focused-tests.log and checks/1795916176590204578-3.json. The colexec short suite also passed: colexec-short.log and checks/1795916557227417478-3.json.
-
The added evaluator regression failed with the frozen base evaluator overlaid, producing the reported 128-versus-3 selection error: base-unit-control.log and checks/1795916266962749386-3.json.
-
A real-worker embedded SQL probe failed with the base evaluator overlaid and passed on the candidate: public-sql-base.log, public-sql-candidate.log and checks/1795916364768038027-3.json, checks/1795916417215816688-3.json.
-
A partial-selection probe passed at 0, 1, 3, 63, 64, 65 and 129 rows after a 130-row batch: partial-boundary.log and checks/1795916472434391686-3.json.
-
All 52 selected benchmark cases completed in a one-iteration smoke run: bench-smoke.log and checks/1795916258636619336-3.json.
Limitations:
-
The public SQL probe is retained as review evidence, not as a maintained mo-tester BVT case.
-
The benchmark smoke run did not independently verify the reported performance or off-heap retention measurements.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 067ae8e9759a46f0ef760302431d4ecea72f54b5
Assessment: approve
The COALESCE fix keeps the existing selection within the current batch by reusing the bitmap prefix view, without adding persistent state or an owned bitmap allocation. The previously requested worker-enabled SQL regression is now included. No actionable defects were found.
Model: gpt-6.1-terra / max
Session: 01a22477-91d1-7a10-9060-414db378340e · slot 1 · generation 35
Validation:
-
Preflight, frozen-source and patch checks, and discussion coverage reconciliation passed; receipts and logs are retained in the diagnostic directory.
-
An exact-head embedded SQL probe ran the new query twice with a real Python worker and returned the independently calculated aggregate. Receipt: checks/1795917748305960653-5.json; log: exact-bvt-query.log.
-
Reused earlier same-PR focused evaluator, bitmap, colexec short-suite, partial-selection boundary, and real-worker evidence after verifying that the production code and relevant inputs were unchanged. Baseline controls reproduced the oversized-selection error.
Limitations:
-
The complete mo-tester case was not rerun independently. The author reports two successful normal-comparison runs with cleanup, but their logs were not supplied.
-
CI status and the author's race, performance, and off-heap measurement logs were not supplied. The retained benchmark run is a smoke check, not a performance measurement.
What type of PR is this?
Which issue(s) this PR fixes:
Related to #33181
What this PR does / why we need it:
Follow-up to the review of #33266. A reused nullable vector can retain a NULL bitmap longer than the current batch. Intersecting it with the remaining rows in
COALESCEgrew the selection and caused a later typed Python routine to reject the batch.Use a read-only prefix view for the longer NULL bitmap. This keeps the current selection length and avoids an allocation. Shorter and equal-length bitmaps use the existing word-wise intersection. The external routine keeps checking its input row domain.
The Decimal mul/sub and OR-LIKE reuse benchmarks now construct their partial mask once before timing and release it at subbenchmark teardown. The expression selection benchmark also releases its existing hoisted mask.
Validation
colexec,filter,projection, andtable_scanpassed with-race -short.udf_python/control_flowBVT covers the 8,192-row batch and 3-row tail. Normal mo-tester comparison passed all 26 statements twice on the same worker-enabled instance, with database cleanup confirmed after each run. The same case failed only the new statement on the base withexternal routine selection has 8192 rows, expected 3; the candidate returns 33,738,797.