-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
executor: fix the issue that SELECT ... INTO OUTFILE
returns runtime error
#19438
Conversation
SELECT ... INTO OUTFILE
returns runtim…SELECT ... INTO OUTFILE
returns runtime error
switch col.GetType().EvalType() { | ||
case types.ETInt: | ||
switch col.GetType().Tp { | ||
case mysql.TypeTiny, mysql.TypeShort, mysql.TypeInt24, mysql.TypeLong: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this branch doesn't need to consider signed or unsigned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For these types, we ignore their signs and store them simply as int64
in TiDB since there is no risk to overflow.
I add one more test for this.
PTAL @winoros
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we load this file into mysql successfully if we ignore the signs?
e.g. tinyint unsigned
column, the value is 127
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I test it successfully in local:
mysql> create table t (v tinyint unsigned);
Query OK, 0 rows affected (0.01 sec)
mysql> load data local infile '/tmp/rrrr' into table t;
Query OK, 1 row affected (0.00 sec)
Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
mysql> select * from t;
+------+
| v |
+------+
| 127 |
+------+
1 row in set (0.00 sec)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
/merge |
Your auto merge job has been accepted, waiting for:
|
/run-all-tests |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-4.0 in PR #19672 |
What problem does this PR solve?
Issue Number: close #19314
Problem Summary:
SELECT ... INTO OUTFILE
returns runtime errorWhat is changed and how it works?
Handle bit type correctly when dumping rows into files.
Check List
Tests
Release note
SELECT ... INTO OUTFILE
returns runtim…