Skip to content

Commit

Permalink
parser: add LOW_PRIORITY for LOAD DATA (#51023)
Browse files Browse the repository at this point in the history
ref #49602
  • Loading branch information
lance6716 authored Feb 8, 2024
1 parent c5eced1 commit 2437633
Show file tree
Hide file tree
Showing 4 changed files with 5,313 additions and 5,279 deletions.
4 changes: 4 additions & 0 deletions pkg/parser/ast/dml.go
Original file line number Diff line number Diff line change
Expand Up @@ -1865,6 +1865,7 @@ const (
type LoadDataStmt struct {
dmlNode

LowPriority bool
FileLocRef FileLocRefTp
Path string
Format *string
Expand All @@ -1884,6 +1885,9 @@ type LoadDataStmt struct {
// Restore implements Node interface.
func (n *LoadDataStmt) Restore(ctx *format.RestoreCtx) error {
ctx.WriteKeyWord("LOAD DATA ")
if n.LowPriority {
ctx.WriteKeyWord("LOW_PRIORITY ")
}
switch n.FileLocRef {
case FileLocServerOrRemote:
case FileLocClient:
Expand Down
4 changes: 4 additions & 0 deletions pkg/parser/ast/dml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,10 @@ func TestWindowSpecRestore(t *testing.T) {

func TestLoadDataRestore(t *testing.T) {
testCases := []NodeRestoreTestCase{
{
sourceSQL: "load data low_priority infile '/a.csv' into table `t`",
expectSQL: "LOAD DATA LOW_PRIORITY INFILE '/a.csv' INTO TABLE `t`",
},
{
sourceSQL: "load data infile '/a.csv' format 'sql file' into table `t`",
expectSQL: "LOAD DATA INFILE '/a.csv' FORMAT 'sql file' INTO TABLE `t`",
Expand Down
Loading

0 comments on commit 2437633

Please sign in to comment.