@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); }
@Override public List<ByteBuffer> values(QueryOptions options) throws InvalidRequestException { return filter(restrictions.values(options), options); }
/** * 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); }
public boolean hasOnlyEqualityRestrictions() { return isOnToken() ? false : restrictions.hasOnlyEqualityRestrictions(); }
Token start = deserializeToken(slice.bounds(START, options).get(0)); BoundType startBoundType = toBoundType(slice.isInclusive(START)); 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 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(); }
/** * Converts the specified list into a range set. * * @param buffers the token restriction values * @return the range set corresponding to the specified list */ private RangeSet<Token> toRangeSet(List<ByteBuffer> buffers) { ImmutableRangeSet.Builder<Token> builder = ImmutableRangeSet.builder(); for (ByteBuffer buffer : buffers) builder.add(Range.singleton(deserializeToken(buffer))); return builder.build(); }
public boolean hasIN() { return isOnToken() ? false : restrictions.hasIN(); }
Token start = deserializeToken(slice.bounds(START, options).get(0)); BoundType startBoundType = toBoundType(slice.isInclusive(START)); 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 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(); }
/** * Converts the specified list into a range set. * * @param buffers the token restriction values * @return the range set corresponding to the specified list */ private RangeSet<Token> toRangeSet(List<ByteBuffer> buffers) { ImmutableRangeSet.Builder<Token> builder = ImmutableRangeSet.builder(); for (ByteBuffer buffer : buffers) builder.add(Range.singleton(deserializeToken(buffer))); return builder.build(); }
public boolean hasContains() { return isOnToken() ? false : restrictions.hasContains(); }
/** * 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); }
Token start = deserializeToken(slice.bounds(START, options).get(0)); BoundType startBoundType = toBoundType(slice.isInclusive(START)); 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 PartitionKeyRestrictions mergeWith(Restriction restriction) throws InvalidRequestException { if (restriction.isOnToken()) return new TokenFilter(restrictions, (TokenRestriction) tokenRestriction.mergeWith(restriction)); return new TokenFilter(restrictions.mergeWith(restriction), tokenRestriction); }
@Override public List<ByteBuffer> values(QueryOptions options) throws InvalidRequestException { return filter(restrictions.values(options), options); }
@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(); }
/** * Converts the specified list into a range set. * * @param buffers the token restriction values * @return the range set corresponding to the specified list */ private RangeSet<Token> toRangeSet(List<ByteBuffer> buffers) { ImmutableRangeSet.Builder<Token> builder = ImmutableRangeSet.builder(); for (ByteBuffer buffer : buffers) builder.add(Range.singleton(deserializeToken(buffer))); return builder.build(); }
public boolean hasIN() { return isOnToken() ? false : restrictions.hasIN(); }
/** * 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); }