Skip to content

Commit a6a2ccc

Browse files
committed
opt: remove Metadata.AllUserDefinedFunctions
The metadata method `AllUserDefinedFunctions` has been replaced with a new function `HasUserDefinedFunctions` which provides a simpler API without exposing the underlying UDF dependency map. The map is still available outside of the opt package via the `TestingUDFDeps` method which is designed for testing use only. Release note: None
1 parent 400105c commit a6a2ccc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pkg/sql/explain_bundle.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ func (b *stmtBundleBuilder) addEnv(ctx context.Context) {
483483
if err := c.PrintCreateEnum(&buf, b.flags.RedactValues); err != nil {
484484
b.printError(fmt.Sprintf("-- error getting schema for enums: %v", err), &buf)
485485
}
486-
if len(mem.Metadata().AllUserDefinedFunctions()) != 0 {
486+
if mem.Metadata().HasUserDefinedFunctions() {
487487
// Get all relevant user-defined functions.
488488
blankLine()
489489
if err := c.PrintRelevantCreateUdf(&buf, strings.ToLower(b.stmt), b.flags.RedactValues, &b.errorStrings); err != nil {

pkg/sql/opt/metadata.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,9 +540,9 @@ func (md *Metadata) AllUserDefinedTypes() []*types.T {
540540
return md.userDefinedTypesSlice
541541
}
542542

543-
// AllUserDefinedFunctions returns all user defined functions used in this query.
544-
func (md *Metadata) AllUserDefinedFunctions() map[cat.StableID]*tree.Overload {
545-
return md.udfDeps
543+
// HasUserDefinedFunctions returns true if the query references a UDF.
544+
func (md *Metadata) HasUserDefinedFunctions() bool {
545+
return len(md.udfDeps) > 0
546546
}
547547

548548
// AddUserDefinedFunction adds a user-defined function to the metadata for this

0 commit comments

Comments
 (0)