public KeySlice prefixKeySlice(KeySlice unprefixed) { KeySlice prefixed = new KeySlice(); prefixed.key = ps.toByteBuffer(unprefixed.key); prefixed.columns = unprefixed.columns; return prefixed; }
public KeySlice unprefixKeySlice(KeySlice prefixed) { KeySlice unprefixed = new KeySlice(); unprefixed.key = ps.fromByteBuffer(unprefixed.key); unprefixed.columns = prefixed.columns; return unprefixed; }
@Test public void getSizeForKeySliceWithKeySetSetButColumnsNotSet() { assertThat(ThriftObjectSizeUtils.getKeySliceSize(new KeySlice().setKey(TEST_NAME.getBytes()))) .isEqualTo(NULL_SIZE + TEST_NAME.getBytes().length); }
@Test public void getSizeForKeySliceWithKeyNotSetButColumnsSet() { assertThat(ThriftObjectSizeUtils.getKeySliceSize(new KeySlice() .setColumns(ImmutableList.of(EMPTY_COLUMN_OR_SUPERCOLUMN)))) .isEqualTo(NULL_SIZE + EMPTY_COLUMN_OR_SUPERCOLUMN_SIZE); }
@Test public void getSizeForKeySliceWithKeyAndColumns() { assertThat(ThriftObjectSizeUtils.getKeySliceSize(new KeySlice() .setKey(TEST_NAME.getBytes()) .setColumns(ImmutableList.of(EMPTY_COLUMN_OR_SUPERCOLUMN)))) .isEqualTo(TEST_NAME.getBytes().length + EMPTY_COLUMN_OR_SUPERCOLUMN_SIZE); }
@Test public void getKeySlicesSize() { List<KeySlice> slices = ImmutableList.of( new KeySlice() .setKey(TEST_NAME_BYTES) .setColumns(ImmutableList.of(EMPTY_COLUMN_OR_SUPERCOLUMN))); long expectedSize = TEST_NAME_BYTES_SIZE + EMPTY_COLUMN_OR_SUPERCOLUMN_SIZE; assertThat(ThriftObjectSizeUtils.getApproximateSizeOfKeySlices(slices)).isEqualTo(expectedSize); }
public KeySlice deepCopy() { return new KeySlice(this); }
public KeySlice deepCopy() { return new KeySlice(this); }
public KeySlice deepCopy() { return new KeySlice(this); }
public KeySlice unprefixKeySlice(KeySlice prefixed) { KeySlice unprefixed = new KeySlice(); unprefixed.key = ps.fromByteBuffer(unprefixed.key); unprefixed.columns = prefixed.columns; return unprefixed; }
public KeySlice prefixKeySlice(KeySlice unprefixed) { KeySlice prefixed = new KeySlice(); prefixed.key = ps.toByteBuffer(unprefixed.key); prefixed.columns = unprefixed.columns; return prefixed; }
public KeySlice unprefixKeySlice(KeySlice prefixed) { KeySlice unprefixed = new KeySlice(); unprefixed.key = ps.fromByteBuffer(unprefixed.key); unprefixed.columns = prefixed.columns; return unprefixed; }
public KeySlice prefixKeySlice(KeySlice unprefixed) { KeySlice prefixed = new KeySlice(); prefixed.key = ps.toByteBuffer(unprefixed.key); prefixed.columns = unprefixed.columns; return prefixed; }
private List<KeySlice> thriftifyKeySlices(List<Row> rows, ColumnParent column_parent, SlicePredicate predicate, long now) { List<KeySlice> keySlices = new ArrayList<KeySlice>(rows.size()); boolean reversed = predicate.slice_range != null && predicate.slice_range.reversed; for (Row row : rows) { List<ColumnOrSuperColumn> thriftifiedColumns = thriftifyColumnFamily(row.cf, column_parent.super_column != null, reversed, now); keySlices.add(new KeySlice(row.key.getKey(), thriftifiedColumns)); } return keySlices; }
private List<KeySlice> thriftifyKeySlices(PartitionIterator results, ColumnParent column_parent, int cellLimit) { try (PartitionIterator iter = results) { List<KeySlice> keySlices = new ArrayList<>(); while (iter.hasNext()) { try (RowIterator partition = iter.next()) { List<ColumnOrSuperColumn> thriftifiedColumns = thriftifyPartition(partition, column_parent.super_column != null, partition.isReverseOrder(), cellLimit); keySlices.add(new KeySlice(partition.partitionKey().getKey(), thriftifiedColumns)); } } return keySlices; } }
private List<KeySlice> thriftifyKeySlices(PartitionIterator results, ColumnParent column_parent, int cellLimit) { try (PartitionIterator iter = results) { List<KeySlice> keySlices = new ArrayList<>(); while (iter.hasNext()) { try (RowIterator partition = iter.next()) { List<ColumnOrSuperColumn> thriftifiedColumns = thriftifyPartition(partition, column_parent.super_column != null, partition.isReverseOrder(), cellLimit); keySlices.add(new KeySlice(partition.partitionKey().getKey(), thriftifiedColumns)); } } return keySlices; } }