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

table: fix the issue that the default value for BIT column is wrong | tidb-test=pr/2424 #57303

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

YangKeao
Copy link
Member

@YangKeao YangKeao commented Nov 11, 2024

What problem does this PR solve?

Issue Number: close #57301, close #57312

Problem Summary:

  1. The CREATE TABLE statement didn't assert whether the default value for BIT is valid.
  2. The default value for BIT column is casted multiple times and may cause unexpected behavior.

What changed and how does it work?

  1. Revert part of types: convert string to MySQL BIT correctly #21310
  2. Validate the length of BIT default value.

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.

None

@ti-chi-bot ti-chi-bot bot added 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. labels Nov 11, 2024
@YangKeao YangKeao force-pushed the fix-57301 branch 3 times, most recently from 47b8870 to 7fac5c8 Compare November 11, 2024 14:40
Copy link

codecov bot commented Nov 11, 2024

Codecov Report

Attention: Patch coverage is 57.14286% with 6 lines in your changes missing coverage. Please review.

Project coverage is 74.6925%. Comparing base (6528da5) to head (ca270ca).
Report is 23 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #57303        +/-   ##
================================================
+ Coverage   72.9071%   74.6925%   +1.7854%     
================================================
  Files          1667       1714        +47     
  Lines        460833     469996      +9163     
================================================
+ Hits         335980     351052     +15072     
+ Misses       104199      96919      -7280     
- Partials      20654      22025      +1371     
Flag Coverage Δ
integration 49.1879% <57.1428%> (?)
unit 72.2852% <35.7142%> (-0.0103%) ⬇️

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

Components Coverage Δ
dumpling 52.7673% <ø> (ø)
parser ∅ <ø> (∅)
br 60.5247% <ø> (+15.4509%) ⬆️

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Nov 12, 2024
@YangKeao
Copy link
Member Author

/hold

I'm solving another issue #57312

@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 Nov 12, 2024
@ti-chi-bot ti-chi-bot bot added approved 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 Nov 12, 2024
@@ -248,7 +248,7 @@ func TestIssue18681(t *testing.T) {
}()
sc.SetTypeFlags(oldTypeFlags.WithIgnoreTruncateErr(true))
tests := []testCase{
{[]byte("true\tfalse\t0\t1\n"), []string{"1|0|0|1"}, "Records: 1 Deleted: 0 Skipped: 0 Warnings: 0"},
{[]byte("true\tfalse\t0\t1\tb'1'\tb'1'\n"), []string{"1|1|1|1|1100010001001110011000100100111|1"}, "Records: 1 Deleted: 0 Skipped: 0 Warnings: 5"},
Copy link
Member Author

Choose a reason for hiding this comment

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

As I've tested, the LOAD DATA in MySQL (both 5.6 and 8.0) also doesn't convert "false" to 0. I don't know why it's originally implemented (in #21310) as this.

@YangKeao YangKeao changed the title table: fix the issue that the default value for BIT column is wrong table: fix the issue that the default value for BIT column is wrong | tidb-test=pr/2424 Nov 12, 2024
Copy link

ti-chi-bot bot commented Nov 12, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: D3Hunter, wjhuang2016

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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 12, 2024
Copy link

ti-chi-bot bot commented Nov 12, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-12 03:09:38.388021211 +0000 UTC m=+325740.578890209: ☑️ agreed by D3Hunter.
  • 2024-11-12 06:58:28.210823319 +0000 UTC m=+339470.401692315: ☑️ agreed by wjhuang2016.

@YangKeao
Copy link
Member Author

/retest

@ti-chi-bot ti-chi-bot bot merged commit 95b04c7 into pingcap:master Nov 12, 2024
25 of 26 checks passed
@YangKeao YangKeao added 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. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. labels Nov 13, 2024
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Nov 13, 2024
@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Nov 13, 2024
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Nov 13, 2024
@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Nov 13, 2024
@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

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-5.4 Should cherry pick this PR to release-5.4 branch. 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.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
4 participants