public Builder retainColumns(ColumnSelection selection) { if (!selection.allColumnsSelected()) { Iterables.addAll(columns, selection.getSelectedColumns()); } return this; }
@Override public void internalExtractResult(long startTs, ColumnSelection selection, byte[] row, byte[] col, byte[] val, long ts) { if (ts < startTs && selection.contains(col)) { Cell cell = Cell.create(row, col); if (!collector.containsKey(cell)) { collector.put(cell, Value.create(val, ts)); } else { notLatestVisibleValueCellFilterMeter.mark(); } } else { notLatestVisibleValueCellFilterMeter.mark(); } }
public static ColumnSelection getColumnSelection(Collection<ValueStreamMetadataNamedColumn> cols) { return ColumnSelection.create(Collections2.transform(cols, ValueStreamMetadataNamedColumn.toShortName())); }
@Override public void visit(Map<ByteBuffer, List<ColumnOrSuperColumn>> results) { extractor.extractResults(results, startTs, ColumnSelection.all()); } }
private Map<Cell, Value> getRowsPartition(TableReference tableRef, List<byte[]> rows, ColumnSelection columnSelection, long timestamp) { if (columnSelection.allColumnsSelected()) { return getRowsAllColumns(tableRef, rows, timestamp); } else { return getRowsSomeColumns(tableRef, rows, columnSelection, timestamp); } }
private Map<Cell, Value> getRowsSomeColumns(final TableReference tableRef, final Iterable<byte[]> rows, final ColumnSelection columnSelection, final long timestamp) { if (Iterables.isEmpty(rows)) { return ImmutableMap.of(); } return run(ctx -> { Select<? extends Record> query = getLatestTimestampQuerySomeColumns( ctx, tableRef, ImmutableList.copyOf(rows), columnSelection.getSelectedColumns(), timestamp); Result<? extends Record> records = fetchValues(ctx, tableRef, query); Map<Cell, Value> results = Maps.newHashMapWithExpectedSize(records.size()); for (Record record : records) { results.put( Cell.create(record.getValue(A_ROW_NAME), record.getValue(A_COL_NAME)), Value.create(record.getValue(A_VALUE), record.getValue(A_TIMESTAMP))); } return results; }); }
@Override public Map<Cell, Value> getRows(TableReference tableRef, Iterable<byte[]> rows, ColumnSelection columnSelection, long timestamp) { if (Iterables.isEmpty(rows) || columnSelection.noColumnsSelected()) { return ImmutableMap.of(); } return delegate.getRows(tableRef, rows, columnSelection, timestamp); }
public static ColumnSelection getColumnSelection(Collection<HotspottyDataStreamHashAidxColumn> cols) { return ColumnSelection.create(Collections2.transform(cols, Persistables.persistToBytesFunction())); }
public TableMigratorBuilder() { srcTable = null; partitions = 8; partitioners = ImmutableList.of(); readBatchSize = 1000; executor = null; checkpointer = null; progress = new NullTaskProgress(); columnSelection = ColumnSelection.all(); rangeMigrator = null; }
ColumnSelection selection, long startTs) { if (!selection.allColumnsSelected()) { return getRowsForSpecificColumns(tableRef, rows, selection, startTs);
public ClosableIterator<AgnosticLightResultRow> getLatestRows( Iterable<byte[]> rows, ColumnSelection columns, long ts, boolean includeValues) { if (columns.noColumnsSelected()) { return ClosableIterators.emptyImmutableClosableIterator(); } else if (isSingleton(rows)) { byte[] row = Iterables.getOnlyElement(rows); return run(queryFactory.getLatestRowQuery(row, ts, columns, includeValues)); } else { return run(queryFactory.getLatestRowsQuery(rows, ts, columns, includeValues)); } }
public static Arg<?> columnCount(ColumnSelection columnSelection) { return getArg("columnCount", columnSelection.allColumnsSelected() ? "all" : Iterables.size(columnSelection.getSelectedColumns()), true); }
public static ColumnSelection valueOf(String serialized) { Set<byte[]> columns = Sets.newTreeSet(UnsignedBytes.lexicographicalComparator()); for (String columnString : serialized.split("\\s*,\\s*")) { String trimmedColumnString = columnString.trim(); if (trimmedColumnString.isEmpty()) { continue; } byte[] column = PtBytes.decodeBase64(trimmedColumnString); assert !columns.contains(column); columns.add(column); } if (columns.isEmpty()) { return all(); } return ColumnSelection.create(columns); }
public static ColumnSelection getColumnSelection(Collection<ValueStreamIdxColumn> cols) { return ColumnSelection.create(Collections2.transform(cols, Persistables.persistToBytesFunction())); }
private byte[] getRowsForCell(Cell cell) { return keyValueService.getRows(TEST_TABLE, ImmutableSet.of(cell.getRowName()), ColumnSelection.all(), TEST_TIMESTAMP + 3) .get(cell).getContents(); }
orignalReads = Maps.filterKeys(orignalReads, input -> columns.contains(input.getColumnName()));
public ClosableIterator<AgnosticLightResultRow> getAllRows( Iterable<byte[]> rows, ColumnSelection columns, long ts, boolean includeValues, Order order) { if (columns.noColumnsSelected()) { return ClosableIterators.emptyImmutableClosableIterator(); } FullQuery query; if (isSingleton(rows)) { byte[] row = Iterables.getOnlyElement(rows); query = queryFactory.getAllRowQuery(row, ts, columns, includeValues); } else { query = queryFactory.getAllRowsQuery(rows, ts, columns, includeValues); } return run(addOrdering(order, query)); }
@Override public FullQuery getAllRowQuery(byte[] row, long ts, ColumnSelection columns, boolean includeValue) { String query = " /* GET_ALL_ROW (" + tableName + ") */ " + " SELECT m.row_name, m.col_name, m.ts" + (includeValue ? ", m.val " : " ") + " FROM " + prefixedTableName() + " m " + " WHERE m.row_name = ? " + " AND m.ts < ? " + (columns.allColumnsSelected() ? "" : " AND m.col_name IN " + numParams(Iterables.size(columns.getSelectedColumns()))); FullQuery fullQuery = new FullQuery(query).withArgs(row, ts); return columns.allColumnsSelected() ? fullQuery : fullQuery.withArgs(columns.getSelectedColumns()); }
public CassandraRangePagingIterable( RowGetter rowGetter, SlicePredicate slicePredicate, ColumnGetter columnGetter, RangeRequest rangeRequest, Supplier<ResultsExtractor<T>> resultsExtractor, long timestamp) { this.rowGetter = rowGetter; this.slicePredicate = slicePredicate; this.columnGetter = columnGetter; this.rangeRequest = rangeRequest; this.resultsExtractor = resultsExtractor; this.timestamp = timestamp; batchHint = rangeRequest.getBatchHint() == null ? 100 : rangeRequest.getBatchHint(); selection = rangeRequest.getColumnNames().isEmpty() ? ColumnSelection.all() : ColumnSelection.create(rangeRequest.getColumnNames()); }