JingsongLi commented on code in PR #388:
URL: https://github.com/apache/flink-table-store/pull/388#discussion_r1027644999
##########
flink-table-store-connector/src/test/java/org/apache/flink/table/store/connector/ContinuousFileStoreITCase.java:
##########
@@ -114,6 +121,55 @@ public void testContinuousLatest() throws TimeoutException
{
.containsExactlyInAnyOrder(Row.of("7", "8", "9"), Row.of("10",
"11", "12"));
}
+ @Test
+ public void testContinuousFromTimestamp() throws Exception {
+ String sql =
+ "SELECT * FROM T1 /*+ OPTIONS('log.scan'='from-timestamp',
'log.scan.timestamp-millis'='%s') */";
+
+ // empty table
+ BlockingIterator<Row, Row> iterator =
BlockingIterator.of(streamSqlIter(sql, 0));
+ batchSql("INSERT INTO T1 VALUES ('1', '2', '3'), ('4', '5', '6')");
+ batchSql("INSERT INTO T1 VALUES ('7', '8', '9'), ('10', '11', '12')");
+ assertThat(iterator.collect(2))
+ .containsExactlyInAnyOrder(Row.of("1", "2", "3"), Row.of("4",
"5", "6"));
+ iterator.close();
+
+ SnapshotManager snapshotManager =
+ new SnapshotManager(
+ new Path(path,
"default_catalog.catalog/default_database.db/T1"));
+ List<Snapshot> snapshots =
+ new
ArrayList<>(ImmutableList.copyOf(snapshotManager.snapshots()));
+ snapshots.sort(Comparator.comparingLong(Snapshot::timeMillis));
+ Snapshot first = snapshots.get(0);
+ Snapshot second = snapshots.get(1);
+
+ // before second snapshot
+ iterator = BlockingIterator.of(streamSqlIter(sql, second.timeMillis()
- 1));
+ batchSql("INSERT INTO T1 VALUES ('13', '14', '15')");
+ assertThat(iterator.collect(3))
+ .containsExactlyInAnyOrder(
+ Row.of("7", "8", "9"), Row.of("10", "11", "12"),
Row.of("13", "14", "15"));
+ iterator.close();
+
+ // from second snapshot
+ iterator = BlockingIterator.of(streamSqlIter(sql,
second.timeMillis()));
+ assertThat(iterator.collect(3))
+ .containsExactlyInAnyOrder(
+ Row.of("7", "8", "9"), Row.of("10", "11", "12"),
Row.of("13", "14", "15"));
+ iterator.close();
+
+ // from start
+ iterator = BlockingIterator.of(streamSqlIter(sql, first.timeMillis() -
1));
Review Comment:
Good~
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]