dbt-labs / dbt-labs/dbt-adapters

[Feature] dbt-spark: support default value for function arguments

Open
#2,041 0 comments 0 reactions 0 assignees View on GitHub
triage:product type:enhancement
Dominant language
Python
Stars
233
Forks
362
Avg merge
3d 22h
Merged PRs (30d)
9

Description

### Is this your first time submitting a feature request?

- [x] I have read the [expectations for open source contributors](https://docs.getdbt.com/docs/contributing/oss-expectations)
- [x] I have searched the existing issues, and I could not find an existing issue for this feature
- [x] I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

### Describe the feature

Currently, default values for function arguments are only supported in the Snowflake and Postgres adapters (https://docs.getdbt.com/docs/build/udfs?version=2.0&name=Fusion#defining-udfs-in-dbt).
Default values for function arguments is supported in Spark, with what seems like the same syntax as in Snowflake (https://spark.apache.org/docs/latest/sql-ref-syntax-ddl-create-sql-function.html).
It would therefore be nice if the spark adapter also supported this functionality. I think it should be possible to mostly copy the code from the `snowflake__formatted_scalar_function_args_sql()`-macro in the [Snowflake adapter](dbt-snowflake/src/dbt/include/snowflake/macros/materializations/functions/scalar.sql).

### Describe alternatives you've considered

_No response_

### Who will this benefit?

Users of functions who are working on Spark and Databricks. Most functions become much more useful with default arguments.

### Are you interested in contributing this feature?

_No response_

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.