Search in sources :

Example 1 with TimestampRangeFilter

use of com.google.cloud.bigtable.data.v2.models.Filters.TimestampRangeFilter in project java-bigtable-hbase by googleapis.

the class ScanAdapter method createTimeRangeFilter.

private Filters.Filter createTimeRangeFilter(TimeRange timeRange) {
    TimestampRangeFilter rangeBuilder = FILTERS.timestamp().range();
    rangeBuilder.startClosed(convertUnits(timeRange.getMin()));
    if (timeRange.getMax() != Long.MAX_VALUE) {
        rangeBuilder.endOpen(convertUnits(timeRange.getMax()));
    }
    return rangeBuilder;
}
Also used : TimestampRangeFilter(com.google.cloud.bigtable.data.v2.models.Filters.TimestampRangeFilter)

Example 2 with TimestampRangeFilter

use of com.google.cloud.bigtable.data.v2.models.Filters.TimestampRangeFilter in project java-bigtable-hbase by googleapis.

the class TestTimestampRangeFilterAdapter method timestampFiltersAreAdapted.

@Test
public void timestampFiltersAreAdapted() {
    TimestampRangeFilter filter = new TimestampRangeFilter(10L, 20L);
    Filters.Filter expectedFilter = filterAdapter.adapt(emptyScanContext, filter);
    TimestampRange expectedTimestampFilter = expectedFilter.toProto().getTimestampRangeFilter();
    Assert.assertEquals(10000L, expectedTimestampFilter.getStartTimestampMicros());
    Assert.assertEquals(20000L, expectedTimestampFilter.getEndTimestampMicros());
}
Also used : Filters(com.google.cloud.bigtable.data.v2.models.Filters) TimestampRangeFilter(com.google.cloud.bigtable.hbase.filter.TimestampRangeFilter) TimestampRange(com.google.bigtable.v2.TimestampRange) Test(org.junit.Test)

Aggregations

TimestampRange (com.google.bigtable.v2.TimestampRange)1 Filters (com.google.cloud.bigtable.data.v2.models.Filters)1 TimestampRangeFilter (com.google.cloud.bigtable.data.v2.models.Filters.TimestampRangeFilter)1 TimestampRangeFilter (com.google.cloud.bigtable.hbase.filter.TimestampRangeFilter)1 Test (org.junit.Test)1