Zach Amsden has posted comments on this change. ( http://gerrit.cloudera.org:8080/8311 )
Change subject: IMPALA-5607: Add additional units to EXTRACT, DATE_PART, TRUNC ...................................................................... Patch Set 2: (6 comments) Overall this looks good - and thank you for the tests. It is worth debating whether NANOSECONDs should be supported at all - let's do that in the JIRA. http://gerrit.cloudera.org:8080/#/c/8311/2/be/src/exprs/expr-test.cc File be/src/exprs/expr-test.cc: http://gerrit.cloudera.org:8080/#/c/8311/2/be/src/exprs/expr-test.cc@5959 PS2, Line 5959: TestStringValue( I don't think the additional test cases add any value unless you add greater precision, i.e. "cast(trunc(cast('2012-09-10 07:02:03.1234' as timestamp), 'SS') as string)" http://gerrit.cloudera.org:8080/#/c/8311/2/be/src/exprs/udf-builtins-ir.cc File be/src/exprs/udf-builtins-ir.cc: http://gerrit.cloudera.org:8080/#/c/8311/2/be/src/exprs/udf-builtins-ir.cc@120 PS2, Line 120: return time.fractional_seconds() + time.seconds() * 1000 * 1000 * 1000; > The seconds field, including fractional parts, multiplied by 1 000 000 000; Use NANOS_PER_SEC http://gerrit.cloudera.org:8080/#/c/8311/2/be/src/exprs/udf-builtins-ir.cc@125 PS2, Line 125: return ExtractNanosecond(time) / 1000; Instead of dividing the result of another function, these should be implement directly, i.e. time.fractional_seconds() / NANOS_PER_MICRO + time.seconds() * MICROS_PER_SEC http://gerrit.cloudera.org:8080/#/c/8311/2/be/src/exprs/udf-builtins-ir.cc@130 PS2, Line 130: return ExtractMicrosecond(time) / 1000; same comment applies http://gerrit.cloudera.org:8080/#/c/8311/2/be/src/exprs/udf-builtins-ir.cc@154 PS2, Line 154: BigIntVal > Return type should be changed from INT to BIGINT because INT data type's ra We only need to change this if we actually implement nanosecond units for EXTRACT; no other referenced system in the JIRA currently supports that, so it is worth debating whether we should or not. http://gerrit.cloudera.org:8080/#/c/8311/2/common/thrift/Exprs.thrift File common/thrift/Exprs.thrift: http://gerrit.cloudera.org:8080/#/c/8311/2/common/thrift/Exprs.thrift@92 PS2, Line 92: MILLISECONDS, We shouldn't have redundant field definitions here; instead we should be lenient with parsing and convert MILISECONDS to MILISECOND. -- To view, visit http://gerrit.cloudera.org:8080/8311 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: If23ea310ddcc5c1c806b2b1ac24d24a4bd6aa4d9 Gerrit-Change-Number: 8311 Gerrit-PatchSet: 2 Gerrit-Owner: Kim Jin Chul <[email protected]> Gerrit-Reviewer: Greg Rahn <[email protected]> Gerrit-Reviewer: Kim Jin Chul <[email protected]> Gerrit-Reviewer: Zach Amsden <[email protected]> Gerrit-Comment-Date: Thu, 26 Oct 2017 23:13:01 +0000 Gerrit-HasComments: Yes
