[
https://issues.apache.org/jira/browse/SPARK-23793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16906805#comment-16906805
]
yangyiwan commented on SPARK-23793:
-----------------------------------
_spark.udf.register("testdb.testfunc", (a: Int) => a + 1)_ *register* looks
like normal , but use sql("select *testdb.testfunc*(1)") throw a
NoSuchFunctionException , This behavior is a bit strange?
> Handle database names in spark.udf.register()
> ---------------------------------------------
>
> Key: SPARK-23793
> URL: https://issues.apache.org/jira/browse/SPARK-23793
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 2.3.0
> Reporter: Takeshi Yamamuro
> Priority: Minor
>
> spark.udf.register currently ignores database names in function names;
> {code}
> scala> sql("create database testdb")
> res0: org.apache.spark.sql.DataFrame = []
> scala> spark.udf.register("testdb.testfunc", (a: Int) => a + 1)
> res1: org.apache.spark.sql.expressions.UserDefinedFunction =
> UserDefinedFunction(<function1>,IntegerType,Some(List(IntegerType)))
> scala> sql("select testdb.testfunc(1)").show
> org.apache.spark.sql.AnalysisException: Undefined function: 'testfunc'. This
> function is neither a registered temporary function nor a permanent function
> registered in the database 'testdb'.; line 1 pos 7
> at
> org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$$anonfun$apply$15$$anonfun$applyOrElse$49.apply(Analyzer.scala:1198)
> at
> org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$$anonfun$apply$15$$anonfun$applyOrElse$49.apply(Analyzer.scala:1198)
> at
> org.apache.spark.sql.catalyst.analysis.package$.withPosition(package.scala:48)
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]