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

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

    [ https://issues.apache.org/jira/browse/SPARK-32877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17195364#comment-17195364 ] 

Apache Spark commented on SPARK-32877:
--------------------------------------

User 'ulysses-you' has created a pull request for this issue:
https://github.com/apache/spark/pull/29749

> 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
>            Priority: Minor
>
> 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