Skip to content

Commit

Permalink
[CHORE] Add developer flag to use Rust query planner (#1205)
Browse files Browse the repository at this point in the history
Setting: `DAFT_DEVELOPER_RUST_QUERY_PLANNER=1`

Retrieving: `get_context().use_rust_planner -> bool`

---------

Co-authored-by: Xiayue Charles Lin <[email protected]>
Co-authored-by: Clark Zinzow <[email protected]>
  • Loading branch information
3 people committed Aug 1, 2023
1 parent eedf120 commit 954788a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions daft/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 954788a

Please sign in to comment.