ulysses-you commented on a change in pull request #29749:
URL: https://github.com/apache/spark/pull/29749#discussion_r490795280



##########
File path: sql/hive/src/main/scala/org/apache/spark/sql/hive/hiveUDFs.scala
##########
@@ -69,6 +70,23 @@ private[hive] case class HiveSimpleUDF(
     udfType != null && udfType.deterministic() && !udfType.stateful()
   }
 
+  override def inputTypes: Seq[AbstractDataType] = {
+    val inTypes = children.map(_.dataType)
+    if (!inTypes.exists(_.existsRecursively(_.isInstanceOf[DecimalType]))) {

Review comment:
       In first commit I did it for all types but test not passed. The reason 
is a UDF required an Object type.
   
   We convert Java Object Type to NullType in 
`HiveInspectors.javaTypeToDataType` (seems this can be changed ?)
   ```
    // Hive seems to return this for struct types?
       case c: Class[_] if c == classOf[java.lang.Object] => NullType
   ```
   
   So we can't reflect the UDF method using a NullType, the error msg is:
   ```
   in query: cannot resolve 'example_format('%o', 93)' due to data type 
mismatch: argument 2 requires array<null> type, however, '93' is of int type.; 
line 1 pos 7;
   ```




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to