@Override public boolean bytesEqual(int position, int offset, Slice otherSlice, int otherOffset, int length) { return block.bytesEqual(position, offset, otherSlice, otherOffset, length); }
@Override public boolean bytesEqual(int position, int offset, Slice otherSlice, int otherOffset, int length) { return block.bytesEqual(position, offset, otherSlice, otherOffset, length); }
@Override public boolean bytesEqual(int position, int offset, Slice otherSlice, int otherOffset, int length) { assureLoaded(); return block.bytesEqual(position, offset, otherSlice, otherOffset, length); }
@Override public boolean bytesEqual(int position, int offset, Slice otherSlice, int otherOffset, int length) { return dictionary.bytesEqual(getId(position), offset, otherSlice, otherOffset, length); }
@Override public boolean bytesEqual(int position, int offset, Slice otherSlice, int otherOffset, int length) { checkReadablePosition(position); return value.bytesEqual(0, offset, otherSlice, otherOffset, length); }
@Override public boolean bytesEqual(int position, int offset, Slice otherSlice, int otherOffset, int length) { position = getAbsolutePosition(position); if (position % 2 == 0) { return getRawKeyBlock().bytesEqual(position / 2, offset, otherSlice, otherOffset, length); } else { return getRawValueBlock().bytesEqual(position / 2, offset, otherSlice, otherOffset, length); } }
@Override public boolean bytesEqual(int position, int offset, Slice otherSlice, int otherOffset, int length) { checkReadablePosition(position); return getBlock().bytesEqual(position + start, offset, otherSlice, otherOffset, length); }
@Override public boolean bytesEqual(int position, int offset, Slice otherSlice, int otherOffset, int length) { checkFieldIndex(position); return getRawFieldBlock(position).bytesEqual(rowIndex, offset, otherSlice, otherOffset, length); }
@Override public boolean equals(int position, int offset, Block otherBlock, int otherPosition, int otherOffset, int length) { checkReadablePosition(position); if (fixedSize < length) { return false; } int thisOffset = valueOffset(position) + offset; return otherBlock.bytesEqual(otherPosition, otherOffset, getRawSlice(), thisOffset, length); }
@Override public boolean equals(int position, int offset, Block otherBlock, int otherPosition, int otherOffset, int length) { checkReadablePosition(position); Slice rawSlice = getRawSlice(position); if (getSliceLength(position) < length) { return false; } return otherBlock.bytesEqual(otherPosition, otherOffset, rawSlice, getPositionOffset(position) + offset, length); }
protected void assertSlicePosition(Block block, int position, Slice expectedSliceValue) { int length = block.getSliceLength(position); assertEquals(length, expectedSliceValue.length()); Block expectedBlock = toSingeValuedBlock(expectedSliceValue); for (int offset = 0; offset < length - 3; offset++) { assertEquals(block.getSlice(position, offset, 3), expectedSliceValue.slice(offset, 3)); assertTrue(block.bytesEqual(position, offset, expectedSliceValue, offset, 3)); // if your tests fail here, please change your test to not use this value assertFalse(block.bytesEqual(position, offset, Slices.utf8Slice("XXX"), 0, 3)); assertEquals(block.bytesCompare(position, offset, 3, expectedSliceValue, offset, 3), 0); assertTrue(block.bytesCompare(position, offset, 3, expectedSliceValue, offset, 2) > 0); Slice greaterSlice = createGreaterValue(expectedSliceValue, offset, 3); assertTrue(block.bytesCompare(position, offset, 3, greaterSlice, 0, greaterSlice.length()) < 0); assertTrue(block.equals(position, offset, expectedBlock, 0, offset, 3)); assertEquals(block.compareTo(position, offset, 3, expectedBlock, 0, offset, 3), 0); BlockBuilder blockBuilder = VARBINARY.createBlockBuilder(null, 1); block.writeBytesTo(position, offset, 3, blockBuilder); blockBuilder.closeEntry(); Block segment = blockBuilder.build(); assertTrue(block.equals(position, offset, segment, 0, 0, 3)); } }
protected void assertSlicePosition(Block block, int position, Slice expectedSliceValue) { int length = block.getSliceLength(position); assertEquals(length, expectedSliceValue.length()); Block expectedBlock = toSingeValuedBlock(expectedSliceValue); for (int offset = 0; offset < length - 3; offset++) { assertEquals(block.getSlice(position, offset, 3), expectedSliceValue.slice(offset, 3)); assertTrue(block.bytesEqual(position, offset, expectedSliceValue, offset, 3)); // if your tests fail here, please change your test to not use this value assertFalse(block.bytesEqual(position, offset, Slices.utf8Slice("XXX"), 0, 3)); assertEquals(block.bytesCompare(position, offset, 3, expectedSliceValue, offset, 3), 0); assertTrue(block.bytesCompare(position, offset, 3, expectedSliceValue, offset, 2) > 0); Slice greaterSlice = createGreaterValue(expectedSliceValue, offset, 3); assertTrue(block.bytesCompare(position, offset, 3, greaterSlice, 0, greaterSlice.length()) < 0); assertTrue(block.equals(position, offset, expectedBlock, 0, offset, 3)); assertEquals(block.compareTo(position, offset, 3, expectedBlock, 0, offset, 3), 0); BlockBuilder blockBuilder = VARBINARY.createBlockBuilder(null, 1); block.writeBytesTo(position, offset, 3, blockBuilder); blockBuilder.closeEntry(); Block segment = blockBuilder.build(); assertTrue(block.equals(position, offset, segment, 0, 0, 3)); } }