/** * Checks that the operator for the specified column is compatible with the bounds of the existing restriction. * * @param existing the existing restriction * @param def the column definition * @param operator the operator * @throws InvalidRequestException if the operator is not compatible with the bounds of the existing restriction */ private static void checkBound(Restriction existing, ColumnDefinition def, Operator operator) throws InvalidRequestException { Restriction.Slice existingSlice = (Restriction.Slice) existing; if (existingSlice.hasBound(Bound.START) && (operator == Operator.GT || operator == Operator.GTE)) throw new InvalidRequestException(String.format( "More than one restriction was found for the start bound on %s", def.name)); if (existingSlice.hasBound(Bound.END) && (operator == Operator.LT || operator == Operator.LTE)) throw new InvalidRequestException(String.format( "More than one restriction was found for the end bound on %s", def.name)); }
private static ByteBuffer getSliceValue(Restriction r, Bound b, QueryOptions options) throws InvalidRequestException { Restriction.Slice slice = (Restriction.Slice)r; assert slice.hasBound(b); ByteBuffer val = slice.bound(b, options); if (val == null) throw new InvalidRequestException(String.format("Invalid null clustering key part %s", r)); return val; }
for (Bound b : Bound.values()) if (slice.hasBound(b))
else if (restriction.isSlice() && ((Slice) restriction).hasBound(Bound.END))
private static boolean isNullRestriction(Restriction r, Bound b) { return r == null || (r.isSlice() && !((Restriction.Slice)r).hasBound(b)); }
public void setBound(Restriction.Slice slice) throws InvalidRequestException { for (Bound bound : Bound.values()) if (slice.hasBound(bound)) setBound(bound, slice.isInclusive(bound), slice.bound(bound)); }