srowen commented on a change in pull request #23552: 
[DO-NOT-MERGE][SPARK-23710] Upgrade built-in Hive to 2.3.4(Without 
hive-thriftserver)
URL: https://github.com/apache/spark/pull/23552#discussion_r247984761
 
 

 ##########
 File path: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/orc/OrcFilters.scala
 ##########
 @@ -82,6 +83,39 @@ private[orc] object OrcFilters extends Logging {
     createBuilder(dataTypeMap, expression, builder, 
canPartialPushDownConjuncts = true)
   }
 
+  /**
+   * Get PredicateLeafType which is corresponding to the given DataType.
+   */
+  private def getPredicateLeafType(dataType: DataType) = dataType match {
+    case BooleanType => PredicateLeaf.Type.BOOLEAN
+    case ByteType | ShortType | IntegerType | LongType => 
PredicateLeaf.Type.LONG
+    case FloatType | DoubleType => PredicateLeaf.Type.FLOAT
+    case StringType => PredicateLeaf.Type.STRING
+    case DateType => PredicateLeaf.Type.DATE
+    case TimestampType => PredicateLeaf.Type.TIMESTAMP
+    case _: DecimalType => PredicateLeaf.Type.DECIMAL
+    case _ => throw new UnsupportedOperationException(s"DataType: 
${dataType.catalogString}")
+  }
+
+  /**
+   * Cast literal values for filters.
+   *
+   * We need to cast to long because ORC raises exceptions
+   * at 'checkLiteralType' of SearchArgumentImpl.java.
+   */
+  private def castLiteralValue(value: Any, dataType: DataType): Any = dataType 
match {
+    case ByteType | ShortType | IntegerType | LongType =>
+      value.asInstanceOf[Number].longValue
 
 Review comment:
   Trivial, but I'd use () or not consistently between here and line 110

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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