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: Fix warnings for FORMAT() in CTE #56198

Merged
merged 5 commits into from
Sep 26, 2024

Conversation

dveeden
Copy link
Contributor

@dveeden dveeden commented Sep 20, 2024

What problem does this PR solve?

Issue Number: close #56193

Problem Summary:

This fixes the corrupt warnings. It doesn't fix the difference in the number of warnings between MySQL and TiDB.

What changed and how does it work?

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.

Fixes corrupt warnings generated by the FORMAT() function within a CTE

@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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 20, 2024
Copy link

tiprow bot commented Sep 20, 2024

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

@dveeden
Copy link
Contributor Author

dveeden commented Sep 20, 2024

The GetString() function:

// GetString returns the string in the specific row.
func (c *Column) GetString(rowID int) string {
return string(hack.String(c.data[c.offsets[rowID]:c.offsets[rowID+1]]))
}

It relies on hack.String():

// String converts slice to MutableString without copy.
// The MutableString can be converts to string without copy.
// Use it at your own risk.
func String(b []byte) MutableString {
if len(b) == 0 {
return ""
}
return MutableString(unsafe.String(unsafe.SliceData(b), len(b)))
}

This doesn't seem to be safe in this case as warnings are added to h.warnings correctly, but then the arguments are corrupt when GetWarnings() is called.

@dveeden
Copy link
Contributor Author

dveeden commented Sep 20, 2024

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Sep 20, 2024
Copy link

codecov bot commented Sep 20, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 5 lines in your changes missing coverage. Please review.

Project coverage is 77.2758%. Comparing base (281462c) to head (0d204aa).
Report is 50 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #56198        +/-   ##
================================================
+ Coverage   73.3745%   77.2758%   +3.9013%     
================================================
  Files          1602       1641        +39     
  Lines        444469     469113     +24644     
================================================
+ Hits         326127     362511     +36384     
+ Misses        98392      85333     -13059     
- Partials      19950      21269      +1319     
Flag Coverage Δ
integration 53.8549% <50.0000%> (?)
unit 73.9513% <0.0000%> (+1.4798%) ⬆️

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

Components Coverage Δ
dumpling 52.9478% <ø> (ø)
parser ∅ <ø> (∅)
br 61.1603% <ø> (+15.2707%) ⬆️

@dveeden
Copy link
Contributor Author

dveeden commented Sep 21, 2024

/retest

1 similar comment
@dveeden
Copy link
Contributor Author

dveeden commented Sep 24, 2024

/retest

@dveeden dveeden requested a review from YangKeao September 24, 2024 09:44
@dveeden
Copy link
Contributor Author

dveeden commented Sep 24, 2024

/retest

Copy link
Member

@YangKeao YangKeao 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 the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Sep 25, 2024
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 26, 2024
Copy link

ti-chi-bot bot commented Sep 26, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-09-25 07:54:14.245110075 +0000 UTC m=+1638923.985534014: ☑️ agreed by YangKeao.
  • 2024-09-26 08:52:24.015482252 +0000 UTC m=+1728813.755906192: ☑️ agreed by hawkingrei.

@dveeden dveeden requested a review from windtalker September 26, 2024 09:09
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

Copy link

ti-chi-bot bot commented Sep 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hawkingrei, windtalker, YangKeao

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 ti-chi-bot bot added the approved label Sep 26, 2024
@ti-chi-bot ti-chi-bot bot merged commit f399e91 into pingcap:master Sep 26, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

Corrupt warnings and compatibility issues with FORMAT and CTE
4 participants