use of com.google.cloud.bigtable.hbase.util.RowKeyWrapper in project java-bigtable-hbase by googleapis.
the class TestMultiRowRangeAdapter method testOverlap.
@Test
public void testOverlap() throws IOException {
MultiRowRangeFilter filter = new MultiRowRangeFilter(Arrays.asList(new RowRange("bb", true, "cc", true), new RowRange("ca", true, "yy", true)));
Filters.Filter adaptedFilter = adapter.adapt(context, filter);
Assert.assertEquals(unaffectedRowFilter, adaptedFilter);
RangeSet<RowKeyWrapper> indexScanHint = adapter.getIndexScanHint(filter);
RangeSet<RowKeyWrapper> expected = ImmutableRangeSet.of(Range.closed(new RowKeyWrapper(ByteString.copyFromUtf8("bb")), new RowKeyWrapper(ByteString.copyFromUtf8("yy"))));
Assert.assertEquals(expected, indexScanHint);
}
use of com.google.cloud.bigtable.hbase.util.RowKeyWrapper in project java-bigtable-hbase by googleapis.
the class TestFilterListAdapter method testInterleavedIndexHintUnion.
@Test
public void testInterleavedIndexHintUnion() {
FilterAdapter adapter = FilterAdapter.buildAdapter();
PrefixFilter p1 = new PrefixFilter("a".getBytes());
PrefixFilter p2 = new PrefixFilter("abc".getBytes());
FilterList filterList = new FilterList(Operator.MUST_PASS_ONE, p1, p2);
RangeSet<RowKeyWrapper> actual = adapter.getIndexScanHint(filterList);
RangeSet<RowKeyWrapper> expected = ImmutableRangeSet.of(Range.closedOpen(new RowKeyWrapper(ByteString.copyFromUtf8("a")), new RowKeyWrapper(ByteString.copyFromUtf8("b"))));
Assert.assertEquals(expected, actual);
}
use of com.google.cloud.bigtable.hbase.util.RowKeyWrapper in project java-bigtable-hbase by googleapis.
the class TestPrefixFilterAdapter method testIndexIsNarrowed.
@Test
public void testIndexIsNarrowed() {
PrefixFilterAdapter adapter = new PrefixFilterAdapter();
String prefix = "Foobar";
PrefixFilter filter = new PrefixFilter(Bytes.toBytes(prefix));
RangeSet<RowKeyWrapper> hint = adapter.getIndexScanHint(filter);
ImmutableRangeSet<RowKeyWrapper> expected = ImmutableRangeSet.<RowKeyWrapper>builder().add(Range.closedOpen(new RowKeyWrapper(ByteString.copyFromUtf8("Foobar")), new RowKeyWrapper(ByteString.copyFromUtf8("Foobas")))).build();
Assert.assertEquals(expected, hint);
}
use of com.google.cloud.bigtable.hbase.util.RowKeyWrapper in project java-bigtable-hbase by googleapis.
the class TestRowRangeAdapter method testLesserOrEqThan.
@Test
public void testLesserOrEqThan() {
ByteString key = ByteString.copyFromUtf8("hi");
RowSet in = RowSet.newBuilder().addRowRanges(RowRange.newBuilder().setEndKeyClosed(key)).build();
RangeSet<RowKeyWrapper> out = adapter.rowSetToRangeSet(in);
RangeSet<RowKeyWrapper> expected = ImmutableRangeSet.<RowKeyWrapper>builder().add(Range.atMost(new RowKeyWrapper(key))).build();
assertEquals(expected, out);
adapter.rangeSetToByteStringRange(out, query);
assertEquals(in, query.toProto(requestContext).getRows());
}
use of com.google.cloud.bigtable.hbase.util.RowKeyWrapper in project java-bigtable-hbase by googleapis.
the class TestRowRangeAdapter method testGreaterOrEqThan.
@Test
public void testGreaterOrEqThan() {
ByteString key = ByteString.copyFromUtf8("hi");
RowSet in = RowSet.newBuilder().addRowRanges(RowRange.newBuilder().setStartKeyClosed(key)).build();
RangeSet<RowKeyWrapper> out = adapter.rowSetToRangeSet(in);
RangeSet<RowKeyWrapper> expected = ImmutableRangeSet.<RowKeyWrapper>builder().add(Range.atLeast(new RowKeyWrapper(key))).build();
assertEquals(expected, out);
adapter.rangeSetToByteStringRange(out, query);
assertEquals(in, query.toProto(requestContext).getRows());
}
Aggregations