Created
April 19, 2023 05:00
-
-
Save nfarah86/316e8731246f9c5fd793cd6e51869243 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val basePath = "/tmp/hudi/stocks" | |
spark.read.format("hudi").load(basePath).createOrReplaceTempView("hudi_stocks") | |
val firstCommit = spark. | |
sql("select distinct(_hoodie_commit_time) as commitTime from hudi_stocks order by commitTime"). | |
map(k => k.getString(0)).take(1)(0) | |
val incrementalDF = spark.read.format("hudi"). | |
option("hoodie.datasource.query.type", "incremental"). | |
option("hoodie.datasource.read.begin.instanttime", firstCommit). | |
load(basePath) | |
incrementalDF.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment