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
@@ -265,56 +265,58 @@ def set(self, key: str, value: str) -> SessionConfig:
265265 return self
266266
267267
268- class RuntimeConfig :
268+ class RuntimeEnvBuilder :
269269 """Runtime configuration options."""
270270
271271 def __init__ (self ) -> None :
272- """Create a new :py:class:`RuntimeConfig ` with default values."""
273- self .config_internal = RuntimeConfigInternal ()
272+ """Create a new :py:class:`RuntimeEnvBuilder ` with default values."""
273+ self .config_internal = RuntimeEnvBuilderInternal ()
274274
275- def with_disk_manager_disabled (self ) -> RuntimeConfig :
275+ def with_disk_manager_disabled (self ) -> RuntimeEnvBuilder :
276276 """Disable the disk manager, attempts to create temporary files will error.
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_disabled ()
282282 return self
283283
284- def with_disk_manager_os (self ) -> RuntimeConfig :
284+ def with_disk_manager_os (self ) -> RuntimeEnvBuilder :
285285 """Use the operating system's temporary directory for disk manager.
286286
287287 Returns:
288- A new :py:class:`RuntimeConfig ` object with the updated setting.
288+ A new :py:class:`RuntimeEnvBuilder ` object with the updated setting.
289289 """
290290 self .config_internal = self .config_internal .with_disk_manager_os ()
291291 return self
292292
293- def with_disk_manager_specified (self , * paths : str | pathlib .Path ) -> RuntimeConfig :
293+ def with_disk_manager_specified (
294+ self , * paths : str | pathlib .Path
295+ ) -> RuntimeEnvBuilder :
294296 """Use the specified paths for the disk manager's temporary files.
295297
296298 Args:
297299 paths: Paths to use for the disk manager's temporary files.
298300
299301 Returns:
300- A new :py:class:`RuntimeConfig ` object with the updated setting.
302+ A new :py:class:`RuntimeEnvBuilder ` object with the updated setting.
301303 """
302304 paths_list = [str (p ) for p in paths ]
303305 self .config_internal = self .config_internal .with_disk_manager_specified (
304306 paths_list
305307 )
306308 return self
307309
308- def with_unbounded_memory_pool (self ) -> RuntimeConfig :
310+ def with_unbounded_memory_pool (self ) -> RuntimeEnvBuilder :
309311 """Use an unbounded memory pool.
310312
311313 Returns:
312- A new :py:class:`RuntimeConfig ` object with the updated setting.
314+ A new :py:class:`RuntimeEnvBuilder ` object with the updated setting.
313315 """
314316 self .config_internal = self .config_internal .with_unbounded_memory_pool ()
315317 return self
316318
317- def with_fair_spill_pool (self , size : int ) -> RuntimeConfig :
319+ def with_fair_spill_pool (self , size : int ) -> RuntimeEnvBuilder :
318320 """Use a fair spill pool with the specified size.
319321
320322 This pool works best when you know beforehand the query has multiple spillable
@@ -335,16 +337,16 @@ def with_fair_spill_pool(self, size: int) -> RuntimeConfig:
335337 size: Size of the memory pool in bytes.
336338
337339 Returns:
338- A new :py:class:`RuntimeConfig ` object with the updated setting.
340+ A new :py:class:`RuntimeEnvBuilder ` object with the updated setting.
339341
340342 Examples usage::
341343
342- config = RuntimeConfig ().with_fair_spill_pool(1024)
344+ config = RuntimeEnvBuilder ().with_fair_spill_pool(1024)
343345 """
344346 self .config_internal = self .config_internal .with_fair_spill_pool (size )
345347 return self
346348
347- def with_greedy_memory_pool (self , size : int ) -> RuntimeConfig :
349+ def with_greedy_memory_pool (self , size : int ) -> RuntimeEnvBuilder :
348350 """Use a greedy memory pool with the specified size.
349351
350352 This pool works well for queries that do not need to spill or have a single
@@ -355,32 +357,39 @@ def with_greedy_memory_pool(self, size: int) -> RuntimeConfig:
355357 size: Size of the memory pool in bytes.
356358
357359 Returns:
358- A new :py:class:`RuntimeConfig ` object with the updated setting.
360+ A new :py:class:`RuntimeEnvBuilder ` object with the updated setting.
359361
360362 Example usage::
361363
362- config = RuntimeConfig ().with_greedy_memory_pool(1024)
364+ config = RuntimeEnvBuilder ().with_greedy_memory_pool(1024)
363365 """
364366 self .config_internal = self .config_internal .with_greedy_memory_pool (size )
365367 return self
366368
367- def with_temp_file_path (self , path : str | pathlib .Path ) -> RuntimeConfig :
369+ def with_temp_file_path (self , path : str | pathlib .Path ) -> RuntimeEnvBuilder :
368370 """Use the specified path to create any needed temporary files.
369371
370372 Args:
371373 path: Path to use for temporary files.
372374
373375 Returns:
374- A new :py:class:`RuntimeConfig ` object with the updated setting.
376+ A new :py:class:`RuntimeEnvBuilder ` object with the updated setting.
375377
376378 Example usage::
377379
378- config = RuntimeConfig ().with_temp_file_path("/tmp")
380+ config = RuntimeEnvBuilder ().with_temp_file_path("/tmp")
379381 """
380382 self .config_internal = self .config_internal .with_temp_file_path (str (path ))
381383 return self
382384
383385
386+ @deprecated ("Use `RuntimeEnvBuilder` instead." )
387+ class RuntimeConfig (RuntimeEnvBuilder ):
388+ """See `RuntimeEnvBuilder`."""
389+
390+ pass
391+
392+
384393class SQLOptions :
385394 """Options to be used when performing SQL queries."""
386395
@@ -454,7 +463,9 @@ class SessionContext:
454463 """
455464
456465 def __init__ (
457- self , config : SessionConfig | None = None , runtime : RuntimeConfig | None = None
466+ self ,
467+ config : SessionConfig | None = None ,
468+ runtime : RuntimeEnvBuilder | None = None ,
458469 ) -> None :
459470 """Main interface for executing queries with DataFusion.
460471
0 commit comments