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 8366E200C2A for ; Wed, 1 Mar 2017 07:43:01 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 81DC0160B70; Wed, 1 Mar 2017 06:43:01 +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 CCD2B160B5E for ; Wed, 1 Mar 2017 07:43:00 +0100 (CET) Received: (qmail 85005 invoked by uid 500); 1 Mar 2017 06:43:00 -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 84984 invoked by uid 99); 1 Mar 2017 06:42:59 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Mar 2017 06:42:59 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 3C9AB180692 for ; Wed, 1 Mar 2017 06:42:59 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.362 X-Spam-Level: X-Spam-Status: No, score=0.362 tagged_above=-999 required=6.31 tests=[RDNS_DYNAMIC=0.363, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Qt8w7EnCu3xV for ; Wed, 1 Mar 2017 06:42:58 +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-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 8A5465F1A1 for ; Wed, 1 Mar 2017 06:42:57 +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 v216guxD012285; Wed, 1 Mar 2017 06:42:56 GMT Message-Id: <201703010642.v216guxD012285@ip-10-146-233-104.ec2.internal> Date: Wed, 1 Mar 2017 06:42:56 +0000 From: "Dan Hecht (Code Review)" To: Zach Amsden , impala-cr@cloudera.com, reviews@impala.incubator.apache.org CC: Michael Ho Reply-To: dhecht@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: d6b9ca92074c4ab55fabcf48102bd075d1a30c3c 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: Wed, 01 Mar 2017 06:43:01 -0000 Dan Hecht has posted comments on this change. Change subject: IMPALA-4813: Round on divide and multiply ...................................................................... Patch Set 8: (5 comments) http://gerrit.cloudera.org:8080/#/c/6132/8/be/src/exprs/expr-test.cc File be/src/exprs/expr-test.cc: Line 1339: { "1.23 * cast(1 as decimal(20,3))", {{ false, 123000, 23, 5 }}}, > Without the result type change, I have been unable to find a meaningful way okay, that makes sense. http://gerrit.cloudera.org:8080/#/c/6132/8/be/src/runtime/decimal-value.inline.h File be/src/runtime/decimal-value.inline.h: PS8, Line 311: sp > single precision (not entirely accurate, but...) i don't think the name will be obvious, but i also don't really have another suggestion other than x16 or x128, and neither is great, so okay to leave it alone. Line 346: DCHECK(r != 0); > It's actually impossible to get a zero value here (value == non-zero value) But we may have promoted to a higher type in this case. The inputs might be 4-byte (i.e. 9 or less precision), while the result is 8-bytes (18 or less precision). So, the premise that we didn't need to promote is false. Or am I misunderstanding? Line 350: DCHECK(sizeof(RESULT_T) > 8 || abs(r) <= DecimalUtil::MAX_UNSCALED_DECIMAL8); > Either we have to promote to a RESULT_T that can hold the result, or there but we may have promoted from 4 to 8. i think what you're trying to show is that RESULT_T is chosen correctly (which also means that the static_cast on the next line is a no-op). so, should it be: DCHECK(abs(r) <= MAX_UNSCALED_DECIMAL16 && (sizeof(RESULT_T) > 8 || abs(r) <= MAX_UNSCALED_DECIMAL8) && (sizeof(RESULT_T) > 4 || abs(r) <= MAX_UNSCALED_DECIMAL4)); ? http://gerrit.cloudera.org:8080/#/c/6132/8/be/src/util/bit-util.h File be/src/util/bit-util.h: Line 52: std::is_same{}, int>::type = 0> > Sure, but then all the following template conditions will become grotesque: okay, let's leave it alone. -- 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: 8 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