Skip to content

Commit 7f5664d

Browse files
committed
change InsertInto to InsertIntoTable
1 parent e05624f commit 7f5664d

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ query
237237
: ctes? queryNoWith
238238
;
239239

240-
insertInto
240+
insertIntoTable
241241
: INSERT OVERWRITE TABLE tableIdentifier (partitionSpec (IF NOT EXISTS)?)?
242242
| INSERT INTO TABLE? tableIdentifier partitionSpec?
243243
| INSERT OVERWRITE LOCAL? DIRECTORY path=STRING rowFormat? createFileFormat?
@@ -326,7 +326,7 @@ resource
326326
;
327327

328328
queryNoWith
329-
: insertInto? queryTerm queryOrganization #singleInsertQuery
329+
: insertIntoTable? queryTerm queryOrganization #singleInsertQuery
330330
| fromClause multiInsertQueryBody+ #multiInsertQuery
331331
;
332332

@@ -340,7 +340,7 @@ queryOrganization
340340
;
341341

342342
multiInsertQueryBody
343-
: insertInto?
343+
: insertIntoTable?
344344
querySpecification
345345
queryOrganization
346346
;

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class AstBuilder(conf: SQLConf) extends SqlBaseBaseVisitor[AnyRef] with Logging
151151
// Add organization statements.
152152
optionalMap(body.queryOrganization)(withQueryResultClauses).
153153
// Add insert.
154-
optionalMap(body.insertInto())(withInsertInto)
154+
optionalMap(body.insertIntoTable())(withInsertIntoTable)
155155
}
156156

157157
// If there are multiple INSERTS just UNION them together into one query.
@@ -170,14 +170,14 @@ class AstBuilder(conf: SQLConf) extends SqlBaseBaseVisitor[AnyRef] with Logging
170170
// Add organization statements.
171171
optionalMap(ctx.queryOrganization)(withQueryResultClauses).
172172
// Add insert.
173-
optionalMap(ctx.insertInto())(withInsertInto)
173+
optionalMap(ctx.insertIntoTable())(withInsertIntoTable)
174174
}
175175

176176
/**
177177
* Add an INSERT INTO [TABLE]/INSERT OVERWRITE TABLE operation to the logical plan.
178178
*/
179-
protected def withInsertInto(
180-
ctx: InsertIntoContext,
179+
protected def withInsertIntoTable(
180+
ctx: InsertIntoTableContext,
181181
query: LogicalPlan): LogicalPlan = withOrigin(ctx) {
182182
val tableIdent = visitTableIdentifier(ctx.tableIdentifier)
183183
val partitionKeys = Option(ctx.partitionSpec).map(visitPartitionSpec).getOrElse(Map.empty)

sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ class SparkSqlAstBuilder(conf: SQLConf) extends AstBuilder(conf) {
13661366
} else {
13671367
// CREATE VIEW ... AS INSERT INTO is not allowed.
13681368
ctx.query.queryNoWith match {
1369-
case s: SingleInsertQueryContext if s.insertInto != null =>
1369+
case s: SingleInsertQueryContext if s.insertIntoTable != null =>
13701370
operationNotAllowed("CREATE VIEW ... AS INSERT INTO", ctx)
13711371
case _: MultiInsertQueryContext =>
13721372
operationNotAllowed("CREATE VIEW ... AS FROM ... [INSERT INTO ...]+", ctx)
@@ -1505,8 +1505,8 @@ class SparkSqlAstBuilder(conf: SQLConf) extends AstBuilder(conf) {
15051505
* Add an INSERT INTO [TABLE]/INSERT OVERWRITE TABLE or INSERT INTO [LOCAL] DIRECOTRY
15061506
* operation to the logical plan.
15071507
*/
1508-
protected override def withInsertInto(ctx: InsertIntoContext,
1509-
query: LogicalPlan): LogicalPlan = withOrigin(ctx) {
1508+
protected override def withInsertIntoTable(ctx: InsertIntoTableContext,
1509+
query: LogicalPlan): LogicalPlan = withOrigin(ctx) {
15101510
val tableIdent = Option(ctx.tableIdentifier).map(visitTableIdentifier)
15111511
val partitionKeys = Option(ctx.partitionSpec).map(visitPartitionSpec).getOrElse(Map.empty)
15121512

0 commit comments

Comments
 (0)