Skip to content

Commit d37b19c

Browse files
committed
Cheng's comments.
1 parent fd6758c commit d37b19c

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/SqlParser.scala

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,9 @@ class SqlParser extends AbstractSparkSQLParser {
146146
}
147147

148148
protected lazy val insert: Parser[LogicalPlan] =
149-
( INSERT ~> OVERWRITE ~> TABLE ~> relation ~ select ^^ {
150-
case r ~ s => InsertIntoTable(r, Map.empty[String, Option[String]], s, true)
151-
}
152-
| INSERT ~> INTO ~> TABLE ~> relation ~ select ^^ {
153-
case r ~ s => InsertIntoTable(r, Map.empty[String, Option[String]], s, false)
154-
}
155-
)
149+
INSERT ~> (OVERWRITE ^^^ true | INTO ^^^ false) ~ (TABLE ~> relation) ~ select ^^ {
150+
case o ~ r ~ s => InsertIntoTable(r, Map.empty[String, Option[String]], s, o)
151+
}
156152

157153
protected lazy val projection: Parser[Expression] =
158154
expression ~ (AS.? ~> ident.?) ^^ {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,13 +318,13 @@ private[sql] abstract class SparkStrategies extends QueryPlanner[SparkPlan] {
318318
ExecutedCommand(
319319
CreateTempTableUsing(
320320
tableName, userSpecifiedSchema, provider, opts, allowExisting)) :: Nil
321-
case CreateTableUsing(_, _, _, false, _, _) =>
321+
case c: CreateTableUsing if !c.temporary =>
322322
sys.error("Tables created with SQLContext must be TEMPORARY. Use a HiveContext instead.")
323323

324324
case CreateTableUsingAsSelect(tableName, provider, true, options, allowExisting, query) =>
325325
ExecutedCommand(
326326
CreateTempTableUsingAsSelect(tableName, provider, options, allowExisting, query)) :: Nil
327-
case CreateTableUsingAsSelect(_, _, false, _, _, _) =>
327+
case c: CreateTableUsingAsSelect if !c.temporary =>
328328
sys.error("Tables created with SQLContext must be TEMPORARY. Use a HiveContext instead.")
329329

330330
case _ => Nil

0 commit comments

Comments
 (0)