Skip to content

Commit

Permalink
Address function inline comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbmeetka committed Nov 22, 2023
1 parent e89099f commit 2daf084
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion metricflow/test/integration/test_configured_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ def render_between_time_constraint(
start_time: str,
stop_time: str,
) -> str:
"""Render an expression like "ds between timestamp '2020-01-01' AND timestamp '2020-01-02'" since Trino require timestamp literals to be wrapped in a timestamp() function."""
"""Render an expression like "ds between timestamp '2020-01-01' AND timestamp '2020-01-02'".
This will cast the literals as needed for each engine, and provide an alternative to incrementing
the date as we do in render_time_constraint. Using BETWEEN is more robust for cases involving potentially
mixed granularities.
"""
start_expr = self.cast_to_ts(f"{start_time}")
stop_expr = self.cast_to_ts(f"{stop_time}")
return f"{expr} BETWEEN {start_expr} AND {stop_expr}"
Expand Down

0 comments on commit 2daf084

Please sign in to comment.