From 0c2e9b99aa33e952c3c4a148802c289a88d719dc Mon Sep 17 00:00:00 2001 From: Cheng Pan <379377944@qq.com> Date: Mon, 19 Apr 2021 10:38:53 -0700 Subject: [PATCH] [SPARK-35138][SQL] Remove Antlr4 workaround ### What changes were proposed in this pull request? Remove Antlr 4.7 workaround. ### Why are the changes needed? The https://github.com/antlr/antlr4/commit/ac9f7530 has been fixed in upstream, so remove the workaround to simplify code. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Existed UTs. Closes #32238 from pan3793/antlr-minor. Authored-by: Cheng Pan <379377944@qq.com> Signed-off-by: Dongjoon Hyun --- .../spark/sql/catalyst/parser/ParseDriver.scala | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParseDriver.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParseDriver.scala index 0083c67da5..ae13bf1a0c 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParseDriver.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParseDriver.scala @@ -169,18 +169,7 @@ private[parser] class UpperCaseCharStream(wrapped: CodePointCharStream) extends override def seek(where: Int): Unit = wrapped.seek(where) override def size(): Int = wrapped.size - override def getText(interval: Interval): String = { - // ANTLR 4.7's CodePointCharStream implementations have bugs when - // getText() is called with an empty stream, or intervals where - // the start > end. See - // https://github.com/antlr/antlr4/commit/ac9f7530 for one fix - // that is not yet in a released ANTLR artifact. - if (size() > 0 && (interval.b - interval.a >= 0)) { - wrapped.getText(interval) - } else { - "" - } - } + override def getText(interval: Interval): String = wrapped.getText(interval) override def LA(i: Int): Int = { val la = wrapped.LA(i)