This is an automated email from the ASF dual-hosted git repository.
agrove pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-python.git
The following commit(s) were added to refs/heads/main by this push:
new 02414d8 Fix SessionContext init with only SessionConfig (#827)
02414d8 is described below
commit 02414d81b2dae6e9a019a079ce7b7958b80ca538
Author: Jim Crist-Harif <[email protected]>
AuthorDate: Fri Aug 23 14:29:39 2024 -0500
Fix SessionContext init with only SessionConfig (#827)
Previously creating a `SessionContext` when specifying only a
`SessionConfig` would error.
---
python/datafusion/context.py | 2 +-
python/datafusion/tests/test_context.py | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/python/datafusion/context.py b/python/datafusion/context.py
index 47f2b9c..d4e50cf 100644
--- a/python/datafusion/context.py
+++ b/python/datafusion/context.py
@@ -445,7 +445,7 @@ class SessionContext:
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)
diff --git a/python/datafusion/tests/test_context.py
b/python/datafusion/tests/test_context.py
index 1b424db..66d7e01 100644
--- a/python/datafusion/tests/test_context.py
+++ b/python/datafusion/tests/test_context.py
@@ -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"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]