Skip to content
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

expression: add new scalar function IsTruthWithNull #19621

Merged
merged 15 commits into from
Sep 9, 2020

Conversation

wshwsh12
Copy link
Contributor

@wshwsh12 wshwsh12 commented Aug 31, 2020

What problem does this PR solve?

Issue Number: close #17720, close #17476

Problem Summary: NewFunction can't get keepnull attributes for isture function.

What is changed and how it works?

Proposal: xxx

What's Changed:

  1. Add a new scalar function name IsTruthWithNull in parser.
  2. Use the function name to build ScalarFuncton in wrapWithIsTrue.

How it Works:

Related changes

  • Need to cherry-pick to the release branch 3.0,4.0

Check List

Tests

  • Unit test
  • Integration test

Side effects

  • Performance regression
    • Consumes more CPU
    • Consumes more MEM
  • Breaking backward compatibility

Release note

  • Fix the behavior of rewrite ScalarFunction IsTure .

@wshwsh12 wshwsh12 requested review from a team as code owners August 31, 2020 09:59
@wshwsh12 wshwsh12 requested review from qw4990 and winoros and removed request for a team August 31, 2020 09:59
@wshwsh12 wshwsh12 closed this Sep 1, 2020
@wshwsh12 wshwsh12 changed the title [DNM] expression: keep null expression: add new scalar function IsTruthWithNull Sep 2, 2020
@wshwsh12 wshwsh12 requested a review from SunRunAway September 2, 2020 03:50
Copy link
Contributor

@qw4990 qw4990 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 2, 2020
@qw4990
Copy link
Contributor

qw4990 commented Sep 2, 2020

PTAL @winoros @SunRunAway

ast.UnaryMinus: &unaryMinusFunctionClass{baseFunctionClass{ast.UnaryMinus, 1, 1}},
ast.In: &inFunctionClass{baseFunctionClass{ast.In, 2, -1}},
ast.IsTruth: &isTrueOrFalseFunctionClass{baseFunctionClass{ast.IsTruth, 1, 1}, opcode.IsTruth, false},
ast.IsTruthWithNull: &isTrueOrFalseFunctionClass{baseFunctionClass{ast.IsTruthWithNull, 1, 1}, opcode.IsTruth, true},
Copy link
Contributor

Choose a reason for hiding this comment

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

By expanding AST, all places of use of ast.IsTruth should also consider ast.IsTrueWithNull.

Is expanding the function signature more suitable comparing to expanding AST?

Copy link
Contributor Author

@wshwsh12 wshwsh12 Sep 3, 2020

Choose a reason for hiding this comment

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

I think the two ways are same... Expanding AST is necessary, expanding the function signature is optional...

Copy link
Contributor

Choose a reason for hiding this comment

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

@qw4990
Copy link
Contributor

qw4990 commented Sep 4, 2020

Please resolve conflicts @wshwsh12

@qw4990
Copy link
Contributor

qw4990 commented Sep 7, 2020

@wshwsh12 Please fix CI problems.

@wshwsh12
Copy link
Contributor Author

wshwsh12 commented Sep 9, 2020

/run-all-tests parser=pr/1016

@wshwsh12
Copy link
Contributor Author

wshwsh12 commented Sep 9, 2020

/run-all-tests

@wshwsh12
Copy link
Contributor Author

wshwsh12 commented Sep 9, 2020

/run-unit-test

Copy link
Contributor

@SunRunAway SunRunAway left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot removed the status/LGT1 Indicates that a PR has LGTM 1. label Sep 9, 2020
@ti-srebot ti-srebot added the status/LGT2 Indicates that a PR has LGTM 2. label Sep 9, 2020
@wshwsh12
Copy link
Contributor Author

wshwsh12 commented Sep 9, 2020

/run-unit-test

1 similar comment
@wshwsh12
Copy link
Contributor Author

wshwsh12 commented Sep 9, 2020

/run-unit-test

@wshwsh12 wshwsh12 merged commit 0c36203 into pingcap:master Sep 9, 2020
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Sep 9, 2020
@ti-srebot
Copy link
Contributor

cherry pick to release-3.0 in PR #19901

@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #19903

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression sig/execution SIG execution sig/planner SIG: Planner status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OR operation not correct in where clause Expression not correct in table join
4 participants