Search in sources :

Example 6 with RowFilter

use of com.google.bigtable.v1.RowFilter in project beam by apache.

the class BigtableIOTest method testReadingDisplayData.

@Test
public void testReadingDisplayData() {
    RowFilter rowFilter = RowFilter.newBuilder().setRowKeyRegexFilter(ByteString.copyFromUtf8("foo.*")).build();
    ByteKeyRange keyRange = ByteKeyRange.ALL_KEYS.withEndKey(ByteKey.of(0xab, 0xcd));
    BigtableIO.Read read = BigtableIO.read().withBigtableOptions(BIGTABLE_OPTIONS).withTableId("fooTable").withRowFilter(rowFilter).withKeyRange(keyRange);
    DisplayData displayData = DisplayData.from(read);
    assertThat(displayData, hasDisplayItem(allOf(hasKey("tableId"), hasLabel("Table ID"), hasValue("fooTable"))));
    assertThat(displayData, hasDisplayItem("rowFilter", rowFilter.toString()));
    assertThat(displayData, hasDisplayItem("keyRange", keyRange.toString()));
    // BigtableIO adds user-agent to options; assert only on key and not value.
    assertThat(displayData, hasDisplayItem("bigtableOptions"));
}
Also used : RowFilter(com.google.bigtable.v2.RowFilter) ByteKeyRange(org.apache.beam.sdk.io.range.ByteKeyRange) DisplayData(org.apache.beam.sdk.transforms.display.DisplayData) Test(org.junit.Test)

Aggregations

RowFilter (com.google.bigtable.v2.RowFilter)4 Test (org.junit.Test)4 ByteString (com.google.protobuf.ByteString)3 ByteString (com.google.bigtable.repackaged.com.google.protobuf.ByteString)2 Column (com.google.bigtable.v1.Column)2 Family (com.google.bigtable.v1.Family)2 DeleteFromRow (com.google.bigtable.v1.Mutation.DeleteFromRow)2 ReadRowsRequest (com.google.bigtable.v1.ReadRowsRequest)2 Row (com.google.bigtable.v1.Row)2 RowFilter (com.google.bigtable.v1.RowFilter)2 Builder (com.google.bigtable.v1.RowFilter.Chain.Builder)2 ByteArrayByteIterator (com.yahoo.ycsb.ByteArrayByteIterator)2 ExecutionException (java.util.concurrent.ExecutionException)2 DisplayData (org.apache.beam.sdk.transforms.display.DisplayData)2 RowRange (com.google.bigtable.v1.RowRange)1 Row (com.google.bigtable.v2.Row)1 ByteIterator (com.yahoo.ycsb.ByteIterator)1 HashMap (java.util.HashMap)1 BigtableSource (org.apache.beam.sdk.io.gcp.bigtable.BigtableIO.BigtableSource)1 ByteKeyRange (org.apache.beam.sdk.io.range.ByteKeyRange)1