-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into all-contributors/add-octiva
- Loading branch information
Showing
8 changed files
with
315 additions
and
32 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
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
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
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
20 changes: 20 additions & 0 deletions
20
dbt/include/athena/macros/materializations/models/helpers/process_bucket_column.sql
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,20 @@ | ||
{% macro process_bucket_column(col, partition_key, table, ns, col_index) %} | ||
{# Extract bucket information from the partition key #} | ||
{%- set bucket_match = modules.re.search('bucket\((.+?),\s*(\d+)\)', partition_key) -%} | ||
|
||
{%- if bucket_match -%} | ||
{# For bucketed columns, compute bucket numbers and conditions #} | ||
{%- set column_type = adapter.convert_type(table, col_index) -%} | ||
{%- set ns.is_bucketed = true -%} | ||
{%- set ns.bucket_column = bucket_match[1] -%} | ||
{%- set bucket_num = adapter.murmur3_hash(col, bucket_match[2] | int) -%} | ||
{%- set formatted_value, comp_func = adapter.format_value_for_partition(col, column_type) -%} | ||
|
||
{%- if bucket_num not in ns.bucket_numbers %} | ||
{%- do ns.bucket_numbers.append(bucket_num) %} | ||
{%- do ns.bucket_conditions.update({bucket_num: [formatted_value]}) -%} | ||
{%- elif formatted_value not in ns.bucket_conditions[bucket_num] %} | ||
{%- do ns.bucket_conditions[bucket_num].append(formatted_value) -%} | ||
{%- endif -%} | ||
{%- endif -%} | ||
{% endmacro %} |
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
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
Oops, something went wrong.