private static Collection<IColumn> getFieldCacheEntries(IndexReader indexReader, String field) throws IOException { String indexName = SolandraCoreContainer.coreInfo.get().indexName + "~" + SolandraCoreContainer.coreInfo.get().shard; byte[] indexNameBytes = indexName.getBytes("UTF-8"); if(logger.isDebugEnabled()) logger.debug("Loading field cache from " + indexName + " " + field); ColumnParent fieldCacheParent = new ColumnParent(CassandraUtils.fieldCacheColumnFamily); ByteBuffer fieldCacheKey = CassandraUtils.hashKeyBytes(indexNameBytes, CassandraUtils.delimeterBytes, field .getBytes()); List<Row> rows = CassandraUtils.robustRead(CassandraUtils.consistency, new SliceFromReadCommand( CassandraUtils.keySpace, fieldCacheKey, fieldCacheParent, ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, false, Integer.MAX_VALUE)); if (rows.isEmpty()) return Collections.emptyList(); Row row = rows.get(0); if (row.cf == null) return Collections.emptyList(); return row.cf.getSortedColumns(); }
Iterables.filter(currentRow.cf.getSortedColumns(), new FilterDeletedColumns(nowMillis)), entryGetter, sliceQuery.getSliceEnd(),
public LucandraTermInfo[] loadFilteredTerms(Term term, List<ByteBuffer> docNums) throws IOException { long start = System.currentTimeMillis(); ColumnParent parent = new ColumnParent(); parent.setColumn_family(CassandraUtils.termVecColumnFamily); ByteBuffer key; try { key = CassandraUtils.hashKeyBytes(indexName.getBytes("UTF-8"), CassandraUtils.delimeterBytes, term.field() .getBytes("UTF-8"), CassandraUtils.delimeterBytes, term.text().getBytes("UTF-8")); } catch (UnsupportedEncodingException e2) { throw new RuntimeException("JVM doesn't support UTF-8", e2); } ReadCommand rc = new SliceByNamesReadCommand(CassandraUtils.keySpace, key, parent, docNums); List<Row> rows = CassandraUtils.robustRead(CassandraUtils.consistency, rc); LucandraTermInfo[] termInfo = null; if (rows != null && rows.size() > 0 && rows.get(0) != null && rows.get(0).cf != null) { termInfo = TermCache.convertTermInfo(rows.get(0).cf.getSortedColumns()); } long end = System.currentTimeMillis(); if (logger.isDebugEnabled()) logger.debug("loadFilterdTerms: " + term + "(" + termInfo == null ? 0 : termInfo.length + ") took " + (end - start) + "ms"); return termInfo; }
columns = rows.get(0).cf.getSortedColumns(); Term term = CassandraUtils.parseTerm(termStr); columns = row.cf.getSortedColumns();
for(IColumn sc : row.cf.getSortedColumns()){
assert row.cf.getSortedColumns() != null; for (IColumn c : row.cf.getSortedColumns())
public void deleteDocuments(String indexName, Term term, boolean autoCommit) throws CorruptIndexException, IOException { ColumnParent cp = new ColumnParent(CassandraUtils.termVecColumnFamily); ByteBuffer key = CassandraUtils.hashKeyBytes(indexName.getBytes("UTF-8"), CassandraUtils.delimeterBytes, term .field().getBytes("UTF-8"), CassandraUtils.delimeterBytes, term.text().getBytes("UTF-8")); ReadCommand rc = new SliceFromReadCommand(CassandraUtils.keySpace, key, cp, ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, false, Integer.MAX_VALUE); List<Row> rows = CassandraUtils.robustRead(CassandraUtils.consistency, rc); // delete by documentId for (Row row : rows) { if (row.cf != null) { Collection<IColumn> columns = row.cf.getSortedColumns(); for (IColumn col : columns) { deleteLucandraDocument(indexName, CassandraUtils.readVInt(col.name()), autoCommit); } } } }
ByteBuffer val = row.cf.getSortedColumns().iterator().next().value();
for (IColumn col : row.cf.getSortedColumns())
Iterables.filter(cf.getSortedColumns(), new FilterDeletedColumns(nowMillis)), entryGetter, query.getSliceEnd(),
public Iterator<Cell> iterator() { return getSortedColumns().iterator(); }
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); }
private List<ColumnOrSuperColumn> thriftifyColumnFamily(ColumnFamily cf, boolean subcolumnsOnly, boolean reverseOrder, long now) { if (cf == null || !cf.hasColumns()) return EMPTY_COLUMNS; if (cf.metadata().isSuper()) { boolean isCounterCF = cf.metadata().isCounter(); return thriftifySuperColumns(cf.getSortedColumns(), reverseOrder, now, subcolumnsOnly, isCounterCF); } else { return thriftifyColumns(cf.getSortedColumns(), reverseOrder, now); } }
public LogEntry(String keyspace, ColumnFamily columnFamily, ByteBuffer rowKey, ConsistencyLevel consistencyLevel, String host, long timestamp, Collection<String> columnNames) throws Throwable { this(keyspace, rowKey, consistencyLevel, host, timestamp, columnNames); this.columnFamily = columnFamily.metadata().cfName; for (IColumn column : columnFamily.getSortedColumns()) { ColumnOperation operation = new ColumnOperation(); operation.setName(column.name()); operation.setDelete(columnFamily.isMarkedForDelete()); operations.add(operation); } }
Iterables.filter(currentRow.cf.getSortedColumns(), new FilterDeletedColumns(nowMillis)), entryGetter, sliceQuery.getSliceEnd(),
Iterables.filter(currentRow.cf.getSortedColumns(), new FilterDeletedColumns(nowMillis)), entryGetter, sliceQuery.getSliceEnd(),
if (cf != null) for (IColumn col : cf.getSortedColumns())
public ColumnFamily trim(ColumnFamily cf, int trimTo, long now) { // each cell can increment the count by at most one, so if we have fewer cells than trimTo, we can skip trimming if (cf.getColumnCount() < trimTo) return cf; ColumnCounter counter = columnCounter(cf.getComparator(), now); ColumnFamily trimmedCf = cf.getFactory().create(cf.metadata(), reversed, trimTo); trimmedCf.delete(cf); Collection<Cell> cells = reversed ? cf.getReverseSortedColumns() : cf.getSortedColumns(); DeletionInfo.InOrderTester tester = cf.deletionInfo().inOrderTester(reversed); for (Iterator<Cell> iter = cells.iterator(); iter.hasNext(); ) { Cell cell = iter.next(); counter.count(cell, tester); if (counter.live() > trimTo) { break; } else { trimmedCf.addColumn(cell); } } return trimmedCf; }
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(); }
ByteBuffer rowKey = row.key.getKey(); Collection<Cell> cols = cf.getSortedColumns(); boolean keyColumnsAdded = false; for (Cell column : cols) {