Search in sources :

Example 1 with ColumnSlice

use of org.apache.cassandra.db.filter.ColumnSlice in project stargate-core by tuplejump.

the class ResultMapper method getColumnSlices.

private ColumnSlice[] getColumnSlices(Collection<IndexEntry> entries) {
    ColumnSlice[] columnSlices = new ColumnSlice[entries.size()];
    int i = 0;
    for (IndexEntry entry : entries) {
        Composite start = tableMapper.start(entry.clusteringKey);
        Composite end = tableMapper.end(start);
        ColumnSlice columnSlice = new ColumnSlice(start, end);
        columnSlices[i++] = columnSlice;
    }
    return columnSlices;
}
Also used : Composite(org.apache.cassandra.db.composites.Composite) ColumnSlice(org.apache.cassandra.db.filter.ColumnSlice) IndexEntry(com.tuplejump.stargate.lucene.IndexEntryCollector.IndexEntry)

Example 2 with ColumnSlice

use of org.apache.cassandra.db.filter.ColumnSlice in project stargate-core by tuplejump.

the class ResultMapper method getPagedColumnSlices.

private ColumnSlice[] getPagedColumnSlices(DecoratedKey dk, Collection<IndexEntry> entries, int pageSize) {
    ArrayList<ColumnSlice> columnSlices = new ArrayList<>(Math.min(entries.size(), pageSize));
    for (IndexEntry entry : entries) {
        CellName cellName = entry.clusteringKey;
        if (!filter.columnFilter(dk.getKey()).maySelectPrefix(tableMapper.table.getComparator(), cellName.start())) {
            continue;
        }
        Composite start = tableMapper.start(cellName);
        Composite end = tableMapper.end(start);
        ColumnSlice columnSlice = new ColumnSlice(start, end);
        columnSlices.add(columnSlice);
        if (columnSlices.size() == pageSize) {
            break;
        }
    }
    return columnSlices.toArray(new ColumnSlice[columnSlices.size()]);
}
Also used : Composite(org.apache.cassandra.db.composites.Composite) ColumnSlice(org.apache.cassandra.db.filter.ColumnSlice) ArrayList(java.util.ArrayList) IndexEntry(com.tuplejump.stargate.lucene.IndexEntryCollector.IndexEntry) CellName(org.apache.cassandra.db.composites.CellName)

Example 3 with ColumnSlice

use of org.apache.cassandra.db.filter.ColumnSlice in project stargate-core by tuplejump.

the class RowIndexSupport method loadOldRow.

private void loadOldRow(DecoratedKey dk, ByteBuffer pkBuf, List<Field> fields) {
    CellName clusteringKey = tableMapper.makeClusteringKey(pkBuf);
    Composite start = tableMapper.start(clusteringKey);
    Composite end = tableMapper.end(start);
    ColumnSlice columnSlice = new ColumnSlice(start, end);
    SliceQueryFilter sliceQueryFilter = new SliceQueryFilter(columnSlice, false, Integer.MAX_VALUE);
    QueryFilter queryFilter = new QueryFilter(dk, tableMapper.table.name, sliceQueryFilter, new Date().getTime());
    ColumnFamily columnFamily = tableMapper.table.getColumnFamily(queryFilter);
    Map<CellName, ColumnFamily> fullSlice = tableMapper.getRows(columnFamily);
    ColumnFamily oldDocument = fullSlice.get(clusteringKey);
    for (Cell cell : oldDocument) {
        CellName cellName = cell.name();
        ColumnIdentifier cql3ColName = cellName.cql3ColumnName(tableMapper.cfMetaData);
        String actualColName = cql3ColName.toString();
        ColumnDefinition columnDefinition = tableMapper.cfMetaData.getColumnDefinition(cql3ColName);
        if (options.shouldIndex(actualColName)) {
            addFields(cell, actualColName, columnDefinition, fields);
        }
    }
}
Also used : SliceQueryFilter(org.apache.cassandra.db.filter.SliceQueryFilter) QueryFilter(org.apache.cassandra.db.filter.QueryFilter) Composite(org.apache.cassandra.db.composites.Composite) ColumnSlice(org.apache.cassandra.db.filter.ColumnSlice) SliceQueryFilter(org.apache.cassandra.db.filter.SliceQueryFilter) ColumnIdentifier(org.apache.cassandra.cql3.ColumnIdentifier) CellName(org.apache.cassandra.db.composites.CellName) ColumnDefinition(org.apache.cassandra.config.ColumnDefinition)

Aggregations

Composite (org.apache.cassandra.db.composites.Composite)3 ColumnSlice (org.apache.cassandra.db.filter.ColumnSlice)3 IndexEntry (com.tuplejump.stargate.lucene.IndexEntryCollector.IndexEntry)2 CellName (org.apache.cassandra.db.composites.CellName)2 ArrayList (java.util.ArrayList)1 ColumnDefinition (org.apache.cassandra.config.ColumnDefinition)1 ColumnIdentifier (org.apache.cassandra.cql3.ColumnIdentifier)1 QueryFilter (org.apache.cassandra.db.filter.QueryFilter)1 SliceQueryFilter (org.apache.cassandra.db.filter.SliceQueryFilter)1