2020from __future__ import annotations
2121
2222from ._internal import SessionConfig as SessionConfigInternal
23- from ._internal import RuntimeConfig as RuntimeConfigInternal
23+ from ._internal import RuntimeEnvBuilder as RuntimeEnvBuilderInternal
2424from ._internal import SQLOptions as SQLOptionsInternal
2525from ._internal import SessionContext as SessionContextInternal
2626
@@ -256,56 +256,58 @@ def set(self, key: str, value: str) -> SessionConfig:
256256 return self
257257
258258
259- class RuntimeConfig :
259+ class RuntimeEnvBuilder :
260260 """Runtime configuration options."""
261261
262262 def __init__ (self ) -> None :
263- """Create a new :py:class:`RuntimeConfig ` with default values."""
264- self .config_internal = RuntimeConfigInternal ()
263+ """Create a new :py:class:`RuntimeEnvBuilder ` with default values."""
264+ self .config_internal = RuntimeEnvBuilderInternal ()
265265
266- def with_disk_manager_disabled (self ) -> RuntimeConfig :
266+ def with_disk_manager_disabled (self ) -> RuntimeEnvBuilder :
267267 """Disable the disk manager, attempts to create temporary files will error.
268268
269269 Returns:
270- A new :py:class:`RuntimeConfig ` object with the updated setting.
270+ A new :py:class:`RuntimeEnvBuilder ` object with the updated setting.
271271 """
272272 self .config_internal = self .config_internal .with_disk_manager_disabled ()
273273 return self
274274
275- def with_disk_manager_os (self ) -> RuntimeConfig :
275+ def with_disk_manager_os (self ) -> RuntimeEnvBuilder :
276276 """Use the operating system's temporary directory for disk manager.
277277
278278 Returns:
279- A new :py:class:`RuntimeConfig ` object with the updated setting.
279+ A new :py:class:`RuntimeEnvBuilder ` object with the updated setting.
280280 """
281281 self .config_internal = self .config_internal .with_disk_manager_os ()
282282 return self
283283
284- def with_disk_manager_specified (self , * paths : str | pathlib .Path ) -> RuntimeConfig :
284+ def with_disk_manager_specified (
285+ self , * paths : str | pathlib .Path
286+ ) -> RuntimeEnvBuilder :
285287 """Use the specified paths for the disk manager's temporary files.
286288
287289 Args:
288290 paths: Paths to use for the disk manager's temporary files.
289291
290292 Returns:
291- A new :py:class:`RuntimeConfig ` object with the updated setting.
293+ A new :py:class:`RuntimeEnvBuilder ` object with the updated setting.
292294 """
293295 paths_list = [str (p ) for p in paths ]
294296 self .config_internal = self .config_internal .with_disk_manager_specified (
295297 paths_list
296298 )
297299 return self
298300
299- def with_unbounded_memory_pool (self ) -> RuntimeConfig :
301+ def with_unbounded_memory_pool (self ) -> RuntimeEnvBuilder :
300302 """Use an unbounded memory pool.
301303
302304 Returns:
303- A new :py:class:`RuntimeConfig ` object with the updated setting.
305+ A new :py:class:`RuntimeEnvBuilder ` object with the updated setting.
304306 """
305307 self .config_internal = self .config_internal .with_unbounded_memory_pool ()
306308 return self
307309
308- def with_fair_spill_pool (self , size : int ) -> RuntimeConfig :
310+ def with_fair_spill_pool (self , size : int ) -> RuntimeEnvBuilder :
309311 """Use a fair spill pool with the specified size.
310312
311313 This pool works best when you know beforehand the query has multiple spillable
@@ -326,16 +328,16 @@ def with_fair_spill_pool(self, size: int) -> RuntimeConfig:
326328 size: Size of the memory pool in bytes.
327329
328330 Returns:
329- A new :py:class:`RuntimeConfig ` object with the updated setting.
331+ A new :py:class:`RuntimeEnvBuilder ` object with the updated setting.
330332
331333 Examples usage::
332334
333- config = RuntimeConfig ().with_fair_spill_pool(1024)
335+ config = RuntimeEnvBuilder ().with_fair_spill_pool(1024)
334336 """
335337 self .config_internal = self .config_internal .with_fair_spill_pool (size )
336338 return self
337339
338- def with_greedy_memory_pool (self , size : int ) -> RuntimeConfig :
340+ def with_greedy_memory_pool (self , size : int ) -> RuntimeEnvBuilder :
339341 """Use a greedy memory pool with the specified size.
340342
341343 This pool works well for queries that do not need to spill or have a single
@@ -346,32 +348,39 @@ def with_greedy_memory_pool(self, size: int) -> RuntimeConfig:
346348 size: Size of the memory pool in bytes.
347349
348350 Returns:
349- A new :py:class:`RuntimeConfig ` object with the updated setting.
351+ A new :py:class:`RuntimeEnvBuilder ` object with the updated setting.
350352
351353 Example usage::
352354
353- config = RuntimeConfig ().with_greedy_memory_pool(1024)
355+ config = RuntimeEnvBuilder ().with_greedy_memory_pool(1024)
354356 """
355357 self .config_internal = self .config_internal .with_greedy_memory_pool (size )
356358 return self
357359
358- def with_temp_file_path (self , path : str | pathlib .Path ) -> RuntimeConfig :
360+ def with_temp_file_path (self , path : str | pathlib .Path ) -> RuntimeEnvBuilder :
359361 """Use the specified path to create any needed temporary files.
360362
361363 Args:
362364 path: Path to use for temporary files.
363365
364366 Returns:
365- A new :py:class:`RuntimeConfig ` object with the updated setting.
367+ A new :py:class:`RuntimeEnvBuilder ` object with the updated setting.
366368
367369 Example usage::
368370
369- config = RuntimeConfig ().with_temp_file_path("/tmp")
371+ config = RuntimeEnvBuilder ().with_temp_file_path("/tmp")
370372 """
371373 self .config_internal = self .config_internal .with_temp_file_path (str (path ))
372374 return self
373375
374376
377+ @deprecated ("Use `RuntimeEnvBuilder` instead." )
378+ class RuntimeConfig (RuntimeEnvBuilder ):
379+ """See `RuntimeEnvBuilder`."""
380+
381+ pass
382+
383+
375384class SQLOptions :
376385 """Options to be used when performing SQL queries."""
377386
@@ -445,7 +454,9 @@ class SessionContext:
445454 """
446455
447456 def __init__ (
448- self , config : SessionConfig | None = None , runtime : RuntimeConfig | None = None
457+ self ,
458+ config : SessionConfig | None = None ,
459+ runtime : RuntimeEnvBuilder | None = None ,
449460 ) -> None :
450461 """Main interface for executing queries with DataFusion.
451462
0 commit comments