Zoltan Borok-Nagy has posted comments on this change. ( http://gerrit.cloudera.org:8080/11183 )
Change subject: IMPALA-7521: Speed up sub-second unix time->TimestampValue conversions ...................................................................... Patch Set 16: (20 comments) Nothing serious, but found quite a few nits. http://gerrit.cloudera.org:8080/#/c/11183/16//COMMIT_MSG Commit Message: http://gerrit.cloudera.org:8080/#/c/11183/16//COMMIT_MSG@10 PS16, Line 10: do typo: to http://gerrit.cloudera.org:8080/#/c/11183/16//COMMIT_MSG@51 PS16, Line 51: Maybe you could mention your results about the speedup. http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/benchmarks/convert-timestamp-benchmark.cc File be/src/benchmarks/convert-timestamp-benchmark.cc: http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/benchmarks/convert-timestamp-benchmark.cc@254 PS16, Line 254: v1 nit: use better names, e.g.: v1 => expected_values, or reference_values v2 => actual_values/vector http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/benchmarks/convert-timestamp-benchmark.cc@592 PS16, Line 592: (uint64_t)MICROS_PER_SEC nit: please use static_cast http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/benchmarks/convert-timestamp-benchmark.cc@604 PS16, Line 604: && nanos == other.nanos If nanos are more variable in the benchmarks then maybe it'd be worth to check it first then the seconds. http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/benchmarks/convert-timestamp-benchmark.cc@627 PS16, Line 627: / ONE_BILLIONTH * NANOS_PER_SEC ? http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/benchmarks/convert-timestamp-benchmark.cc@634 PS16, Line 634: / ONE_BILLIONTH * NANOS_PER_SEC ? http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/exprs/expr-test.cc File be/src/exprs/expr-test.cc: http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/exprs/expr-test.cc@6508 PS16, Line 6508: ScopedLocalUnixTimestampConversionOverride I just noticed that this class has a bug. It doesn't reset FLAGS_use_local_tz_for_unix_timestamp_conversions to its original value in its destructor, but it resets it to false. http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/runtime/timestamp-test.cc File be/src/runtime/timestamp-test.cc: http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/runtime/timestamp-test.cc@241 PS16, Line 241: 1000 nit: MILLIS_PER_SEC? http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/runtime/timestamp-test.cc@241 PS16, Line 241: (double) seconds + (double) nit: static_cast http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/runtime/timestamp-test.cc@250 PS16, Line 250: 8 nit: please give it a name, e.g. MARGIN_OF_ERROR http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/runtime/timestamp-test.cc@261 PS16, Line 261: 1000 nit: MILLIS_PER_SEC from gutil/walltime.h? http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/runtime/timestamp-test.cc@266 PS16, Line 266: 1000 nit: MICROS_PER_MILLI from walltime.h? http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/runtime/timestamp-test.cc@280 PS16, Line 280: 60*60 it appears twice http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/runtime/timestamp-value.h File be/src/runtime/timestamp-value.h: http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/runtime/timestamp-value.h@188 PS16, Line 188: (int64_t)1000*1000*1000 nit: static_cast or, NANOS_PER_SEC? it is already a long long. http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/runtime/timestamp-value.h@318 PS16, Line 318: int64_t SplitTime(int64_t* ticks) Maybe it would be cleaner to change the signature to void SplitTime(const int64_t ticks, int64_t* whole_part, int64_t* remainder); We'd end up using more int64s, but I don't think it's critical. http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/runtime/timestamp-value.h@317 PS16, Line 317: template <int64_t GRANULARITY> : inline static int64_t SplitTime(int64_t* ticks) { : int64_t result = *ticks / GRANULARITY; : *ticks %= GRANULARITY; : if (*ticks < 0) { : result--; : *ticks += GRANULARITY; : } : return result; : } We have this function here and in the benchmark. Can we place it to some common header? http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/runtime/timestamp-value.inline.h File be/src/runtime/timestamp-value.inline.h: http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/runtime/timestamp-value.inline.h@39 PS16, Line 39: EPOCH + boost::gregorian::date_duration(days), nit: it fits to the previous line http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/runtime/timestamp-value.inline.h@62 PS16, Line 62: / ONE_BILLIONTH * NANOS_PER_SEC ? I think it expresses the intention better. http://gerrit.cloudera.org:8080/#/c/11183/16/be/src/runtime/timestamp-value.inline.h@70 PS16, Line 70: [0,1) [0, NANOS_PER_SEC) -- To view, visit http://gerrit.cloudera.org:8080/11183 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I572b5876b979ddae58165bd40d5b008ce9d7a4aa Gerrit-Change-Number: 11183 Gerrit-PatchSet: 16 Gerrit-Owner: Csaba Ringhofer <csringho...@cloudera.com> Gerrit-Reviewer: Attila Jeges <atti...@cloudera.com> Gerrit-Reviewer: Csaba Ringhofer <csringho...@cloudera.com> Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Gerrit-Reviewer: Zoltan Borok-Nagy <borokna...@cloudera.com> Gerrit-Comment-Date: Wed, 05 Sep 2018 12:38:12 +0000 Gerrit-HasComments: Yes