Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SL-3069] Expose a way to disable automatic date_trunc on time dimensions #1498

Open
Jstein77 opened this issue Nov 1, 2024 · 0 comments
Open

Comments

@Jstein77
Copy link
Contributor

Jstein77 commented Nov 1, 2024

Summary

MetricFlow will apply a date_trunc on time dimensions to make sure they conform the the specified granularity. i.e we will render this SQL for the following dimension date_trunc('day', data_dt)

- name: data_dt
        type: time
        is_partition: True
        type_params:
          time_granularity: day

The issue is that Snowflake, and likely other engines, won't respect partition pruning on data_dt if we apply a date trunc function. We need a way to respect partition pruning for time dimension

Possible Solutions

We could expose a way to make the date trunc function optional i.e

- name: data_dt
        type: time
        is_partition: True
        type_params:
          time_granularity: day
          enfore_granularity: false #default true 

This could lead to some odd behavior with time based joins, where we expect every dimension to conform to the specified grain. The expectation would be that the user makes sure the dimension is add the right grain downstream to guarantee all time based joins will work.

From SyncLinear.com | SL-3069

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant