Repository navigation
fix(plan): preserve temporal fractional precision in CTAS metadata - #30798
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? |
|
mo-bot review · Commit: Review completed. Read the assessment. |
|
mo-bot review · Commit: "interrupted" |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 529584181e9d89b2b83e0871f846e30d1185634a
Assessment: request_changes
Reviewed the complete four-file delta and affected binder, CTAS, prepared-execution, cast and catalog paths. Normalizing inferred temporal columns at the existing CTAS owner is reasonable and preserves explicit column definitions. However, literal precision inference incorrectly treats dotted date separators as fractional seconds. Added work is confined to binding and schema inference; no per-row overhead was introduced.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1
- P2
pkg/sql/plan/base_binder.go:8252: CREATE TABLE tz_fsp AS SELECT CONVERT_TZ('2024.01.15', '+00:00', '+00:00') AS d;
Impact: This valid date-only literal acquires Scale=2 and Width=2, so CTAS exposes datetime(2) and DATETIME_PRECISION=2 instead of precision 0. Equivalent dashed and dotted dates therefore produce different schemas.
Evidence: ParseDatetime accepts this input through ParseDateCast; date_test.go explicitly includes '2024.01.15' as a valid dotted date. datetimeLiteralScale in generate_series.go:196 counts digits after the last dot, interpreting the day '15' as fractional seconds. The new caller assigns that count to the result type, and CTAS preserves it. Catalog formatting reads Width for COLUMN_TYPE and Scale for DATETIME_PRECISION. Derive precision from the actual fractional-seconds component and add dotted-date controls, including a dotted datetime without fractions.
Validation:
-
Reviewed all changed implementation and tests, existing prepared temporal reuse tests, CTAS SQL regressions, implicit-cast precision handling and catalog formatting.
-
Frozen evidence reports successful exact-head Ubuntu UT, SCA, coverage, proxy BVT and multi-CN pessimistic BVT checks. These statuses do not establish coverage of the dotted-date counterexample.
-
git diff --check passed. Reconciled checks/1792645906150398847-3.json with diff-check.log under /home/xupeng/.local/state/mo-bot/jobs/10d85d11f584940d63e673f8/attempt-1; receipt records the assigned head, clean source fingerprint and exit 0.
-
Isolation preflight passed. Reconciled checks/1792645906240191074-29.json with preflight.log in the same directory. This verifies executor setup, not product behavior.
Limitations:
-
The finding is established by source tracing; no local Go tests or SQL server reproduction were executed.
-
local_validation is empty, and raw CI logs and per-test execution manifests were not supplied. The author's recorded SQL reproduction tested the base revision only.
-
The linked issue #28236 body was not included in the frozen evidence; its contract was assessed from the PR description.
-
No performance benchmark was run; the added literal parse and scan occur during binding.
aptend
left a comment
There was a problem hiding this comment.
Reviewed exact head 5295841, the complete four-file change, linked issue, and all review discussion.
The common CTAS temporal-width normalization is placed at the existing inferred-schema owner and preserves explicit target definitions. One blocker remains in the new CONVERT_TZ literal precision inference: calendar punctuation is mistaken for fractional seconds.
I independently reproduced it in both actual DDL planning and the SQL frontend/catalog: dotted date and dotted datetime-without-fractions become datetime(2) / DATETIME_PRECISION=2, while equivalent dashed-date and genuine-fraction controls behave correctly. Details and reproducible SQL are inline. Exact-head green planner/SCA CI does not cover this counterexample. No production files were changed.
aptend
left a comment
There was a problem hiding this comment.
APPROVE on exact head 106541b35681a66dc861ac6b349e90c01433b84d (base/merge-base a949c88af0ed2cc4fe98e2ac32f0732a1235bd85).
Re-reviewed all historical reviews, inline discussion and resolved-thread state, every hunk since my previous reviewed head 529584181e9d89b2b83e0871f846e30d1185634a, and the complete current eight-file diff. The previous blocker is genuinely fixed, rather than merely marked resolved: calendar dots are excluded from fractional precision, while dotted datetimes with real fractions and compact 14-digit datetime fractions retain their precision. I also traced the shared generate_series consumer and normal/prepared CTAS normalization; explicit target definitions remain protected. This is a focused bug fix, exempt from the major-refactor design gate.
Independent verification in an isolated exact-head worktree:
- Eight focused planner test roots passed (
-count=1, package 0.065s), including the new binder/CTAS/helper tests, prepared temporal contracts/reuse, and an independent eight-input BuildPlan probe. The previous dotted-date witnesses now yield Width=Scale=0; real fractions yield 3/6, including compact, ISO and short-calendar controls. - Real SQL frontend/catalog probe passed (4.957s): six CONVERT_TZ CTAS inputs agree on
COLUMN_TYPE,DATETIME_PRECISIONand stored microseconds. Prepared ADDTIME CTAS was executed twice with different values and retained datetime(6). Database teardown was checked. - Ran the committed
func_convert_tz_ctas_fsp.sqlwith its unchanged.resultthrough mo-tester in normal comparison mode, equivalent-n -g -o -poptions, twice on the same test-owned single-CN embedded instance. Both reports name the exact case and show 6/6 success, 0 ignored/failed/abnormal, in 0.113s and 0.105s; database absence was checked between runs. An initial harness attempt failed before any case execution because my temporary tester configuration lackedoutfiles; after correcting only that configuration, both comparisons passed. No result file was generated or accepted from output. - Reused exact-head CI coverage UT job 119713597337: raw checkout matches this SHA; producer receipt is passed/exit 0, 509 package starts and no package/test failure events; changed helper/normalization blocks have positive coverage. Full race UT, SCA and multi-CN BVT are still running and are not claimed green.
No remaining blocking issue found. Temporary tests were removed; no production source or expected result was modified.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 106541b35681a66dc861ac6b349e90c01433b84d
Assessment: approve
Reviewed the complete eight-file delta and affected callers. The existing binder and CTAS schema owners restore consistent temporal precision across ordinary and prepared CTAS while preserving explicit definitions. Reusing the corrected literal helper closes the dotted-date finding without adding state or per-row work. No actionable defects remain.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
Validation:
-
Passed 11 focused planner test roots covering new regressions, generate_series inference, temporal contracts and prepared reuse.
-
Passed an independent single-CN MySQL-protocol probe checking catalog metadata and stored microseconds, fractional rounding, timezone conversion, NULL handling, explicit target precision and repeated prepared CTAS execution.
-
Configured incremental planner lint reported zero issues; formatting and diff checks passed.
-
Isolation preflight passed. Verified 192 matching native inputs and seven build-owner output hashes before executing tests.
-
Reconciled commands, clean-head fingerprints, exits and retained logs in /home/xupeng/.local/state/mo-bot/jobs/3aac129a72931a731d1a5dc9/attempt-1/review-evidence-audit.json. Source remains unchanged.
Limitations:
-
The initial SQL probe had an incorrect integer-control expectation; its failure and corrected passing run are retained separately. Native setup failures were resolved before product tests.
-
No full distributed-suite rerun or performance benchmark. Added work is confined to literal binding and constant-size normalization per inferred CTAS column.
-
The frozen packet lacks original linked-issue text and raw author/CI execution artifacts; those assertions were not counted as independently verified passes.
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
Summary
Fixes #28236.
CONVERT_TZ's result fractional precision from a constant datetime string, while retaining the declared precision of a temporal input.2024.01.15no longer produce a falsedatetime(2)result. CompactYYYYMMDDHHMMSS.fractionvalues retain their fractional precision. The shared inference also servesgenerate_series.COLUMN_TYPEandDATETIME_PRECISIONagree with the stored value.ADDTIME/SUBTIMEcases.Verification
The original PR head
529584181e9d89b2b83e0871f846e30d1185634awas independently reproduced through SQL and planning in the change-request review: dotted date and dotted datetime inputs yieldeddatetime(2)instead of precision zero.For updated head
106541b35681a66dc861ac6b349e90c01433b84d, the GitHub CI shared build passed and itsBUILD_INFOconfirms the exact SHA. On[email protected],func_convert_tz_ctas_fsp.sqlpassed twice in normal mo-tester comparison mode against that binary (6/6 statements, zero failures each run). The isolated test database was removed. The focused local-to-remote Go test attempt was cancelled during an overloaded linker phase and is not counted as passing; CI unit and coverage checks have passed; the static check is still running.