anishshri-db commented on code in PR #52148: URL: https://github.com/apache/spark/pull/52148#discussion_r2308800321
########## sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/state/StateDataSourceChangeDataReadSuite.scala: ########## @@ -322,4 +336,91 @@ abstract class StateDataSourceChangeDataReaderSuite extends StateDataSourceTestB checkAnswer(keyToNumValuesDf, keyToNumValuesDfExpectedDf) } } + + test("read change feed past multiple snapshots") { + withSQLConf("spark.sql.streaming.stateStore.minDeltasForSnapshot" -> "2") { + withTempDir { tempDir => + val inputData = MemoryStream[Int] + val df = inputData.toDF().groupBy("value").count() + testStream(df, OutputMode.Update)( + StartStream(checkpointLocation = tempDir.getAbsolutePath), + AddData(inputData, 1, 2, 3, 4, 1), + ProcessAllAvailable(), + AddData(inputData, 2, 3, 4, 5), + ProcessAllAvailable(), + AddData(inputData, 3, 4, 5, 6), + ProcessAllAvailable(), + AddData(inputData, 1, 1), + ProcessAllAvailable(), + AddData(inputData, 1, 1), + ProcessAllAvailable(), + AddData(inputData, 1, 1), + ProcessAllAvailable() + ) + + val stateDf = spark.read.format("statestore") + .option(StateSourceOptions.READ_CHANGE_FEED, value = true) + .option(StateSourceOptions.CHANGE_START_BATCH_ID, 0) + .option(StateSourceOptions.CHANGE_END_BATCH_ID, 5) + .load(tempDir.getAbsolutePath) + + val expectedDf = Seq( + Row(0L, "update", Row(3), Row(1), 1), Review Comment: Can we also track other operations such as `insert`, `update`, `delete` etc ? -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org