Skip to content

Commit 9738934

Browse files
committed
Minor refactoring, removes optional trailing ";" in the parser
1 parent bb2ab12 commit 9738934

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ class SqlParser extends AbstractSparkSQLParser {
106106

107107
// Use reflection to find the reserved words defined in this class.
108108
protected val reservedWords =
109-
this.getClass
109+
this
110+
.getClass
110111
.getMethods
111112
.filter(_.getReturnType == classOf[Keyword])
112113
.map(_.invoke(this).asInstanceOf[Keyword].str)
@@ -132,13 +133,13 @@ class SqlParser extends AbstractSparkSQLParser {
132133

133134
protected lazy val select: Parser[LogicalPlan] =
134135
SELECT ~> DISTINCT.? ~
135-
repsep(projection, ",": Parser[String]) ~
136+
repsep(projection, ",") ~
136137
(FROM ~> relations).? ~
137138
(WHERE ~> expression).? ~
138139
(GROUP ~ BY ~> rep1sep(expression, ",")).? ~
139140
(HAVING ~> expression).? ~
140141
(ORDER ~ BY ~> ordering).? ~
141-
(LIMIT ~> expression).? <~ ";".? ^^ {
142+
(LIMIT ~> expression).? ^^ {
142143
case d ~ p ~ r ~ f ~ g ~ h ~ o ~ l =>
143144
val base = r.getOrElse(NoRelation)
144145
val withFilter = f.map(f => Filter(f, base)).getOrElse(base)
@@ -153,7 +154,7 @@ class SqlParser extends AbstractSparkSQLParser {
153154
}
154155

155156
protected lazy val insert: Parser[LogicalPlan] =
156-
INSERT ~> OVERWRITE.? ~ (INTO ~> relation) ~ select <~ ";".? ^^ {
157+
INSERT ~> OVERWRITE.? ~ (INTO ~> relation) ~ select ^^ {
157158
case o ~ r ~ s => InsertIntoTable(r, Map.empty[String, Option[String]], s, o.isDefined)
158159
}
159160

0 commit comments

Comments
 (0)