@Override public String toString() { return format("SingleMapBlock{positionCount=%d}", getPositionCount()); }
int blockPositionCount = singleMapBlock.getPositionCount(); if (blockPositionCount % 2 != 0) { throw new IllegalArgumentException(format("block position count is not even: %s", blockPositionCount));
assertEquals(elementBlock.getPositionCount(), map.size() * 2); for (int i = 0; i < elementBlock.getPositionCount(); i += 2) { String actualKey = VARCHAR.getSlice(elementBlock, i).toStringUtf8(); Long actualValue;
for (int position = 0; position < leftSingleMapLeftBlock.getPositionCount(); position += 2) { Object key = readNativeValue(keyType, leftBlock, position); int leftPosition = position + 1;
boolean[] keyFound = new boolean[rightMapBlock.getPositionCount()]; for (int leftKeyPosition = 0; leftKeyPosition < leftMapBlock.getPositionCount(); leftKeyPosition += 2) { Object key = readNativeValue(keyType, leftMapBlock, leftKeyPosition); Object leftValue = readNativeValue(leftValueType, leftMapBlock, leftKeyPosition + 1); for (int rightKeyPosition = 0; rightKeyPosition < rightMapBlock.getPositionCount(); rightKeyPosition += 2) { if (!keyFound[rightKeyPosition / 2]) { Object key = readNativeValue(keyType, rightMapBlock, rightKeyPosition);
@Override public void writeBlock(BlockEncodingSerde blockEncodingSerde, SliceOutput sliceOutput, Block block) { SingleMapBlock singleMapBlock = (SingleMapBlock) block; TypeSerde.writeType(sliceOutput, singleMapBlock.keyType); int offset = singleMapBlock.getOffset(); int positionCount = singleMapBlock.getPositionCount(); blockEncodingSerde.writeBlock(sliceOutput, singleMapBlock.getRawKeyBlock().getRegion(offset / 2, positionCount / 2)); blockEncodingSerde.writeBlock(sliceOutput, singleMapBlock.getRawValueBlock().getRegion(offset / 2, positionCount / 2)); int[] hashTable = singleMapBlock.getHashTable(); sliceOutput.appendInt(positionCount / 2 * HASH_MULTIPLIER); sliceOutput.writeBytes(wrappedIntArray(hashTable, offset / 2 * HASH_MULTIPLIER, positionCount / 2 * HASH_MULTIPLIER)); }
@Override public String toString() { return format("SingleMapBlock{positionCount=%d}", getPositionCount()); }
int blockPositionCount = singleMapBlock.getPositionCount(); if (blockPositionCount % 2 != 0) { throw new IllegalArgumentException(format("block position count is not even: %s", blockPositionCount));
@Override public void writeBlock(BlockEncodingSerde blockEncodingSerde, SliceOutput sliceOutput, Block block) { SingleMapBlock singleMapBlock = (SingleMapBlock) block; TypeSerde.writeType(sliceOutput, singleMapBlock.keyType); int offset = singleMapBlock.getOffset(); int positionCount = singleMapBlock.getPositionCount(); blockEncodingSerde.writeBlock(sliceOutput, singleMapBlock.getRawKeyBlock().getRegion(offset / 2, positionCount / 2)); blockEncodingSerde.writeBlock(sliceOutput, singleMapBlock.getRawValueBlock().getRegion(offset / 2, positionCount / 2)); int[] hashTable = singleMapBlock.getHashTable(); sliceOutput.appendInt(positionCount / 2 * HASH_MULTIPLIER); sliceOutput.writeBytes(wrappedIntArray(hashTable, offset / 2 * HASH_MULTIPLIER, positionCount / 2 * HASH_MULTIPLIER)); }