-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{% macro jaro_winkler(str1, str2) %} | ||
-- Check inputs are not None or empty | ||
-- Max can be empty | ||
{% if str1 is none or str2 is none or str1 == "" or str2 == ""%} | ||
{{ exceptions.raise_compiler_error("Both input strings must contain text.") }} | ||
{% endif %} | ||
-- Use Dispatch to handle nuances in syntax across DWs | ||
{{ return(adapter.dispatch('jaro_winkler', 'fuzzy_text')(str1, str2)) }} | ||
{% endmacro %} | ||
|
||
-- For non-supported adapters | ||
{% macro default__jaro_winkler() %} | ||
{{ exceptions.raise_compiler_error("Jaccard index is not yet implemented for this adapter. Currently it is only available for Snowflake and BigQuery. Please raise an issue on the Github repo to request expanding coverage.") }} | ||
{% endmacro %} | ||
|
||
{% macro snowflake__jaro_winkler(str1, str2) %} | ||
-- Built-in support for Snowflake | ||
JAROWINKLER_SIMILARITY({{str1}}, {{str2}}) | ||
{% endmacro %} | ||
|
||
-- {% macro bigquery__jaro_winkler(str1, str2) %} | ||
-- -- TODO | ||
-- {% endmacro %} |