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 3A8FB200CDE for ; Tue, 25 Jul 2017 00:53:41 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 38DE6165952; Mon, 24 Jul 2017 22:53:41 +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 7EE9B16590E for ; Tue, 25 Jul 2017 00:53:40 +0200 (CEST) Received: (qmail 60668 invoked by uid 500); 24 Jul 2017 22:53:39 -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 60635 invoked by uid 99); 24 Jul 2017 22:53:39 -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; Mon, 24 Jul 2017 22:53:39 +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 023611806F6 for ; Mon, 24 Jul 2017 22:53:39 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.162 X-Spam-Level: * X-Spam-Status: No, score=1.162 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, 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 5dXG_VRYV9vm for ; Mon, 24 Jul 2017 22:53:36 +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 3AFE65F3FF for ; Mon, 24 Jul 2017 22:53:36 +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 v6OMrYTr001455; Mon, 24 Jul 2017 22:53:34 GMT Message-Id: <201707242253.v6OMrYTr001455@ip-10-146-233-104.ec2.internal> Date: Mon, 24 Jul 2017 22:53:34 +0000 From: "Taras Bobrovytsky (Code Review)" To: impala-cr@cloudera.com, reviews@impala.incubator.apache.org CC: Michael Ho , Zach Amsden , Dan Hecht , Tim Armstrong Reply-To: tbobrovytsky@cloudera.com X-Gerrit-MessageType: newpatchset Subject: =?UTF-8?Q?=5BImpala-ASF-CR=5D_IMPALA-4939=2C_IMPALA-4939=3A_Decimal_V2_multiplication=0A?= X-Gerrit-Change-Id: I37ad6232d7953bd75c18dc86e665b2b501a1ebe1 X-Gerrit-ChangeURL: X-Gerrit-Commit: 084b3881731447930f1ca6eff9a6b3d7b10f3a5e 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: Mon, 24 Jul 2017 22:53:41 -0000 Taras Bobrovytsky has uploaded a new patch set (#3). Change subject: IMPALA-4939, IMPALA-4939: Decimal V2 multiplication ...................................................................... IMPALA-4939, IMPALA-4939: Decimal V2 multiplication Implement the new DECIMAL return type rules for multiply expressions, active when query option DECIMAL_V2=1. The algorithm for determining the type of the result of multiplication is described in the JIRA. DECIMAL V1: +-----------------------------------------------------------------------+ | typeof(cast('0.1' as decimal(38,38)) * cast('0.1' as decimal(38,38))) | +-----------------------------------------------------------------------+ | DECIMAL(38,38) | +-----------------------------------------------------------------------+ +-----------------------------------------------------------------------+ | typeof(cast('0.1' as decimal(38,15)) * cast('0.1' as decimal(38,15))) | +-----------------------------------------------------------------------+ | DECIMAL(38,30) | +-----------------------------------------------------------------------+ DECIMAL V2: +-----------------------------------------------------------------------+ | typeof(cast('0.1' as decimal(38,38)) * cast('0.1' as decimal(38,38))) | +-----------------------------------------------------------------------+ | DECIMAL(38,37) | +-----------------------------------------------------------------------+ +-----------------------------------------------------------------------+ | typeof(cast('0.1' as decimal(38,15)) * cast('0.1' as decimal(38,15))) | +-----------------------------------------------------------------------+ | DECIMAL(38,6) | +-----------------------------------------------------------------------+ In this patch, we also fix the early multiplication overflow. We compute an int256 intermediate value, which we then attempt to scale down and round to int128. Change-Id: I37ad6232d7953bd75c18dc86e665b2b501a1ebe1 --- M be/src/exprs/expr-test.cc M be/src/runtime/decimal-value.inline.h M be/src/util/bit-util.h M fe/src/main/java/org/apache/impala/analysis/TypesUtil.java 4 files changed, 237 insertions(+), 57 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/38/7438/3 -- To view, visit http://gerrit.cloudera.org:8080/7438 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I37ad6232d7953bd75c18dc86e665b2b501a1ebe1 Gerrit-PatchSet: 3 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Taras Bobrovytsky Gerrit-Reviewer: Dan Hecht Gerrit-Reviewer: Michael Ho Gerrit-Reviewer: Taras Bobrovytsky Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zach Amsden