yihua commented on code in PR #12772: URL: https://github.com/apache/hudi/pull/12772#discussion_r2074381508
########## hudi-spark-datasource/hudi-spark4-common/src/main/java/org/apache/spark/sql/execution/datasources/parquet/Spark4HoodieVectorizedParquetRecordReader.java: ########## @@ -0,0 +1,96 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.spark.sql.execution.datasources.parquet; + +import org.apache.hadoop.mapreduce.InputSplit; +import org.apache.hadoop.mapreduce.TaskAttemptContext; +import org.apache.hudi.common.util.collection.Pair; +import org.apache.spark.sql.types.DataType; + +import java.io.IOException; +import java.time.ZoneId; +import java.util.Map; + +public class Spark4HoodieVectorizedParquetRecordReader extends SparkBaseHoodieVectorizedParquetRecordReader { Review Comment: Should we maintain this new logic to support both Spark 3 and 4? The original logic of using reflection to get `batchIdx` is hacky. Would be good to have a separate PR to fix the Hudi-based vectorized parquet reader and land the PR first. ########## hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/PartitionDirectoryConverter.scala: ########## @@ -53,7 +53,7 @@ object PartitionDirectoryConverter extends SparkAdapterSupport { val c = fileSlices.filter(f => f.hasLogFiles || f.hasBootstrapBase).foldLeft(Map[String, FileSlice]()) { (m, f) => m + (f.getFileId -> f) } if (c.nonEmpty) { sparkAdapter.getSparkPartitionedFileUtils.newPartitionDirectory( - new HoodiePartitionFileSliceMapping(InternalRow.fromSeq(partitionOpt.get.values), c), delegateFiles) + sparkAdapter.createHoodiePartitionFileSliceMapping(InternalRow.fromSeq(partitionOpt.get.values), c), delegateFiles) Review Comment: Same on revisiting if `sparkAdapter.createHoodiePartitionFileSliceMapping` is necessary. ########## hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieIncrementalFileIndex.scala: ########## @@ -73,7 +73,7 @@ class HoodieIncrementalFileIndex(override val spark: SparkSession, foldLeft(Map[String, FileSlice]()) { (m, f) => m + (f.getFileId -> f) } if (c.nonEmpty) { sparkAdapter.getSparkPartitionedFileUtils.newPartitionDirectory( - new HoodiePartitionFileSliceMapping(partitionValues, c), baseFileStatusesAndLogFileOnly) + sparkAdapter.createHoodiePartitionFileSliceMapping(partitionValues, c), baseFileStatusesAndLogFileOnly) Review Comment: Same on revisiting if `sparkAdapter.createHoodiePartitionFileSliceMapping` is necessary. ########## hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieCDCFileIndex.scala: ########## @@ -66,7 +66,7 @@ class HoodieCDCFileIndex (override val spark: SparkSession, // Note that CDC file splits must be sorted based on their instant time. // Otherwise, the resulting records may not be correct. sparkAdapter.getSparkPartitionedFileUtils.newPartitionDirectory( - new HoodiePartitionCDCFileGroupMapping( + sparkAdapter.createHoodiePartitionCDCFileGroupMapping( Review Comment: Same on revisiting if `sparkAdapter.createHoodiePartitionCDCFileGroupMapping` is necessary. -- 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]
