Skip to content

Commit

Permalink
fix(datafusion): fix creation of SessionContext in datafusion 40.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist authored and cpcloud committed Aug 21, 2024
1 parent 4aa402a commit eec5328
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ibis/backends/datafusion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
except ImportError:
SessionConfig = None

try:
from datafusion import RuntimeConfig
except ImportError:
RuntimeConfig = None

if TYPE_CHECKING:
import pandas as pd
import polars as pl
Expand Down Expand Up @@ -105,7 +110,12 @@ def do_connect(
).with_information_schema(True)
else:
df_config = None
self.con = SessionContext(df_config)
if RuntimeConfig is None:
self.con = SessionContext(df_config)
else:
# datafusion 40.1.0 has a bug where SessionContext requires
# both SessionConfig and RuntimeConfig be provided.
self.con = SessionContext(df_config, RuntimeConfig())

self._register_builtin_udfs()

Expand Down

0 comments on commit eec5328

Please sign in to comment.