Repository navigation
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? |
e47d7d3 to
164615f
Compare
Description
Minimal reproductionCREATE TABLE decimal256_variance_repro (
v DECIMAL(65,30)
);
INSERT INTO decimal256_variance_repro VALUES
(CAST('12345678901234567890123456789012345.123456789012345678901234567890'
AS DECIMAL(65,30)));
SELECT VAR_POP(v), VAR_SAMP(v), STDDEV_POP(v), STDDEV_SAMP(v)
FROM decimal256_variance_repro;The same failure is exposed by a wide unquoted decimal literal after the Expected behaviorEvery accepted Scope / regression coverageCover all four aliases/functions, ordinary and grouped execution where Fixes a base contract exposed by #28825. |
164615f to
9219ddf
Compare
|
CI triage and rebase update: The failed wide-decimal BVT was a real base defect, not a defect in this PR's literal-preservation implementation: accepted This PR remains focused on preserving wide unquoted decimal literal precision. I rebased it onto current |
|
Updated head: The binder fix preserves raw spelling for target-typed decimal literals (including During rebase, the decimal BVT oracle was aligned with the final 40-digit literal path: it now expects the physical |
|
Systematic follow-up after rebasing onto latest |
|
Rebased and refreshed on the latest The systematic fix keeps exact DECIMAL literal/cast/comparison semantics, carries the v85 persisted-expression fence without consuming v84's discrete-percentile contract, and fixes the negative Decimal256 trailing-zero early-fold regression by using magnitude only for the planner divisibility predicate. Full GPT-6 medium exact-head review: |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review(head 6358694)
发现 1 个 P2;这是作者自有 PR,本次提交 COMMENT,不提交 APPROVE/REQUEST_CHANGES。
[P2] 宽位数字面量升级为 Decimal256 后,INTERVAL 可能丢失小数时间。引入点见 make.go:84-100,遗漏消费者见 base_binder.go:9028-9031。
反例:
SELECT DATE_ADD(CAST('2026-01-01 00:00:00' AS DATETIME(6)), INTERVAL 1.25000000000000000000000000000000000000 SECOND);
该 literal 被绑定为 Decimal256,但 resetDateFunctionArgs 的小数时间分支未处理 Decimal256,随后落入 INT64 转换路径,1.25 秒可能变成 1 秒;base 中相同输入走 Decimal128 并保留 250000 微秒。建议补齐 Decimal256 到微秒的转换,并增加真实 SQL 结果测试,覆盖短写 1.25、宽尾零、正负值和 prepared 执行。
其余 lexer/parser、精度边界、负数/溢出、prepared 生命周期、持久化编码和资源路径未发现新的确定性阻断问题。当前 head 的 UT、SCA、Compose/BVT 和 CI Required 已通过,但现有测试没有覆盖该 INTERVAL public contract。
源码链接:
matrixone/pkg/sql/plan/make.go
Line 84 in 6358694
matrixone/pkg/sql/plan/base_binder.go
Line 9028 in 6358694
Final systematic follow-upUpdated head:
Only the personal fork feature branch was updated; no default branch was touched. |
|
已完成修复并 rebase 到最新 main(480b91764a94)。 根因:decimal256_interval.result 中 7 个 date_add/date_sub 的 DATETIME 结果 metadata 按字符串断言为 [12,-1,0],但 binder 保留了 typed DATETIME 合约,正确 metadata 是 [93,26,0],值使用 9 位小数;MINUTE 和 interval CAST(0b10 AS DECIMAL(40,2)) 两个 control 也同步修正。仅修改 result fixture,未扩散生产代码。 10.222.1.55 验证:normal metadata mode(无 -n)运行 decimal256_interval.test 两次,均 8/8 通过;task-owned service/workspace 已清理。 当前 head:6ee2babe0fb457d248971ea831f4e2865565b75c。提交前 GPT-6 medium review 结论 ACCEPT,无 P0/P1/P2。新的 CI 已启动,等待 GitHub 结果。 |
|
Coverage follow-up and conflict resolution:
No BVT, slow/full UT, workflow, threshold, exclusion, retry, or skip changes were added in this update. Remote CI was not awaited. |
|
Fixed and pushed as
Local evidence on the current head:
The CGo test binary used the existing local native artifact via an explicit rpath because the primary checkout has unrelated dirty native artifacts; this is a local-environment limitation, not a source failure. |
|
Final incremental SCA on head
Focused Decimal256 normalization/interval tests remain passing. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Astra medium re-review on current head 915deec.\n\n发现 3 个 P2,未发现 P0/P1:\n\n1. [P2] SQL 一元负号使 Decimal256 interval 绕过微秒归一化,丢失小数部分。位置:pkg/sql/plan/interval_decimal.go:110、pkg/sql/plan/base_binder.go:9138。\n\nSELECT DATE_ADD(CAST('2026-01-01 00:00:00' AS DATETIME(6)), INTERVAL -1.25000000000000000000000000000000000000 SECOND);\n\n预期为 2025-12-31 23:59:58.750000;当前调用链中 decimalIntervalText 不处理 unary_minus,后续 Decimal256→INT64 可能把 -1.25 当作 -1 秒。现有测试只覆盖负数字符串 CAST,没有覆盖 SQL 一元负号。建议让归一化处理真实的带类型常量表达式,并增加公开 SQL 精确结果回归。\n\n2. [P2] interval 的嵌套 CAST 预计算可能改变 FLOAT→DECIMAL 舍入。位置:pkg/sql/plan/interval_decimal.go:113、245。普通执行器的 FLOAT64→Decimal64 与 helper 的 FLOAT64→字符串→Decimal64 路径对 1.005e0 可能分别得到 1.00 和 1.01,导致普通 CAST 与 DATE_ADD INTERVAL 表达同一嵌套 CAST 时结果不一致。建议保留每层 CAST 的源类型并复用执行器转换语义,补充正负半舍入边界差分测试。\n\n3. [P2] negative Decimal128 尾零修复未完整进入 persisted-view v86 protocol fence。位置:pkg/sql/plan/make.go:202。类似 d = -12345678901234567890.00 的比较,base 可能因补码取模误折叠为 false,head 保留正确比较,但当前 literal/folding/source-scale 条件可能不设置 DecimalLiteralSemantics marker,floor=85 的旧 CN 仍可重绑为不同结果。建议 fence 覆盖所有被修正的负 Decimal128 尾零判断,并补充 floor85 拒绝、floor86 接受及旧/新重建结果验证。\n\n固定 head 的 CI 和相关 BVT 已通过;上述公开 SQL 反例及真实混合版本 persisted-view replay 尚未实跑。本 PR 为自有 PR,提交 COMMENT。
Follow-up: Decimal interval/comparison semantic fixesPushed exact head This follow-up closes three confirmed planner contract gaps:
Validation on this exact head:
The local BVT used a task-owned service built from this exact source head; CI was not awaited. The native CGo library was reused from the primary checkout because the linked worktree has no source-matched native artifact. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Astra medium re-review on current head b46e832.\n\n上一轮 interval 一元负号和 FLOAT→DECIMAL 舍入问题已闭合;仍有 1 个 P2,未发现 P0/P1:\n\n[P2] v86 fence 遗漏旧尾零判断的反向误判及正数低位溢出。位置:pkg/sql/plan/make.go:251、257。\n\ndecimalComparisonUsesSignedTrailingZeroSemantics 仅在“负数且新算法确认尾缀为零”时设置 fence,但旧/新 decimal128HasTrailingZeros/Mod128 的差异还包括:\n\n- 正数低位超过 int64 的零尾缀,例如系数 9223372036854775810;旧 high==0 分支将低位当 int64,可能误判不可整除,base 折叠为 false,head 保留正确比较,但正数路径不设置 v86 marker;\n- 负数非零尾缀,例如 -12345678901234567896;旧无符号补码取模可能误判可整除,base 缩减 scale 并得到错误匹配,head 正确折叠为 false,但当前 proven && trailingZeros 为 false,同样不设置 fence。\n\n这类 view 在 floor=85 下可被发布,旧 CN 重绑原 SQL 后与 head 得到不同结果。建议根据旧/新尾零判定是否不同设置 fence,覆盖正数低位溢出和负数被误判可整除的情况;补充 floor85 拒绝、floor86 接受及旧/新 view 重绑结果验证。\n\n固定 head 的 UT/BVT 已通过;仍缺真实 v85/v86 混合版本 view replay/restart/recovery 证据。本 PR 为自有 PR,提交 COMMENT。
XuPeng-SH
left a comment
There was a problem hiding this comment.
Astra medium review on current head 4e31403.\n\n发现 1 个 P2,未发现 P0/P1:\n\n[P2] v86 suffix fence 遗漏 typed IN 和 BETWEEN 路径。marker 目前只在 binary comparison 的 base_binder.go:5325 设置,但修正后的 suffix helper 还被 IN:5728 和 BETWEEN:6161 的 checkNoNeedCast 使用。\n\n例如 d DECIMAL(30,0) NOT NULL:\nCREATE VIEW v AS\nSELECT d IN (-1234567890123456789.0, -10.0) AS matched FROM t;\n\nUnary-minus folding 后的 typed decimal literal 会进入 typed IN vector,绕过 binary-comparison marker;base 的旧 suffix 判断可能将同一候选展开/折叠为不同结果,但 view 不携带 v86 requirement。d BETWEEN -1234567890123456789.6 AND -10.0 存在同类风险。建议在这些 coercion 决策前记录 old/new suffix dependency,并贯穿 vector folding;补充 floor85 拒绝、floor86 接受及 base/head 结果测试。\n\n此前 binary comparison fence、interval unary-sign 和 FLOAT→DECIMAL 舍入问题已闭合。固定 head CI 已通过,但真实 v85/v86 view replay、restart/restore/rollback 仍缺失。本 PR 为自有 PR,提交 COMMENT。
XuPeng-SH
left a comment
There was a problem hiding this comment.
Force re-review at exact head 0ad4066.
未发现新增可确认的 P0/P1/P2 代码问题。此前 typed IN/BETWEEN suffix-fence 遗漏已修复:共享 coercion 判定同时记录旧/新 suffix disagreement,覆盖 typed IN/NOT IN、BETWEEN/in_range;provenance 可穿过 scalar/list/vector folding、deep copy、protobuf 和 persisted-view。有效 decimal fence 为 protocol87,同时保留 main86 与 integer85;view lifecycle 测试覆盖 85/86 拒绝、87 接受。
已复查完整 diff 及 lexer/parser、binder、decimal/unary-sign、comparison、interval、folding、prepared、view/regeneration、admission 路径,未确认其他 scoped blocker。
验证证据为核验已有日志、未本轮重跑:dedicated decimal 23/23、interval 11/11;同实例重跑 34/34,teardown 0;已有 v86 -> v87 view/store replay、v87 graceful restart、旧 v86 对 required87 的 admission rejection。legacy decimal 全量仍为 584/690,整体 exit 1;剩余 106 项与真实旧 v86 baseline 完全一致,不能表述为全套 PASS。
尚未看到完整真实 v85 执行矩阵;旧容器 exit137 不能当作 graceful shutdown;mixed-CN、故障注入、backup/restore 矩阵仍不完整。这些是验收覆盖边界,不是已确认代码 defect。
本 PR 为自有 PR,提交 COMMENT。
XuPeng-SH
left a comment
There was a problem hiding this comment.
[P2] Preserve decimal provenance when materializing numeric window bounds
In pkg/sql/plan/window_binder.go:1281, GetConstantValue replaces the expression without copying DecimalLiteralRequiresV82. The interval path preserves it, but ordinary numeric RANGE bounds lose it.
Concrete case: with a DECIMAL(20,18) ordering column and an unquoted frame bound containing 80 leading zeroes followed by .123456789012345678, the old path falls back to float64 (0.123456789012345680) while this head normalizes to the exact decimal (0.123456789012345678). With rows 0 and 0.123456789012345679, COUNT(*) OVER (ORDER BY d RANGE BETWEEN <bound> PRECEDING AND CURRENT ROW) can therefore differ.
The direct NumVal → makeWindowFrameConstValue path bypasses the function-binding observer. After materialization, the view pre-optimization scan and persisted protocol calculation do not see the dependency, so a view can omit required protocol87 and be rebound differently by v85/v86.
Please preserve the provenance from e onto c here and add view authoring/regeneration tests that reject this case at 85/86 and retain 87.
Other inspected chains—lexer/parser, decimal arithmetic/casts, interval conversion, typed IN/BETWEEN, folding, hashing/deepcopy, protobuf, Substrait, and remote execution—had no additional verified P0–P2 findings. Exact-head Linux UT/SCA and active multi-CN BVT jobs passed; upgrade compatibility jobs were skipped.
Rebase/update at
|
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed exact head 0120d9103aa060ff8e7876a67ea0e4070adb1f60; self-authored PR, so COMMENT only.
[P1] Allocate a distinct decimal protocol version after the rebase.
pkg/sql/plan/persisted_ip.go:102-104 still fences decimal semantics at 87, but main already advertises 87 for grouping transport without these decimal fixes. A main-only v87 CN can therefore pass the persisted-view version check and reparse a wide literal such as 12345678901234567890123456789012345678.1 through the old Decimal128 path. Mixed deployment/rollback can silently change values despite the durable floor. Please allocate an unambiguous newer protocol version and verify rejection with the actual main-v87 binary; v86 rejection does not cover this boundary.
[P2] Preserve decimal provenance when materializing numeric RANGE bounds.
pkg/sql/plan/window_binder.go:1281-1285 replaces e with a fresh literal without copying DecimalLiteralRequiresV82. For a DECIMAL(20,18) ordering column and a bound with 80 leading zeroes followed by .123456789012345678, the direct literal path loses the view compatibility dependency; exact and legacy rounded bounds can produce different frame counts. Preserve the marker from e onto c, and cover view authoring/regeneration at incompatible and supported protocol floors.
No additional verified P0-P2 findings. Exact-head Linux UT/SCA and active multi-CN BVT passed; upgrade jobs were skipped.
|
Rebased onto current Closed the two requested review findings:
Rebase correctness:
Not verified locally:
Fresh CI has been triggered by the push. Remaining risk is limited to the unexecuted mixed-version lifecycle matrix; the protocol gate is covered structurally and by focused unit tests in the change. |
|
Rerun status: this head already has current |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed exact head 835bca8d0e3b8d16a1707d9bfbbeac85c29c4095; self-authored PR, so COMMENT only.
The previous findings are fixed: decimal semantics now require distinct protocol v89, and numeric RANGE materialization preserves DecimalLiteralRequiresV82.
[P2] Decimal256 promotion exposes an unsupported numeric RANGE path. With a wide literal such as 1.25000000000000000000000000000000000000 used as the ordering value, the binder promotes the RANGE offset to Decimal256, but makeWindowFrameConstValue calls GetConstantValue, which has no Decimal256 case and returns a nil literal. The runtime RANGE materializer/validation/search also lack Decimal256 support.
Please complete Decimal256 bound representation and RANGE execution support, with short/wide spelling and prepared-execution regressions. Exact-head CI passed; this finding is source-traced rather than runtime-reproduced, and v88/v89 mixed-version lifecycle evidence remains outstanding.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Review status — exact head b3d42f5fe7441e96a03e1521690a1e2e963c4eb7。
当前 review 尚未完成,暂不判定 PASS。远端 PR 元数据/变更核验曾遇到 TLS 超时,Decimal256 RANGE window bounds 的完整 diff、边界行为和 consumer 闭环尚未独立确认。当前没有确认的 P0–P3 功能缺陷;这条 COMMENT 仅表示验证尚未收敛,不代表实现已通过 review。
XuPeng-SH
left a comment
There was a problem hiding this comment.
PASS — exact head b3d42f5fe7441e96a03e1521690a1e2e963c4eb7。
已完整复核 Decimal256 RANGE 从绑定、LiteralVec 序列化、Prepare 到窗口搜索消费者的闭环,覆盖 width/scale、NULL、负数、畸形载荷、ASC/DESC、PRECEDING/FOLLOWING、peers、空 frame、常量向量、溢出边界及 prepared 重用。未发现 P0/P1/P2 blocker。
Exact-head CI 的 UT、SCA、共享构建、PROXY/PESSIMISTIC BVT 和 Required gate 均通过。自有 PR 按规则只提交 COMMENT,不提交 APPROVE。
What type of PR is this?
Which issue(s) this PR fixes:
Closes #29168
Closes #28765
Follow-up to #28765, #28766, #28771, #28776: the original exact-decimal work
already landed on main through #28830. This PR now contains only the remaining
Decimal256 numeric RANGE gap identified in review, rebased onto that implementation.
What this PR does / why we need it:
A wide exact literal in ORDER BY promotes numeric RANGE bounds to Decimal256.
The scalar plan literal has no Decimal256 variant, so folding previously published
a nil literal and execution reported a missing prepared parameter. Prepared
execution and RANGE searches also lacked Decimal256 support.
literal encoding; retain decimal protocol provenance through copying/serialization.
Overflow maps to an insertion boundary instead of wrapping.
partitions without indexing physical storage with a logical row number.
protocol field, persistent data, or optimization path.
existing decimal BVT files already landed unchanged and are not duplicated.
Validation
Base
5e1e93ae35efc6eea54ae2935f68154493d6e95c, Linux amd64, Go 1.26.4.Final reviewed tree:
b3d42f5fe7441e96a03e1521690a1e2e963c4eb7.Native provenance verified against primary worktree artifacts rebuilt from the
same native inputs. The initial public reproducer failed on the #29121 candidate
with identical main decimal/window sources; not claimed as a clean-main binary run.
error/reuse, physical overflow, constant partitions and zero-allocation assertion.
./pkg/sql/colexec/window ./pkg/sql/plan),golangci-lint 2.6.2 built with Go 1.26.4 and repository .golangci.yml.
the same instance, 76/76 each, exit 0, zero failed/ignored/abnormal statements.
New Decimal256 case 24/24 plus signed integer 15/15, uint64 15/15, temporal
RANGE 22/22. Hand-calculated oracles; no genrs. Final fixture schema residue 0.
-race -count=1 -timeout=180s -run TestDecimal256Range ./pkg/sql/colexec/window. No new goroutine,synchronization, shared mutable state or timing contract; no whole-repository
race/stress claim. Allocation correctness was also checked in normal mode.
gpt-6-astra, medium) design and independent review found and closedthe constant-vector indexing counterexample; final exact-commit independent
source/evidence review: APPROVE.
Risks and rollback
Shared RANGE wrapper changes are covered by existing non-Decimal256 regressions.
Decoder accepts only the bounded singleton encoding produced by the current
vector serializer; malformed/type-mismatched payloads return errors.
Rollback is code-only and restores the unsupported behavior; no data migration.
Single-CN local validation; distributed compose/proxy execution remains CI coverage.