wangyum commented on a change in pull request #23788: [SPARK-27176][SQL] 
Upgrade hadoop-3's built-in Hive maven dependencies to 2.3.4
URL: https://github.com/apache/spark/pull/23788#discussion_r269515635
 
 

 ##########
 File path: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/orc/OrcFilters.scala
 ##########
 @@ -57,22 +62,33 @@ import org.apache.spark.sql.types._
  * known to be convertible.
  */
 private[orc] object OrcFilters extends Logging {
+
+  private def findMethod(klass: Class[_], name: String, args: Class[_]*): 
Method = {
+    val method = klass.getMethod(name, args: _*)
+    method.setAccessible(true)
+    method
+  }
+
   def createFilter(schema: StructType, filters: Array[Filter]): 
Option[SearchArgument] = {
-    val dataTypeMap = schema.map(f => f.name -> f.dataType).toMap
-
-    // First, tries to convert each filter individually to see whether it's 
convertible, and then
-    // collect all convertible ones to build the final `SearchArgument`.
-    val convertibleFilters = for {
-      filter <- filters
-      _ <- buildSearchArgument(dataTypeMap, filter, newBuilder)
-    } yield filter
-
-    for {
-      // Combines all convertible filters using `And` to produce a single 
conjunction
-      conjunction <- buildTree(convertibleFilters)
-      // Then tries to build a single ORC `SearchArgument` for the conjunction 
predicate
-      builder <- buildSearchArgument(dataTypeMap, conjunction, newBuilder)
-    } yield builder.build()
+    if (HiveUtils.isHive2) {
+      BuiltinOrcFilters.createFilter(schema, 
filters).asInstanceOf[Option[SearchArgument]]
 
 Review comment:
   If the built-in Hive is 2.3.4, we use 
[org.apache.spark.sql.execution.datasources.orc.OrcFilters](sql/core/v2.3.4/src/main/scala/org/apache/spark/sql/execution/datasources/orc/OrcFilters.scala)
 to create the filter.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to