xushiyan commented on code in PR #5378:
URL: https://github.com/apache/hudi/pull/5378#discussion_r855120835


##########
hudi-spark-datasource/hudi-spark3/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/Spark32HoodieParquetFileFormat.scala:
##########
@@ -332,10 +390,33 @@ class Spark32HoodieParquetFileFormat(private val 
shouldAppendPartitionValues: Bo
       }
     }
   }
+
 }
 
 object Spark32HoodieParquetFileFormat {
 
+  private def createParquetFilters(args: Any*): ParquetFilters = {
+    // NOTE: ParquetFilters ctor args contain Scala enum, therefore we can't 
look it
+    //       up by arg types, and have to instead rely on relative order of 
ctors
+    val ctor = classOf[ParquetFilters].getConstructors.head
+    ctor.newInstance(args.map(_.asInstanceOf[AnyRef]): _*)
+      .asInstanceOf[ParquetFilters]
+  }
+
+  private def createParquetReadSupport(args: Any*): ParquetReadSupport = {
+    // NOTE: ParquetReadSupport ctor args contain Scala enum, therefore we 
can't look it
+    //       up by arg types, and have to instead rely on relative order of 
ctors
+    val ctor = classOf[ParquetReadSupport].getConstructors.head
+    ctor.newInstance(args.map(_.asInstanceOf[AnyRef]): _*)
+      .asInstanceOf[ParquetReadSupport]
+  }
+
+  private def createVectorizedParquetRecordReader(args: Any*): 
VectorizedParquetRecordReader = {
+    val ctor = classOf[VectorizedParquetRecordReader].getConstructors.head

Review Comment:
   this actually breaks. From getConstructors.head it actually gives the 2nd 
constructor from the code with 2 arguments. 
   
   
https://github.com/apache/spark/blob/v3.2.0/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java



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