ignite-757 - decimal temporary 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/2fb6213d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2fb6213d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2fb6213d

Branch: refs/heads/ignite-286
Commit: 2fb6213dbd17459f34e7db29b6bfc73a9445bcd5
Parents: 94aac21
Author: S.Vladykin <svlady...@gridgain.com>
Authored: Mon Apr 27 10:58:09 2015 +0300
Committer: S.Vladykin <svlady...@gridgain.com>
Committed: Mon Apr 27 10:58:09 2015 +0300

----------------------------------------------------------------------
 .../processors/query/h2/twostep/msg/GridH2Decimal.java  | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2fb6213d/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 be74fc1..ea1b87c 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
@@ -20,14 +20,16 @@ package 
org.apache.ignite.internal.processors.query.h2.twostep.msg;
 import org.apache.ignite.plugin.extensions.communication.*;
 import org.h2.value.*;
 
+import java.math.*;
 import java.nio.*;
 
 /**
  * H2 Decimal.
  */
+// TODO optimize representation
 public class GridH2Decimal extends GridH2ValueMessage {
     /** */
-    private byte[] b;
+    private String b;
 
     /**
      *
@@ -42,12 +44,12 @@ public class GridH2Decimal extends GridH2ValueMessage {
     public GridH2Decimal(Value val) {
         assert val.getType() == Value.DECIMAL : val.getType();
 
-        b = val.getBytesNoCopy();
+        b = val.getString();
     }
 
     /** {@inheritDoc} */
     @Override public Value value() {
-        return ValueBytes.getNoCopy(b).convertTo(Value.DECIMAL);
+        return ValueDecimal.get(new BigDecimal(b));
     }
 
     /** {@inheritDoc} */
@@ -66,7 +68,7 @@ public class GridH2Decimal extends GridH2ValueMessage {
 
         switch (writer.state()) {
             case 0:
-                if (!writer.writeByteArray("b", b))
+                if (!writer.writeString("b", b))
                     return false;
 
                 writer.incrementState();
@@ -88,7 +90,7 @@ public class GridH2Decimal extends GridH2ValueMessage {
 
         switch (reader.state()) {
             case 0:
-                b = reader.readByteArray("b");
+                b = reader.readString("b");
 
                 if (!reader.isLastRead())
                     return false;

Reply via email to