public UnfilteredRowIterator unfilteredIterator() { return unfilteredIterator(ColumnFilter.selection(columns()), Slices.ALL, false); }
public UnfilteredRowIterator unfilteredIterator() { return unfilteredIterator(ColumnFilter.selection(columns()), Slices.ALL, false); }
public UnfilteredRowIterator unfilteredIterator() { return unfilteredIterator(ColumnFilter.selection(columns()), Slices.ALL, false); }
public Row getPrefetchedRow(DecoratedKey key, Clustering clustering) { if (prefetchedRows == null) return null; Partition partition = prefetchedRows.get(key); return partition == null ? null : partition.searchIterator(ColumnFilter.selection(partition.columns()), false).next(clustering); } }
public UnfilteredRowIterator unfilteredIterator() { return unfilteredIterator(ColumnFilter.selection(columns()), Slices.ALL, false); }
public Row getRow(Clustering clustering) { Row row = searchIterator(ColumnFilter.selection(columns()), false).next(clustering); // Note that for statics, this will never return null, this will return an empty row. However, // it's more consistent for this method to return null if we don't really have a static row. return row == null || (clustering == Clustering.STATIC_CLUSTERING && row.isEmpty()) ? null : row; }
public Row getRow(Clustering clustering) { Row row = searchIterator(ColumnFilter.selection(columns()), false).next(clustering); // Note that for statics, this will never return null, this will return an empty row. However, // it's more consistent for this method to return null if we don't really have a static row. return row == null || (clustering == Clustering.STATIC_CLUSTERING && row.isEmpty()) ? null : row; }
public Row getRow(Clustering clustering) { Row row = searchIterator(ColumnFilter.selection(columns()), false).next(clustering); // Note that for statics, this will never return null, this will return an empty row. However, // it's more consistent for this method to return null if we don't really have a static row. return row == null || (clustering == Clustering.STATIC_CLUSTERING && row.isEmpty()) ? null : row; }
public Row getRow(Clustering clustering) { Row row = searchIterator(ColumnFilter.selection(columns()), false).next(clustering); // Note that for statics, this will never return null, this will return an empty row. However, // it's more consistent for this method to return null if we don't really have a static row. return row == null || (clustering == Clustering.STATIC_CLUSTERING && row.isEmpty()) ? null : row; }
public SinglePartitionReadCommand readCommand(int nowInSec) { assert staticConditions != null || !conditions.isEmpty(); // Fetch all columns, but query only the selected ones ColumnFilter columnFilter = ColumnFilter.selection(columnsToRead()); // With only a static condition, we still want to make the distinction between a non-existing partition and one // that exists (has some live data) but has not static content. So we query the first live row of the partition. if (conditions.isEmpty()) return SinglePartitionReadCommand.create(cfm, nowInSec, columnFilter, RowFilter.NONE, DataLimits.cqlLimits(1), key, new ClusteringIndexSliceFilter(Slices.ALL, false)); ClusteringIndexNamesFilter filter = new ClusteringIndexNamesFilter(conditions.navigableKeySet(), false); return SinglePartitionReadCommand.create(cfm, nowInSec, key, columnFilter, filter); }
public SinglePartitionReadCommand readCommand(int nowInSec) { assert staticConditions != null || !conditions.isEmpty(); // Fetch all columns, but query only the selected ones ColumnFilter columnFilter = ColumnFilter.selection(columnsToRead()); // With only a static condition, we still want to make the distinction between a non-existing partition and one // that exists (has some live data) but has not static content. So we query the first live row of the partition. if (conditions.isEmpty()) return SinglePartitionReadCommand.create(cfm, nowInSec, columnFilter, RowFilter.NONE, DataLimits.cqlLimits(1), key, new ClusteringIndexSliceFilter(Slices.ALL, false)); ClusteringIndexNamesFilter filter = new ClusteringIndexNamesFilter(conditions.navigableKeySet(), false); return SinglePartitionReadCommand.create(cfm, nowInSec, key, columnFilter, filter); }
public SinglePartitionReadCommand readCommand(int nowInSec) { assert staticConditions != null || !conditions.isEmpty(); // Fetch all columns, but query only the selected ones ColumnFilter columnFilter = ColumnFilter.selection(columnsToRead()); // With only a static condition, we still want to make the distinction between a non-existing partition and one // that exists (has some live data) but has not static content. So we query the first live row of the partition. if (conditions.isEmpty()) return SinglePartitionReadCommand.create(cfm, nowInSec, columnFilter, RowFilter.NONE, DataLimits.cqlLimits(1), key, new ClusteringIndexSliceFilter(Slices.ALL, false)); ClusteringIndexNamesFilter filter = new ClusteringIndexNamesFilter(conditions.navigableKeySet(), false); return SinglePartitionReadCommand.create(cfm, nowInSec, key, columnFilter, filter); }
Row prefetchedRow = partition == null ? null : partition.searchIterator(ColumnFilter.selection(partition.columns()), false).next(clustering);
private ColumnFilter makeColumnFilter(CFMetaData metadata, Slices slices) { PartitionColumns columns = metadata.partitionColumns(); if (metadata.isStaticCompactTable() && !columns.statics.isEmpty()) { PartitionColumns.Builder builder = PartitionColumns.builder(); builder.addAll(columns.regulars); // We only want to include the static columns that are selected by the slices for (ColumnDefinition def : columns.statics) { if (slices.selects(Clustering.make(def.name.bytes))) builder.add(def); } columns = builder.build(); } return ColumnFilter.selection(columns); }
public boolean hasEnoughLiveData(CachedPartition cached, int nowInSec, boolean countPartitionsWithOnlyStaticData, boolean enforceStrictLiveness) { // We want the number of cells that are currently live. Getting that precise number forces // us to iterate the cached partition in general, but we can avoid that if: // - The number of non-expiring live cells is greater than the number of cells asked (we then // know we have enough live cells). // - The number of cells cached is less than requested, in which case we know we won't have enough. if (cached.nonExpiringLiveCells() >= cellPerPartitionLimit) return true; if (cached.nonTombstoneCellCount() < cellPerPartitionLimit) return false; // Otherwise, we need to re-count DataLimits.Counter counter = newCounter(nowInSec, false, countPartitionsWithOnlyStaticData, enforceStrictLiveness); try (UnfilteredRowIterator cacheIter = cached.unfilteredIterator(ColumnFilter.selection(cached.columns()), Slices.ALL, false); UnfilteredRowIterator iter = counter.applyTo(cacheIter)) { // Consume the iterator until we've counted enough while (iter.hasNext()) iter.next(); return counter.isDone(); } }
public boolean hasEnoughLiveData(CachedPartition cached, int nowInSec, boolean countPartitionsWithOnlyStaticData, boolean enforceStrictLiveness) { // We want the number of row that are currently live. Getting that precise number forces // us to iterate the cached partition in general, but we can avoid that if: // - The number of rows with at least one non-expiring cell is greater than what we ask, // in which case we know we have enough live. // - The number of rows is less than requested, in which case we know we won't have enough. if (cached.rowsWithNonExpiringCells() >= rowLimit) return true; if (cached.rowCount() < rowLimit) return false; // Otherwise, we need to re-count DataLimits.Counter counter = newCounter(nowInSec, false, countPartitionsWithOnlyStaticData, enforceStrictLiveness); try (UnfilteredRowIterator cacheIter = cached.unfilteredIterator(ColumnFilter.selection(cached.columns()), Slices.ALL, false); UnfilteredRowIterator iter = counter.applyTo(cacheIter)) { // Consume the iterator until we've counted enough while (iter.hasNext()) iter.next(); return counter.isDone(); } }
private ColumnFilter makeColumnFilter(CFMetaData metadata, Slices slices) { PartitionColumns columns = metadata.partitionColumns(); if (metadata.isStaticCompactTable() && !columns.statics.isEmpty()) { PartitionColumns.Builder builder = PartitionColumns.builder(); builder.addAll(columns.regulars); // We only want to include the static columns that are selected by the slices for (ColumnDefinition def : columns.statics) { if (slices.selects(Clustering.make(def.name.bytes))) builder.add(def); } columns = builder.build(); } return ColumnFilter.selection(columns); }
public boolean hasEnoughLiveData(CachedPartition cached, int nowInSec, boolean countPartitionsWithOnlyStaticData, boolean enforceStrictLiveness) { // We want the number of cells that are currently live. Getting that precise number forces // us to iterate the cached partition in general, but we can avoid that if: // - The number of non-expiring live cells is greater than the number of cells asked (we then // know we have enough live cells). // - The number of cells cached is less than requested, in which case we know we won't have enough. if (cached.nonExpiringLiveCells() >= cellPerPartitionLimit) return true; if (cached.nonTombstoneCellCount() < cellPerPartitionLimit) return false; // Otherwise, we need to re-count DataLimits.Counter counter = newCounter(nowInSec, false, countPartitionsWithOnlyStaticData, enforceStrictLiveness); try (UnfilteredRowIterator cacheIter = cached.unfilteredIterator(ColumnFilter.selection(cached.columns()), Slices.ALL, false); UnfilteredRowIterator iter = counter.applyTo(cacheIter)) { // Consume the iterator until we've counted enough while (iter.hasNext()) iter.next(); return counter.isDone(); } }
public SinglePartitionReadCommand readCommand(int nowInSec) { if (expected.isEmpty()) { // We want to know if the partition exists, so just fetch a single cell. ClusteringIndexSliceFilter filter = new ClusteringIndexSliceFilter(Slices.ALL, false); DataLimits limits = DataLimits.thriftLimits(1, 1); return SinglePartitionReadCommand.create(true, metadata, nowInSec, ColumnFilter.all(metadata), RowFilter.NONE, limits, key, filter); } // Gather the clustering for the expected values and query those. BTreeSet.Builder<Clustering> clusterings = BTreeSet.builder(metadata.comparator); FilteredPartition expectedPartition = FilteredPartition.create(LegacyLayout.toRowIterator(metadata, key, expected.iterator(), nowInSec)); for (Row row : expectedPartition) clusterings.add(row.clustering()); PartitionColumns columns = expectedPartition.staticRow().isEmpty() ? metadata.partitionColumns().withoutStatics() : metadata.partitionColumns(); ClusteringIndexNamesFilter filter = new ClusteringIndexNamesFilter(clusterings.build(), false); return SinglePartitionReadCommand.create(true, metadata, nowInSec, ColumnFilter.selection(columns), RowFilter.NONE, DataLimits.NONE, key, filter); }
public boolean hasEnoughLiveData(CachedPartition cached, int nowInSec, boolean countPartitionsWithOnlyStaticData, boolean enforceStrictLiveness) { // We want the number of row that are currently live. Getting that precise number forces // us to iterate the cached partition in general, but we can avoid that if: // - The number of rows with at least one non-expiring cell is greater than what we ask, // in which case we know we have enough live. // - The number of rows is less than requested, in which case we know we won't have enough. if (cached.rowsWithNonExpiringCells() >= rowLimit) return true; if (cached.rowCount() < rowLimit) return false; // Otherwise, we need to re-count DataLimits.Counter counter = newCounter(nowInSec, false, countPartitionsWithOnlyStaticData, enforceStrictLiveness); try (UnfilteredRowIterator cacheIter = cached.unfilteredIterator(ColumnFilter.selection(cached.columns()), Slices.ALL, false); UnfilteredRowIterator iter = counter.applyTo(cacheIter)) { // Consume the iterator until we've counted enough while (iter.hasNext()) iter.next(); return counter.isDone(); } }