[ https://issues.apache.org/jira/browse/HIVE-11812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15725058#comment-15725058 ]
Hive QA commented on HIVE-11812: -------------------------------- Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12830654/HIVE-11812.1.patch {color:green}SUCCESS:{color} +1 due to 1 test(s) being added or modified. {color:red}ERROR:{color} -1 due to 15 failed/errored test(s), 10769 tests executed *Failed tests:* {noformat} org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver[auto_sortmerge_join_2] (batchId=44) org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver[date_udf] (batchId=28) org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver[sample2] (batchId=5) org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver[sample4] (batchId=15) org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver[sample6] (batchId=61) org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver[sample7] (batchId=60) org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver[sample9] (batchId=38) org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver[timestamp_udf] (batchId=71) org.apache.hadoop.hive.cli.TestMiniLlapCliDriver.testCliDriver[transform_ppr2] (batchId=134) org.apache.hadoop.hive.cli.TestMiniLlapLocalCliDriver.testCliDriver[stats_based_fetch_decision] (batchId=150) org.apache.hadoop.hive.cli.TestMiniLlapLocalCliDriver.testCliDriver[vectorized_date_funcs] (batchId=150) org.apache.hadoop.hive.cli.TestMiniTezCliDriver.testCliDriver[explainanalyze_2] (batchId=92) org.apache.hadoop.hive.cli.TestSparkCliDriver.testCliDriver[date_udf] (batchId=106) org.apache.hadoop.hive.cli.TestSparkCliDriver.testCliDriver[timestamp_udf] (batchId=127) org.apache.hive.jdbc.TestJdbcWithLocalClusterSpark.testTempTable (batchId=215) {noformat} Test results: https://builds.apache.org/job/PreCommit-HIVE-Build/2437/testReport Console output: https://builds.apache.org/job/PreCommit-HIVE-Build/2437/console Test logs: http://104.198.109.242/logs/PreCommit-HIVE-Build-2437/ Messages: {noformat} Executing org.apache.hive.ptest.execution.TestCheckPhase Executing org.apache.hive.ptest.execution.PrepPhase Executing org.apache.hive.ptest.execution.ExecutionPhase Executing org.apache.hive.ptest.execution.ReportingPhase Tests exited with: TestsFailedException: 15 tests failed {noformat} This message is automatically generated. ATTACHMENT ID: 12830654 - PreCommit-HIVE-Build > datediff sometimes returns incorrect results when called with dates > ------------------------------------------------------------------- > > Key: HIVE-11812 > URL: https://issues.apache.org/jira/browse/HIVE-11812 > Project: Hive > Issue Type: Bug > Components: UDF > Affects Versions: 2.0.0 > Reporter: Nicholas Brenwald > Assignee: Chetna Chaudhari > Priority: Minor > Attachments: HIVE-11812.1.patch > > > DATEDIFF returns an incorrect result when one of the arguments is a date > type. > The Hive Language Manual provides the following signature for datediff: > {code} > int datediff(string enddate, string startdate) > {code} > I think datediff should either throw an error (if date types are not > supported), or return the correct result. > To reproduce, create a table: > {code} > create table t (c1 string, c2 date); > {code} > Assuming you have a table x containing some data, populate table t with 1 row: > {code} > insert into t select '2015-09-15', '2015-09-15' from x limit 1; > {code} > Then run the following 12 test queries: > {code} > select datediff(c1, '2015-09-14') from t; > select datediff(c1, '2015-09-15') from t; > select datediff(c1, '2015-09-16') from t; > select datediff('2015-09-14', c1) from t; > select datediff('2015-09-15', c1) from t; > select datediff('2015-09-16', c1) from t; > select datediff(c2, '2015-09-14') from t; > select datediff(c2, '2015-09-15') from t; > select datediff(c2, '2015-09-16') from t; > select datediff('2015-09-14', c2) from t; > select datediff('2015-09-15', c2) from t; > select datediff('2015-09-16', c2) from t; > {code} > The below table summarises the result. All results for column c1 (which is a > string) are correct, but when using c2 (which is a date), two of the results > are incorrect. > || Test || Expected Result || Actual Result || Passed / Failed || > |datediff(c1, '2015-09-14')| 1 | 1| Passed | > |datediff(c1, '2015-09-15')| 0 | 0| Passed | > |datediff(c1, '2015-09-16') | -1 | -1| Passed | > |datediff('2015-09-14', c1) | -1 | -1| Passed | > |datediff('2015-09-15', c1)| 0 | 0| Passed | > |datediff('2015-09-16', c1)| 1 | 1| Passed | > |datediff(c2, '2015-09-14')| 1 | 0| {color:red}Failed{color} | > |datediff(c2, '2015-09-15')| 0 | 0| Passed | > |datediff(c2, '2015-09-16') | -1 | -1| Passed | > |datediff('2015-09-14', c2) | -1 | 0 | {color:red}Failed{color} | > |datediff('2015-09-15', c2)| 0 | 0| Passed | > |datediff('2015-09-16', c2)| 1 | 1| Passed | -- This message was sent by Atlassian JIRA (v6.3.4#6332)