Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3E31F178F4 for ; Thu, 30 Apr 2015 14:54:53 +0000 (UTC) Received: (qmail 84038 invoked by uid 500); 30 Apr 2015 14:54:53 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 84008 invoked by uid 500); 30 Apr 2015 14:54:53 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 83999 invoked by uid 99); 30 Apr 2015 14:54:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Apr 2015 14:54:53 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of root@apache.org designates 54.164.171.186 as permitted sender) Received: from [54.164.171.186] (HELO mx1-us-east.apache.org) (54.164.171.186) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Apr 2015 14:54:47 +0000 Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with SMTP id AC65E47357 for ; Thu, 30 Apr 2015 14:54:08 +0000 (UTC) Received: (qmail 81248 invoked by uid 99); 30 Apr 2015 14:54:08 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Apr 2015 14:54:08 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1F25DE00C5; Thu, 30 Apr 2015 14:54:08 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.incubator.apache.org Date: Thu, 30 Apr 2015 14:54:09 -0000 Message-Id: In-Reply-To: <2045542d955e44dc9b090b1a9a973eaa@git.apache.org> References: <2045542d955e44dc9b090b1a9a973eaa@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [02/50] incubator-ignite git commit: ignite-757 - decimal fix X-Virus-Checked: Checked by ClamAV on apache.org ignite-757 - decimal fix Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ab052aca Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ab052aca Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ab052aca Branch: refs/heads/ignite-732 Commit: ab052aca5deeb768982be3ebed28b740748c406e Parents: f674ec7 Author: S.Vladykin Authored: Mon Apr 27 12:25:04 2015 +0300 Committer: S.Vladykin Committed: Mon Apr 27 12:25:04 2015 +0300 ---------------------------------------------------------------------- .../query/h2/twostep/msg/GridH2Decimal.java | 27 +++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ab052aca/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java index c51df77..c52e7a9 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2Decimal.java @@ -18,7 +18,6 @@ package org.apache.ignite.internal.processors.query.h2.twostep.msg; import org.apache.ignite.plugin.extensions.communication.*; -import org.h2.util.*; import org.h2.value.*; import java.math.*; @@ -29,6 +28,9 @@ import java.nio.*; */ public class GridH2Decimal extends GridH2ValueMessage { /** */ + private int scale; + + /** */ private byte[] b; /** @@ -44,12 +46,15 @@ public class GridH2Decimal extends GridH2ValueMessage { public GridH2Decimal(Value val) { assert val.getType() == Value.DECIMAL : val.getType(); - b = Utils.serialize(val.getBigDecimal(), null); + BigDecimal x = val.getBigDecimal(); + + scale = x.scale(); + b = x.unscaledValue().toByteArray(); } /** {@inheritDoc} */ @Override public Value value() { - return ValueDecimal.get((BigDecimal)Utils.deserialize(b, null)); + return ValueDecimal.get(new BigDecimal(new BigInteger(b), scale)); } /** {@inheritDoc} */ @@ -73,6 +78,12 @@ public class GridH2Decimal extends GridH2ValueMessage { writer.incrementState(); + case 1: + if (!writer.writeInt("scale", scale)) + return false; + + writer.incrementState(); + } return true; @@ -97,6 +108,14 @@ public class GridH2Decimal extends GridH2ValueMessage { reader.incrementState(); + case 1: + scale = reader.readInt("scale"); + + if (!reader.isLastRead()) + return false; + + reader.incrementState(); + } return true; @@ -109,6 +128,6 @@ public class GridH2Decimal extends GridH2ValueMessage { /** {@inheritDoc} */ @Override public byte fieldsCount() { - return 1; + return 2; } }