-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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: support load data with ignore lines #7576
Conversation
@mccxj Thanks! |
parser/parser.y
Outdated
@@ -809,6 +809,7 @@ import ( | |||
TableOptimizerHintOpt "Table level optimizer hint" | |||
TableOptimizerHints "Table level optimizer hints" | |||
TableOptimizerHintList "Table level optimizer hint list" | |||
IgnoreLines "Ignore num(int) lines" |
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.
Keep alignment.
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.
fixed.
executor/write_test.go
Outdated
c.Assert(ok, IsTrue) | ||
defer ctx.SetValue(executor.LoadDataVarKey, nil) | ||
c.Assert(ld, NotNil) | ||
// test escape |
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.
What do you mean by "test escape"?
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.
copy comment by mistake.
parser/parser.y
Outdated
@@ -802,6 +802,7 @@ import ( | |||
OptBinMod "Optional BINARY mode" | |||
OptCharset "Optional Character setting" | |||
OptCollate "Optional Collate setting" | |||
IgnoreLines "Ignore num(int) lines" |
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.
Please keep alignment.
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.
fixed.
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
{ | ||
$$ = uint64(0) | ||
} | ||
| "IGNORE" NUM "LINES" |
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.
In MySQL, a negative number will casue syntax error. Could you add a test case about this?
mysql> load data local infile '/tmp/t.csv' into table t ignore -1 lines;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1 lines' at line 1
mysql> load data local infile '/tmp/t.csv' into table t ignore 1 lines;
ERROR 1148 (42000): The used command is not allowed with this MySQL version
mysql> quit
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.
testcase added.
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.
Got it.
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
/run-all-tests |
@mccxj Thanks! |
What problem does this PR solve?
For #7476
What is changed and how it works?
Check List
Tests
Code changes