private boolean handleInFilter(SingleRestriction restriction, int index) { return restriction.isContains() || restriction.isLIKE() || index != restriction.getFirstColumn().position(); }
private boolean handleInFilter(SingleRestriction restriction, int index) { return restriction.isContains() || restriction.isLIKE() || index != restriction.getFirstColumn().position(); }
private boolean handleInFilter(SingleRestriction restriction, int index) { return restriction.isContains() || restriction.isLIKE() || index != restriction.getFirstColumn().position(); }
@Override public SingleRestriction doMergeWith(SingleRestriction otherRestriction) { checkTrue(otherRestriction.isSlice(), "Column \"%s\" cannot be restricted by both an equality and an inequality relation", getColumnsInCommons(otherRestriction)); if (!getFirstColumn().equals(otherRestriction.getFirstColumn())) { ColumnDefinition column = getFirstColumn().position() > otherRestriction.getFirstColumn().position() ? getFirstColumn() : otherRestriction.getFirstColumn(); throw invalidRequest("Column \"%s\" cannot be restricted by two inequalities not starting with the same column", column.name); } checkFalse(hasBound(Bound.START) && otherRestriction.hasBound(Bound.START), "More than one restriction was found for the start bound on %s", getColumnsInCommons(otherRestriction)); checkFalse(hasBound(Bound.END) && otherRestriction.hasBound(Bound.END), "More than one restriction was found for the end bound on %s", getColumnsInCommons(otherRestriction)); SliceRestriction otherSlice = (SliceRestriction) otherRestriction; List<ColumnDefinition> newColumnDefs = columnDefs.size() >= otherSlice.columnDefs.size() ? columnDefs : otherSlice.columnDefs; return new SliceRestriction(newColumnDefs, slice.merge(otherSlice.slice)); }
@Override public SingleRestriction doMergeWith(SingleRestriction otherRestriction) { checkTrue(otherRestriction.isSlice(), "Column \"%s\" cannot be restricted by both an equality and an inequality relation", getColumnsInCommons(otherRestriction)); if (!getFirstColumn().equals(otherRestriction.getFirstColumn())) { ColumnDefinition column = getFirstColumn().position() > otherRestriction.getFirstColumn().position() ? getFirstColumn() : otherRestriction.getFirstColumn(); throw invalidRequest("Column \"%s\" cannot be restricted by two inequalities not starting with the same column", column.name); } checkFalse(hasBound(Bound.START) && otherRestriction.hasBound(Bound.START), "More than one restriction was found for the start bound on %s", getColumnsInCommons(otherRestriction)); checkFalse(hasBound(Bound.END) && otherRestriction.hasBound(Bound.END), "More than one restriction was found for the end bound on %s", getColumnsInCommons(otherRestriction)); SliceRestriction otherSlice = (SliceRestriction) otherRestriction; List<ColumnDefinition> newColumnDefs = columnDefs.size() >= otherSlice.columnDefs.size() ? columnDefs : otherSlice.columnDefs; return new SliceRestriction(newColumnDefs, slice.merge(otherSlice.slice)); }
@Override public SingleRestriction doMergeWith(SingleRestriction otherRestriction) { checkTrue(otherRestriction.isSlice(), "Column \"%s\" cannot be restricted by both an equality and an inequality relation", getColumnsInCommons(otherRestriction)); if (!getFirstColumn().equals(otherRestriction.getFirstColumn())) { ColumnDefinition column = getFirstColumn().position() > otherRestriction.getFirstColumn().position() ? getFirstColumn() : otherRestriction.getFirstColumn(); throw invalidRequest("Column \"%s\" cannot be restricted by two inequalities not starting with the same column", column.name); } checkFalse(hasBound(Bound.START) && otherRestriction.hasBound(Bound.START), "More than one restriction was found for the start bound on %s", getColumnsInCommons(otherRestriction)); checkFalse(hasBound(Bound.END) && otherRestriction.hasBound(Bound.END), "More than one restriction was found for the end bound on %s", getColumnsInCommons(otherRestriction)); SliceRestriction otherSlice = (SliceRestriction) otherRestriction; List<ColumnDefinition> newColumnDefs = columnDefs.size() >= otherSlice.columnDefs.size() ? columnDefs : otherSlice.columnDefs; return new SliceRestriction(newColumnDefs, slice.merge(otherSlice.slice)); }
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); }
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); }
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); }