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


##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/TestHoodieTableValuedFunction.scala:
##########
@@ -558,4 +558,50 @@ class TestHoodieTableValuedFunction extends 
HoodieSparkSqlTestBase {
       }
     }
   }
+
+  test(s"Test hudi_metadata Table-Valued Function") {
+    if (HoodieSparkUtils.gteqSpark3_2) {
+      withTempDir { tmp =>
+        Seq("cow").foreach { tableType =>
+          val tableName = generateTableName
+          val identifier = tableName
+          spark.sql("set " + SPARK_SQL_INSERT_INTO_OPERATION.key + "=upsert")
+          spark.sql(
+            s"""
+               |create table $tableName (
+               |  id int,
+               |  name string,
+               |  ts long,
+               |  price int
+               |) using hudi
+               |partitioned by (price)
+               |tblproperties (
+               |  type = '$tableType',
+               |  primaryKey = 'id',
+               |  preCombineField = 'ts',
+               |  hoodie.datasource.write.recordkey.field = 'id',
+               |  hoodie.metadata.record.index.enable = 'true',
+               |  hoodie.metadata.index.column.stats.enable = 'true',
+               |  hoodie.metadata.index.column.stats.column.list = 'price'
+               |)
+               |location '${tmp.getCanonicalPath}/$tableName'
+               |""".stripMargin
+          )
+
+          spark.sql(
+            s"""
+               | insert into $tableName
+               | values (1, 'a1', 1000, 10), (2, 'a2', 2000, 20), (3, 'a3', 
3000, 30)
+               | """.stripMargin
+          )
+
+          val result1DF = spark.sql(
+            s"select * from hudi_metadata('$identifier')"
+          )
+          result1DF.show(false)

Review Comment:
   @codope could not figure out a way to format/decorate the output RDD 
generated by `MergeOnReadSnapshotRelation`. I was hoping that such a trait 
exists which a relation could implement (which allows modifying RDDs generated 
by `buildScan()`, but did not find anything obvious in the documentation. Let's 
discuss if this output is okay?



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