cloud-fan commented on code in PR #53437:
URL: https://github.com/apache/spark/pull/53437#discussion_r2649184102
##########
sql/core/src/test/scala/org/apache/spark/sql/connector/ProcedureSuite.scala:
##########
@@ -562,6 +568,46 @@ class ProcedureSuite extends QueryTest with
SharedSparkSession with BeforeAndAft
}
}
+ test("SPARK-51780: DESC PROCEDURE with binding failure") {
+ catalog.createProcedure(Identifier.of(Array("ns"), "bind_fail"),
UnboundBindFailProcedure)
+ checkAnswer(
+ sql("DESC PROCEDURE cat.ns.bind_fail"),
+ Row("Procedure: bind_fail") ::
+ Row("Description: bind fail procedure") :: Nil)
+ }
+
+ test("SPARK-51780: DESC PROCEDURE with zero parameters") {
+ catalog.createProcedure(
+ Identifier.of(Array("ns"), "zero_params"), SimpleZeroParameterProcedure)
+ checkAnswer(
+ sql("DESC PROCEDURE cat.ns.zero_params"),
+ Row("Procedure: zero_params") ::
+ Row("Description: zero parameter procedure") ::
+ Row("Parameters: ()") :: Nil)
+ }
+
+ object UnboundBindFailProcedure extends UnboundProcedure {
+ override def name: String = "bind_fail"
+ override def description: String = "bind fail procedure"
+ override def bind(inputType: StructType): BoundProcedure = {
+ throw new UnsupportedOperationException("Cannot bind")
+ }
+ }
+
+ object UnboundZeroParameterProcedure extends UnboundProcedure {
+ override def name: String = "zero_params"
+ override def description: String = "zero parameter procedure"
+ override def bind(inputType: StructType): BoundProcedure =
ZeroParameterProcedure
+ }
+
+ object ZeroParameterProcedure extends BoundProcedure {
+ override def name: String = "zero_params"
+ override def description: String = "zero parameter procedure"
+ override def isDeterministic: Boolean = true
+ override def parameters: Array[ProcedureParameter] = Array.empty
+ override def call(input: InternalRow): java.util.Iterator[Scan] =
Collections.emptyIterator
+ }
+
Review Comment:
```suggestion
```
--
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]