impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Armstrong (Code Review)" <>
Subject [Impala-ASF-CR] IMPALA-3894: Changed the behavior parsing 2-digit year values
Date Fri, 28 Jul 2017 01:18:59 GMT
Tim Armstrong has posted comments on this change.

Change subject: IMPALA-3894: Changed the behavior parsing 2-digit year values

Patch Set 4:


Looks pretty good. No major concerns, we just need some tests and a bit of cleanup to make
it easier to follow.
Commit Message:

Line 16: > select from_unixtime(unix_timestamp('31-AUG-94', 'dd-MMM-yy'),'yyyyMMdd');
Can you add some tests in expr-test for some different cases to cover all of the code paths?

I think you can make the value of "now()" deterministic if you set up a RuntimeState(), and
pass in a TQueryCtx with now_string set.
File be/src/exprs/

Line 159:   dt_ctx->now = context->impl()->state()->now();
We should be able to do this during the Prepare() phase of this function. It looks like that's
implemented in UnixAndFromUnixPrepare() according to the function registry:
File be/src/runtime/

Line 449:         if (tok_len <= 2) {
You can do this on one line (see

  if (tok_len <= 2) realign_year = true;

PS4, Line 549:>date()
Let's factor this common subexpression out into a separate variable for readability.

Line 551:     dt_result->year += (century_start_year / 100) * 100;
Could you add a comment giving an example of what the value might be at this point. It's subtle..

Line 555:     if (TimestampValue(parsed_date, parsed_time) <
Could you add a comment giving an example of when we need to increment by 100?
File be/src/runtime/timestamp-parse-util.h:

Line 139:   /// Current time to determine the actual year when parsing 2-digit year token
nit: add a "." for consistency with other comments.

Line 140:   const TimestampValue* now;
Let's just store a copy of the TimestampValue inline instead of the pointer. Makes it easier
to understand who owns the memory.

To view, visit
To unsubscribe, visit

Gerrit-MessageType: comment
Gerrit-Change-Id: I5da761255915dc741f1dcc488fd4ef6ecc385896
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Tianyi Wang <>
Gerrit-Reviewer: Greg Rahn <>
Gerrit-Reviewer: Tim Armstrong <>
Gerrit-HasComments: Yes

View raw message