You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/04/01 08:02:09 UTC

[GitHub] [spark] dilipbiswal commented on a change in pull request #21334: [SPARK-24345][SQL]Improve ParseError stop location when offending symbol is a token

dilipbiswal commented on a change in pull request #21334: [SPARK-24345][SQL]Improve ParseError stop location when offending symbol is a token
URL: https://github.com/apache/spark/pull/21334#discussion_r270752136
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParseDriver.scala
 ##########
 @@ -203,8 +203,17 @@ case object ParseErrorListener extends BaseErrorListener {
       charPositionInLine: Int,
       msg: String,
       e: RecognitionException): Unit = {
-    val position = Origin(Some(line), Some(charPositionInLine))
-    throw new ParseException(None, msg, position, position)
+    val (start, stop) = offendingSymbol match {
+      case token: CommonToken =>
+        val start = Origin(Some(line), Some(token.getCharPositionInLine))
 
 Review comment:
   seems like computation of `start` can be moved outside ? Only the computation of stop is different between commonToken and non common tokens ?
   
   Also, just for my understanding, can you please briefly explain the difference between the common token and other ones ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org