hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zoltan Haindrich (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-13557) Make interval keyword optional while specifying DAY in interval arithmetic
Date Tue, 06 Sep 2016 21:45:21 GMT

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

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

[~ashutoshc] [~cartershanklin]
I've tried to run the above sample query...but it failed with:
{code}
Wrong arguments '30': No matching method for class org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPDTIPlus
with (date, int)
{code}

anyway...I think if it should work...then {{intervalQualifiers}} should appear at at least
one other place than this...because this rule requires the interval keyword to work; this
one is ruled out - however I haven't found any other occurences
https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g#L294

of course I might be wrong...or I've missed something...

{{DAYS}}: I think that's optional...the standard (which I was able to access - some draft)
only requires {{DAY}} ...but supporting {{DAYS}} may make the sql statements more readable
(at the cost of reserving {{DAYS}} to be a keyword )

note: I think hplsql's interval misses a few interval keywords like {{month}} and {{day}}
https://github.com/apache/hive/blob/master/hplsql/src/main/antlr4/org/apache/hive/hplsql/Hplsql.g4#L1046

note: while I was reading the standard...the {{<interval qualifier>}} caught my attention
- it looks like a lot more sophisticated than I expected...I'm not sure it's required...so
I think it might worth a look from someone else..
oracle has some docs about this which looks more readable:
https://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements003.htm#i38598

making the interval keyword optional:
* supporting {{select date '2012-01-01' + '-30' days}} and/or {{select date '2012-01-01' -
30 days}} would be ok I think
* but supporting {{select date '2012-01-01' + (-30) days}} would be a bit more trickier...but
not impossible



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

Mime
View raw message