Skip to content

Commit 2b6110a

Browse files
committed
fix default value check for scalar functions
1 parent b701d18 commit 2b6110a

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/dbt/include/fabric/macros/materializations/functions/scalar.sql

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
{% set args = [] %}
1111
{% for arg in model.arguments -%}
1212
{%- set arg_str = '@' ~ arg.name ~ ' ' ~ arg.data_type -%}
13-
{%- if arg.default_value is not none -%}
14-
{% set arg_str = arg_str ~ ' = ' ~ arg.default_value %}
13+
{%- set default_value = arg.get('default_value', none) -%}
14+
{%- if default_value is not none -%}
15+
{%- set arg_str = arg_str ~ ' = ' ~ arg.default_value -%}
1516
{%- endif -%}
1617
{%- do args.append(arg_str) -%}
1718
{%- endfor %}
@@ -29,4 +30,13 @@
2930
BEGIN
3031
RETURN ({{ model.compiled_code }});
3132
END
33+
{% endmacro %}
34+
35+
{% macro fabric__scalar_function_volatility_sql() %}
36+
{% set volatility = model.config.get('volatility') %}
37+
{% if volatility != none %}
38+
{# This shouldn't happen unless a new volatility is invented #}
39+
{% do unsupported_volatility_warning(volatility) %}
40+
{% endif %}
41+
{# If no volatility is set, don't add anything and let the data warehouse default it #}
3242
{% endmacro %}

tests/functional/adapter/test_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def test_udfs(self, project, sql_event_catcher):
7575
assert result.results[0].agate_table.rows[0].values()[0] == 200
7676

7777

78-
@pytest.mark.skip(reason="Functions are not fully supported yet.")
78+
@pytest.mark.skip(reason="Aggregate functions don't exist in T-SQL.")
7979
class TestBasicSQLUDAFFabric(BasicSQLUDAF):
8080
pass
8181

0 commit comments

Comments
 (0)