Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id BE89A200C38 for ; Wed, 1 Mar 2017 00:58:50 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id BB58D160B7E; Tue, 28 Feb 2017 23:58:50 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1115D160B7C for ; Wed, 1 Mar 2017 00:58:49 +0100 (CET) Received: (qmail 50656 invoked by uid 500); 28 Feb 2017 23:58:49 -0000 Mailing-List: contact reviews-help@impala.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list reviews@impala.incubator.apache.org Received: (qmail 50644 invoked by uid 99); 28 Feb 2017 23:58:49 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Feb 2017 23:58:49 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 872B31A7A72 for ; Tue, 28 Feb 2017 23:58:48 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.363 X-Spam-Level: X-Spam-Status: No, score=0.363 tagged_above=-999 required=6.31 tests=[RDNS_DYNAMIC=0.363, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 5cfEVY0Awa1j for ; Tue, 28 Feb 2017 23:58:47 +0000 (UTC) Received: from ip-10-146-233-104.ec2.internal (ec2-75-101-130-251.compute-1.amazonaws.com [75.101.130.251]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 65BA55F23A for ; Tue, 28 Feb 2017 23:58:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by ip-10-146-233-104.ec2.internal (8.14.4/8.14.4) with ESMTP id v1SNwkfR026371; Tue, 28 Feb 2017 23:58:46 GMT Message-Id: <201702282358.v1SNwkfR026371@ip-10-146-233-104.ec2.internal> Date: Tue, 28 Feb 2017 23:58:46 +0000 From: "Zach Amsden (Code Review)" To: impala-cr@cloudera.com, reviews@impala.incubator.apache.org CC: Dan Hecht , Michael Ho Reply-To: zamsden@cloudera.com X-Gerrit-MessageType: comment Subject: =?UTF-8?Q?=5BImpala-ASF-CR=5D_IMPALA-4813=3A_Round_on_divide_and_multiply=0A?= X-Gerrit-Change-Id: Ie6bfcbe37555b74598d409c6f84f06b0ae5c4312 X-Gerrit-ChangeURL: X-Gerrit-Commit: 55a9a04068de4f2b9c05db433f28914e191b1d39 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/2.12.7 archived-at: Tue, 28 Feb 2017 23:58:50 -0000 Zach Amsden has posted comments on this change. Change subject: IMPALA-4813: Round on divide and multiply ...................................................................... Patch Set 5: (9 comments) http://gerrit.cloudera.org:8080/#/c/6132/2/be/src/exprs/decimal-operators-ir.cc File be/src/exprs/decimal-operators-ir.cc: PS2, Line 729: \ > ROUND && ? I thought I already got rid of this, it's not needed. http://gerrit.cloudera.org:8080/#/c/6132/5/be/src/runtime/decimal-value.inline.h File be/src/runtime/decimal-value.inline.h: PS5, Line 194: namespace detail { > Why new namespace ? To avoid name collision ? Yeah, even though this is "inline.h", this is still a private implementation detail. PS5, Line 203: DCHECK(multiplier > 1); > DCHECK(multiplier > 0 && multiplier % 2 == 0); We still want multiplier > 1, since delta_scale > 0 PS5, Line 205: RESULT_T result = value / multiplier; > Please consider hoisting this out of the loop so we don't need the else sta Done PS5, Line 208: a multiple of two. > Should there be a DCHECK for this ? See comment above. Done PS5, Line 249: // Check overflow again after rounding since +/-1 could cause decimal overflow : if (result_precision == ColumnType::MAX_PRECISION) { : *overflow |= abs(result) > DecimalUtil::MAX_UNSCALED_DECIMAL16; > Should this be inside the if-stmt above ? I don't see any rounding outside Done PS5, Line 285: // Check overflow again after rounding since +/-1 could cause decimal overflow : if (result_precision == ColumnType::MAX_PRECISION) { : *overflow |= abs(result) > DecimalUtil::MAX_UNSCALED_DECIMAL16; > Should this be inside the if-stmt above ? I don't see any rounding outside Done PS5, Line 314: if (round) { > Should we skip this if *overflow is true ? probably not worth it. If things can inline, we may start computing x % y before overflow's value is known, so we may get better code. PS5, Line 316: free : // free > duplicated "free" Done -- To view, visit http://gerrit.cloudera.org:8080/6132 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie6bfcbe37555b74598d409c6f84f06b0ae5c4312 Gerrit-PatchSet: 5 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Zach Amsden Gerrit-Reviewer: Dan Hecht Gerrit-Reviewer: Michael Ho Gerrit-Reviewer: Michael Ho Gerrit-Reviewer: Zach Amsden Gerrit-HasComments: Yes