diff options
author | Henning Baldersheim <balder@oath.com> | 2019-04-05 11:13:53 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2019-04-05 11:26:30 +0000 |
commit | f46d5619c6dbac79bdb72924291ff2879ef7224a (patch) | |
tree | b5656a26766bff3a2b999b3e1a44971ccd9ecb27 /vespajlib | |
parent | 747114c0f7835bf9a3e47a19e924856227efde8d (diff) |
Use bit number 3 mean 'with cell type' to carry forward the current schema where the bits hav meaning.
Update expected result.
Diffstat (limited to 'vespajlib')
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/tensor/serialization/TypedBinaryFormat.java | 8 | ||||
-rw-r--r-- | vespajlib/src/test/java/com/yahoo/tensor/serialization/DenseBinaryFormatTestCase.java | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/serialization/TypedBinaryFormat.java b/vespajlib/src/main/java/com/yahoo/tensor/serialization/TypedBinaryFormat.java index f2c5d4e2bd8..9b298f1dffb 100644 --- a/vespajlib/src/main/java/com/yahoo/tensor/serialization/TypedBinaryFormat.java +++ b/vespajlib/src/main/java/com/yahoo/tensor/serialization/TypedBinaryFormat.java @@ -23,7 +23,9 @@ public class TypedBinaryFormat { private static final int SPARSE_BINARY_FORMAT_TYPE = 1; private static final int DENSE_BINARY_FORMAT_TYPE = 2; private static final int MIXED_BINARY_FORMAT_TYPE = 3; - private static final int TYPED_DENSE_BINARY_FORMAT_TYPE = 4; + private static final int SPARSE_BINARY_FORMAT_WITH_CELLTYPE = 5; + private static final int DENSE_BINARY_FORMAT_WITH_CELLTYPE = 6; + private static final int MIXED_BINARY_FORMAT_WITH_CELLTYPE = 7; public static byte[] encode(Tensor tensor) { GrowableByteBuffer buffer = new GrowableByteBuffer(); @@ -38,7 +40,7 @@ public class TypedBinaryFormat { new DenseBinaryFormat(DenseBinaryFormat.EncodeType.DOUBLE_IS_DEFAULT).encode(buffer, tensor); break; default: - buffer.putInt1_4Bytes(TYPED_DENSE_BINARY_FORMAT_TYPE); + buffer.putInt1_4Bytes(DENSE_BINARY_FORMAT_WITH_CELLTYPE); new DenseBinaryFormat(DenseBinaryFormat.EncodeType.NO_DEFAULT).encode(buffer, tensor); break; } @@ -67,7 +69,7 @@ public class TypedBinaryFormat { case MIXED_BINARY_FORMAT_TYPE: return new MixedBinaryFormat().decode(type, buffer); case SPARSE_BINARY_FORMAT_TYPE: return new SparseBinaryFormat().decode(type, buffer); case DENSE_BINARY_FORMAT_TYPE: return new DenseBinaryFormat(DenseBinaryFormat.EncodeType.DOUBLE_IS_DEFAULT).decode(type, buffer); - case TYPED_DENSE_BINARY_FORMAT_TYPE: return new DenseBinaryFormat(DenseBinaryFormat.EncodeType.NO_DEFAULT).decode(type, buffer); + case DENSE_BINARY_FORMAT_WITH_CELLTYPE: return new DenseBinaryFormat(DenseBinaryFormat.EncodeType.NO_DEFAULT).decode(type, buffer); default: throw new IllegalArgumentException("Binary format type " + formatType + " is unknown"); } } diff --git a/vespajlib/src/test/java/com/yahoo/tensor/serialization/DenseBinaryFormatTestCase.java b/vespajlib/src/test/java/com/yahoo/tensor/serialization/DenseBinaryFormatTestCase.java index 8fa2537e1e2..5d1bc7b0c3f 100644 --- a/vespajlib/src/test/java/com/yahoo/tensor/serialization/DenseBinaryFormatTestCase.java +++ b/vespajlib/src/test/java/com/yahoo/tensor/serialization/DenseBinaryFormatTestCase.java @@ -55,7 +55,7 @@ public class DenseBinaryFormatTestCase { @Test public void requireThatFloatSerializationFormatDoNotChange() { - byte[] encodedTensor = new byte[]{4, // binary format type + byte[] encodedTensor = new byte[]{6, // binary format type 1, // float type 2, // dimension count 2, (byte) 'x', (byte) 'y', 2, // dimension xy with size |