Skip to content

Commit

Permalink
Fix SessionContext init with only SessionConfig (#827)
Browse files Browse the repository at this point in the history
Previously creating a `SessionContext` when specifying only a
`SessionConfig` would error.
  • Loading branch information
jcrist authored Aug 23, 2024
1 parent 3b5085e commit 02414d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/datafusion/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ def __init__(
df = ctx.read_csv("data.csv")
"""
config = config.config_internal if config is not None else None
runtime = runtime.config_internal if config is not None else None
runtime = runtime.config_internal if runtime is not None else None

self.ctx = SessionContextInternal(config, runtime)

Expand Down
8 changes: 8 additions & 0 deletions python/datafusion/tests/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ def test_create_context_no_args():
SessionContext()


def test_create_context_session_config_only():
SessionContext(config=SessionConfig())


def test_create_context_runtime_config_only():
SessionContext(runtime=RuntimeConfig())


@pytest.mark.parametrize("path_to_str", (True, False))
def test_runtime_configs(tmp_path, path_to_str):
path1 = tmp_path / "dir1"
Expand Down

0 comments on commit 02414d8

Please sign in to comment.