Skip to content

cherrypick:SQRT(-1), ASIN(2) - #24563

Merged
mergify[bot] merged 23 commits into
matrixorigin:3.0-devfrom
daviszhen:0525-cherrypick-b7ad9486d
May 27, 2026
Merged

mergify[bot] merged 23 commits into
matrixorigin:3.0-devfrom
daviszhen:0525-cherrypick-b7ad9486d

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 #24481

What this PR does / why we need it:

SQRT(-1), ASIN(2), 混合字符串/数字表达式

daviszhen and others added 3 commits May 25, 2026 11:57
…ressions (matrixorigin#24519)

- Return NULL for math domain errors in ACOS/ASIN/COT/LN/LOG/LOG2/LOG10/SQRT, including array SQRT.
- Widen mixed string/numeric CASE / COALESCE / IFF / UNION expressions to varchar.
- Update distributed baselines for the affected math, array, function, and union cases.

Approved by: @heni02, @aunjgr
@daviszhen
daviszhen requested a review from a user May 25, 2026 06:22
@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 →

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

Blocking issue: this cherry-pick is incomplete on 3.0-dev for ASIN.

The diff adds the implementation (builtInASin in pkg/sql/plan/function/func_builtin.go) and tests, but ASIN is still not wired into the builtin function registry on this branch:

  • pkg/sql/plan/function/function_id.go already defines ASIN = 53
  • pkg/sql/plan/function/list_builtIn.go has entries for nearby math functions like SQRT, ACOS, ATAN, LN, but no ASIN entry at all
  • the new distributed baseline test/distributed/cases/function/func_math_asin.result still expects not supported: function or operator 'asin'

So the PR title/body says ASIN(2), but after this cherry-pick SQL still cannot call ASIN(...) on 3.0-dev. Please add the missing registry wiring (and update the baseline to actual function results) before approving.

@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-checked the current head from multiple angles. The earlier ASIN wiring problem is fixed now (list_builtIn.go, function resolution tests, and the new distributed ASIN baseline all line up), so that blocker is gone.

However, there is still a blocking regression in this PR: it now blesses a planner/runtime downgrade for an existing IF + subquery + GROUP BY case that is unrelated to the advertised fix set.

In test/distributed/cases/function/func_if.test the existing issue #3265 query is unchanged:

SELECT IF(b, (SELECT a FROM t1 LIMIT 1), b) c FROM t1 GROUP BY c;

On the base branch, func_if.result expects this query to succeed and return grouped rows. In this PR, test/distributed/cases/function/func_if.result is changed to expect:

subquery in GROUP BY clause is not yet implemented

That is a user-visible capability regression, and it is not explained by the function changes in this cherry-pick. The IF/CASE/COALESCE type-change logic added here only special-cases mixed string/numeric expressions, while this query is numeric/subquery-only.

Please either fix the regression or remove the unrelated baseline change before approval.

@daviszhen

Copy link
Copy Markdown
Contributor Author

Re-checked the current head from multiple angles. The earlier ASIN wiring problem is fixed now (list_builtIn.go, function resolution tests, and the new distributed ASIN baseline all line up), so that blocker is gone.

However, there is still a blocking regression in this PR: it now blesses a planner/runtime downgrade for an existing IF + subquery + GROUP BY case that is unrelated to the advertised fix set.

In test/distributed/cases/function/func_if.test the existing issue #3265 query is unchanged:

SELECT IF(b, (SELECT a FROM t1 LIMIT 1), b) c FROM t1 GROUP BY c;

On the base branch, func_if.result expects this query to succeed and return grouped rows. In this PR, test/distributed/cases/function/func_if.result is changed to expect:

subquery in GROUP BY clause is not yet implemented

That is a user-visible capability regression, and it is not explained by the function changes in this cherry-pick. The IF/CASE/COALESCE type-change logic added here only special-cases mixed string/numeric expressions, while this query is numeric/subquery-only.

Please either fix the regression or remove the unrelated baseline change before approval.

已经明确问题. 代码本身没问题, 是本地生成结果文件时, 将bvt tag的case, 也跑了,导致了错误的结果文件.
issue #3265 main和3.0-dev都没有解决, 但是此issue被关闭了.

@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 the current head from multiple angles. The earlier two blockers are now resolved: ASIN is wired into the builtin registry on 3.0-dev with matching tests/baselines, and the unrelated IF + subquery + GROUP BY regression in func_if.result has been corrected back to the successful result.

I also re-checked the remaining semantic changes around NULL-on-error math behavior and mixed string/numeric CASE/IF/UNION coercion. I don't see a remaining correctness blocker in the current head. LGTM.

@mergify

mergify Bot commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-05-26 10:31 UTC · Rule: release-3.0
  • ✅ Checks started · in-place
  • ❌ Checks failed
  • 🚫 Left the queue — 2026-05-26 10:46 UTC · at 4b103b1e09de3c730d18b69b23ece50800c21511

This pull request spent 14 minutes 55 seconds in the queue, with no time running CI.

Waiting for
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Utils CI (3.0) / Coverage
    • check-skipped = Matrixone Utils CI (3.0) / Coverage
    • check-success = Matrixone Utils CI (3.0) / Coverage
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI (3.0) / SCA Test on Ubuntu/x86
    • check-skipped = Matrixone CI (3.0) / SCA Test on Ubuntu/x86
    • check-success = Matrixone CI (3.0) / SCA Test on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI (3.0) / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI (3.0) / UT Test on Ubuntu/x86
    • check-success = Matrixone CI (3.0) / UT Test on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-skipped = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-success = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(Optimistic/PUSH)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-skipped = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-success = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(PESSIMISTIC)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Standlone CI (3.0) / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-skipped = Matrixone Standlone CI (3.0) / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-success = Matrixone Standlone CI (3.0) / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-success = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-skipped = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-success = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Upgrade CI (3.0) / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-skipped = Matrixone Upgrade CI (3.0) / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-success = Matrixone Upgrade CI (3.0) / Compatibility Test With Target on Linux/x64(LAUNCH)
All conditions
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Utils CI (3.0) / Coverage
    • check-skipped = Matrixone Utils CI (3.0) / Coverage
    • check-success = Matrixone Utils CI (3.0) / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI (3.0) / SCA Test on Ubuntu/x86
    • check-skipped = Matrixone CI (3.0) / SCA Test on Ubuntu/x86
    • check-success = Matrixone CI (3.0) / SCA Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI (3.0) / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI (3.0) / UT Test on Ubuntu/x86
    • check-success = Matrixone CI (3.0) / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-skipped = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-success = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(Optimistic/PUSH)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-skipped = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-success = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Standlone CI (3.0) / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-skipped = Matrixone Standlone CI (3.0) / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-success = Matrixone Standlone CI (3.0) / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-success = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-skipped = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-success = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Upgrade CI (3.0) / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-skipped = Matrixone Upgrade CI (3.0) / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-success = Matrixone Upgrade CI (3.0) / Compatibility Test With Target on Linux/x64(LAUNCH)
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • github-review-decision = APPROVED [🛡 GitHub branch protection]

Reason

The merge conditions cannot be satisfied due to failing checks

Hint

You may have to fix your CI before adding the pull request to the queue again.
If you update this pull request, to fix the CI, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

@daviszhen

Copy link
Copy Markdown
Contributor Author

@mergify refresh

@mergify

mergify Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

refresh

✅ Pull request refreshed

@daviszhen

Copy link
Copy Markdown
Contributor Author

@mergify refresh

@mergify

mergify Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

refresh

✅ Pull request refreshed

@mergify

mergify Bot commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-05-27 06:43 UTC · Rule: release-3.0
  • 🚫 Left the queue — 2026-05-27 07:53 UTC · at 61e0fc16349265461b6ba9f460c9dc6e9d8e6b23

This pull request spent 1 hour 10 minutes 53 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

merge conflict between base and head

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

@daviszhen

Copy link
Copy Markdown
Contributor Author

@mergify refresh

@mergify

mergify Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

refresh

✅ Pull request refreshed

@daviszhen

Copy link
Copy Markdown
Contributor Author

@mergify refresh

@mergify

mergify Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

refresh

✅ Pull request refreshed

@mergify

mergify Bot commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-05-27 10:33 UTC · Rule: release-3.0
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-05-27 10:33 UTC · at 9b76cf6b20dc9a67b32ad394fb93ef5f703e4712 · squash

This pull request spent 27 seconds in the queue, including 4 seconds running CI.

Required conditions to merge
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • github-review-decision = APPROVED [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI (3.0) / Coverage
    • check-neutral = Matrixone Utils CI (3.0) / Coverage
    • check-skipped = Matrixone Utils CI (3.0) / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI (3.0) / SCA Test on Ubuntu/x86
    • check-neutral = Matrixone CI (3.0) / SCA Test on Ubuntu/x86
    • check-skipped = Matrixone CI (3.0) / SCA Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI (3.0) / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI (3.0) / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI (3.0) / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-neutral = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-skipped = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(Optimistic/PUSH)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-neutral = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-skipped = Matrixone Compose CI (3.0) / multi cn e2e bvt test docker compose(PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI (3.0) / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-neutral = Matrixone Standlone CI (3.0) / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-skipped = Matrixone Standlone CI (3.0) / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-neutral = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-skipped = Matrixone Standlone CI (3.0) / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Upgrade CI (3.0) / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-neutral = Matrixone Upgrade CI (3.0) / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-skipped = Matrixone Upgrade CI (3.0) / Compatibility Test With Target on Linux/x64(LAUNCH)

@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 the current head from multiple angles. I don't see a remaining correctness blocker in the current diff; LGTM.

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/enhancement size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants