yihua commented on code in PR #8885:
URL: https://github.com/apache/hudi/pull/8885#discussion_r1225127785


##########
hudi-client/hudi-spark-client/src/main/scala/org/apache/spark/sql/execution/datasources/HoodieSparkPartitionedFileUtils.scala:
##########
@@ -0,0 +1,77 @@
+/*
+ * 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
+
+import org.apache.hadoop.fs.Path
+import org.apache.spark.sql.catalyst.InternalRow
+
+/**
+ * Utils on Spark [[PartitionedFile]] to adapt to type changes.
+ * Before Spark 3.4.0,
+ * ```
+ * case class PartitionedFile(
+ *   partitionValues: InternalRow,
+ *   filePath: String,
+ *   start: Long,
+ *   @transient locations: Array[String] = Array.empty)
+ * ```,
+ * Since Spark 3.4.0, the filePath is switch to [[SparkPath]] for type safety:
+ * ```
+ * case class PartitionedFile(
+ *   partitionValues: InternalRow,
+ *   filePath: SparkPath,
+ *   start: Long,
+ *   length: Long,
+ *   @transient locations: Array[String] = Array.empty,
+ *   modificationTime: Long = 0L,
+ *   fileSize: Long = 0L)
+ * ```
+ */
+trait HoodieSparkPartitionedFileUtils extends Serializable {
+  /**
+   * Gets the Hadoop [[Path]] instance from Spark [[PartitionedFile]] instance.
+   *
+   * @param partitionedFile Spark [[PartitionedFile]] instance.
+   * @return Hadoop [[Path]] instance.
+   */
+  def getPathFromPartitionedFile(partitionedFile: PartitionedFile): Path

Review Comment:
   `SparkPath` has `toPath` function to efficiently return the `Path` instance 
in Spark 3.4, so I opt to have two separate APIs here.



-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to