You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "ulysses you (Jira)" <ji...@apache.org> on 2020/09/14 10:35:00 UTC

[jira] [Created] (SPARK-32877) Fix Hive UDF not support decimal type in complex type

ulysses you created SPARK-32877:
-----------------------------------

             Summary: Fix Hive UDF not support decimal type in complex type
                 Key: SPARK-32877
                 URL: https://issues.apache.org/jira/browse/SPARK-32877
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 3.1.0
            Reporter: ulysses you


This pr aims to support Hive UDF when input complex type contains decimal type.

Before this pr, we failed in this code.
{code:java}
class ArraySumUDF extends UDF {
 import scala.collection.JavaConverters._
 def evaluate(values: java.util.List[java.lang.Double]): java.lang.Double = {
 var r = 0d
 for (v <- values.asScala) {
 r += v
 }
 r
 }
}

sql(s"CREATE FUNCTION testArraySum AS '${classOf[ArraySumUDF].getName}'")
sql("SELECT testArraySum(array(1, 1.1, 1.2))")
-- failed msg
Error in query: No handler for UDF/UDAF/UDTF 'ArraySumUDF': org.apache.hadoop.hive.ql.exec.NoMatchingMethodException: No matching method for class ArraySumUDF with (array<decimal(11,1)>). Possible choices: _FUNC_(array<double>) ; line 1 pos 7
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org