public CellName create(Composite prefix, ColumnDefinition column) { assert prefix.isEmpty(); CellName cn = internedNames.get(column.name.bytes); return cn == null ? new SimpleSparseCellName(column.name) : cn; }
private static void validateSliceFilter(CFMetaData metadata, Composite start, Composite finish, boolean reversed) throws InvalidRequestException { CellNameType comparator = metadata.comparator; Comparator<Composite> orderedComparator = reversed ? comparator.reverseComparator(): comparator; if (!start.isEmpty() && !finish.isEmpty() && orderedComparator.compare(start, finish) > 0) throw new InvalidRequestException("range finish must come after start in traversal order"); }
private static boolean pagingFinished(ColumnFamily hintColumnFamily, Composite startColumn) { // done if no hints found or the start column (same as last column processed in previous iteration) is the only one return hintColumnFamily == null || (!startColumn.isEmpty() && hintColumnFamily.getSortedColumns().size() == 1 && hintColumnFamily.getColumn((CellName)startColumn) != null); }
protected boolean isBeforeSliceStart(Composite name) { Composite start = currentStart(); return !start.isEmpty() && comparator.compare(name, start) < 0; }
public int compare(Composite c1, Composite c2) { if (isByteOrderComparable) return AbstractSimpleCellNameType.compareUnsigned(c1, c2); assert !(c1.isEmpty() | c2.isEmpty()); // This method assumes that simple composites never have an EOC != NONE. This assumption // stands in particular on the fact that a Composites.EMPTY never has a non-NONE EOC. If // this ever change, we'll need to update this. return type.compare(c1.get(0), c2.get(0)); }
public CellName rowMarker(Composite prefix) { assert !prefix.isStatic(); // static columns don't really create rows, they shouldn't have a row marker if (prefix.isEmpty()) return rowMarkerNoPrefix; return create(prefix, rowMarkerId, false); }
protected boolean isAfterSliceFinish(Composite name) { Composite finish = currentFinish(); return !finish.isEmpty() && comparator.compare(name, finish) > 0; } }
private static OnDiskAtomIterator createReader(SSTableReader sstable, RowIndexEntry indexEntry, FileDataInput file, ColumnSlice[] slices, boolean reversed) { return slices.length == 1 && slices[0].start.isEmpty() && !reversed ? new SimpleSliceReader(sstable, indexEntry, file, slices[0].finish) : new IndexedSliceReader(sstable, indexEntry, file, slices, reversed); }
protected OnDiskAtom computeNext() { if (!atomIterator.hasNext()) return endOfData(); OnDiskAtom column = atomIterator.next(); if (!finishColumn.isEmpty() && comparator.compare(column.name(), finishColumn) > 0) return endOfData(); return column; }
public int compareNextTo(Composite composite) throws IOException { maybeReadNext(); if (composite.isEmpty()) return next.hasRemaining() ? 1 : 0; return type.subtype(0).compare(next, composite.get(0)); }
public CellName deserialize(DataInput in) throws IOException { Composite ct = serializer().deserialize(in); if (ct.isEmpty()) throw ColumnSerializer.CorruptColumnException.create(in, ByteBufferUtil.EMPTY_BYTE_BUFFER); assert ct instanceof CellName : ct; return (CellName)ct; }
protected boolean isColumnBeforeSliceFinish(OnDiskAtom column) { Composite finish = currentFinish(); return finish.isEmpty() || comparator.compare(column.name(), finish) <= 0; }
private List<Composite> getRequestedBound(Bound b, QueryOptions options) throws InvalidRequestException { assert isColumnRange(); List<Composite> bound = buildBound(b, cfm.clusteringColumns(), columnRestrictions, isReversed, cfm.comparator, options); for (Composite c : bound) { if (!c.isEmpty()) QueryProcessor.validateComposite(c, cfm.comparator); } return bound; }
private CellName create(Composite prefix, ColumnIdentifier columnName, boolean isStatic) { if (isStatic) prefix = staticPrefix(); assert prefix.size() == clusteringSize; if (prefix.isEmpty()) return new CompoundSparseCellName(columnName, isStatic); assert prefix instanceof CompoundComposite; CompoundComposite lc = (CompoundComposite)prefix; return new CompoundSparseCellName(lc.elements, clusteringSize, columnName, isStatic); }
@Override public CellName create(Composite prefix, ColumnDefinition column, ByteBuffer collectionElement) { if (column.isStatic()) prefix = staticPrefix(); assert prefix.size() == clusteringSize; if (prefix.isEmpty()) return new CompoundSparseCellName.WithCollection(column.name, collectionElement, column.isStatic()); assert prefix instanceof CompoundComposite; CompoundComposite lc = (CompoundComposite)prefix; return new CompoundSparseCellName.WithCollection(lc.elements, clusteringSize, column.name, collectionElement, column.isStatic()); }