tidb icon indicating copy to clipboard operation
tidb copied to clipboard

expression: fix wrong flen from baseFunctionClass

Open joechenrh opened this issue 1 year ago • 6 comments

What problem does this PR solve?

Issue Number: close #56587

Problem Summary:

What changed and how does it work?

ro Previously, quoteFunctionClass may return type with flen = 0

https://github.com/pingcap/tidb/blob/f0b3bf0332ae33b0593f5f89ead872f71816cbd3/pkg/expression/builtin_string.go#L2899

And this type will be passed into LogicalUnionAll, which will result to a wrong type.

https://github.com/pingcap/tidb/blob/f0b3bf0332ae33b0593f5f89ead872f71816cbd3/pkg/planner/core/logical_plan_builder.go#L1586-L1591

Some other functions also have this problem, for example:

mysql> select elt(2, "123", cast('abcdefg' as char)) union all select "1234";
+----------------------------------------+
| elt(2, "123", cast('abcdefg' as char)) |
+----------------------------------------+
| abcd                                   |
| 1234                                   |
+----------------------------------------+
2 rows in set, 1 warning (0.00 sec)

Check List

Tests

  • [X] 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.

None

joechenrh avatar Oct 12 '24 06:10 joechenrh

Hi @joechenrh. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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-sigs/prow repository.

tiprow[bot] avatar Oct 12 '24 06:10 tiprow[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 74.8608%. Comparing base (0e3efb6) to head (3afd694). Report is 8 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #56607        +/-   ##
================================================
+ Coverage   72.8325%   74.8608%   +2.0283%     
================================================
  Files          1672       1717        +45     
  Lines        462833     472049      +9216     
================================================
+ Hits         337093     353380     +16287     
+ Misses       104947      96604      -8343     
- Partials      20793      22065      +1272     
Flag Coverage Δ
integration 49.1691% <83.3333%> (?)
unit 72.4300% <100.0000%> (+0.2216%) :arrow_up:

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

Components Coverage Δ
dumpling 52.7673% <ø> (ø)
parser ∅ <ø> (∅)
br 60.7186% <ø> (+15.6309%) :arrow_up:
---- 🚨 Try these New Features:

codecov[bot] avatar Oct 12 '24 06:10 codecov[bot]

/retest

joechenrh avatar Oct 12 '24 08:10 joechenrh

@joechenrh: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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-sigs/prow repository.

tiprow[bot] avatar Oct 12 '24 08:10 tiprow[bot]

/test check-dev

yibin87 avatar Nov 19 '24 07:11 yibin87

@yibin87: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test check-dev

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-sigs/prow repository.

tiprow[bot] avatar Nov 19 '24 07:11 tiprow[bot]

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: windtalker, yibin87

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

ti-chi-bot[bot] avatar Nov 19 '24 07:11 ti-chi-bot[bot]

[LGTM Timeline notifier]

Timeline:

  • 2024-10-21 05:46:33.878196916 +0000 UTC m=+243594.574987550: :ballot_box_with_check: agreed by windtalker.
  • 2024-11-19 07:51:17.919284155 +0000 UTC m=+947440.110153151: :ballot_box_with_check: agreed by yibin87.

ti-chi-bot[bot] avatar Nov 19 '24 07:11 ti-chi-bot[bot]

/retest

joechenrh avatar Nov 19 '24 07:11 joechenrh

@joechenrh: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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-sigs/prow repository.

tiprow[bot] avatar Nov 19 '24 07:11 tiprow[bot]

/retest

joechenrh avatar Nov 19 '24 08:11 joechenrh

@joechenrh: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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-sigs/prow repository.

tiprow[bot] avatar Nov 19 '24 08:11 tiprow[bot]

/ok-to-test

joechenrh avatar Nov 19 '24 08:11 joechenrh

/retest

joechenrh avatar Nov 19 '24 09:11 joechenrh

/retest

joechenrh avatar Nov 19 '24 10:11 joechenrh

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

ti-chi-bot avatar Nov 19 '24 12:11 ti-chi-bot