-
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
Changes from 3 commits
feb6c6d
ba95d82
594586d
0abd9c0
51680c4
e20422a
af17ba1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -802,6 +802,7 @@ import ( | |
OptBinMod "Optional BINARY mode" | ||
OptCharset "Optional Character setting" | ||
OptCollate "Optional Collate setting" | ||
IgnoreLines "Ignore num(int) lines" | ||
NUM "A number" | ||
NumList "Some numbers" | ||
LengthNum "Field length num(uint64)" | ||
|
@@ -6883,12 +6884,13 @@ RevokeStmt: | |
* See https://dev.mysql.com/doc/refman/5.7/en/load-data.html | ||
*******************************************************************************************/ | ||
LoadDataStmt: | ||
"LOAD" "DATA" LocalOpt "INFILE" stringLit "INTO" "TABLE" TableName CharsetOpt Fields Lines ColumnNameListOptWithBrackets | ||
"LOAD" "DATA" LocalOpt "INFILE" stringLit "INTO" "TABLE" TableName CharsetOpt Fields Lines IgnoreLines ColumnNameListOptWithBrackets | ||
{ | ||
x := &ast.LoadDataStmt{ | ||
Path: $5, | ||
Table: $8.(*ast.TableName), | ||
Columns: $12.([]*ast.ColumnName), | ||
Columns: $13.([]*ast.ColumnName), | ||
IgnoreLines:$12.(uint64), | ||
} | ||
if $3 != nil { | ||
x.IsLocal = true | ||
|
@@ -6902,6 +6904,15 @@ LoadDataStmt: | |
$$ = x | ||
} | ||
|
||
IgnoreLines: | ||
{ | ||
$$ = uint64(0) | ||
} | ||
| "IGNORE" NUM "LINES" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Got it. |
||
{ | ||
$$ = getUint64FromNUM($2) | ||
} | ||
|
||
CharsetOpt: | ||
{} | ||
| "CHARACTER" "SET" CharsetName | ||
|
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.