Skip to content

add examples and description to scalar/aggregate functions?  #8366

@universalmind303

Description

@universalmind303

Is your feature request related to a problem or challenge?

Currently I am working on adding examples & documentation to all sql functions for a database implementation built on datafusion. GlareDB. We are manually providing examples and docs for all of the functions native to datafusion. It'd be nice if these were provided by datafusion out of the box.

Describe the solution you'd like

in addition to name, and signature, BuiltinScalarFunction and AggregateFunction should provide methods for description & example usage.

let abs = BuiltinScalarFunction::Abs;
abs.name() // "abs"
abs.sql_example() // "abs(-1)"
abs.description() //  "Compute the absolute value of a number."

Describe alternatives you've considered

See above.

Additional context

Considering we've (glaredb) already implemented the examples/descriptions for our own usecase, I'd be happy to submit a PR to add it to datafusion if it's something that would benefit others. One thing to consider is that it may add a bit of bloat to binaries as it'll need to contain all of these additional strings. (maybe we could/should feature flag it?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions