package com.splicemachine.derby.impl.sql.execute.serial;

import com.gotometrics.orderly.BigDecimalRowKey;
import com.gotometrics.orderly.DoubleRowKey;
import org.apache.derby.iapi.types.DataValueDescriptor;

import java.math.BigDecimal;

public class DoubleDVDSerializer implements DVDSerializer {

    private BigDecimalRowKey rowKey = new BigDecimalRowKey();

    @Override
    public void deserialize(byte[] bytes, DataValueDescriptor ldvd) throws Exception {
        BigDecimal bd = (BigDecimal) rowKey.deserialize(bytes);
        ldvd.setValue(bd.doubleValue());
    }

    @Override
    public byte[] serialize(DataValueDescriptor obj) throws Exception {
        return rowKey.serialize(new BigDecimal(obj.getDouble()));
    }
}

@@ -66,89 +66,39 @@
 com.
-gotometrics.orderly.BigDecimalRowKey;%0Aimport com.gotometrics.orderly.DoubleRowKey
+splicemachine.encoding.Encoding
 ;%0Aim
@@ -156,37 +156,8 @@
 r;%0A%0A
-import java.math.BigDecimal;%0A
 %0Apub
@@ -218,71 +218,8 @@
  %7B%0A%0A
-    private BigDecimalRowKey rowKey = new BigDecimalRowKey();%0A%0A
     
@@ -327,101 +327,49 @@
     
-BigDecimal bd = (BigDecimal) rowKey.deserialize(bytes);%0A        ldvd.setValue(bd.doubleValue(
+ldvd.setValue(Encoding.decodeDouble(bytes
 ));%0A
@@ -480,39 +480,23 @@
 urn 
-rowKey.serialize(new BigDecimal
+Encoding.encode
 (obj
@@ -508,17 +508,16 @@
 ouble())
-)
 ;%0A    %7D%0A

Switch DoubleDVDSerializer to use the new Encoding stuff