bhat-vinay commented on code in PR #10491:
URL: https://github.com/apache/hudi/pull/10491#discussion_r1449035307


##########
hudi-spark-datasource/hudi-spark3.2plus-common/src/main/scala/org/apache/spark/sql/hudi/analysis/HoodieSpark32PlusAnalysis.scala:
##########
@@ -134,6 +134,21 @@ case class HoodieSpark32PlusResolveReferences(spark: 
SparkSession) extends Rule[
           catalogTable.location.toString))
         LogicalRelation(relation, catalogTable)
       }
+    case HoodieMetadataTableValuedFunction(args) =>
+      val (tablePath, opts) = 
HoodieMetadataTableValuedFunction.parseOptions(args, 
HoodieMetadataTableValuedFunction.FUNC_NAME)
+      val hoodieDataSource = new DefaultSource
+      if (tablePath.contains(Path.SEPARATOR)) {
+        // the first param is table path
+        val relation = hoodieDataSource.createRelation(spark.sqlContext, opts 
++ Map("path" -> (tablePath + "/.hoodie/metadata")))
+        LogicalRelation(relation)
+      } else {
+        // the first param is table identifier
+        val tableId = 
spark.sessionState.sqlParser.parseTableIdentifier(tablePath)
+        val catalogTable = spark.sessionState.catalog.getTableMetadata(tableId)
+        val relation = hoodieDataSource.createRelation(spark.sqlContext, opts 
++ Map("path" ->
+          (catalogTable.location.toString + "/.hoodie/metadata")))

Review Comment:
   Could not find any way to format and change the output RDD generated by the 
relation. Thought about subclassing the `MergeOnReadSnapshotRelation` with some 
trait that allows to decorate/modify the generated RDD, but could not find any 
such trait. 



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