Skip to content

Commit

Permalink
Disable predicate pushdown optimizer
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyholcomb committed Sep 6, 2024
1 parent 1f593a4 commit 38a7363
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
8 changes: 8 additions & 0 deletions metricflow/dataflow/optimizer/dataflow_optimizer_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ def all_optimizations() -> FrozenSet[DataflowPlanOptimization]:
"""Convenience method for getting a set of all available optimizations."""
return frozenset((DataflowPlanOptimization.SOURCE_SCAN, DataflowPlanOptimization.PREDICATE_PUSHDOWN))

@staticmethod
def enabled_obtimizations() -> FrozenSet[DataflowPlanOptimization]:
"""Set of DataflowPlanOptimization that are currently enabled.
Predicate pushdown optimizer is currently disabled.
"""
return frozenset((DataflowPlanOptimization.SOURCE_SCAN,))


class DataflowPlanOptimizerFactory:
"""Factory class for initializing an enumerated set of optimizers.
Expand Down
6 changes: 4 additions & 2 deletions metricflow/engine/metricflow_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class MetricFlowQueryRequest:
order_by: Optional[Sequence[OrderByQueryParameter]] = None
min_max_only: bool = False
sql_optimization_level: SqlQueryOptimizationLevel = SqlQueryOptimizationLevel.O4
dataflow_plan_optimizations: FrozenSet[DataflowPlanOptimization] = DataflowPlanOptimization.all_optimizations()
dataflow_plan_optimizations: FrozenSet[DataflowPlanOptimization] = DataflowPlanOptimization.enabled_obtimizations()
query_type: MetricFlowQueryType = MetricFlowQueryType.METRIC

@staticmethod
Expand All @@ -128,7 +128,9 @@ def create_with_random_request_id( # noqa: D102
order_by_names: Optional[Sequence[str]] = None,
order_by: Optional[Sequence[OrderByQueryParameter]] = None,
sql_optimization_level: SqlQueryOptimizationLevel = SqlQueryOptimizationLevel.O4,
dataflow_plan_optimizations: FrozenSet[DataflowPlanOptimization] = DataflowPlanOptimization.all_optimizations(),
dataflow_plan_optimizations: FrozenSet[
DataflowPlanOptimization
] = DataflowPlanOptimization.enabled_obtimizations(),
query_type: MetricFlowQueryType = MetricFlowQueryType.METRIC,
min_max_only: bool = False,
) -> MetricFlowQueryRequest:
Expand Down
4 changes: 2 additions & 2 deletions tests_metricflow/query_rendering/compare_rendered_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ def render_and_check(
# Run dataflow -> sql conversion with all optimizers
if is_distinct_values_plan:
optimized_plan = dataflow_plan_builder.build_plan_for_distinct_values(
query_spec, optimizations=DataflowPlanOptimization.all_optimizations()
query_spec, optimizations=DataflowPlanOptimization.enabled_obtimizations()
)
else:
optimized_plan = dataflow_plan_builder.build_plan(
query_spec, optimizations=DataflowPlanOptimization.all_optimizations()
query_spec, optimizations=DataflowPlanOptimization.enabled_obtimizations()
)
conversion_result = dataflow_to_sql_converter.convert_to_sql_query_plan(
sql_engine_type=sql_client.sql_engine_type,
Expand Down

0 comments on commit 38a7363

Please sign in to comment.