You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by henryr <gi...@git.apache.org> on 2017/10/25 23:14:52 UTC

[GitHub] spark pull request #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warn...

GitHub user henryr opened a pull request:

    https://github.com/apache/spark/pull/19578

    [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings

    ## What changes were proposed in this pull request?
    
    Fix three deprecation warnings introduced by move to ANTLR 4.7:
    
    * Use ParserRuleContext.addChild(TerminalNode) in preference to
      deprecated ParserRuleContext.addChild(Token) interface.
    * TokenStream.reset() is deprecated in favour of seek(0)
    * Replace use of deprecated ANTLRInputStream with stream returned by
      CharStreams.fromString()
    
    The last item changed the way we construct ANTLR's input stream (from
    direct instantiation to factory construction), so necessitated a change
    to how we override the LA() method to always return an upper-case
    char. The ANTLR object is now wrapped, rather than inherited-from.
    
    * Also fix incorrect usage of CharStream.getText() which expects the rhs
      of the supplied interval to be the last char to be returned, i.e. the
      interval is inclusive, and work around bug in ANTLR 4.7 where empty
      streams or intervals may cause getText() to throw an error.
    
    ## How was this patch tested?
    
    Ran all the sql tests. Confirmed that LA() override has coverage by
    breaking it, and noting that tests failed.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/henryr/spark spark-21983

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/19578.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #19578
    
----
commit 6c6b1385ead60d1998dac626ccf0a8f2ba203abd
Author: Henry Robinson <he...@apache.org>
Date:   2017-10-24T20:59:05Z

    [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings
    
     ## What changes were proposed in this pull request?
    
    Fix three deprecation warnings introduced by move to ANTLR 4.7:
    
    * Use ParserRuleContext.addChild(TerminalNode) in preference to
      deprecated ParserRuleContext.addChild(Token) interface.
    * TokenStream.reset() is deprecated in favour of seek(0)
    * Replace use of deprecated ANTLRInputStream with stream returned by
      CharStreams.fromString()
    
    The last item changed the way we construct ANTLR's input stream (from
    direct instantiation to factory construction), so necessitated a change
    to how we override the LA() method to always return an upper-case
    char. The ANTLR object is now wrapped, rather than inherited-from.
    
    * Also fix incorrect usage of CharStream.getText() which expects the rhs
      of the supplied interval to be the last char to be returned, i.e. the
      interval is inclusive, and work around bug in ANTLR 4.7 where empty
      streams or intervals may cause getText() to throw an error.
    
     ## How was this patch tested?
    
    Ran all the sql tests. Confirmed that LA() override has coverage by
    breaking it, and noting that tests failed.

----


---

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


[GitHub] spark issue #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19578
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/83133/
    Test PASSed.


---

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


[GitHub] spark issue #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19578
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/83065/
    Test PASSed.


---

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


[GitHub] spark pull request #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warn...

Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19578#discussion_r147380192
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParserUtils.scala ---
    @@ -32,7 +32,7 @@ object ParserUtils {
       /** Get the command which created the token. */
       def command(ctx: ParserRuleContext): String = {
         val stream = ctx.getStart.getInputStream
    -    stream.getText(Interval.of(0, stream.size()))
    +    stream.getText(Interval.of(0, stream.size() - 1))
    --- End diff --
    
    Is this a bug fix?


---

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


[GitHub] spark pull request #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warn...

Posted by henryr <gi...@git.apache.org>.
Github user henryr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19578#discussion_r147463093
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParseDriver.scala ---
    @@ -244,11 +266,12 @@ case object PostProcessor extends SqlBaseBaseListener {
         val parent = ctx.getParent
         parent.removeLastChild()
         val token = ctx.getChild(0).getPayload.asInstanceOf[Token]
    -    parent.addChild(f(new CommonToken(
    +    var newToken = new CommonToken(
    --- End diff --
    
    Done


---

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


[GitHub] spark issue #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19578
  
    Can one of the admins verify this patch?


---

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


[GitHub] spark issue #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19578
  
    **[Test build #83133 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83133/testReport)** for PR 19578 at commit [`c572154`](https://github.com/apache/spark/commit/c57215478e324d20b3bcbc4985f2bbf8f2f69a2b).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19578
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark pull request #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warn...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/19578


---

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


[GitHub] spark issue #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the issue:

    https://github.com/apache/spark/pull/19578
  
    Merged to master


---

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


[GitHub] spark issue #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19578
  
    **[Test build #83086 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83086/testReport)** for PR 19578 at commit [`6c6b138`](https://github.com/apache/spark/commit/6c6b1385ead60d1998dac626ccf0a8f2ba203abd).


---

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


[GitHub] spark pull request #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warn...

Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19578#discussion_r147381885
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParseDriver.scala ---
    @@ -151,9 +152,30 @@ object CatalystSqlParser extends AbstractSqlParser {
      * have the ANTLRNoCaseStringStream implementation.
      */
     
    -private[parser] class ANTLRNoCaseStringStream(input: String) extends ANTLRInputStream(input) {
    +private[parser] class ANTLRNoCaseStringStream(wrapped: CodePointCharStream) extends CharStream {
    --- End diff --
    
    Maybe we should rename this to matter match what it is actually doing. `NoCaseCharStream`?


---

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


[GitHub] spark issue #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19578
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/83086/
    Test PASSed.


---

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


[GitHub] spark pull request #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warn...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19578#discussion_r147372575
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParseDriver.scala ---
    @@ -244,11 +266,12 @@ case object PostProcessor extends SqlBaseBaseListener {
         val parent = ctx.getParent
         parent.removeLastChild()
         val token = ctx.getChild(0).getPayload.asInstanceOf[Token]
    -    parent.addChild(f(new CommonToken(
    +    var newToken = new CommonToken(
    --- End diff --
    
    Nit: `val`?


---

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


[GitHub] spark pull request #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warn...

Posted by henryr <gi...@git.apache.org>.
Github user henryr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19578#discussion_r147462424
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParseDriver.scala ---
    @@ -151,9 +152,30 @@ object CatalystSqlParser extends AbstractSqlParser {
      * have the ANTLRNoCaseStringStream implementation.
      */
     
    -private[parser] class ANTLRNoCaseStringStream(input: String) extends ANTLRInputStream(input) {
    +private[parser] class ANTLRNoCaseStringStream(wrapped: CodePointCharStream) extends CharStream {
    --- End diff --
    
    Good idea - I went with UpperCaseCharStream.


---

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


[GitHub] spark issue #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19578
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19578
  
    **[Test build #83065 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83065/testReport)** for PR 19578 at commit [`6c6b138`](https://github.com/apache/spark/commit/6c6b1385ead60d1998dac626ccf0a8f2ba203abd).


---

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


[GitHub] spark pull request #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warn...

Posted by henryr <gi...@git.apache.org>.
Github user henryr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19578#discussion_r147463751
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParserUtils.scala ---
    @@ -32,7 +32,7 @@ object ParserUtils {
       /** Get the command which created the token. */
       def command(ctx: ParserRuleContext): String = {
         val stream = ctx.getStart.getInputStream
    -    stream.getText(Interval.of(0, stream.size()))
    +    stream.getText(Interval.of(0, stream.size() - 1))
    --- End diff --
    
    Yes - the RHS of the interval should correspond to the last char we want `getText()` to return. the previous stream implementation would silently bound the RHS of the interval to the last char in the stream, but the new implementation can fail if the RHS is off the end of the stream. The interface documentation says that this shouldn't be considered a bug in ANTLR (even though it's pretty unfriendly).


---

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


[GitHub] spark issue #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19578
  
    **[Test build #83133 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83133/testReport)** for PR 19578 at commit [`c572154`](https://github.com/apache/spark/commit/c57215478e324d20b3bcbc4985f2bbf8f2f69a2b).


---

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


[GitHub] spark issue #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings

Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on the issue:

    https://github.com/apache/spark/pull/19578
  
    ok to test


---

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


[GitHub] spark issue #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the issue:

    https://github.com/apache/spark/pull/19578
  
    Jenkins, add to whitelist


---

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


[GitHub] spark issue #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19578
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19578
  
    **[Test build #83086 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83086/testReport)** for PR 19578 at commit [`6c6b138`](https://github.com/apache/spark/commit/6c6b1385ead60d1998dac626ccf0a8f2ba203abd).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #19578: [SPARK-21983][SQL] Fix Antlr 4.7 deprecation warnings

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19578
  
    **[Test build #83065 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83065/testReport)** for PR 19578 at commit [`6c6b138`](https://github.com/apache/spark/commit/6c6b1385ead60d1998dac626ccf0a8f2ba203abd).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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