Skip to content

Commit ed9e27f

Browse files
committed
udfs: norma exclusion petits mots, cleanup
1 parent 0feae5c commit ed9e27f

7 files changed

+10
-9
lines changed

dbt/macros/udf/udf_ae_string_cleanup.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
to NULL for easier processing whenever we consider
77
it to be empty.
88
*/
9-
DROP FUNCTION IF EXISTS {{ target.schema }}.udf_ae_string_cleanup(TEXT) CASCADE;
9+
DROP FUNCTION IF EXISTS {{ target.schema }}.udf_ae_string_cleanup CASCADE;
1010
CREATE FUNCTION {{ target.schema }}.udf_ae_string_cleanup(val TEXT)
1111
RETURNS TEXT AS $$
1212
BEGIN

dbt/macros/udf/udf_columns_concat_unique_non_empty.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
Concatenate strings from various columns while only retaining non-empty values
44
*/
5-
DROP FUNCTION IF EXISTS {{ target.schema }}.udf_columns_concat_unique_non_empty(VARIADIC input_columns TEXT[]) CASCADE;
5+
DROP FUNCTION IF EXISTS {{ target.schema }}.udf_columns_concat_unique_non_empty CASCADE;
66
CREATE FUNCTION {{ target.schema }}.udf_columns_concat_unique_non_empty(VARIADIC input_columns TEXT[])
77
RETURNS TEXT AS $$
88
DECLARE

dbt/macros/udf/udf_columns_words_in_common_count.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
Count number of words in common between 2 columns
44
*/
5-
DROP FUNCTION IF EXISTS {{ target.schema }}.udf_columns_words_in_common_count(text, text) CASCADE;
5+
DROP FUNCTION IF EXISTS {{ target.schema }}.udf_columns_words_in_common_count CASCADE;
66
CREATE FUNCTION {{ target.schema }}.udf_columns_words_in_common_count(col1 text, col2 text)
77
RETURNS integer AS $$
88
DECLARE

dbt/macros/udf/udf_encode_base57.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% macro create_udf_encode_base57() %}
22

3-
DROP FUNCTION IF EXISTS {{ target.schema }}.encode_base57(uuid) CASCADE;
3+
DROP FUNCTION IF EXISTS {{ target.schema }}.encode_base57 CASCADE;
44
CREATE FUNCTION {{ target.schema }}.encode_base57(uuid UUID)
55
RETURNS text AS $$
66
DECLARE

dbt/macros/udf/udf_normalize_string_alpha_for_match.sql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
E.g. to test this function:
1010
SELECT udf_normalize_string_for_match(' Héllo-Wørld! Ça va? 123 ');
1111
*/
12-
DROP FUNCTION IF EXISTS {{ target.schema }}.udf_normalize_string_for_match(TEXT) CASCADE;
13-
CREATE FUNCTION {{ target.schema }}.udf_normalize_string_for_match(input_text TEXT) RETURNS TEXT AS $$
12+
DROP FUNCTION IF EXISTS {{ target.schema }}.udf_normalize_string_for_match CASCADE;
13+
CREATE FUNCTION {{ target.schema }}.udf_normalize_string_for_match(input_text TEXT, remove_words_smaller_size INTEGER DEFAULT 2) RETURNS TEXT AS $$
1414
DECLARE
1515
normalized TEXT;
1616
words TEXT[];
@@ -28,7 +28,8 @@ BEGIN
2828
FROM (
2929
SELECT unnest(words) AS word
3030
ORDER BY word
31-
) AS words_sorted;
31+
) AS words_sorted
32+
WHERE length(word) >= remove_words_smaller_size;
3233

3334
RETURN normalized;
3435
END;

dbt/macros/udf/udf_safe_divmod.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% macro create_udf_safe_divmod() %}
2-
DROP FUNCTION IF EXISTS {{ target.schema }}.safe_divmod(numeric, numeric) CASCADE;
2+
DROP FUNCTION IF EXISTS {{ target.schema }}.safe_divmod CASCADE;
33
CREATE FUNCTION {{ target.schema }}.safe_divmod(n numeric, d numeric)
44
RETURNS TABLE(quotient numeric, remainder numeric) AS $$
55
DECLARE

dbt/macros/udf/udf_uuid_to_int.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% macro create_udf_uuid_to_int() %}
2-
DROP FUNCTION IF EXISTS {{ target.schema }}.uuid_to_int(uuid) CASCADE;
2+
DROP FUNCTION IF EXISTS {{ target.schema }}.uuid_to_int CASCADE;
33
CREATE FUNCTION {{ target.schema }}.uuid_to_int(uuid UUID)
44
RETURNS numeric AS $$
55
DECLARE

0 commit comments

Comments
 (0)