[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 <dhyun@apple.com>
This commit is contained in:
Cheng Pan 2021-04-19 10:38:53 -07:00 committed by Dongjoon Hyun
parent d37d18dd7f
commit 0c2e9b99aa

View file

@ -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)