danny0405 commented on code in PR #12679:
URL: https://github.com/apache/hudi/pull/12679#discussion_r1927992951
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/IncrementalRelationV2.scala:
##########
@@ -207,78 +207,83 @@ class IncrementalRelationV2(val sqlContext: SQLContext,
val sOpts = optParams.filter(p => !p._1.equalsIgnoreCase("path"))
val startInstantArchived = !queryContext.getArchivedInstants.isEmpty
- val endInstantTime = queryContext.getEndInstant.get()
-
- val scanDf = if (fallbackToFullTableScan && startInstantArchived) {
- log.info(s"Falling back to full table scan as startInstantArchived:
$startInstantArchived")
- fullTableScanDataFrame(commitsToReturn)
+ if (queryContext.isEmpty) {
+ // no commits to read
+ sqlContext.sparkContext.emptyRDD[Row]
} else {
- if (filteredRegularFullPaths.isEmpty &&
filteredMetaBootstrapFullPaths.isEmpty) {
- sqlContext.createDataFrame(sqlContext.sparkContext.emptyRDD[Row],
usedSchema)
- } else {
- log.info("Additional Filters to be applied to incremental source are
:" + filters.mkString("Array(", ", ", ")"))
+ val endInstantTime = queryContext.getLastInstant
- var df: DataFrame =
sqlContext.createDataFrame(sqlContext.sparkContext.emptyRDD[Row], usedSchema)
+ val scanDf = if (fallbackToFullTableScan && startInstantArchived) {
+ log.info(s"Falling back to full table scan as startInstantArchived:
$startInstantArchived")
+ fullTableScanDataFrame(commitsToReturn)
+ } else {
+ if (filteredRegularFullPaths.isEmpty &&
filteredMetaBootstrapFullPaths.isEmpty) {
Review Comment:
Can we keep the change incremental and most of the lines unchanged?
--
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]