Skip to content

Commit

Permalink
Merge pull request #338 from 3fonov/main
Browse files Browse the repository at this point in the history
Fix quotation in split_part macro
  • Loading branch information
BentsiLeviav authored Oct 30, 2024
2 parents 51bf0e1 + efec997 commit 6e92d04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion dbt/include/clickhouse/macros/utils/utils.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@


{% macro clickhouse__split_part(string_text, delimiter_text, part_number) %}
splitByChar('{{delimiter_text}}', {{ string_text }})[{{ part_number }}]
splitByString({{delimiter_text}}, {{ string_text }})[{{ part_number }}]
{% endmacro %}


Expand Down Expand Up @@ -108,3 +108,4 @@
{% macro clickhouse__array_concat(array_1, array_2) -%}
arrayConcat({{ array_1 }}, {{ array_2 }})
{% endmacro %}

6 changes: 3 additions & 3 deletions tests/integration/adapter/utils/test_split_part.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@
)
select
{{ split_part('parts', '|', 1) }} as actual,
{{ split_part('parts', "'|'", 1) }} as actual,
result_1 as expected
from data
union all
select
{{ split_part('parts', '|', 2) }} as actual,
{{ split_part('parts', "'|'", 2) }} as actual,
result_2 as expected
from data
union all
select
{{ split_part('parts', '|', 3) }} as actual,
{{ split_part('parts', "'|'", 3) }} as actual,
result_3 as expected
from data
Expand Down

0 comments on commit 6e92d04

Please sign in to comment.