} else {
// Assumes that only single keys occur in RVCs (i.e. when a PK spans columns)
assert(this.getPKSpan() > 1);
assert(this.getPKPosition() <= that.getPKPosition());
ImmutableBytesWritable ptr = context.getTempPtr();
RowKeySchema schema = table.getRowKeySchema();
if (this.getPKSpan() > 1 && that.getPKSpan() > 1) {
// TODO: Trickiest case: both key slots are multi-span RVCs.
// Punt for now: we could intersect these, but it'd be a fair amount of code.
// Instead, just keep the original slot and don't extract
// the other expressions (so they'll be evaluated row by row).
return this;
} else {
assert(this.getPKSpan() > 1);
assert(this.getPKPosition() <= that.getPKPosition());
int position = this.getPKPosition();
int thatPosition = that.getPKPosition();
List<KeyRange> newKeyRanges = Lists.newArrayListWithExpectedSize(this.getKeyRanges().size());
// We know we have a set of RVCs (i.e. multi-span key ranges)
// Get the PK slot value in the RVC for the position of the other KeySlot
// If they don't intersect, we cannot have a match for the RVC, so filter it out.
// Otherwise, we keep it.
for (KeyRange keyRange : this.getKeyRanges()) {
assert(keyRange.isSingleKey());
byte[] key = keyRange.getLowerRange();
schema.iterator(key, ptr); // initialize for iteration
while (position < thatPosition) { // skip to part of RVC that overlaps
schema.next(ptr, position++, key.length);
}
// Create a range just for the overlapping column
List<KeyRange> slotKeyRanges = Collections.singletonList(KeyRange.getKeyRange(ByteUtil.copyKeyBytesIfNecessary(ptr)));
// Intersect with other ranges and add to list if it overlaps
if (!isDegenerate(KeyRange.intersect(slotKeyRanges, that.getKeyRanges()))) {