[
https://issues.apache.org/jira/browse/SPARK-20171?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jacek Laskowski updated SPARK-20171:
------------------------------------
Description:
The following {{AnalysisException}} was because the arity of {{cast}} was
wrong, but it said {{cast}} was not available. It'd be much more helpful to say
something like {{"Undefined function: 'cast' with 2 params"}}.
Hint: It'd be even nicer if the exception included candidates like: {{Did you
mean "cast with 1 param"?}}
{code}
scala> sql("SELECT cast(id, INT) FROM range(1)").queryExecution.analyzed
org.apache.spark.sql.AnalysisException: Undefined function: 'cast'. This
function is neither a registered temporary function nor a permanent function
registered in the database 'default'.; line 1 pos 7
at
org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$$anonfun$apply$13$$anonfun$applyOrElse$44.apply(Analyzer.scala:1130)
at
org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$$anonfun$apply$13$$anonfun$applyOrElse$44.apply(Analyzer.scala:1130)
at
org.apache.spark.sql.catalyst.analysis.package$.withPosition(package.scala:48)
at
org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$$anonfun$apply$13.applyOrElse(Analyzer.scala:1129)
at
org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$$anonfun$apply$13.applyOrElse(Analyzer.scala:1127)
{code}
was:
{code}
scala> sql("SELECT cast(id, INT) FROM range(1)").queryExecution.analyzed
org.apache.spark.sql.AnalysisException: Undefined function: 'cast'. This
function is neither a registered temporary function nor a permanent function
registered in the database 'default'.; line 1 pos 7
at
org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$$anonfun$apply$13$$anonfun$applyOrElse$44.apply(Analyzer.scala:1130)
at
org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$$anonfun$apply$13$$anonfun$applyOrElse$44.apply(Analyzer.scala:1130)
at
org.apache.spark.sql.catalyst.analysis.package$.withPosition(package.scala:48)
at
org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$$anonfun$apply$13.applyOrElse(Analyzer.scala:1129)
at
org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$$anonfun$apply$13.applyOrElse(Analyzer.scala:1127)
{code}
> Analyzer should include the arity of a function when reporting
> "AnalysisException: Undefined function"
> ------------------------------------------------------------------------------------------------------
>
> Key: SPARK-20171
> URL: https://issues.apache.org/jira/browse/SPARK-20171
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 2.2.0
> Reporter: Jacek Laskowski
> Priority: Minor
>
> The following {{AnalysisException}} was because the arity of {{cast}} was
> wrong, but it said {{cast}} was not available. It'd be much more helpful to
> say something like {{"Undefined function: 'cast' with 2 params"}}.
> Hint: It'd be even nicer if the exception included candidates like: {{Did you
> mean "cast with 1 param"?}}
> {code}
> scala> sql("SELECT cast(id, INT) FROM range(1)").queryExecution.analyzed
> org.apache.spark.sql.AnalysisException: Undefined function: 'cast'. This
> function is neither a registered temporary function nor a permanent function
> registered in the database 'default'.; line 1 pos 7
> at
> org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$$anonfun$apply$13$$anonfun$applyOrElse$44.apply(Analyzer.scala:1130)
> at
> org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$$anonfun$apply$13$$anonfun$applyOrElse$44.apply(Analyzer.scala:1130)
> at
> org.apache.spark.sql.catalyst.analysis.package$.withPosition(package.scala:48)
> at
> org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$$anonfun$apply$13.applyOrElse(Analyzer.scala:1129)
> at
> org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$$anonfun$apply$13.applyOrElse(Analyzer.scala:1127)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]