Repository navigation
fix(group): prevent declared key width overflow - #30999
Open
LeftHandCold wants to merge 2 commits into
Open
LeftHandCold wants to merge 2 commits into
LeftHandCold wants to merge 2 commits into
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? |
LeftHandCold
commented
Oct 24, 2026
LeftHandCold
left a comment
Collaborator
Author
There was a problem hiding this comment.
代码复核:建议通过,未发现需要 Request Changes 的确定性问题。审查 HEAD:a6eb721152e0aaeda7e398d8f80ad4f7a1513f98。
设计判断:这是局部分组键宽度溢出修复,保留现有 Group/HashMap/MergeGroup 的职责,不需要引入新状态或替代编码路径。
逐项核对:
- 宽度在转 int32 和相加之前饱和,避免 nullable LONGTEXT/组合键把估算值绕回 0 或小值;H0 由真实键数量决定,而不是依赖可能溢出的宽度。
- 小固定键的 H8、全局 nullable 标记、v77/v78 兼容选择和 grouping sets 路径仍保留;宽度是编码策略估计,不会按 LONGTEXT 声明大小分配内存。
- 检查了 partial Group → MergeGroup 的元数据消费。新增测试覆盖无键、8 字节边界、宽键、NULL、旧协议、reset/reuse 和释放;SQL 用少量真实短字符串触发声明宽度问题,不依赖超大数据。
验证边界:已核对当前 HEAD 对应的成功 CI 40015109628,阅读相关实现和新增回归测试,并完成 diff --check。本次没有在本机重跑整套 UT/真实业务负载;PR 中作者的性能/真实数据报告不冒充本次独立实测。当前没有需要关闭的人工 review thread。
当前认证账号也是 PR 作者,GitHub 不允许自审 Approve,因此以 COMMENT 记录“代码审查建议通过”,不是正式 Approval。
This branch was successfully 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.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #30997
What this PR does / why we need it:
Grouping by two nullable LONGTEXT columns can fail before reading any input: each declared width plus its NULL marker overflows int32, and the sum wraps to zero. Group then selects the no-key H0 path and dereferences an expression vector before evaluation. Tiny ordinary text values reproduce this; STORED JSON projections expose the same metadata path.
Saturate the width estimate before narrowing or addition, and select H0 from the actual number of grouping keys. Exact small widths, the eight-byte fast path and the existing legacy protocol fence are preserved. This adds no retained data, cache, synchronization, wire format or schema migration.
Validation:
The causal SQL/BVT and workload binary is based on b787941; the final branch is rebased onto main 156b7cc and revalidates the owning package/static closure. The intervening Group change is downstream spill handling; preparation and the regression case are unchanged. The later main commit 1651eec changes only a Python SDK test. Full CI remains for this draft PR.