> On April 5, 2017, 3:37 p.m., Ashutosh Chauhan wrote:
> > ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
> > Lines 590-592 (patched)
> > <https://reviews.apache.org/r/58181/diff/2/?file=1684715#file1684715line590>
> >
> > It will be good to not add extra tokens in grammar as it increases the
> > size of state machine. How about:
> >
> >
> > KW_IS (a=KW_NOT)? KW_DISTINCT KW_FROM
> > -> {$a !=null}? ^(EQUAL_NS)
> > -> ^(KW_NOT EQUAL_NS)
I agree and I tried not to add new tokens but I couldn't figure out how to
write grammar in such a way to avoid adding it.
For is distinct from we want AST as follows
KW_NOT
EQUAL_NS
Expr1
Expr2
isDistinctFrom rule is invoked from precedenceEqualOperator which is suppose to
return an AST for operator. This AST is further used by
precedenceEqualOperator's invoker to make an AST with returned AST as root and
with two expression as it's children. So if isDistinctFrom return this AST
KW_NOT
EQUAL_NS
invoker of precedenceEqualOperator will end up creating
KW_NOT
EQUAL_NS
Expr1
Expr2
which is not what we want.
Your above suggestion throws an exception while parsing FAILED:
RewriteEmptyStreamException token KW_NOT.
I am not sure why
- Vineet
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/58181/#review171125
-----------------------------------------------------------
On April 4, 2017, 11:05 p.m., Vineet Garg wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/58181/
> -----------------------------------------------------------
>
> (Updated April 4, 2017, 11:05 p.m.)
>
>
> Review request for hive, Ashutosh Chauhan and Jesús Camacho Rodríguez.
>
>
> Bugs: HIVE-15986
> https://issues.apache.org/jira/browse/HIVE-15986
>
>
> Repository: hive-git
>
>
> Description
> -------
>
> This patch adds support for 'is distinct from' and 'is not distinct from'.
>
>
> Diffs
> -----
>
> itests/src/test/resources/testconfiguration.properties 7a70c9c
> ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java ccfb455
>
> ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/SqlFunctionConverter.java
> 85450c9
> ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g d98a663
> ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g 8c4ee8a
> ql/src/test/queries/clientpositive/is_distinct_from.q PRE-CREATION
> ql/src/test/results/clientpositive/llap/is_distinct_from.q.out PRE-CREATION
>
>
> Diff: https://reviews.apache.org/r/58181/diff/2/
>
>
> Testing
> -------
>
> Added new tests
> Pre-commit testing
>
>
> Thanks,
>
> Vineet Garg
>
>