hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Traynham (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HIVE-10366) Multiple Date Functions inside Named Struct return the wrong values
Date Thu, 16 Apr 2015 18:02:59 GMT
Matt Traynham created HIVE-10366:
------------------------------------

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

Mime
View raw message