Skip to content

Fix SQL compatibility regressions across aggregates, casts, and prepared DML - #32002

Open
jiangxinmeng1 wants to merge 12 commits into
matrixorigin:mainfrom
jiangxinmeng1:codex/issues-28562-28485-28230-28119-28024-27340-27332
Open

jiangxinmeng1 wants to merge 12 commits into
matrixorigin:mainfrom
jiangxinmeng1:codex/issues-28562-28485-28230-28119-28024-27340-27332

Conversation

@jiangxinmeng1

@jiangxinmeng1 jiangxinmeng1 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

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

Which issue(s) this PR fixes:

Closes #28562, #28485, #28230, #28119, #28024, #27340, #27332.

What this PR does / why we need it:

  • Return SQL NULL when a finite DOUBLE input makes DEGREES overflow. Preserve CHAR PAD SPACE provenance through COALESCE and IFNULL keys.
  • Widen MEDIAN(DECIMAL(38,s)) to an exact DECIMAL(39,s+1) result and return SUM(INT) as DECIMAL(32,0), including the single-group reuse path.
  • Preserve prepared ENUM/SET parameter markers until the execution binding selects the label or numeric converter.
  • Apply DML assignment bounds and SQL-mode behavior to integer, DECIMAL, BINARY/VARBINARY, and DATE paths. Strict mode rejects invalid writes; non-strict and IGNORE adjust values and emit warnings. Keep safe literal fast paths and unchanged stored DECIMAL projections to preserve DML planning.
  • The CTAS TIMESTAMPADD unit and prepared DATE_ADD/DATE_SUB cases were already fixed on the earlier base; this PR verifies their status alongside the remaining consolidated fixes.
  • Release native test vectors, aggregate executors, and mpools when assertions fail. The merged MEDIAN flush-error fixture uses valid 37-digit inputs so it still exercises result ownership after DECIMAL(38,s) widening.
  • Preserve grouped outer-join domain pruning when bounded integer SUM now returns DECIMAL; keep unsafe bounds rejected. Update spill-recovery and dictionary-pipeline tests for the widened result type after merging upstream/main.

Validation

  • On the merged head, complete CGo-linked tests pass for pkg/sql/colexec/aggexec, pkg/sql/colexec/group, pkg/sql/plan/function, pkg/sql/plan, and pkg/sql/compile. Focused merge-conflict, grouped-domain boundary, and reviewer-cleanup regressions pass. The previous CI UT failure was an outdated dictionary-pipeline assertion that read SUM(INT32) as int64; it now checks the DECIMAL128 result and type.
  • go vet passes for those packages and pkg/sql/compile. The merge includes upstream/main 7fcd9bdff8; the worktree has no unresolved conflicts or whitespace errors.
  • Earlier local SQL BVT and MySQL binary-protocol checks covered DML modes, aggregate types, CHAR keys, and prepared ENUM/SET. Those service-level checks have not been rerun after this merge. The focused TestDictionaryPipelineAccountLifetime regression passes with -race; CI is running on the new head.

@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 →

@mergify

mergify Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request

…view

# Conflicts:
#	pkg/sql/plan/base_binder_test.go
#	pkg/sql/plan/build_constraint_util.go
#	pkg/sql/plan/function/func_cast.go
#	test/distributed/cases/ddl/alter_table_add_drop_primary_key.result
#	test/distributed/cases/ddl/alter_table_add_drop_primary_key.sql
#	test/distributed/cases/dtype/binary.result
#	test/distributed/cases/fulltext/fulltext2.result
#	test/distributed/cases/git4data/clone/clone_db_table_to_new_db_table.result

This branch is being deployed

1 in progress 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/L Denotes a PR that changes [500,999] lines

Projects

None yet

3 participants