Taras Bobrovytsky has posted comments on this change. Change subject: IMPALA-3163: Fix Decimal to Timestamp casting ......................................................................
Patch Set 5: (11 comments) http://gerrit.cloudera.org:8080/#/c/2791/5/be/src/exprs/decimal-operators-ir.cc File be/src/exprs/decimal-operators-ir.cc: Line 561: // What is the right way to store multiple variables? > Store a struct with whatever fields you need. Done Line 566: for (int i = 0; i < 9 - scale; i++) { > we prefer pre-increments, i.e. ++i here and elsewhere Got rid of the for loop. Line 572: *coeffs = (uint64_t)mult << 32 | div; > Why not make mult a uint64_t to begin with? Also, we generally avoid C-styl It's a struct now. Line 580: uint64_t* coeffs = reinterpret_cast<uint64_t*>( > const uint64_t* Done Line 581: context->GetFunctionState(FunctionContext::THREAD_LOCAL)); > indent 4 Done Line 583: int div = ((uint64_t)*coeffs << 32) >> 32; > why not precompute these directly? Done Line 591: // According to my benchmark, this implementation is about 1% faster than the > mention more details about this benchmark as well as your findings in the c Done Line 628: // What is that it has to be uint8_t here (instead of uint64_t)? > arbitrary choice of implementing ctx->Free() ok, thanks http://gerrit.cloudera.org:8080/#/c/2791/5/be/src/exprs/decimal-operators.h File be/src/exprs/decimal-operators.h: Line 55: static void CastToTimestampValPrepare( > please wrap consistently by moving ctx one line up Done http://gerrit.cloudera.org:8080/#/c/2791/5/fe/src/main/java/com/cloudera/impala/analysis/CastExpr.java File fe/src/main/java/com/cloudera/impala/analysis/CastExpr.java: Line 157: if(toType.isTimestamp() && fromType.isDecimal()) { > formatting: space after if Removed these changes. http://gerrit.cloudera.org:8080/#/c/2791/5/testdata/workloads/functional-query/queries/QueryTest/exprs.test File testdata/workloads/functional-query/queries/QueryTest/exprs.test: Line 2459: select cast(cast(1457473016.1230 as decimal(17,4)) as timestamp) > Move this into expr-test.cc Done -- To view, visit http://gerrit.cloudera.org:8080/2791 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iabeea9f4ab4880b2f814408add63c77916e2dba9 Gerrit-PatchSet: 5 Gerrit-Project: Impala Gerrit-Branch: cdh5-trunk Gerrit-Owner: Taras Bobrovytsky <[email protected]> Gerrit-Reviewer: Alex Behm <[email protected]> Gerrit-Reviewer: Taras Bobrovytsky <[email protected]> Gerrit-HasComments: Yes
