-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-54682][SQL] Support showing parameters in DESCRIBE PROCEDURE #53437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| val procedureCatalog = catalog.asProcedureCatalog | ||
| case UnresolvedProcedure(CatalogAndIdentifier(catalog, ident)) => | ||
| if (!catalog.isInstanceOf[ProcedureCatalog]) { | ||
| throw QueryCompilationErrors.missingCatalogProceduresAbilityError(catalog) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does catalog.asProcedureCatalog do this check?
| // which differs from the StructType used by internal stored procedures (handled by | ||
| // formatParameters). | ||
| private def formatProcedureParameters(params: Array[ProcedureParameter]): Seq[String] = { | ||
| val modes = tabulate(params.map(_.mode().toString).toSeq) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The impl here is really awkward, can we iterate param just once?
params.map { param =>
s"${param.mode} ${param.name} ..."
}
| // UnboundProcedure requires binding to retrieve parameters. We try to bind with an empty | ||
| // argument list to get the parameters. If the procedure requires arguments, binding might | ||
| // fail. In that case, we suppress the exception and just show the procedure metadata | ||
| // without parameters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid this is a common case, not rare
What changes were proposed in this pull request?
This PR updates the DESCRIBE PROCEDURE command to correctly resolve V2 procedures and display detailed parameter information.
Previously, DESCRIBE PROCEDURE did not provide parameter details. This change enhances the command to:
Why are the changes needed?
Users need to know the parameter signatures of stored procedures to call them correctly. Without this change, DESCRIBE PROCEDURE provided insufficient information for using a procedure. This change also makes the command more like DESCRIBE FUNCTION.
Does this PR introduce any user-facing change?
Yes, DESCRIBE PROCEDURE output now includes a "Parameters" section listing all arguments with their types and defaults.
How was this patch tested?
Existing tests.
Was this patch authored or co-authored using generative AI tooling?
Yes