You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: LAG/LEAD narrows defaults to the input type, truncating strings and rounding decimal values #29974
官方 main 5a5501b3e1048f3d19d96824cc68a62b7f0fcb07,2026-10-12 固定基线;macOS arm64,本地源码构建单 CN/TN/LogService,etc/launch/launch.toml。对照 MySQL 8.0.46,Connector/J 8.3.0。
复现
CREATETABLEwdefault(id INTPRIMARY KEY,s VARCHAR(10),v INT);
INSERT INTO wdefault VALUES(1,'a',100),(2,'b',10),(3,NULL,20);
SELECT id,
LAG(s,1,'long default') OVER(ORDER BY id) lg,
LEAD(s,1,'long default') OVER(ORDER BY id) ld,
LAG(v,1,0.5) OVER(ORDER BY id) lv
FROM wdefault ORDER BY id;
MO 第一行 lg=long defau、lv=1,最后一行 ld=long defau。
MySQL 第一行 lg=long default、lv=0.5,最后一行 ld=long default。
CREATETABLEwcopyASSELECT id,LAG(s,1,'long default') OVER(ORDER BY id) lg FROM wdefault;
SHOW COLUMNS FROM wcopy;
SELECT*FROM wcopy ORDER BY id;
MO lg 类型为 VARCHAR(10),已写入截断后的 long defau;MySQL 是 VARCHAR(12),完整保留 long default。
Actual post-merge functional verification of #30115, with separate main and release results.
main b111224b0c624773389b390cd3cf1223126b6ee2: reported behavior fixed in the executed scope. Linux/amd64, Go1.27.1, CPU/CGo test binaries built with the repository wrapper. An independent MySQL-protocol overlay replays the original table/rows/query and asserts:
first LAG string = long default, first decimal default = 0.5; existing 100/10 values remain exact;
CTAS retains full text and VARCHAR(12) metadata; View returns the decimal values;
prepared default reuse across long/NULL/UTF-8 values;
65,536-byte MEDIUMTEXT survives mixed defaults and CTAS; BOOL defaults do not turn 42 into a boolean; numeric 0.5 and string '0.5' retain distinct window identities.
Normal and race independent original-SQL runs pass all three selected issue subcases, including this one. Commands:
.agents/skills/mo-dev/scripts/mo-cgo-test -p 1 -count=1 -short -tags matrixone_test -timeout=12m -json -overlay main-original-overlay.json -run '^TestAuditRound1450OriginalSQL$' ./pkg/tests/sqlintegration
# Repeat with -race, same source and assertions.
Additional owning-package verification: 13 complete owner packages, 40,594 pass events, 0 failures/11 explicit skips; complete SQL integration 54 roots/391 pass events, no failures/skips. The selected SQL/race consumer set passes 82 events. Window owning package passes all 532 events normal and race. This is not whole-repository/GPU certification.
4.2-dev ac27db31696c0394ab1b2787b7b0a8f4933f088f, Go1.26.4: original public SQL still fails. The same independent source and expected rows run via an overlay in ./pkg/tests/issues:
actual first row: 1 | long defau | b | 1
expected: 1 | long default | b | 0.5
The old clean main d00ece1f55fa696414bea2ac312d0d27e7967c8d is an executed negative control and reproduces the same narrowing. No product source or result assertion was edited for these probes.
This remains a partial branch fix. Assignment events show ck89119 unassigned and slyunnn assigned at 2026-10-17T12:47:59Z. Returning to ck89119, the evidenced developer before QA, for the still-failing release scope; not guessing an owner or treating main-only repair as issue-wide completion.
An initial race attempt failed before entering SQL due to audit processes using different temporary-directory port registries. Those raw logs are retained as environment failures. The passing normal/race evidence above uses one shared runtime lease directory; no skips/retries were added to product or test assertions. MySQL reference server/GPU/live mixed-binary rollout were not executed.
Regression and extended verification for #29974 (2026-10-21)
Verification Environment
Freshly fetched MatrixOne origin/main: e47f45ca6548e198e73ecb242521047bfd449850 — fix(python-sdk): redact create_table diagnostics and gate the success log (#30678).
Clean source built with make build TYPECHECK=1, Go 1.27.1, Linux/arm64. The running binary reports e47f45ca65.
Full isolated local topology: 2 CN / 1 TN / 1 Log service / 1 Proxy. Proxy 127.0.0.1:6001, CN1 127.0.0.1:16001, and CN2 127.0.0.1:16002 were connected and used for actual original and extended queries.
Clients: MOTR/PyMySQL text protocol; Go database/sql + go-sql-driver/mysql with interpolateParams=false; Connector/J 8.3.0 with verified ClientPreparedStatement and ServerPreparedStatement modes. MySQL 8.0.46 was used for the Java original-query, metadata and prepared-reuse control.
What Was Covered
OK — Original three-row query: first LAG default is the complete long default, numeric default remains 0.5, and the final LEAD default is untruncated. Existing values and source NULL remain correct.
OK — CTAS and direct-expression View values and metadata: VARCHAR(12) and DECIMAL(11,1); JDBC string width, numeric precision and scale were asserted.
OK — LAG / LEAD binary prepared reuse with short, long, NULL, UTF-8 and short-again defaults; decimal defaults changed between positive, negative, NULL and larger fractional values. Binary defaults preserve NUL and FF bytes.
OK — Zero and out-of-partition offsets, empty input, same-type decimal and Boolean controls, unchanged source rows and reusable connections.
OK — 65,535 / 65,536-byte MEDIUMTEXT with JSON fallback survives CTAS in strict and permissive SQL modes with full content equality.
OK — A common DECIMAL domain exceeding precision 65 is rejected with 1690; failed CTAS leaves no catalog table.
OK — Native protocol checks passed 37/37 per endpoint, 111/111 overall. Connector/J passed 114/114 checks on MatrixOne and 38/38 against MySQL.
OK — Isolated endpoint fixtures ran concurrently. SQL and protocol cases use separate databases and passed MOTR -j 2; this is test scheduling, not an engine-parallel performance claim. Cleanup left no issue databases.
Not covered — Full window BVT group, production/TKE deployment and mixed-version upgrade. The developer explicitly states that a 4.2-dev backport is not required; that branch is outside this acceptance scope.
Findings
Related fix: #30115, merge commit 728c6863579518bff9e0967bc2cddb0ef319a83e — fix(sql): reconcile LAG/LEAD default values into a common result type with the value argument.
The original narrowing no longer reproduces on the tested main. Values and defaults are reconciled into a common result type rather than narrowing defaults to the input column type. No new product failure was observed in the executed scope.
Source commit: 61b25424d98c918cfe0c2cc613d19bfa0df80216, pushed to MOTR over SSH; remote commit and branch tracking verified.
SQL/result: suites/14_issue_regression/{t,r}/issue_29974_lag_lead_default_type.{test,result}; native prepared checks are in the companion Go protocol script and launcher.
Final SQL recording passed 19/19 statements. Final parallel replay passed 2/2 cases, including after cherry-pick into daily PR #251, commit fa226d5a8b494d7575f66edce8a860e4e6895c65.
Existing window_lag_lead_default_type.sql coverage was inspected. The entire product BVT group was not rerun. The Java compatibility helper was executed locally; the committed MOTR additions contain SQL and Go coverage. MatrixOne service source is unchanged.
Final Conclusion
Fixed on the tested latest main, within the developer-confirmed main-only acceptance scope.
Large-row-count regression is not required: this is a common-type and result-width contract. Three source rows plus explicit 65,535 / 65,536-byte boundaries cover the relevant states without a larger dataset or long-running load test.
Activity
XuPeng-SH commentedon Oct 17, 2026
Actual post-merge functional verification of #30115, with separate main and release results.
main
b111224b0c624773389b390cd3cf1223126b6ee2: reported behavior fixed in the executed scope. Linux/amd64, Go1.27.1, CPU/CGo test binaries built with the repository wrapper. An independent MySQL-protocol overlay replays the original table/rows/query and asserts:long default, first decimal default =0.5; existing 100/10 values remain exact;Normal and race independent original-SQL runs pass all three selected issue subcases, including this one. Commands:
Additional owning-package verification: 13 complete owner packages, 40,594 pass events, 0 failures/11 explicit skips; complete SQL integration 54 roots/391 pass events, no failures/skips. The selected SQL/race consumer set passes 82 events. Window owning package passes all 532 events normal and race. This is not whole-repository/GPU certification.
4.2-dev
ac27db31696c0394ab1b2787b7b0a8f4933f088f, Go1.26.4: original public SQL still fails. The same independent source and expected rows run via an overlay in ./pkg/tests/issues:The old clean main
d00ece1f55fa696414bea2ac312d0d27e7967c8dis an executed negative control and reproduces the same narrowing. No product source or result assertion was edited for these probes.This remains a partial branch fix. Assignment events show ck89119 unassigned and slyunnn assigned at 2026-10-17T12:47:59Z. Returning to ck89119, the evidenced developer before QA, for the still-failing release scope; not guessing an owner or treating main-only repair as issue-wide completion.
An initial race attempt failed before entering SQL due to audit processes using different temporary-directory port registries. Those raw logs are retained as environment failures. The passing normal/race evidence above uses one shared runtime lease directory; no skips/retries were added to product or test assertions. MySQL reference server/GPU/live mixed-binary rollout were not executed.
ck89119 commentedon Oct 18, 2026
no need to backport to 4.2-dev
XuPeng-SH commentedon Oct 19, 2026
补充本轮更高边界的 main 公共 SQL 验证,保持现有测试负责人 slyunnn。
2026-10-19,本轮新构建 native CGO,main完整SHA
2ad1d7e5c2baafdee0b8fa097ce02ca32feb3a7b,Linux/amd64、Go1.27.1,真实两 CN/MySQL TCP。LAG/LEAD 的长默认值、decimal 0.5、CTAS varchar(12) metadata、VIEW、prepared 短→长→Unicode→短复用均通过;额外用65536字节 MEDIUMTEXT 与 JSON 默认值验证 fallback CTAS,在 strict 和 permissive sql_mode 下均保留完整内容,无截断。TestAudit21NumericWindowContracts的此子场景两个 CN 都PASS,同命令的 NTILE 输入/prepare复用和浮点 BIT_COUNT 对照也PASS,整体exit0。原始严格断言与日志:pr-audit-continue21/public_numeric_test.go、numeric-overlay.json、logs/public-numeric.{log,exit}。该证据属于本轮main,不把历史4.2或作者说明当本轮结果。slyunnn commentedon Oct 21, 2026
Regression and extended verification for #29974 (2026-10-21)
Verification Environment
origin/main:e47f45ca6548e198e73ecb242521047bfd449850—fix(python-sdk): redact create_table diagnostics and gate the success log (#30678).make build TYPECHECK=1, Go1.27.1, Linux/arm64. The running binary reportse47f45ca65.2 CN / 1 TN / 1 Log service / 1 Proxy. Proxy127.0.0.1:6001, CN1127.0.0.1:16001, and CN2127.0.0.1:16002were connected and used for actual original and extended queries.database/sql+go-sql-driver/mysqlwithinterpolateParams=false; Connector/J8.3.0with verifiedClientPreparedStatementandServerPreparedStatementmodes. MySQL8.0.46was used for the Java original-query, metadata and prepared-reuse control.What Was Covered
LAGdefault is the completelong default, numeric default remains0.5, and the finalLEADdefault is untruncated. Existing values and sourceNULLremain correct.VARCHAR(12)andDECIMAL(11,1); JDBC string width, numeric precision and scale were asserted.LAG/LEADbinary prepared reuse with short, long,NULL, UTF-8 and short-again defaults; decimal defaults changed between positive, negative,NULLand larger fractional values. Binary defaults preserve NUL andFFbytes.65,535/65,536-byte MEDIUMTEXT with JSON fallback survives CTAS in strict and permissive SQL modes with full content equality.65is rejected with1690; failed CTAS leaves no catalog table.37/37per endpoint,111/111overall. Connector/J passed114/114checks on MatrixOne and38/38against MySQL.-j 2; this is test scheduling, not an engine-parallel performance claim. Cleanup left no issue databases.4.2-devbackport is not required; that branch is outside this acceptance scope.Findings
Related fix: #30115, merge commit
728c6863579518bff9e0967bc2cddb0ef319a83e—fix(sql): reconcile LAG/LEAD default values into a common result type with the value argument.The original narrowing no longer reproduces on the tested main. Values and defaults are reconciled into a common result type rather than narrowing defaults to the input column type. No new product failure was observed in the executed scope.
MOTR / BVT Coverage
test/issue-29974-lag-lead-default-type.61b25424d98c918cfe0c2cc613d19bfa0df80216, pushed to MOTR over SSH; remote commit and branch tracking verified.suites/14_issue_regression/{t,r}/issue_29974_lag_lead_default_type.{test,result}; native prepared checks are in the companion Go protocol script and launcher.19/19statements. Final parallel replay passed2/2cases, including after cherry-pick into daily PR #251, commitfa226d5a8b494d7575f66edce8a860e4e6895c65.window_lag_lead_default_type.sqlcoverage was inspected. The entire product BVT group was not rerun. The Java compatibility helper was executed locally; the committed MOTR additions contain SQL and Go coverage. MatrixOne service source is unchanged.Final Conclusion
Fixedon the tested latest main, within the developer-confirmed main-only acceptance scope.Large-row-count regression is not required: this is a common-type and result-width contract. Three source rows plus explicit
65,535/65,536-byte boundaries cover the relevant states without a larger dataset or long-running load test.