File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
google-cloud-bigtable/src
main/java/com/google/cloud/bigtable/data/v2/models
test/java/com/google/cloud/bigtable/data/v2/models Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -516,6 +516,15 @@ private TimestampFilter() {}
516516 public TimestampRangeFilter range () {
517517 return new TimestampRangeFilter ();
518518 }
519+
520+ /**
521+ * Matches cells with exact given timestamp.
522+ *
523+ * @return a {@link TimestampRangeFilter} with start/end closed timestamp.
524+ */
525+ public TimestampRangeFilter exact (Long exactTimestamp ) {
526+ return new TimestampRangeFilter ().startClosed (exactTimestamp ).endClosed (exactTimestamp );
527+ }
519528 }
520529
521530 /** Matches only cells with microsecond timestamps within the given range. */
Original file line number Diff line number Diff line change @@ -350,6 +350,21 @@ public void timestampRange() {
350350 assertThat (actualFilter ).isEqualTo (expectedFilter );
351351 }
352352
353+ @ Test
354+ public void timestampAtExactTime () {
355+ RowFilter actualFilter = FILTERS .timestamp ().exact (20_000L ).toProto ();
356+
357+ RowFilter expectedFilter =
358+ RowFilter .newBuilder ()
359+ .setTimestampRangeFilter (
360+ TimestampRange .newBuilder ()
361+ .setStartTimestampMicros (20_000L )
362+ .setEndTimestampMicros (20_000L + 1 ))
363+ .build ();
364+
365+ assertThat (actualFilter ).isEqualTo (expectedFilter );
366+ }
367+
353368 @ Test
354369 public void timestampOpenClosedFakeRange () {
355370 RowFilter actualFilter =
You can’t perform that action at this time.
0 commit comments