Skip to content

Conversation

@allisonwang-db
Copy link
Contributor

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:

  • Properly resolve procedure identifiers using the ResolveProcedures analyzer rule.
  • Bind the procedure to retrieve its schema.
  • Display a comprehensive list of input parameters, including their mode (IN/OUT), name, data type, default values, and comments.

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

val procedureCatalog = catalog.asProcedureCatalog
case UnresolvedProcedure(CatalogAndIdentifier(catalog, ident)) =>
if (!catalog.isInstanceOf[ProcedureCatalog]) {
throw QueryCompilationErrors.missingCatalogProceduresAbilityError(catalog)
Copy link
Contributor

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)
Copy link
Contributor

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.
Copy link
Member

@pan3793 pan3793 Dec 11, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants