Skip to content

Commit 440dcbd

Browse files
committed
added multi-line to single comments
1 parent 9d354c2 commit 440dcbd

File tree

2 files changed

+11
-1
lines changed
  • sql
    • catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser
    • hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver

2 files changed

+11
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1814,7 +1814,7 @@ fragment LETTER
18141814
;
18151815

18161816
SIMPLE_COMMENT
1817-
: '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN)
1817+
: '--' ('\\\n' | ~[\r\n])* '\r'? '\n'? -> channel(HIDDEN)
18181818
;
18191819

18201820
BRACKETED_COMMENT

sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/CliSuite.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,4 +464,14 @@ class CliSuite extends SparkFunSuite with BeforeAndAfterAll with BeforeAndAfterE
464464
| 2;""".stripMargin -> "testcomment"
465465
)
466466
}
467+
468+
test("SPARK-30049 Should not complain for quotes in commented with multi-lines") {
469+
runCliWithin(3.minute)(
470+
"""SELECT concat('test', 'comment') -- someone's comment here \
471+
| comment continues here with single ' quote \
472+
| extra ' \
473+
|;""".stripMargin -> "testcomment"
474+
)
475+
}
476+
467477
}

0 commit comments

Comments
 (0)