/** * Reverses the bound if the column type is a reversed one. * * @param columnDefinition the column definition * @return the bound reversed if the column type was a reversed one or the original bound */ public Bound reverseIfNeeded(ColumnDefinition columnDefinition) { return columnDefinition.isReversedType() ? reverse() : this; }
/** * Returns the index operator corresponding to the specified boundary. * * @param b the boundary type * @return the index operator corresponding to the specified boundary */ public Operator getIndexOperator(Bound b) { if (b.isStart()) return boundInclusive[b.idx] ? Operator.GTE : Operator.GT; return boundInclusive[b.idx] ? Operator.LTE : Operator.LT; }
Bound b = bound.reverseIfNeeded(column); if (hasComponent(b.reverse(), i, componentBounds)) toAdd.add(values); if (bound.isEnd()) Collections.reverse(toAdd);
public NavigableSet<ClusteringBound> boundsAsClustering(Bound bound, QueryOptions options) throws InvalidRequestException { MultiCBuilder builder = MultiCBuilder.create(comparator, hasIN() || hasMultiColumnSlice()); int keyPosition = 0; for (SingleRestriction r : restrictions) { if (handleInFilter(r, keyPosition)) break; if (r.isSlice()) { r.appendBoundTo(builder, bound, options); return builder.buildBoundForSlice(bound.isStart(), r.isInclusive(bound), r.isInclusive(bound.reverse()), r.getColumnDefs()); } r.appendBoundTo(builder, bound, options); if (builder.hasMissingElements()) return BTreeSet.empty(comparator); keyPosition = r.getLastColumn().position() + 1; } // Everything was an equal (or there was nothing) return builder.buildBound(bound.isStart(), true); }
public void setBound(Restriction.Slice slice) throws InvalidRequestException { for (Bound bound : Bound.values()) if (slice.hasBound(bound)) setBound(bound, slice.isInclusive(bound), slice.bound(bound)); }
@Override public MultiCBuilder appendBoundTo(MultiCBuilder builder, Bound bound, QueryOptions options) { Bound b = bound.reverseIfNeeded(getFirstColumn()); if (!hasBound(b)) return builder; Term term = slice.bound(b); assert (term instanceof Tuples.Value); firstValue = ((Tuples.Value)term).getElements().get(0); secondValue = ((Tuples.Value)term).getElements().get(1); checkBindValueSet(firstValue, "Invalid unset value for column %s", columnDef.name); checkBindValueSet(secondValue, "Invalid unset value for column %s", columnDef.name); return builder.addElementToAll(firstValue); } }
Bound b = bound.reverseIfNeeded(column); if (hasComponent(b.reverse(), i, componentBounds)) toAdd.add(values); if (bound.isEnd()) Collections.reverse(toAdd);
public NavigableSet<ClusteringBound> boundsAsClustering(Bound bound, QueryOptions options) throws InvalidRequestException { MultiCBuilder builder = MultiCBuilder.create(comparator, hasIN() || hasMultiColumnSlice()); int keyPosition = 0; for (SingleRestriction r : restrictions) { if (handleInFilter(r, keyPosition)) break; if (r.isSlice()) { r.appendBoundTo(builder, bound, options); return builder.buildBoundForSlice(bound.isStart(), r.isInclusive(bound), r.isInclusive(bound.reverse()), r.getColumnDefs()); } r.appendBoundTo(builder, bound, options); if (builder.hasMissingElements()) return BTreeSet.empty(comparator); keyPosition = r.getLastColumn().position() + 1; } // Everything was an equal (or there was nothing) return builder.buildBound(bound.isStart(), true); }
@Override public void addRowFilterTo(RowFilter filter, SecondaryIndexManager indexManager, QueryOptions options) { for (Bound b : Bound.values()) if (hasBound(b)) filter.add(columnDef, slice.getIndexOperator(b), slice.bound(b).bindAndGet(options)); }
@Override public MultiCBuilder appendBoundTo(MultiCBuilder builder, Bound bound, QueryOptions options) { Bound b = bound.reverseIfNeeded(getFirstColumn()); if (!hasBound(b)) return builder; Term term = slice.bound(b); assert (term instanceof Tuples.Value); firstValue = ((Tuples.Value)term).getElements().get(0); secondValue = ((Tuples.Value)term).getElements().get(1); checkBindValueSet(firstValue, "Invalid unset value for column %s", columnDef.name); checkBindValueSet(secondValue, "Invalid unset value for column %s", columnDef.name); return builder.addElementToAll(firstValue); } }
Bound b = bound.reverseIfNeeded(column); if (hasComponent(b.reverse(), i, componentBounds)) toAdd.add(values); if (bound.isEnd()) Collections.reverse(toAdd);
public NavigableSet<ClusteringBound> boundsAsClustering(Bound bound, QueryOptions options) throws InvalidRequestException { MultiCBuilder builder = MultiCBuilder.create(comparator, hasIN() || hasMultiColumnSlice()); int keyPosition = 0; for (SingleRestriction r : restrictions) { if (handleInFilter(r, keyPosition)) break; if (r.isSlice()) { r.appendBoundTo(builder, bound, options); return builder.buildBoundForSlice(bound.isStart(), r.isInclusive(bound), r.isInclusive(bound.reverse()), r.getColumnDefs()); } r.appendBoundTo(builder, bound, options); if (builder.hasMissingElements()) return BTreeSet.empty(comparator); keyPosition = r.getLastColumn().position() + 1; } // Everything was an equal (or there was nothing) return builder.buildBound(bound.isStart(), true); }
@Override public void addRowFilterTo(RowFilter filter, SecondaryIndexManager indexManager, QueryOptions options) { for (Bound b : Bound.values()) if (hasBound(b)) filter.add(columnDef, slice.getIndexOperator(b), slice.bound(b).bindAndGet(options)); }
/** * Returns the index operator corresponding to the specified boundary. * * @param b the boundary type * @return the index operator corresponding to the specified boundary */ public Operator getIndexOperator(Bound b) { if (b.isStart()) return boundInclusive[b.idx] ? Operator.GTE : Operator.GT; return boundInclusive[b.idx] ? Operator.LTE : Operator.LT; }
/** * Reverses the bound if the column type is a reversed one. * * @param columnDefinition the column definition * @return the bound reversed if the column type was a reversed one or the original bound */ public Bound reverseIfNeeded(ColumnDefinition columnDefinition) { return columnDefinition.isReversedType() ? reverse() : this; }
@Override public MultiCBuilder appendBoundTo(MultiCBuilder builder, Bound bound, QueryOptions options) { Bound b = bound.reverseIfNeeded(getFirstColumn()); if (!hasBound(b)) return builder; Term term = slice.bound(b); assert (term instanceof Tuples.Value); firstValue = ((Tuples.Value)term).getElements().get(0); secondValue = ((Tuples.Value)term).getElements().get(1); checkBindValueSet(firstValue, "Invalid unset value for column %s", columnDef.name); checkBindValueSet(secondValue, "Invalid unset value for column %s", columnDef.name); return builder.addElementToAll(firstValue); } }
@Override public void addRowFilterTo(RowFilter filter, SecondaryIndexManager indexManager, QueryOptions options) { for (Bound b : Bound.values()) if (hasBound(b)) filter.add(columnDef, slice.getIndexOperator(b), slice.bound(b).bindAndGet(options)); }
public Bound reverse() { return isStart() ? END : START; }
/** * Reverses the bound if the column type is a reversed one. * * @param columnDefinition the column definition * @return the bound reversed if the column type was a reversed one or the original bound */ public Bound reverseIfNeeded(ColumnDefinition columnDefinition) { return columnDefinition.isReversedType() ? reverse() : this; }
@Override public MultiCBuilder appendBoundTo(MultiCBuilder builder, Bound bound, QueryOptions options) { Bound b = bound.reverseIfNeeded(getFirstColumn()); if (!hasBound(b)) return builder; ByteBuffer value = slice.bound(b).bindAndGet(options); checkBindValueSet(value, "Invalid unset value for column %s", columnDef.name); return builder.addElementToAll(value); }