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

Matt Traynham commented on HIVE-10366:
--------------------------------------

Possible dupe of https://issues.apache.org/jira/browse/HIVE-9278.  Took a while 
skimming to find it.

> Multiple Date Functions inside Named Struct return the wrong values
> -------------------------------------------------------------------
>
>                 Key: HIVE-10366
>                 URL: https://issues.apache.org/jira/browse/HIVE-10366
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive
>    Affects Versions: 0.14.0
>            Reporter: Matt Traynham
>
> Using multiple date functions inside a named struct results in incorrect 
> values.  The first date function is correct.  All subsequent date functions 
> receive the value of the first date function, unless the function has a 
> different valued argument.
> As shown below, the 3rd query returns an incorrect value for 
> `month(datetime)`.  A not so pleasant workaround is to substr datetime 
> resulting in a different value (4th query).
> > DESCRIBE my_datamart;
> OK
> datetime              string
> > SELECT datetime FROM my_datamart LIMIT 1;
> OK
> 2015-04-14T00:00:00
> > SELECT named_struct('dayofmonth', day(datetime), 'monthofyear', 
> > month(datetime)), day(datetime), month(datetime) FROM my_datamart LIMIT 1;
> OK
> {"dayofmonth":14,"monthofyear":14} 14 4
> > SELECT named_struct('dayofmonth', day(datetime), 'monthofyear', 
> > month(substr(datetime, 0, 10))), day(datetime), month(datetime) FROM 
> > my_datamart LIMIT 1;
> OK
> {"dayofmonth":14,"monthofyear":4} 14  4
> I havn't tried all the other date functions, but this is happens with  
> weekofyear as well.  Looks like a caching issue...



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

Reply via email to