Skip to content

Commit

Permalink
Add optimize logic for auto liquid clustering
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaneMazur committed Feb 7, 2025
1 parent fa85697 commit 896b89c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dbt/include/databricks/macros/relations/optimize.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{%- if var('DATABRICKS_SKIP_OPTIMIZE', 'false')|lower != 'true' and
var('databricks_skip_optimize', 'false')|lower != 'true' and
config.get('file_format', 'delta') == 'delta' -%}
{%- if (config.get('zorder', False) or config.get('liquid_clustered_by', False)) -%}
{%- if (config.get('zorder', False) or config.get('liquid_clustered_by', False)) or config.get('auto_liquid_cluster', False) -%}
{%- call statement('run_optimize_stmt') -%}
{{ get_optimize_sql(relation) }}
{%- endcall -%}
Expand All @@ -17,8 +17,8 @@
{%- macro get_optimize_sql(relation) %}
optimize {{ relation }}
{%- if config.get('zorder', False) and config.get('file_format', 'delta') == 'delta' %}
{%- if config.get('liquid_clustered_by', False) %}
{{ exceptions.warn("Both zorder and liquid_clustered_by are set but they are incompatible. zorder will be ignored.") }}
{%- if config.get('liquid_clustered_by', False) or config.get('auto_liquid_cluster', False) %}
{{ exceptions.warn("Both zorder and liquid_clustering are set but they are incompatible. zorder will be ignored.") }}
{%- else %}
{%- set zorder = config.get('zorder', none) %}
{# TODO: predicates here? WHERE ... #}
Expand Down

0 comments on commit 896b89c

Please sign in to comment.