Skip to content

fix ctas - #26349

Merged
mergify[bot] merged 12 commits into
matrixorigin:mainfrom
daviszhen:0728-fix-ctas
Jul 30, 2026
Merged

fix ctas#26349
mergify[bot] merged 12 commits into
matrixorigin:mainfrom
daviszhen:0728-fix-ctas

Conversation

@daviszhen

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #25524

What this PR does / why we need it:

  • InternalType.Format 对 TIME、DATETIME、TIMESTAMP 使用单参数 FSP 格式,例如 datetime(6),避免生成无法解析的 datetime(0, 6)。
  • 新增 planner 单测,覆盖 CTAS 的 TIME(3)、DATETIME(6)、TIMESTAMP(6),并验证生成的内部 SQL 可重新解析。
  • 新增分布式 BVT:CTAS DATETIME(6) 查询、information_schema.columns 元数据,以及带 UNION ALL 的 CTAS 场景。
  • 结果文件已证明原先 CTAS parser error 消失,DATETIME(6) 元数据得以保留。

当前仍需处理 parser round-trip 测试期望、CTAS nullable/display 与 MySQL 的差异,以及 result 中无关时间戳和尾随空白。

@daviszhen
daviszhen requested a review from a user July 29, 2026 03:20
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@daviszhen

Copy link
Copy Markdown
Contributor Author

Re-reviewed exact head 99485e5. The parser round-trip remains correct and the new commit fixes the nullable metadata half (DATETIME(6), YES), but the previous end-to-end blocker is still only partially resolved.\n\n[P1] Preserve FSP 6 through the final CTAS read/output path — test/distributed/cases/ddl/create_table_as_select.result:2091,2105-2106\n\nThe PR still records 2025-05-06 07:08:09.123456000 and ...654321000, while issue #25524 explicitly expects six fractional digits (.123456 / .654321) for a column advertised as DATETIME(6). The new unit test only checks the generated insert-plan expression scale; it does not cover the stored-column SELECT/result-vector scale where the observable mismatch remains. Please propagate the declared FSP through that path and make the BVT assert the six-digit contract.\n\n[P2] Remove unrelated/nondeterministic result churn — create_table_as_select.result:553,567,1674,1696\n\nThe two floating-point changes and regenerated publication timestamps remain unrelated to this regression, and the two publication lines still have trailing spaces, so git diff --check origin/main...HEAD fails. Please revert that noise and keep only deterministic CTAS expectations.\n\nFocused planner tests pass under race x20 and all affected packages/vet pass; the head merges cleanly and latest CI is green, but those checks currently accept the incorrect BVT output above.

1, FSP 6 显示为9位数字 是Connector/J本身的问题. mo-tester 用了Connector/J
2, 结果文件重新生成后, 浮点数值 会改变. 浮点数值是近似比较.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed exact head 22ceb83739644ccb772db7db8401761d6b738189. The new commits merge main, but both blockers from the previous review remain in the PR's current final diff.

P1 — Preserve the declared DATETIME(6) display scale end to end

test/distributed/cases/ddl/create_table_as_select.result:2091,2105-2106 still records .123456000 / .654321000 for columns advertised as DATETIME(6). The parser round trip, nullable metadata, and insert-plan expression scale are fixed, but the stored-column SELECT/result-vector path still exposes nine fractional digits. Please propagate the declared FSP through the final read/output path and make the BVT assert six digits.

P2 — Remove unrelated and nondeterministic result churn

The unrelated floating-point changes at lines 553/567 and regenerated publication timestamps remain. Lines 1674 and 1696 also retain trailing whitespace, so git diff --check 41332062...HEAD still fails. Please revert this noise and keep the regression deterministic and scoped.

The PR body itself also notes these items are still outstanding; a green CI run currently accepts the incorrect golden output rather than proving the intended contract.

@daviszhen

daviszhen commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Re-reviewed exact head 22ceb83739644ccb772db7db8401761d6b738189. The new commits merge main, but both blockers from the previous review remain in the PR's current final diff.

P1 — Preserve the declared DATETIME(6) display scale end to end

test/distributed/cases/ddl/create_table_as_select.result:2091,2105-2106 still records .123456000 / .654321000 for columns advertised as DATETIME(6). The parser round trip, nullable metadata, and insert-plan expression scale are fixed, but the stored-column SELECT/result-vector path still exposes nine fractional digits. Please propagate the declared FSP through the final read/output path and make the BVT assert six digits.

P2 — Remove unrelated and nondeterministic result churn

The unrelated floating-point changes at lines 553/567 and regenerated publication timestamps remain. Lines 1674 and 1696 also retain trailing whitespace, so git diff --check 41332062...HEAD still fails. Please revert this noise and keep the regression deterministic and scoped.

The PR body itself also notes these items are still outstanding; a green CI run currently accepts the incorrect golden output rather than proving the intended contract.

1, FSP 6显示为9位数字 是Connector/J的问题. mo-tester 使用了Connector/J.
2, 已经修改

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep re-reviewed exact head 10971abb4acaa7560211efb4fa702aad3ad39a12: no blocking findings.

I am withdrawing the previous FSP display blocker. The nine-digit value in this BVT is the established Connector/J ResultSet.getString() representation (microseconds expanded into Java nanoseconds), not evidence that MatrixOne changed the declared or protocol precision. The final code preserves DATETIME(6) through parser formatting and CTAS re-binding, and the regression records DATETIME(6) / nullable YES. The latest commits also reverted the unrelated floating-point/timestamp churn and git diff --check is clean.

Fresh local evidence on this head: all three added CTAS focused planner tests pass, the parser round-trip test passes, and go build plus go vet pass for pkg/sql/parsers/tree, pkg/sql/parsers/dialect/mysql, and pkg/sql/plan. Latest reported CI is green and the PR remains MERGEABLE.

Non-blocking: please update the final paragraph of the PR description, which still says the now-resolved parser/nullability/display/result-file items are outstanding.

@mergify

mergify Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-07-30 11:17 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-07-30 12:50 UTC · at d5b898ac64a4434123218eef3ce7e949ae3f4856 · squash

This pull request spent 1 hour 32 minutes 50 seconds in the queue, including 39 minutes 27 seconds running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants