VSizeColumnarInts next = objects.next(); if (numBytes == -1) { numBytes = next.getNumBytes(); if (object.getNumBytes() != numBytes) { throw new ISE("val.numBytes[%s] != numBytesInValue[%s]", object.getNumBytes(), numBytes);
@Test public void testSerialization() throws Exception { final int[] array = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; VSizeColumnarInts ints = VSizeColumnarInts.fromArray(array); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ints.writeTo(Channels.newChannel(baos), null); final byte[] bytes = baos.toByteArray(); Assert.assertEquals(ints.getSerializedSize(), bytes.length); VSizeColumnarInts deserialized = VSizeColumnarInts.readFromByteBuffer(ByteBuffer.wrap(bytes)); Assert.assertEquals(1, deserialized.getNumBytes()); Assert.assertEquals(array.length, deserialized.size()); for (int i = 0; i < array.length; i++) { Assert.assertEquals(array[i], deserialized.get(i)); } } }
VSizeColumnarInts next = objects.next(); if (numBytes == -1) { numBytes = next.getNumBytes(); if (object.getNumBytes() != numBytes) { throw new ISE("val.numBytes[%s] != numBytesInValue[%s]", object.getNumBytes(), numBytes);
private void assertSame(List<int[]> someInts, VSizeColumnarMultiInts indexed) { Assert.assertEquals(3, indexed.size()); for (int i = 0; i < indexed.size(); ++i) { final int[] ints = someInts.get(i); final VSizeColumnarInts vSizeColumnarInts = indexed.get(i); Assert.assertEquals(ints.length, vSizeColumnarInts.size()); Assert.assertEquals(1, vSizeColumnarInts.getNumBytes()); for (int j = 0; j < ints.length; j++) { Assert.assertEquals(ints[j], vSizeColumnarInts.get(j)); } } } }
@Test public void testSanity() { final int[] array = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; VSizeColumnarInts ints = VSizeColumnarInts.fromArray(array); Assert.assertEquals(1, ints.getNumBytes()); Assert.assertEquals(array.length, ints.size()); for (int i = 0; i < array.length; i++) { Assert.assertEquals(array[i], ints.get(i)); } }