df = spark.readStream.option("readChangeFeed", "true").option("startingVersion", 2).load(tablePath)
def foreach_batch_function(df, epoch_id):
print("epoch_id: ", epoch_id)
df.write.mode("append").json("/mnt/sample/data/test/")
df.writeStream.foreachBatch(foreach_batch_function).start()
When I terminate the writestream and run again foreachBatch processes same data again. How can we maintain checkpoints avoid this situation of reading old data?