public Iterator<Cell> getColumnIterator(ColumnFamily cf) { assert cf != null; return reversed ? cf.reverseIterator(slices) : cf.iterator(slices); }
public boolean appliesTo(ColumnFamily current) { if (current == null) return true; Iterator<Cell> iter = current.iterator(new ColumnSlice[]{ rowPrefix.slice() }); while (iter.hasNext()) if (iter.next().isLive(now)) return false; return true; } }
public boolean appliesTo(ColumnFamily current) { if (current == null) return false; Iterator<Cell> iter = current.iterator(new ColumnSlice[]{ rowPrefix.slice() }); while (iter.hasNext()) if (iter.next().isLive(now)) return true; return false; } }
public Collection<RowMutation> augment(ByteBuffer key, ColumnFamily cf) { try { ByteBuffer id_bb = CompositeType.extractComponent(key, 0); UUID id=TimeUUIDType.instance.compose(id_bb); ByteBuffer data_key_bb = CompositeType.extractComponent(key, 1); String data_key=UTF8Type.instance.compose(data_key_bb); Iterator col_itr=cf.iterator(); Column ts_col=(Column)col_itr.next(); ByteBuffer time_bb=CompositeType.extractComponent(ts_col.name(),0); long time=(TimestampType.instance.compose(time_bb)).getTime(); Column data_bb=(Column)col_itr.next(); String data=UTF8Type.instance.compose(data_bb.value()); log(" id --> "+id.toString()); log(" data_key-->"+data_key); log(" time == "+time); log(" data == "+data); } catch (Exception e) { logger.warn("Exception ", e); } return null; }
protected Iterator<Cell> collectionColumns(CellName collection, ColumnFamily cf, final long now) { // We are testing for collection equality, so we need to have the expected values *and* only those. ColumnSlice[] collectionSlice = new ColumnSlice[]{ collection.slice() }; // Filter live columns, this makes things simpler afterwards return Iterators.filter(cf.iterator(collectionSlice), new Predicate<Cell>() { public boolean apply(Cell c) { // we only care about live columns return c.isLive(now); } }); } }
public boolean isFullyCoveredBy(ColumnFamily cf, long now) { // cf will cover all the requested columns if the range it covers include // all said columns CellName first = cf.iterator(ColumnSlice.ALL_COLUMNS_ARRAY).next().name(); CellName last = cf.reverseIterator(ColumnSlice.ALL_COLUMNS_ARRAY).next().name(); return cf.getComparator().compare(first, columns.first()) <= 0 && cf.getComparator().compare(columns.last(), last) <= 0; }
public void applyUpdates(ColumnFamily current, ColumnFamily updates) throws InvalidRequestException { Map<ByteBuffer, CQL3Row> map = null; if (stmt.requiresRead()) { // Uses the "current" values read by Paxos for lists operation that requires a read Iterator<CQL3Row> iter = cfm.comparator.CQL3RowBuilder(cfm, now).group(current.iterator(new ColumnSlice[]{ rowPrefix.slice() })); if (iter.hasNext()) { map = Collections.singletonMap(key, iter.next()); assert !iter.hasNext() : "We shoudn't be updating more than one CQL row per-ModificationStatement"; } } UpdateParameters params = new UpdateParameters(cfm, options, timestamp, stmt.getTimeToLive(options), map); stmt.addUpdateForKey(updates, key, rowPrefix, params); } }
public void addAll(ColumnFamily other) { delete(other.deletionInfo()); if (!other.hasColumns()) return; // In reality, with ABSC being the only remaining container (aside from ABTC), other will aways be ABSC. if (size == 0 && other instanceof ArrayBackedSortedColumns) { fastAddAll((ArrayBackedSortedColumns) other); } else { Iterator<Cell> iterator = reversed ? other.reverseIterator() : other.iterator(); while (iterator.hasNext()) addColumn(iterator.next()); } }
private int discardLast(ColumnFamily cf, int toDiscard, ColumnFamily newCf) { boolean isReversed = isReversed(); DeletionInfo.InOrderTester tester = cf.deletionInfo().inOrderTester(isReversed); return isReversed ? discardHead(cf, toDiscard, newCf, cf.reverseIterator(), tester) : discardTail(cf, toDiscard, newCf, cf.iterator(), tester); }
private int discardFirst(ColumnFamily cf, int toDiscard, ColumnFamily newCf) { boolean isReversed = isReversed(); DeletionInfo.InOrderTester tester = cf.deletionInfo().inOrderTester(isReversed); return isReversed ? discardTail(cf, toDiscard, newCf, cf.reverseIterator(), tester) : discardHead(cf, toDiscard, newCf, cf.iterator(), tester); }
Indexer indexer = indexContainer.indexer(dk); IndexEntryBuilder builder = new IndexEntryBuilder(); Iterator<Cell> cols = cf.iterator(); if (cols.hasNext()) { while (cols.hasNext()) {
static ColumnFamily resolveSuperset(Iterable<ColumnFamily> versions, long now) { assert Iterables.size(versions) > 0; ColumnFamily resolved = null; for (ColumnFamily cf : versions) { if (cf == null) continue; if (resolved == null) resolved = cf.cloneMeShallow(); else resolved.delete(cf); } if (resolved == null) return null; // mimic the collectCollatedColumn + removeDeleted path that getColumnFamily takes. // this will handle removing columns and subcolumns that are suppressed by a row or // supercolumn tombstone. QueryFilter filter = new QueryFilter(null, resolved.metadata().cfName, new IdentityQueryFilter(), now); List<CloseableIterator<Cell>> iters = new ArrayList<>(Iterables.size(versions)); for (ColumnFamily version : versions) if (version != null) iters.add(FBUtilities.closeableIterator(version.iterator())); filter.collateColumns(resolved, iters, Integer.MIN_VALUE); return ColumnFamilyStore.removeDeleted(resolved, Integer.MIN_VALUE); }
public boolean isFullyCoveredBy(ColumnFamily cf, long now) { // cf is the beginning of a partition. It covers this filter if: // 1) either this filter requests the head of the partition and request less // than what cf has to offer (note: we do need to use getLiveCount() for that // as it knows if the filter count cells or CQL3 rows). // 2) the start and finish bound of this filter are included in cf. if (isHeadFilter() && count <= getLiveCount(cf, now)) return true; if (start().isEmpty() || finish().isEmpty() || !cf.hasColumns()) return false; Composite low = isReversed() ? finish() : start(); Composite high = isReversed() ? start() : finish(); CellName first = cf.iterator(ColumnSlice.ALL_COLUMNS_ARRAY).next().name(); CellName last = cf.reverseIterator(ColumnSlice.ALL_COLUMNS_ARRAY).next().name(); return cf.getComparator().compare(first, low) <= 0 && cf.getComparator().compare(high, last) <= 0; }
Iterator<Cell> iter = data.iterator(new ColumnSlice[]{ data.getComparator().create(prefix, def).slice() }); while (iter.hasNext())
filter.collateOnDiskAtom(returnCF, container.iterator(), gcBefore);