Skip to content

Commit

Permalink
Fix Trino issue with previous check query test
Browse files Browse the repository at this point in the history
Unrelated to this PR, but this is causing SQL engine test failures. I
 assume this was not caught previously because the SQL engine tests were not run for this change.
  • Loading branch information
courtneyholcomb committed Jul 29, 2024
1 parent ed9555c commit e63dfca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests_metricflow/integration/test_cases/itest_metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2225,5 +2225,5 @@ integration_test:
SELECT
SUM(1) AS bookings_between_dec_18_2019_and_dec_20_2019
FROM {{ source_schema }}.fct_bookings
WHERE ({{ render_date_trunc("ds", TimeGranularity.DAY) }} < '2012-12-20')
AND ({{ render_date_trunc("ds", TimeGranularity.WEEK) }} > '2019-12-18')
WHERE ({{ render_less_than_time_constraint(render_date_trunc("ds", TimeGranularity.DAY), '2012-12-20') }})
AND ({{ render_greater_than_time_constraint(render_date_trunc("ds", TimeGranularity.WEEK), '2019-12-18') }})
10 changes: 10 additions & 0 deletions tests_metricflow/integration/test_configured_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ def render_time_constraint(
stop_expr = self.cast_to_ts(f"{stop_time_plus_one_day}")
return f"{self.cast_expr_to_ts(expr)} >= {start_expr} AND {self.cast_expr_to_ts(expr)} < {stop_expr}"

def render_greater_than_time_constraint(self, expr: str, date_str: str) -> str:
return f"{expr} > {self.cast_to_ts(date_str)}"

def render_less_than_time_constraint(self, expr: str, date_str: str) -> str:
return f"{expr} < {self.cast_to_ts(date_str)}"

def render_between_time_constraint(
self,
expr: str,
Expand Down Expand Up @@ -296,6 +302,8 @@ def test_case(
source_schema=mf_test_configuration.mf_source_schema,
render_time_constraint=check_query_helpers.render_time_constraint,
render_between_time_constraint=check_query_helpers.render_between_time_constraint,
render_greater_than_time_constraint=check_query_helpers.render_greater_than_time_constraint,
render_less_than_time_constraint=check_query_helpers.render_less_than_time_constraint,
TimeGranularity=TimeGranularity,
DatePart=DatePart,
render_date_sub=check_query_helpers.render_date_sub,
Expand Down Expand Up @@ -329,6 +337,8 @@ def test_case(
source_schema=mf_test_configuration.mf_source_schema,
render_time_constraint=check_query_helpers.render_time_constraint,
render_between_time_constraint=check_query_helpers.render_between_time_constraint,
render_greater_than_time_constraint=check_query_helpers.render_greater_than_time_constraint,
render_less_than_time_constraint=check_query_helpers.render_less_than_time_constraint,
TimeGranularity=TimeGranularity,
DatePart=DatePart,
render_date_sub=check_query_helpers.render_date_sub,
Expand Down

0 comments on commit e63dfca

Please sign in to comment.