Skip to content

Commit

Permalink
More trino related fixes (#2454)
Browse files Browse the repository at this point in the history
  • Loading branch information
ravenac95 authored Nov 5, 2024
1 parent 1a9a476 commit 92a70c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
11 changes: 6 additions & 5 deletions warehouse/metrics_tools/factory/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def generate_rolling_python_model_for_rendered_query(

columns = METRICS_COLUMNS_BY_ENTITY[ref["entity_type"]]

kind_common = {"batch_size": 90}
kind_common = {"batch_size": 90, "batch_concurrency": 1}
partitioned_by = ("day(metrics_sample_date)",)
window = ref.get("window")
assert window is not None
Expand Down Expand Up @@ -452,7 +452,7 @@ def generate_rolling_model_for_rendered_query(

columns = METRICS_COLUMNS_BY_ENTITY[ref["entity_type"]]

kind_common = {"batch_size": 1}
kind_common = {"batch_size": 1, "batch_concurrency": 1}
partitioned_by = ("day(metrics_sample_date)",)
window = ref.get("window")
assert window is not None
Expand Down Expand Up @@ -503,13 +503,14 @@ def generate_time_aggregation_model_for_rendered_query(
time_aggregation = ref.get("time_aggregation")
assert time_aggregation is not None

kind_options = {"batch_size": 180, "lookback": 7}
kind_common = {"batch_concurrency": 1}
kind_options = {"batch_size": 180, "lookback": 7, **kind_common}
partitioned_by = ("day(metrics_sample_date)",)

if time_aggregation == "weekly":
kind_options = {"batch_size": 182, "lookback": 7}
kind_options = {"batch_size": 182, "lookback": 7, **kind_common}
if time_aggregation == "monthly":
kind_options = {"batch_size": 6, "lookback": 1}
kind_options = {"batch_size": 6, "lookback": 1, **kind_common}
partitioned_by = ("month(metrics_sample_date)",)

grain = [
Expand Down
8 changes: 3 additions & 5 deletions warehouse/metrics_tools/factory/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,9 @@ def metrics_start(evaluator: MacroEvaluator, _data_type: t.Optional[str] = None)
_type=exp.DataType(this=exp.DataType.Type.DATETIME),
),
expression=exp.Interval(
this=exp.Paren(
# The interval parameter should be a string or some dialects
# have issues parsing
this=exp.Literal(this=str(rolling_window), is_string=True),
),
# The interval parameter should be a string or some dialects
# have issues parsing
this=exp.Literal(this=str(rolling_window), is_string=True),
unit=exp.Var(this=rolling_unit.upper()),
),
)
Expand Down

0 comments on commit 92a70c5

Please sign in to comment.