rows.get(0).cf.getColumn(CassandraUtils.cachedColBytes).getSubColumn(CassandraUtils.cachedColBytes).timestamp() >= lastCheck)
public boolean deleteIfNotLatest(DecoratedKey decoratedKey, long timestamp, String pkString, ColumnFamily cf) throws IOException { if (deleteRowIfNotLatest(decoratedKey, cf)) return true; Cell lastColumn = null; for (CellName colKey : cf.getColumnNames()) { String name = colKey.cql3ColumnName(tableMapper.cfMetaData).toString(); com.tuplejump.stargate.lucene.Properties option = options.fields.get(name); //if option was not found then the column is not indexed if (option != null) { lastColumn = cf.getColumn(colKey); } } if (lastColumn != null && lastColumn.timestamp() > timestamp) { currentIndex.delete(decoratedKey, pkString, timestamp); return true; } return false; }
private ByteBuffer extractDataValue(ColumnDefinition def, ByteBuffer rowKey, ColumnFamily data, Composite prefix) { switch (def.kind) { case PARTITION_KEY: return def.isOnAllComponents() ? rowKey : ((CompositeType)data.metadata().getKeyValidator()).split(rowKey)[def.position()]; case CLUSTERING_COLUMN: return prefix.get(def.position()); case REGULAR: CellName cname = prefix == null ? data.getComparator().cellFromByteBuffer(def.name.bytes) : data.getComparator().create(prefix, def); Cell cell = data.getColumn(cname); return cell == null ? null : cell.value(); case COMPACT_VALUE: assert data.getColumnCount() == 1; return data.getSortedColumns().iterator().next().value(); } throw new AssertionError(); }
public Long checkForUpdate(String indexName, String key) throws IOException { ByteBuffer keyCol = ByteBuffer.wrap(key.getBytes("UTF-8")); ByteBuffer keyKey = CassandraUtils.hashKeyBytes((indexName + "~" + key).getBytes("UTF-8"), CassandraUtils.delimeterBytes, "keys".getBytes("UTF-8")); List<Row> rows = CassandraUtils.robustRead(keyKey, new QueryPath(CassandraUtils.schemaInfoColumnFamily), Arrays.asList(keyCol), ConsistencyLevel.QUORUM); if (rows.size() == 1) { Row row = rows.get(0); if (row.cf != null) { IColumn col = row.cf.getColumn(keyCol); if (col != null) { Collection<IColumn> subCols = col.getSubColumns(); if (subCols != null && !subCols.isEmpty()) { ByteBuffer idVal = col.getSubColumns().iterator().next().name(); Long id = Long.valueOf(ByteBufferUtil.string(idVal)); return id; } } } } return null; }
.getColumn(coreNameBytes) .getSubColumn(resourceNameBytes).value();
IColumn col = row.cf.getColumn(keyCol);
DocumentMetadata allTerms = IndexWriter.fromBytesUsingThrift(rows.get(0).cf.getColumn( CassandraUtils.documentMetaFieldBytes).value());
return; // nothing to delete IColumn metaCol = rows.get(0).cf.getColumn(CassandraUtils.documentMetaFieldBytes); if (metaCol == null) return;
supercol = rows.get(0).cf.getColumn(id);
protected OnDiskAtom computeNext() { while (iter.hasNext()) { CellName current = iter.next(); Cell cell = cf.getColumn(current); if (cell != null) return cell; } return endOfData(); }
/** * remove columns from @param filter where we already have data in @param container newer than @param sstableTimestamp */ private void reduceNameFilter(QueryFilter filter, ColumnFamily container, long sstableTimestamp) { if (container == null) return; for (Iterator<CellName> iterator = ((NamesQueryFilter) filter.filter).columns.iterator(); iterator.hasNext(); ) { CellName filterColumn = iterator.next(); Cell cell = container.getColumn(filterColumn); if (cell != null && cell.timestamp() > sstableTimestamp) iterator.remove(); } }
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); }
public boolean appliesTo(Composite rowPrefix, ColumnFamily current, long now) throws InvalidRequestException { CellName name = current.metadata().comparator.create(rowPrefix, column); for (ByteBuffer value : inValues) { if (isSatisfiedByValue(value, current.getColumn(name), column.type, Operator.EQ, now)) return true; } return false; } }
public boolean appliesTo(Composite rowPrefix, ColumnFamily current, long now) throws InvalidRequestException { CellName name = current.metadata().comparator.create(rowPrefix, column); return isSatisfiedByValue(value, current.getColumn(name), column.type, operator, now); } }
private boolean needsExtraQuery(ByteBuffer rowKey, ColumnFamily data) { IDiskAtomFilter filter = columnFilter(rowKey); if (filter instanceof SliceQueryFilter && DataRange.isFullRowSlice((SliceQueryFilter)filter)) return false; for (IndexExpression expr : clause) { if (data.getColumn(data.getComparator().cellFromByteBuffer(expr.column)) == null) { logger.debug("adding extraFilter to cover additional expressions"); return true; } } return false; }
public boolean isStale(IndexedEntry entry, ColumnFamily data, long now) { CellName name = data.getComparator().create(entry.indexedEntryPrefix, columnDef, entry.indexValue.getKey()); Cell cell = data.getColumn(name); return cell == null || !cell.isLive(now); } }
public boolean isIndexEntryStale(ByteBuffer indexedValue, ColumnFamily data, long now) { Cell cell = data.getColumn(data.getComparator().makeCellName(columnDef.name.bytes)); return cell == null || !cell.isLive(now) || columnDef.type.compare(indexedValue, cell.value()) != 0; }
public boolean isStale(IndexedEntry entry, ColumnFamily data, long now) { CellName name = data.getComparator().create(entry.indexedEntryPrefix, columnDef); Cell cell = data.getColumn(name); return cell == null || !cell.isLive(now) || columnDef.type.compare(entry.indexValue.getKey(), cell.value()) != 0; } }
public boolean isStale(IndexedEntry entry, ColumnFamily data, long now) { CellName name = data.getComparator().create(entry.indexedEntryPrefix, columnDef, entry.indexedEntryCollectionKey); Cell cell = data.getColumn(name); return cell == null || !cell.isLive(now) || ((CollectionType) columnDef.type).valueComparator().compare(entry.indexValue.getKey(), cell.value()) != 0; } }
public Pair<CounterCacheKey, ClockAndCount> call() throws Exception { DecoratedKey key = cfs.partitioner.decorateKey(partitionKey); QueryFilter filter = QueryFilter.getNamesFilter(key, cfs.metadata.cfName, FBUtilities.singleton(cellName, cfs.metadata.comparator), Long.MIN_VALUE); ColumnFamily cf = cfs.getTopLevelColumns(filter, Integer.MIN_VALUE); if (cf == null) return null; Cell cell = cf.getColumn(cellName); if (cell == null || !cell.isLive(Long.MIN_VALUE)) return null; ClockAndCount clockAndCount = CounterContext.instance().getLocalClockAndCount(cell.value()); return Pair.create(CounterCacheKey.create(cfs.metadata.ksAndCFName, partitionKey, cellName), clockAndCount); } });