@Override public void addFunctionsTo(List<Function> functions) { restrictions.addFunctionsTo(functions); }
@Override public void addRowFilterTo(RowFilter filter, SecondaryIndexManager indexManager, QueryOptions options) { restrictions.addRowFilterTo(filter, indexManager, options); }
/** * Returns the specified bound of the partition key. * * @param b the boundary type * @param options the query options * @return the specified bound of the partition key */ private ByteBuffer getPartitionKeyBound(Bound b, QueryOptions options) { // We deal with IN queries for keys in other places, so we know buildBound will return only one result return partitionKeyRestrictions.bounds(b, options).get(0); }
checkFalse(partitionKeyRestrictions.isOnToken(), "The token function cannot be used in WHERE clauses for %s statements", type); if (partitionKeyRestrictions.hasUnrestrictedPartitionKeyComponents(cfm)) throw invalidRequest("Some partition key parts are missing: %s", Joiner.on(", ").join(getPartitionKeyUnrestrictedComponents())); checkFalse(partitionKeyRestrictions.hasSlice(), "Only EQ and IN relation are supported on the partition key (unless you use the token() function)" + " for %s statements", type); if (partitionKeyRestrictions.isOnToken()) isKeyRange = true; if (partitionKeyRestrictions.isEmpty() && partitionKeyRestrictions.hasUnrestrictedPartitionKeyComponents(cfm)) if (partitionKeyRestrictions.needFiltering(cfm)) if (partitionKeyRestrictions.hasIN()) throw new InvalidRequestException("IN restrictions are not supported when the query involves filtering");
private Token getTokenBound(Bound b, QueryOptions options, IPartitioner p) { if (!partitionKeyRestrictions.hasBound(b)) return p.getMinimumToken(); ByteBuffer value = partitionKeyRestrictions.bounds(b, options).get(0); checkNotNull(value, "Invalid null token value"); return p.getTokenFactory().fromByteArray(value); }
@Override public List<ColumnDefinition> getColumnDefs() { return restrictions.getColumnDefs(); }
/** * Checks if the restrictions on the partition key has IN restrictions. * * @return <code>true</code> the restrictions on the partition key has an IN restriction, <code>false</code> * otherwise. */ public boolean keyIsInRelation() { return partitionKeyRestrictions.hasIN(); }
@Override public Set<Restriction> getRestrictions(ColumnDefinition columnDef) { Set<Restriction> set = new HashSet<>(); set.addAll(restrictions.getRestrictions(columnDef)); set.addAll(tokenRestriction.getRestrictions(columnDef)); return set; }
@Override public ColumnDefinition getFirstColumn() { return restrictions.getFirstColumn(); }
@Override public ColumnDefinition getLastColumn() { return restrictions.getLastColumn(); }
@Override public boolean hasBound(Bound bound) { return isOnToken() ? tokenRestriction.hasBound(bound) : restrictions.hasBound(bound); }
public boolean hasContains() { return isOnToken() ? false : restrictions.hasContains(); }
checkFalse(partitionKeyRestrictions.isOnToken(), "The token function cannot be used in WHERE clauses for %s statements", type); if (partitionKeyRestrictions.hasUnrestrictedPartitionKeyComponents(cfm)) throw invalidRequest("Some partition key parts are missing: %s", Joiner.on(", ").join(getPartitionKeyUnrestrictedComponents())); checkFalse(partitionKeyRestrictions.hasSlice(), "Only EQ and IN relation are supported on the partition key (unless you use the token() function)" + " for %s statements", type); if (partitionKeyRestrictions.isOnToken()) isKeyRange = true; if (partitionKeyRestrictions.isEmpty() && partitionKeyRestrictions.hasUnrestrictedPartitionKeyComponents(cfm)) if (partitionKeyRestrictions.needFiltering(cfm)) if (partitionKeyRestrictions.hasIN()) throw new InvalidRequestException("IN restrictions are not supported when the query involves filtering");
private Token getTokenBound(Bound b, QueryOptions options, IPartitioner p) { if (!partitionKeyRestrictions.hasBound(b)) return p.getMinimumToken(); ByteBuffer value = partitionKeyRestrictions.bounds(b, options).get(0); checkNotNull(value, "Invalid null token value"); return p.getTokenFactory().fromByteArray(value); }
@Override public List<ColumnDefinition> getColumnDefs() { return restrictions.getColumnDefs(); }
/** * Checks if the restrictions on the partition key has IN restrictions. * * @return <code>true</code> the restrictions on the partition key has an IN restriction, <code>false</code> * otherwise. */ public boolean keyIsInRelation() { return partitionKeyRestrictions.hasIN(); }
@Override public Set<Restriction> getRestrictions(ColumnDefinition columnDef) { Set<Restriction> set = new HashSet<>(); set.addAll(restrictions.getRestrictions(columnDef)); set.addAll(tokenRestriction.getRestrictions(columnDef)); return set; }
@Override public ColumnDefinition getFirstColumn() { return restrictions.getFirstColumn(); }
@Override public ColumnDefinition getLastColumn() { return restrictions.getLastColumn(); }
@Override public boolean hasBound(Bound bound) { return isOnToken() ? tokenRestriction.hasBound(bound) : restrictions.hasBound(bound); }