[ 
https://issues.apache.org/jira/browse/HIVE-13557?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15655541#comment-15655541
 ] 

Zoltan Haindrich commented on HIVE-13557:
-----------------------------------------

Thank you for your comments [~pxiong]!
I assume that the usage of UDF for this is ok...and you would prefer to merge 
the interval logics - which is perfectly reasonable.

However removing that parentheneses...and making the interval keyword optional 
at the same time makes the following rule left-recursive:
{code}
    KW_INTERVAL? k=expression qualifiers=intervalQualifiers
{code}
because for example it would permit: {{1 DAY DAY DAY}} which is problematic...

I think the following changes will be reasonable:
* make the {{INTERVAL}} keyword optional for "simple usage" - using constants 
{{ 1 + 1 DAY }} would mean {{ 1 + INTERVAL 1 DAY }} in practice
* for advanced usage (expression level); it will be mandatory: {{INTERVAL 1+1 
DAY}}.



> Make interval keyword optional while specifying DAY in interval arithmetic
> --------------------------------------------------------------------------
>
>                 Key: HIVE-13557
>                 URL: https://issues.apache.org/jira/browse/HIVE-13557
>             Project: Hive
>          Issue Type: Sub-task
>          Components: Types
>            Reporter: Ashutosh Chauhan
>            Assignee: Zoltan Haindrich
>         Attachments: HIVE-13557.1.patch, HIVE-13557.1.patch, 
> HIVE-13557.1.patch
>
>
> Currently we support expressions like: {code}
> WHERE SOLD_DATE BETWEEN ((DATE('2000-01-31'))  - INTERVAL '30' DAY) AND 
> DATE('2000-01-31')
> {code}
> We should support:
> {code}
> WHERE SOLD_DATE BETWEEN ((DATE('2000-01-31')) + (-30) DAY) AND 
> DATE('2000-01-31')
> {code}
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to