@Override public final PartitionKeyRestrictions mergeWith(Restriction otherRestriction) throws InvalidRequestException { if (!otherRestriction.isOnToken()) return new TokenFilter(toPartitionKeyRestrictions(otherRestriction), this); return doMergeWith((TokenRestriction) otherRestriction); }
@Override public final boolean isEmpty() { return getColumnDefs().isEmpty(); }
@Override public Set<Restriction> getRestrictions(ColumnDefinition columnDef) { Set<Restriction> set = new HashSet<>(); set.addAll(restrictions.getRestrictions(columnDef)); set.addAll(tokenRestriction.getRestrictions(columnDef)); return set; }
if (slice.hasBound(START)) Token start = deserializeToken(slice.bounds(START, options).get(0)); BoundType startBoundType = toBoundType(slice.isInclusive(START)); if (slice.hasBound(END)) BoundType endBoundType = toBoundType(slice.isInclusive(END)); Token end = deserializeToken(slice.bounds(END, options).get(0)); startBoundType)); Token end = deserializeToken(slice.bounds(END, options).get(0)); return ImmutableRangeSet.of(Range.upTo(end, toBoundType(slice.isInclusive(END))));
/** * Filter the values returned by the restriction. * * @param values the values returned by the decorated restriction * @param options the query options * @return the values matching the token restriction * @throws InvalidRequestException if the request is invalid */ private List<ByteBuffer> filter(List<ByteBuffer> values, QueryOptions options) throws InvalidRequestException { RangeSet<Token> rangeSet = tokenRestriction.hasSlice() ? toRangeSet(tokenRestriction, options) : toRangeSet(tokenRestriction.values(options)); return filterWithRangeSet(rangeSet, values); }
@Override public boolean isInclusive(Bound bound) { return isOnToken() ? tokenRestriction.isInclusive(bound) : restrictions.isInclusive(bound); }
@Override public boolean isOnToken() { // if all partition key columns have non-token restrictions and do not need filtering, // we can simply use the token range to filter those restrictions and then ignore the token range return needFiltering(tokenRestriction.metadata) || restrictions.size() < tokenRestriction.size(); }
@Override public boolean hasBound(Bound bound) { return isOnToken() ? tokenRestriction.hasBound(bound) : restrictions.hasBound(bound); }
@Override public List<ByteBuffer> bounds(Bound bound, QueryOptions options) throws InvalidRequestException { return isOnToken() ? tokenRestriction.bounds(bound, options) : restrictions.bounds(bound, options); }
@Override public PartitionKeyRestrictions mergeWith(Restriction restriction) throws InvalidRequestException { if (restriction.isOnToken()) return new TokenFilter(restrictions, (TokenRestriction) tokenRestriction.mergeWith(restriction)); return new TokenFilter(restrictions.mergeWith(restriction), tokenRestriction); }
if (slice.hasBound(START)) Token start = deserializeToken(slice.bounds(START, options).get(0)); BoundType startBoundType = toBoundType(slice.isInclusive(START)); if (slice.hasBound(END)) BoundType endBoundType = toBoundType(slice.isInclusive(END)); Token end = deserializeToken(slice.bounds(END, options).get(0)); startBoundType)); Token end = deserializeToken(slice.bounds(END, options).get(0)); return ImmutableRangeSet.of(Range.upTo(end, toBoundType(slice.isInclusive(END))));
/** * Filter the values returned by the restriction. * * @param values the values returned by the decorated restriction * @param options the query options * @return the values matching the token restriction * @throws InvalidRequestException if the request is invalid */ private List<ByteBuffer> filter(List<ByteBuffer> values, QueryOptions options) throws InvalidRequestException { RangeSet<Token> rangeSet = tokenRestriction.hasSlice() ? toRangeSet(tokenRestriction, options) : toRangeSet(tokenRestriction.values(options)); return filterWithRangeSet(rangeSet, values); }
@Override public boolean isInclusive(Bound bound) { return isOnToken() ? tokenRestriction.isInclusive(bound) : restrictions.isInclusive(bound); }
@Override public boolean isOnToken() { // if all partition key columns have non-token restrictions and do not need filtering, // we can simply use the token range to filter those restrictions and then ignore the token range return needFiltering(tokenRestriction.metadata) || restrictions.size() < tokenRestriction.size(); }
@Override public boolean hasBound(Bound bound) { return isOnToken() ? tokenRestriction.hasBound(bound) : restrictions.hasBound(bound); }
@Override public List<ByteBuffer> bounds(Bound bound, QueryOptions options) throws InvalidRequestException { return isOnToken() ? tokenRestriction.bounds(bound, options) : restrictions.bounds(bound, options); }
@Override public PartitionKeyRestrictions mergeWith(Restriction restriction) throws InvalidRequestException { if (restriction.isOnToken()) return new TokenFilter(restrictions, (TokenRestriction) tokenRestriction.mergeWith(restriction)); return new TokenFilter(restrictions.mergeWith(restriction), tokenRestriction); }
if (slice.hasBound(START)) Token start = deserializeToken(slice.bounds(START, options).get(0)); BoundType startBoundType = toBoundType(slice.isInclusive(START)); if (slice.hasBound(END)) BoundType endBoundType = toBoundType(slice.isInclusive(END)); Token end = deserializeToken(slice.bounds(END, options).get(0)); startBoundType)); Token end = deserializeToken(slice.bounds(END, options).get(0)); return ImmutableRangeSet.of(Range.upTo(end, toBoundType(slice.isInclusive(END))));
@Override public final PartitionKeyRestrictions mergeWith(Restriction otherRestriction) throws InvalidRequestException { if (!otherRestriction.isOnToken()) return new TokenFilter(toPartitionKeyRestrictions(otherRestriction), this); return doMergeWith((TokenRestriction) otherRestriction); }
/** * Filter the values returned by the restriction. * * @param values the values returned by the decorated restriction * @param options the query options * @return the values matching the token restriction * @throws InvalidRequestException if the request is invalid */ private List<ByteBuffer> filter(List<ByteBuffer> values, QueryOptions options) throws InvalidRequestException { RangeSet<Token> rangeSet = tokenRestriction.hasSlice() ? toRangeSet(tokenRestriction, options) : toRangeSet(tokenRestriction.values(options)); return filterWithRangeSet(rangeSet, values); }