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


##########
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:
   @xiarixiaoyao it has another constructor which was put as the 1st in the 
constructor array returned by `getConstructors`
   
   
https://github.com/apache/spark/blob/5d45a415f3a29898d92380380cfd82bfc7f579ea/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java#L143
   



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