Repository navigation
fix(plan): infer prepared ntile parameters - #26950
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.
[P1] Reject NULL for a prepared NTILE bucket count
This patch makes NTILE(?) bind as a nullable INT64 cast, but NULL is not validated at execution. FillValuesOfParamsInPlan(..., []any{nil}) succeeds; then ntileWindowExec.Fill skips the bucket-value check for a null vector entry and immediately defaults the bucket count to 1. Therefore PREPARE ... NTILE(?) ...; SET @n = NULL; EXECUTE ... USING @n silently returns a one-bucket result instead of rejecting the invalid argument.
This is also inconsistent with the static path: NTILE(NULL) is rejected by the new integer-only function check. The existing executor test explicitly asserts null_bucket_defaults_to_1, while the new BVT covers only a positive value, so the end-to-end NULL boundary is currently missed.
Please reject NULL at runtime, update the executor expectation, and add a prepared EXECUTE-with-NULL regression.
There was a problem hiding this comment.
Reviewed exact head d6cbb3f with all checks terminal and green.
[P1] Reject NULL for a prepared NTILE bucket count.
NTILE(?) now binds through a nullable INT64 cast, but NULL reaches ntileWindowExec.Fill, skips validation, and is defaulted to one bucket. That silently succeeds while the new static NTILE(NULL) path is rejected by the integer-only function check.
Please reject NULL at execution, update the executor expectation, and add an actual prepared EXECUTE-with-NULL regression.
Cast prepared NTILE bucket markers to int64 while retaining dynamic parameter metadata, and reject non-integer bucket arguments during planning.
LeftHandCold
left a comment
There was a problem hiding this comment.
Reviewed exact head 7d094d272d0fd200df3701bea10f0d898e8be3e7.
Deep-reviewed the prepared-parameter path from planner inference through per-execution plan copying, expression evaluation, and both NTILE executors. The previous NULL issue is fixed before executor state is mutated, with unit and actual PREPARE/EXECUTE regression coverage. The new integer-only planner check does not remove a previously successful non-integer path: those types were already rejected by the runtime executor. Signed/unsigned integer handling, partitions, bucket counts larger than row counts, repeated execution, result metadata, cleanup, and ordinary literal NTILE paths show no new correctness, performance, or regression blocker.
All current required checks are terminal and green.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-reviewed exact head 7d094d2. The previous NULL blocker is fixed across both NTILE execution paths: a NULL bucket count is rejected before group state is mutated, and the public PREPARE/EXECUTE regression now covers the boundary. The prepared parameter receives a stable INT64 computation context, ordinary non-integer NTILE arguments remain rejected, and protocol metadata is covered. Full owning-package build, vet, and tests passed for pkg/sql/plan, pkg/sql/colexec/aggexec, pkg/sql/colexec/window, and pkg/frontend. A synthetic merge with current main 41e51e7 was conflict-free and the same full package tests passed. No remaining merge-blocking issue found.
aunjgr
left a comment
There was a problem hiding this comment.
Reviewed exact head 7d094d2. The prior prepared NTILE NULL blocker is closed in both execution paths before group state is mutated, and the public PREPARE and EXECUTE regression covers the boundary. The parameter receives a stable INT64 computation context, ordinary non-integer arguments remain rejected, repeated execution keeps plan state isolated, and result metadata is covered.
I found no remaining blocker. All current CI checks are terminal and green.
Merge Queue Status
This pull request spent 1 hour 45 minutes 22 seconds in the queue, including 58 minutes 46 seconds running CI. Required conditions to merge
|
fix(plan): infer prepared ntile parameters Approved by: @XuPeng-SH, @aunjgr, @LeftHandCold
fix(plan): infer prepared ntile parameters Approved by: @XuPeng-SH, @aunjgr, @LeftHandCold
fix(plan): infer prepared ntile parameters Approved by: @XuPeng-SH, @aunjgr, @LeftHandCold
Cast prepared NTILE bucket markers to int64 while retaining dynamic parameter metadata, and reject non-integer bucket arguments during planning.
What type of PR is this?
Which issue(s) this PR fixes:
issue #26867
What this PR does / why we need it:
fix(plan): infer prepared ntile parameters