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: ignore TypeNULL in HandleBinaryLiteral #49527

Merged
merged 2 commits into from
Dec 17, 2023

Conversation

YangKeao
Copy link
Member

What problem does this PR solve?

Issue Number: close #49526

Problem Summary:

What changed and how does it work?

Ignore the TypeNull in HandleBinaryLiteral, as the castStringToString will actually do nothing for NULL (except changing the type).

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

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 17, 2023
@YangKeao YangKeao force-pushed the fix-handle-binary-literal-null branch from 7919946 to eeceee4 Compare December 17, 2023 09:31
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Dec 17, 2023
@@ -97,3 +97,10 @@ select 1 from t where y = YEAR(CURDATE());
select cast(cast('14:15' as time) as year) = YEAR(CURDATE());
cast(cast('14:15' as time) as year) = YEAR(CURDATE())
1
explain select null as a union all select 'a' as a;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the explain result without this pr?

Copy link
Member Author

Choose a reason for hiding this comment

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

mysql> explain select null as a union all select 'a' as a;
+------------------------+---------+------+---------------+---------------------------------------------------+
| id                     | estRows | task | access object | operator info                                     |
+------------------------+---------+------+---------------+---------------------------------------------------+
| Union_8                | 2.00    | root |               |                                                   |
| ├─Projection_10        | 1.00    | root |               | cast(from_binary(<nil>), var_string(1))->Column#3 |
| │ └─TableDual_11       | 1.00    | root |               | rows:1                                            |
| └─Projection_12        | 1.00    | root |               | a->Column#3                                       |
|   └─TableDual_13       | 1.00    | root |               | rows:1                                            |
+------------------------+---------+------+---------------+---------------------------------------------------+
5 rows in set (0.00 sec)

Copy link

codecov bot commented Dec 17, 2023

Codecov Report

Merging #49527 (36817d5) into master (074af10) will increase coverage by 0.5642%.
Report is 2 commits behind head on master.
The diff coverage is 13.0434%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #49527        +/-   ##
================================================
+ Coverage   70.9977%   71.5619%   +0.5642%     
================================================
  Files          1368       1418        +50     
  Lines        399517     415243     +15726     
================================================
+ Hits         283648     297156     +13508     
- Misses        96068      99289      +3221     
+ Partials      19801      18798      -1003     
Flag Coverage Δ
integration 43.8524% <13.0434%> (?)
unit 71.0009% <ø> (+0.0031%) ⬆️

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

Components Coverage Δ
dumpling 53.9663% <ø> (ø)
parser ∅ <ø> (∅)
br 47.7771% <ø> (-5.1177%) ⬇️

@YangKeao YangKeao force-pushed the fix-handle-binary-literal-null branch from eeceee4 to 3f0c4e5 Compare December 17, 2023 09:44
Copy link
Contributor

@windtalker windtalker 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-chi-bot ti-chi-bot bot added approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 17, 2023
Copy link

ti-chi-bot bot commented Dec 17, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-12-17 09:33:55.343793067 +0000 UTC m=+780726.381019978: ☑️ agreed by tangenta.
  • 2023-12-17 09:46:24.341434046 +0000 UTC m=+781475.378660968: ☑️ agreed by windtalker.

@YangKeao YangKeao force-pushed the fix-handle-binary-literal-null branch from 3f0c4e5 to d1e207c Compare December 17, 2023 09:59
@YangKeao YangKeao added needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. and removed needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. labels Dec 17, 2023
Copy link

ti-chi-bot bot commented Dec 17, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jackysp, tangenta, windtalker

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

The pull request process is described 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

@wuhuizuo
Copy link
Contributor

/test all

3 similar comments
@wuhuizuo
Copy link
Contributor

/test all

@wuhuizuo
Copy link
Contributor

/test all

@wuhuizuo
Copy link
Contributor

/test all

@wuhuizuo
Copy link
Contributor

/test ?

Copy link

ti-chi-bot bot commented Dec 17, 2023

@wuhuizuo: The following commands are available to trigger required jobs:

  • /test build
  • /test check-dev
  • /test check-dev2
  • /test mysql-test
  • /test unit-test

The following commands are available to trigger optional jobs:

  • /test canary-notify-when-compatibility-sections-changed
  • /test pingcap/tidb/canary_ghpr_unit_test
  • /test pull-br-integration-test
  • /test pull-common-test
  • /test pull-e2e-test
  • /test pull-integration-common-test
  • /test pull-integration-copr-test
  • /test pull-integration-ddl-test
  • /test pull-integration-jdbc-test
  • /test pull-integration-mysql-test
  • /test pull-integration-nodejs-test
  • /test pull-lightning-integration-test
  • /test pull-mysql-client-test
  • /test pull-sqllogic-test
  • /test pull-tiflash-test

Use /test all to run the following jobs that were automatically triggered:

  • pingcap/tidb/ghpr_build
  • pingcap/tidb/ghpr_check
  • pingcap/tidb/ghpr_check2
  • pingcap/tidb/ghpr_mysql_test
  • pingcap/tidb/ghpr_unit_test

In response to this:

/test ?

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@wuhuizuo
Copy link
Contributor

/retest

Signed-off-by: Yang Keao <yangkeao@chunibyo.icu>
@YangKeao YangKeao force-pushed the fix-handle-binary-literal-null branch from 0402760 to 3348a87 Compare December 17, 2023 12:57
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 17, 2023
Signed-off-by: Yang Keao <yangkeao@chunibyo.icu>
@YangKeao YangKeao force-pushed the fix-handle-binary-literal-null branch from 3348a87 to 36817d5 Compare December 17, 2023 13:05
@YangKeao
Copy link
Member Author

/retest

1 similar comment
@YangKeao
Copy link
Member Author

/retest

@wuhuizuo
Copy link
Contributor

/test check-dev2

Copy link

tiprow bot commented Dec 17, 2023

@wuhuizuo: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test check-dev2

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@wuhuizuo
Copy link
Contributor

/retest

@ti-chi-bot ti-chi-bot bot merged commit 3a7bd53 into pingcap:master Dec 17, 2023
16 checks passed
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #49531.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Dec 17, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #49532.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Dec 17, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #49533.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Dec 17, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.1: #49534.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Dec 17, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot bot pushed a commit that referenced this pull request Dec 18, 2023
ti-chi-bot bot pushed a commit that referenced this pull request Dec 21, 2023
ti-chi-bot bot pushed a commit that referenced this pull request Dec 22, 2023
guoshouyan pushed a commit to guoshouyan/tidb that referenced this pull request Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HandleBinaryLiteral should ignore TypeNull
6 participants