if (isNullRestriction(r, b) || !r.canEvaluateWithSlices())
{
// There wasn't any non EQ relation on that key, we select all records having the preceding component as prefix.
// For composites, if there was preceding component and we're computing the end, we must change the last component
// End-Of-Component, otherwise we would be selecting only one record.
EOC eoc = !compositeBuilder.isEmpty() && eocBound == Bound.END ? EOC.END : EOC.NONE;
return compositeBuilder.buildWithEOC(eoc);
}
if (r.isSlice())
{
compositeBuilder.addElementToAll(getSliceValue(r, b, options));
Operator relType = ((Restriction.Slice) r).getRelation(eocBound, b);
return compositeBuilder.buildWithEOC(eocForRelation(relType));
}
compositeBuilder.addEachElementToAll(r.values(options));
if (compositeBuilder.containsNull())
throw new InvalidRequestException(
String.format("Invalid null clustering key part %s", def.name));
}
// Means no relation at all or everything was an equal
// Note: if the builder is "full", there is no need to use the end-of-component bit. For columns selection,
// it would be harmless to do it. However, we use this method got the partition key too. And when a query
// with 2ndary index is done, and with the the partition provided with an EQ, we'll end up here, and in that
// case using the eoc would be bad, since for the random partitioner we have no guarantee that
// prefix.end() will sort after prefix (see #5240).
EOC eoc = eocBound == Bound.END && compositeBuilder.hasRemaining() ? EOC.END : EOC.NONE;
return compositeBuilder.buildWithEOC(eoc);
}