Skip to content

expression: simple expression IsTruthWithNull/IsTruthWithoutNull with CAST #61076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

hawkingrei
Copy link
Member

@hawkingrei hawkingrei commented May 12, 2025

What problem does this PR solve?

Issue Number: close #61062

close #51359

Problem Summary:

What changed and how does it work?

IsTruthWithNull/IsTruthWithoutNull with cast(cast(xxx)) ( IsTruthWithNull(cast(cast(xxx)))) can be transfer into IsTruthWithNull/IsTruthWithoutNull(xxx).

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

expression: simple expression IsTruthWithNull/IsTruthWithoutNull with CAST

简化带 CAST 的 IsTruthWithNull/IsTruthWithoutNull 表达式

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-tests-checked sig/planner SIG: Planner size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 12, 2025
Copy link

ti-chi-bot bot commented May 13, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from hawkingrei and additionally assign windtalker for approval(Please ensuring that each of them provides their approval before proceeding). For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 13, 2025
@hawkingrei hawkingrei changed the title planner: fix incorrect query result may caused by join [WIP] executor: simple expression IsTruthWithNull/IsTruthWithNull with CAST May 13, 2025
@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. labels May 13, 2025
@hawkingrei hawkingrei changed the title executor: simple expression IsTruthWithNull/IsTruthWithNull with CAST expression: simple expression IsTruthWithNull/IsTruthWithNull with CAST May 13, 2025
Copy link

codecov bot commented May 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.4729%. Comparing base (2503d50) to head (3dc6f01).
Report is 12 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #61076        +/-   ##
================================================
+ Coverage   73.1498%   73.4729%   +0.3230%     
================================================
  Files          1724       1724                
  Lines        477078     478816      +1738     
================================================
+ Hits         348982     351800      +2818     
+ Misses       106697     105602      -1095     
- Partials      21399      21414        +15     
Flag Coverage Δ
integration 42.5656% <ø> (?)
unit 72.3819% <ø> (+0.0244%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.7804% <ø> (ø)
parser ∅ <ø> (∅)
br 47.1585% <ø> (-0.3939%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@TheoristCoder
Copy link

Dear Developers, Kindly inquire that if this bug is also related to this root case? #60127

Signed-off-by: Weizhen Wang <[email protected]>
Signed-off-by: Weizhen Wang <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 13, 2025
@hawkingrei hawkingrei changed the title expression: simple expression IsTruthWithNull/IsTruthWithNull with CAST expression: simple expression IsTruthWithNull/IsTruthWithoutNull with CAST May 13, 2025
@hawkingrei hawkingrei requested a review from windtalker May 13, 2025 08:00
@hawkingrei
Copy link
Member Author

Dear Developers, Kindly inquire that if this bug is also related to this root case? #60127

I take a look at this problem. it is not the same as the root cause.

@hawkingrei hawkingrei requested review from winoros and XuHuaiyu May 13, 2025 08:23
return FoldConstant(ctx, sf), nil
}

func simpleExpression(arg Expression) Expression {
Copy link
Contributor

Choose a reason for hiding this comment

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

The convert is too aggressive, istrue(cast(xxx as xxx)) is not always equal to istrue(xxx)
For example:


mysql> select istrue_with_null('0.1');
+-------------------------+
| istrue_with_null('0.1') |
+-------------------------+
|                       1 |
+-------------------------+
1 row in set (0.01 sec)

mysql> select istrue_with_null(cast('0.1' as signed));
+-----------------------------------------+
| istrue_with_null(cast('0.1' as signed)) |
+-----------------------------------------+
|                                       0 |
+-----------------------------------------+
1 row in set, 1 warning (0.00 sec)

@hawkingrei
Copy link
Member Author

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/planner SIG: Planner size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect query result may caused by join. Incorrect query result may caused by REGEXP_LIKE function
3 participants