apache/datafusion-python

Cannot create a `SessionContext` with only a `SessionConfig`

jcrist opened this issue · 0 comments

In datafusion 40.1.0 a bug was added where a SessionContext cannot be created when specifying only a SessionConfig. This is due to a small copy-paste error in the SessionContext.__init__.

In [1]: import datafusion

In [2]: config = datafusion.SessionConfig()

In [3]: ctx = datafusion.SessionContext(config)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[3], line 1
----> 1 ctx = datafusion.SessionContext(config)

File ~/miniforge3/envs/ibis/lib/python3.11/site-packages/datafusion/context.py:448, in SessionContext.__init__(self, config, runtime)
    427 """Main interface for executing queries with DataFusion.
    428 
    429 Maintains the state of the connection between a user and an instance
   (...)
    445     df = ctx.read_csv("data.csv")
    446 """
    447 config = config.config_internal if config is not None else None
--> 448 runtime = runtime.config_internal if config is not None else None
    450 self.ctx = SessionContextInternal(config, runtime)

AttributeError: 'NoneType' object has no attribute 'config_internal'