jonvex commented on code in PR #8847:
URL: https://github.com/apache/hudi/pull/8847#discussion_r1218359283


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieBootstrapRDD.scala:
##########
@@ -36,53 +37,68 @@ class HoodieBootstrapRDD(@transient spark: SparkSession,
                          @transient splits: Seq[HoodieBootstrapSplit])
   extends RDD[InternalRow](spark.sparkContext, Nil) {
 
-  override def compute(split: Partition, context: TaskContext): 
Iterator[InternalRow] = {
-    val bootstrapPartition = split.asInstanceOf[HoodieBootstrapPartition]
 
+  protected def getSkeletonIteratorSchema(dataFile: PartitionedFile, 
skeletonFile: PartitionedFile): (Iterator[InternalRow], StructType) = {
+    if (bootstrapDataFileReader.schema.isEmpty) {
+      // No data column to fetch, hence fetch only from skeleton file
+      (bootstrapSkeletonFileReader.read(skeletonFile), 
bootstrapSkeletonFileReader.schema)
+    } else if (bootstrapSkeletonFileReader.schema.isEmpty) {
+      // No metadata column to fetch, hence fetch only from data file
+      (bootstrapDataFileReader.read(dataFile), bootstrapDataFileReader.schema)
+    } else {
+      // Fetch from both data and skeleton file, and merge
+      val dataFileIterator = bootstrapDataFileReader.read(dataFile)
+      val skeletonFileIterator = bootstrapSkeletonFileReader.read(skeletonFile)
+      val mergedSchema = StructType(bootstrapSkeletonFileReader.schema.fields 
++ bootstrapDataFileReader.schema.fields)
+
+      (merge(skeletonFileIterator, dataFileIterator), mergedSchema)
+    }
+  }
+
+  /**
+   *  Here we have to project the [[InternalRow]]s fetched into the expected 
target schema.
+   *  These could diverge for ex, when requested schema contains partition 
columns which might not be

Review Comment:
   Not sure. That comment was already in this file. I moved those lines into a 
new method because we don't want to do the projection in the case where 
bootstrap base file and log files exist. The RecordMergingFileIterator applies 
a projection and doing the double projection was causing spark bufferholder to 
exceed 2G which isn't allowed 



-- 
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]

Reply via email to