viirya commented on code in PR #60396:
URL: https://github.com/apache/spark/pull/60396#discussion_r4560268052
##########
sql/core/src/test/scala/org/apache/spark/sql/connector/ProcedureSuite.scala:
##########
@@ -241,6 +241,28 @@ class ProcedureSuite extends SharedSparkSession with
BeforeAndAfter {
}
}
+ test("SPARK-61553: a null from loadProcedure means the procedure is not
found") {
+ withSQLConf("spark.sql.catalog.nullcat" ->
classOf[NullReturningProcedureCatalog].getName) {
+ checkError(
+ exception = intercept[AnalysisException](sql("CALL
nullcat.ns.missing()")),
+ condition = "UNRESOLVED_ROUTINE",
+ parameters = Map(
+ "routineName" -> "`nullcat`.`ns`.`missing`",
+ "searchPath" -> "[`system`.`builtin`, `system`.`session`,
`spark_catalog`.`default`]"),
+ context = ExpectedContext(fragment = "CALL nullcat.ns.missing()",
start = 0, stop = 24))
Review Comment:
Could you also cover `DESC PROCEDURE nullcat.ns.missing` here? It is the
third row of the PR description but has no test.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionResolution.scala:
##########
@@ -873,7 +873,11 @@ class FunctionResolution(
case pc: ProcedureCatalog =>
try {
val procedure = pc.loadProcedure(ident)
- return ResolvedProcedure(pc, ident, procedure)
+ // A null means the catalog has no such procedure. Treat it as
a miss, so an
+ // unqualified name keeps searching PATH and a qualified one
fails as unresolved.
+ if (procedure != null) {
Review Comment:
Now that the analyzer gives `null` a meaning, would it be worth one sentence
in the `ProcedureCatalog.loadProcedure` Javadoc? Fine to leave it as is if you
prefer not to touch the API doc.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]