flow-models/macros/udf_array_disjunctive_union.sql
2023-09-05 16:44:38 -06:00

11 lines
390 B
SQL

{% macro run_create_udf_array_disjunctive_union() %}
{% set func_sql %}
CREATE
OR REPLACE FUNCTION {{ target.database }}.silver.udf_array_disjunctive_union(
a1 ARRAY,
a2 ARRAY
) returns ARRAY LANGUAGE javascript AS 'return [...A1.filter(e => !A2.includes(e)),...A2.filter(e => !A1.includes(e))]';
{% endset %}
{% do run_query(func_sql) %}
{% endmacro %}