@Override public void addFunctionsTo(List<Function> functions) { for (Restriction restriction : this) restriction.addFunctionsTo(functions); }
@Override public void addRowFilterTo(RowFilter filter, SecondaryIndexManager indexManager, QueryOptions options) throws InvalidRequestException { for (Restriction restriction : restrictions.values()) restriction.addRowFilterTo(filter, indexManager, options); }
/** * Returns the names of the columns that are specified within this <code>Restrictions</code> and the other one * as a comma separated <code>String</code>. * * @param otherRestriction the other restrictions * @return the names of the columns that are specified within this <code>Restrictions</code> and the other one * as a comma separated <code>String</code>. */ protected final String getColumnsInCommons(Restriction otherRestriction) { Set<ColumnDefinition> commons = new HashSet<>(getColumnDefs()); commons.retainAll(otherRestriction.getColumnDefs()); StringBuilder builder = new StringBuilder(); for (ColumnDefinition columnDefinition : commons) { if (builder.length() != 0) builder.append(" ,"); builder.append(columnDefinition.name); } return builder.toString(); }
throw new InvalidRequestException("Unsupported restriction: " + relation); for (ColumnDefinition def : relation.toRestriction(cfm, boundNames).getColumnDefs()) this.notNullColumns.add(def); if (!type.allowUseOfSecondaryIndices() || !restriction.hasSupportingIndex(secondaryIndexManager)) throw new InvalidRequestException(String.format("LIKE restriction is only supported on properly " + "indexed columns. %s is not valid.",
@Override public final PartitionKeyRestrictions mergeWith(Restriction otherRestriction) throws InvalidRequestException { if (!otherRestriction.isOnToken()) return new TokenFilter(toPartitionKeyRestrictions(otherRestriction), this); return doMergeWith((TokenRestriction) otherRestriction); }
private void addRestriction(Restriction restriction) { ColumnDefinition def = restriction.getFirstColumn(); if (def.isPartitionKey()) partitionKeyRestrictions = partitionKeyRestrictions.mergeWith(restriction); else if (def.isClusteringColumn()) clusteringColumnsRestrictions = clusteringColumnsRestrictions.mergeWith(restriction); else nonPrimaryKeyRestrictions = nonPrimaryKeyRestrictions.addRestriction((SingleRestriction) restriction); }
@Override public final boolean hasSupportingIndex(SecondaryIndexManager indexManager) { for (Restriction restriction : restrictions.values()) { if (restriction.hasSupportingIndex(indexManager)) return true; } return false; }
throw new InvalidRequestException("Unsupported restriction: " + relation); for (ColumnDefinition def : relation.toRestriction(cfm, boundNames).getColumnDefs()) this.notNullColumns.add(def); if (!type.allowUseOfSecondaryIndices() || !restriction.hasSupportingIndex(secondaryIndexManager)) throw new InvalidRequestException(String.format("LIKE restriction is only supported on properly " + "indexed columns. %s is not valid.",
@Override public final PartitionKeyRestrictions mergeWith(Restriction otherRestriction) throws InvalidRequestException { if (!otherRestriction.isOnToken()) return new TokenFilter(toPartitionKeyRestrictions(otherRestriction), this); return doMergeWith((TokenRestriction) otherRestriction); }
private void addRestriction(Restriction restriction) { ColumnDefinition def = restriction.getFirstColumn(); if (def.isPartitionKey()) partitionKeyRestrictions = partitionKeyRestrictions.mergeWith(restriction); else if (def.isClusteringColumn()) clusteringColumnsRestrictions = clusteringColumnsRestrictions.mergeWith(restriction); else nonPrimaryKeyRestrictions = nonPrimaryKeyRestrictions.addRestriction((SingleRestriction) restriction); }
@Override public final boolean hasSupportingIndex(SecondaryIndexManager indexManager) { for (Restriction restriction : restrictions.values()) { if (restriction.hasSupportingIndex(indexManager)) return true; } return false; }
throw new InvalidRequestException("Unsupported restriction: " + relation); for (ColumnDefinition def : relation.toRestriction(cfm, boundNames).getColumnDefs()) this.notNullColumns.add(def); if (!type.allowUseOfSecondaryIndices() || !restriction.hasSupportingIndex(secondaryIndexManager)) throw new InvalidRequestException(String.format("LIKE restriction is only supported on properly " + "indexed columns. %s is not valid.",
@Override public PartitionKeyRestrictions mergeWith(Restriction restriction) { if (restriction.isOnToken()) { if (isEmpty()) return (PartitionKeyRestrictions) restriction; return new TokenFilter(this, (TokenRestriction) restriction); } return new PartitionKeySingleRestrictionSet(this, (SingleRestriction) restriction); }
private void addRestriction(Restriction restriction) { ColumnDefinition def = restriction.getFirstColumn(); if (def.isPartitionKey()) partitionKeyRestrictions = partitionKeyRestrictions.mergeWith(restriction); else if (def.isClusteringColumn()) clusteringColumnsRestrictions = clusteringColumnsRestrictions.mergeWith(restriction); else nonPrimaryKeyRestrictions = nonPrimaryKeyRestrictions.addRestriction((SingleRestriction) restriction); }
@Override public void addRowFilterTo(RowFilter filter, SecondaryIndexManager indexManager, QueryOptions options) throws InvalidRequestException { for (Restriction restriction : restrictions.values()) restriction.addRowFilterTo(filter, indexManager, options); }
@Override public void addFunctionsTo(List<Function> functions) { for (Restriction restriction : this) restriction.addFunctionsTo(functions); }
@Override public final boolean hasSupportingIndex(SecondaryIndexManager indexManager) { for (Restriction restriction : restrictions.values()) { if (restriction.hasSupportingIndex(indexManager)) return true; } return false; }
/** * Returns the names of the columns that are specified within this <code>Restrictions</code> and the other one * as a comma separated <code>String</code>. * * @param otherRestriction the other restrictions * @return the names of the columns that are specified within this <code>Restrictions</code> and the other one * as a comma separated <code>String</code>. */ protected final String getColumnsInCommons(Restriction otherRestriction) { Set<ColumnDefinition> commons = new HashSet<>(getColumnDefs()); commons.retainAll(otherRestriction.getColumnDefs()); StringBuilder builder = new StringBuilder(); for (ColumnDefinition columnDefinition : commons) { if (builder.length() != 0) builder.append(" ,"); builder.append(columnDefinition.name); } return builder.toString(); }
@Override public PartitionKeyRestrictions mergeWith(Restriction restriction) { if (restriction.isOnToken()) { if (isEmpty()) return (PartitionKeyRestrictions) restriction; return new TokenFilter(this, (TokenRestriction) restriction); } return new PartitionKeySingleRestrictionSet(this, (SingleRestriction) restriction); }
public ClusteringColumnRestrictions mergeWith(Restriction restriction) throws InvalidRequestException { SingleRestriction newRestriction = (SingleRestriction) restriction; RestrictionSet newRestrictionSet = restrictions.addRestriction(newRestriction); if (!isEmpty() && !allowFiltering) { SingleRestriction lastRestriction = restrictions.lastRestriction(); ColumnDefinition lastRestrictionStart = lastRestriction.getFirstColumn(); ColumnDefinition newRestrictionStart = restriction.getFirstColumn(); checkFalse(lastRestriction.isSlice() && newRestrictionStart.position() > lastRestrictionStart.position(), "Clustering column \"%s\" cannot be restricted (preceding column \"%s\" is restricted by a non-EQ relation)", newRestrictionStart.name, lastRestrictionStart.name); if (newRestrictionStart.position() < lastRestrictionStart.position() && newRestriction.isSlice()) throw invalidRequest("PRIMARY KEY column \"%s\" cannot be restricted (preceding column \"%s\" is restricted by a non-EQ relation)", restrictions.nextColumn(newRestrictionStart).name, newRestrictionStart.name); } return new ClusteringColumnRestrictions(this.comparator, newRestrictionSet, allowFiltering); }