From 954788af65bc2269b7afc5cea16f9e4c190ab79c Mon Sep 17 00:00:00 2001 From: xcharleslin <4212216+xcharleslin@users.noreply.github.com> Date: Tue, 1 Aug 2023 12:41:23 -0700 Subject: [PATCH] [CHORE] Add developer flag to use Rust query planner (#1205) Setting: `DAFT_DEVELOPER_RUST_QUERY_PLANNER=1` Retrieving: `get_context().use_rust_planner -> bool` --------- Co-authored-by: Xiayue Charles Lin Co-authored-by: Clark Zinzow --- daft/context.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/daft/context.py b/daft/context.py index 8cb7e6f020..63209971d7 100644 --- a/daft/context.py +++ b/daft/context.py @@ -54,12 +54,18 @@ def _get_runner_config_from_env() -> _RunnerConfig: _RUNNER: Runner | None = None +def _get_planner_from_env() -> bool: + """Returns whether or not to use the new query planner.""" + return bool(int(os.getenv("DAFT_DEVELOPER_RUST_QUERY_PLANNER", default="1"))) + + @dataclasses.dataclass(frozen=True) class DaftContext: """Global context for the current Daft execution environment""" runner_config: _RunnerConfig = dataclasses.field(default_factory=_get_runner_config_from_env) disallow_set_runner: bool = False + use_rust_planner: bool = dataclasses.field(default_factory=_get_planner_from_env) def runner(self) -> Runner: global _RUNNER