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

Load Data From S3 #6823

Merged
merged 3 commits into from
Oct 8, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go/vt/sqlparser/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func ASTToStatementType(stmt Statement) StatementType {
return StmtDDL
case *Use:
return StmtUse
case *OtherRead, *OtherAdmin:
case *OtherRead, *OtherAdmin, *Load:
return StmtOther
case *Explain:
return StmtExplain
Expand Down
9 changes: 9 additions & 0 deletions go/vt/sqlparser/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ type (
// DDLAction is an enum for DDL.Action
DDLAction int8

Load struct {
InfileS3 string
}

// ParenSelect is a parenthesized SELECT statement.
ParenSelect struct {
Select SelectStatement
Expand Down Expand Up @@ -333,6 +337,7 @@ func (*OtherAdmin) iStatement() {}
func (*Select) iSelectStatement() {}
func (*Union) iSelectStatement() {}
func (*ParenSelect) iSelectStatement() {}
func (*Load) iStatement() {}

// ParenSelect can actually not be a top level statement,
// but we have to allow it because it's a requirement
Expand Down Expand Up @@ -2056,3 +2061,7 @@ func (node AccessMode) Format(buf *TrackedBuffer) {
buf.WriteString(TxReadWrite)
}
}

func (load *Load) Format(buf *TrackedBuffer) {
buf.WriteString("AST node missing for Load type")
}
6 changes: 6 additions & 0 deletions go/vt/sqlparser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,12 @@ var (
output: "alter database d",
}, {
input: "create table a",
}, {
input: "load data from s3 'x.txt'",
output: "AST node missing for Load type",
}, {
input: "load data from s3 'x.txt' into table x",
output: "AST node missing for Load type",
}, {
input: "create table a (\n\t`a` int\n)",
output: "create table a (\n\ta int\n)",
Expand Down
2 changes: 2 additions & 0 deletions go/vt/sqlparser/rewriter.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading