You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by viirya <gi...@git.apache.org> on 2016/01/06 17:24:56 UTC

[GitHub] spark pull request: Better support of parentheses in partition by.

GitHub user viirya opened a pull request:

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

    Better support of parentheses in partition by.

    JIRA: https://issues.apache.org/jira/browse/SPARK-12577

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

    $ git pull https://github.com/viirya/spark-1 fix-parentheses

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

    https://github.com/apache/spark/pull/10620.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 #10620
    
----
commit ae1aa8a9d9784431c3011a64485ecd3bef267813
Author: Liang-Chi Hsieh <vi...@gmail.com>
Date:   2016-01-06T16:23:07Z

    Better support of parentheses in partition by.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

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


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

Posted by davies <gi...@git.apache.org>.
Github user davies commented on the pull request:

    https://github.com/apache/spark/pull/10620#issuecomment-169473010
  
    @viirya Since you need to rebase this PR, I will help to create a PR only for splitting IdentifiersParser.g, #10624


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

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


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#issuecomment-170067289
  
    LGTM


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#discussion_r49259620
  
    --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala ---
    @@ -936,6 +936,35 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
         assert(e.getMessage.contains("Distinct window functions are not supported"))
       }
     
    +  test("window function: better support of parentheses") {
    +    val data = Seq(
    +      WindowData(1, "a", 5),
    +      WindowData(2, "a", 6),
    +      WindowData(3, "b", 7),
    +      WindowData(4, "b", 8),
    +      WindowData(5, "c", 9),
    +      WindowData(6, "c", 10)
    +    )
    +    sparkContext.parallelize(data).toDF().registerTempTable("windowData")
    +
    +    checkAnswer(
    +      sql(
    +        """
    +          |select month, area, product,
    +          |sum(product + 1) over (partition by ((1) + (1 - 1) -
    +          |(2 * 1 / 2) + (1) + product - (product)) order by 2)
    --- End diff --
    
    Putting this query into the test is because we want to make sure some corner cases passed. E.g., (expression) op (expression op expression). I will try simpler ones.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#issuecomment-170199897
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#issuecomment-169403644
  
    **[Test build #48861 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/48861/consoleFull)** for PR 10620 at commit [`ae1aa8a`](https://github.com/apache/spark/commit/ae1aa8a9d9784431c3011a64485ecd3bef267813).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#issuecomment-169381098
  
    @viirya what is the reason for breaking up the ```identifiers_parser.g```? Shall we - at least - wait with doing until https://github.com/apache/spark/pull/10583 is in, and do this in a separate ticket?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#discussion_r49259453
  
    --- Diff: sql/catalyst/src/main/antlr3/org/apache/spark/sql/catalyst/parser/ExpressionParser.g ---
    @@ -223,7 +223,12 @@ precedenceUnaryPrefixExpression
         ;
     
     precedenceUnarySuffixExpression
    -    : precedenceUnaryPrefixExpression (a=KW_IS nullCondition)?
    +    :
    +    (
    +    (LPAREN precedenceUnaryPrefixExpression RPAREN) => LPAREN precedenceUnaryPrefixExpression (a=KW_IS nullCondition)? RPAREN
    --- End diff --
    
    Yes. I think so.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#issuecomment-170199833
  
    **[Test build #49037 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/49037/consoleFull)** for PR 10620 at commit [`119a055`](https://github.com/apache/spark/commit/119a055c7c3749ca6014635d280e3a28324e3b45).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#discussion_r49216358
  
    --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala ---
    @@ -936,6 +936,35 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
         assert(e.getMessage.contains("Distinct window functions are not supported"))
       }
     
    +  test("window function: better support of parentheses") {
    +    val data = Seq(
    +      WindowData(1, "a", 5),
    +      WindowData(2, "a", 6),
    +      WindowData(3, "b", 7),
    +      WindowData(4, "b", 8),
    +      WindowData(5, "c", 9),
    +      WindowData(6, "c", 10)
    +    )
    +    sparkContext.parallelize(data).toDF().registerTempTable("windowData")
    +
    +    checkAnswer(
    +      sql(
    +        """
    +          |select month, area, product,
    +          |sum(product + 1) over (partition by ((1) + (1 - 1) -
    +          |(2 * 1 / 2) + (1) + product - (product)) order by 2)
    --- End diff --
    
    This test case should be also moved to CatalystQlSuite (we are going to have more and more, so they should run as fast as possible) 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the pull request:

    https://github.com/apache/spark/pull/10620#issuecomment-169383102
  
    @hvanhovell I am ok to wait until #10583 is in. If you are asking to split identifiers_parser.g to two parts in a separate ticket, I am also ok for that. Then this one can wait for it too.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

Posted by davies <gi...@git.apache.org>.
Github user davies commented on the pull request:

    https://github.com/apache/spark/pull/10620#issuecomment-170200154
  
    LGTM, merging into master, thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#discussion_r49215653
  
    --- Diff: sql/catalyst/src/main/antlr3/org/apache/spark/sql/catalyst/parser/ExpressionParser.g ---
    @@ -223,7 +223,12 @@ precedenceUnaryPrefixExpression
         ;
     
     precedenceUnarySuffixExpression
    -    : precedenceUnaryPrefixExpression (a=KW_IS nullCondition)?
    +    :
    +    (
    +    (LPAREN precedenceUnaryPrefixExpression RPAREN) => LPAREN precedenceUnaryPrefixExpression (a=KW_IS nullCondition)? RPAREN
    --- End diff --
    
    Does this support `(a  is null)` ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#issuecomment-169381021
  
    **[Test build #48861 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/48861/consoleFull)** for PR 10620 at commit [`ae1aa8a`](https://github.com/apache/spark/commit/ae1aa8a9d9784431c3011a64485ecd3bef267813).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#issuecomment-169381357
  
    @viirya what line(s) did you change? It is quite hard to see what has changed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#issuecomment-169432492
  
    @viirya I missed your comment on splitting the file. That makes perfect sense.
    
    @davies ```code too large``` error viirya is hitting, looks similar to the problems you are having in https://github.com/apache/spark/pull/10622.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#issuecomment-169632731
  
    **[Test build #48929 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/48929/consoleFull)** for PR 10620 at commit [`d0511c0`](https://github.com/apache/spark/commit/d0511c015b6c4bb6ee873aaeaa88daee5d21a36c).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#issuecomment-169387016
  
    @viirya thanks. Could you also explain why you feel that we need to split up the grammar?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#issuecomment-169610656
  
    **[Test build #48929 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/48929/consoleFull)** for PR 10620 at commit [`d0511c0`](https://github.com/apache/spark/commit/d0511c015b6c4bb6ee873aaeaa88daee5d21a36c).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#issuecomment-169404350
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the pull request:

    https://github.com/apache/spark/pull/10620#issuecomment-169382272
  
    @hvanhovell I just modified `precedenceUnarySuffixExpression`. But the generated java file will have "code too large" error. So I need to split it to two files.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#discussion_r48977585
  
    --- Diff: sql/hive/src/main/antlr3/org/apache/spark/sql/parser/ExpressionParser.g ---
    @@ -0,0 +1,509 @@
    +/**
    +   Licensed to the Apache Software Foundation (ASF) under one or more 
    +   contributor license agreements.  See the NOTICE file distributed with 
    +   this work for additional information regarding copyright ownership.
    +   The ASF licenses this file to You under the Apache License, Version 2.0
    +   (the "License"); you may not use this file except in compliance with 
    +   the License.  You may obtain a copy of the License at
    +
    +       http://www.apache.org/licenses/LICENSE-2.0
    +
    +   Unless required by applicable law or agreed to in writing, software
    +   distributed under the License is distributed on an "AS IS" BASIS,
    +   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +   See the License for the specific language governing permissions and
    +   limitations under the License.
    +*/
    +parser grammar ExpressionParser;
    +
    +options
    +{
    +output=AST;
    +ASTLabelType=CommonTree;
    +backtrack=false;
    +k=3;
    +}
    +
    +@members {
    +  @Override
    +  public Object recoverFromMismatchedSet(IntStream input,
    +      RecognitionException re, BitSet follow) throws RecognitionException {
    +    throw re;
    +  }
    +  @Override
    +  public void displayRecognitionError(String[] tokenNames,
    +      RecognitionException e) {
    +    gParent.errors.add(new ParseError(gParent, e, tokenNames));
    +  }
    +  protected boolean useSQL11ReservedKeywordsForIdentifier() {
    +    return gParent.useSQL11ReservedKeywordsForIdentifier();
    +  }
    +}
    +
    +@rulecatch {
    +catch (RecognitionException e) {
    +  throw e;
    +}
    +}
    +
    +//-----------------------------------------------------------------------------------
    +
    +constant
    +@init { gParent.pushMsg("constant", state); }
    +@after { gParent.popMsg(state); }
    +    :
    +    Number
    +    | dateLiteral
    +    | timestampLiteral
    +    | intervalLiteral
    +    | StringLiteral
    +    | stringLiteralSequence
    +    | BigintLiteral
    +    | SmallintLiteral
    +    | TinyintLiteral
    +    | DecimalLiteral
    +    | charSetStringLiteral
    +    | booleanValue
    +    ;
    +
    +stringLiteralSequence
    +    :
    +    StringLiteral StringLiteral+ -> ^(TOK_STRINGLITERALSEQUENCE StringLiteral StringLiteral+)
    +    ;
    +
    +charSetStringLiteral
    +@init { gParent.pushMsg("character string literal", state); }
    +@after { gParent.popMsg(state); }
    +    :
    +    csName=CharSetName csLiteral=CharSetLiteral -> ^(TOK_CHARSETLITERAL $csName $csLiteral)
    +    ;
    +
    +dateLiteral
    +    :
    +    KW_DATE StringLiteral ->
    +    {
    +      // Create DateLiteral token, but with the text of the string value
    +      // This makes the dateLiteral more consistent with the other type literals.
    +      adaptor.create(TOK_DATELITERAL, $StringLiteral.text)
    +    }
    +    |
    +    KW_CURRENT_DATE -> ^(TOK_FUNCTION KW_CURRENT_DATE)
    +    ;
    +
    +timestampLiteral
    +    :
    +    KW_TIMESTAMP StringLiteral ->
    +    {
    +      adaptor.create(TOK_TIMESTAMPLITERAL, $StringLiteral.text)
    +    }
    +    |
    +    KW_CURRENT_TIMESTAMP -> ^(TOK_FUNCTION KW_CURRENT_TIMESTAMP)
    +    ;
    +
    +intervalLiteral
    +    :
    +    KW_INTERVAL StringLiteral qualifiers=intervalQualifiers ->
    +    {
    +      adaptor.create($qualifiers.tree.token.getType(), $StringLiteral.text)
    +    }
    +    ;
    +
    +intervalQualifiers
    +    :
    +    KW_YEAR KW_TO KW_MONTH -> TOK_INTERVAL_YEAR_MONTH_LITERAL
    +    | KW_DAY KW_TO KW_SECOND -> TOK_INTERVAL_DAY_TIME_LITERAL
    +    | KW_YEAR -> TOK_INTERVAL_YEAR_LITERAL
    +    | KW_MONTH -> TOK_INTERVAL_MONTH_LITERAL
    +    | KW_DAY -> TOK_INTERVAL_DAY_LITERAL
    +    | KW_HOUR -> TOK_INTERVAL_HOUR_LITERAL
    +    | KW_MINUTE -> TOK_INTERVAL_MINUTE_LITERAL
    +    | KW_SECOND -> TOK_INTERVAL_SECOND_LITERAL
    +    ;
    +
    +expression
    +@init { gParent.pushMsg("expression specification", state); }
    +@after { gParent.popMsg(state); }
    +    :
    +    precedenceOrExpression
    +    ;
    +
    +atomExpression
    +    :
    +    (KW_NULL) => KW_NULL -> TOK_NULL
    +    | (constant) => constant
    +    | castExpression
    +    | caseExpression
    +    | whenExpression
    +    | (functionName LPAREN) => function
    +    | tableOrColumn
    +    | LPAREN! expression RPAREN!
    +    ;
    +
    +
    +precedenceFieldExpression
    +    :
    +    atomExpression ((LSQUARE^ expression RSQUARE!) | (DOT^ identifier))*
    +    ;
    +
    +precedenceUnaryOperator
    +    :
    +    PLUS | MINUS | TILDE
    +    ;
    +
    +nullCondition
    +    :
    +    KW_NULL -> ^(TOK_ISNULL)
    +    | KW_NOT KW_NULL -> ^(TOK_ISNOTNULL)
    +    ;
    +
    +precedenceUnaryPrefixExpression
    +    :
    +    (precedenceUnaryOperator^)* precedenceFieldExpression
    +    ;
    +
    +precedenceUnarySuffixExpression
    +    :
    +    (
    +    (LPAREN precedenceUnaryPrefixExpression RPAREN) => LPAREN precedenceUnaryPrefixExpression (a=KW_IS nullCondition)? RPAREN
    +    |
    +    precedenceUnaryPrefixExpression (a=KW_IS nullCondition)?
    --- End diff --
    
    @hvanhovell I made the change here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#issuecomment-170189419
  
    **[Test build #49037 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/49037/consoleFull)** for PR 10620 at commit [`119a055`](https://github.com/apache/spark/commit/119a055c7c3749ca6014635d280e3a28324e3b45).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

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


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

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


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#issuecomment-169632979
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the pull request:

    https://github.com/apache/spark/pull/10620#issuecomment-169508801
  
    @davies thanks and I saw that pr was merged. O will rebase this pr later.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-12577][SQL] Better support of parenthes...

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

    https://github.com/apache/spark/pull/10620#discussion_r49240283
  
    --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala ---
    @@ -936,6 +936,35 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
         assert(e.getMessage.contains("Distinct window functions are not supported"))
       }
     
    +  test("window function: better support of parentheses") {
    +    val data = Seq(
    +      WindowData(1, "a", 5),
    +      WindowData(2, "a", 6),
    +      WindowData(3, "b", 7),
    +      WindowData(4, "b", 8),
    +      WindowData(5, "c", 9),
    +      WindowData(6, "c", 10)
    +    )
    +    sparkContext.parallelize(data).toDF().registerTempTable("windowData")
    +
    +    checkAnswer(
    +      sql(
    +        """
    +          |select month, area, product,
    +          |sum(product + 1) over (partition by ((1) + (1 - 1) -
    +          |(2 * 1 / 2) + (1) + product - (product)) order by 2)
    --- End diff --
    
    Can we replace this SQL query with several simpler and more obvious ones? For example, `... (partition by (product) + 1) ...`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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