(self, path_or_paths, filesystem=None, schema=None, *, filters=None,
read_dictionary=None, binary_type=None, list_type=None,
memory_map=False, buffer_size=None, partitioning="hive",
ignore_prefixes=None,
pre_buffer=True, coerce_int96_timestamp_unit=None,
decryption_properties=None, thrift_string_size_limit=None,
thrift_container_size_limit=None,
page_checksum_verification=False,
arrow_extensions_enabled=True)
| 1382 | """ |
| 1383 | |
| 1384 | def __init__(self, path_or_paths, filesystem=None, schema=None, *, filters=None, |
| 1385 | read_dictionary=None, binary_type=None, list_type=None, |
| 1386 | memory_map=False, buffer_size=None, partitioning="hive", |
| 1387 | ignore_prefixes=None, |
| 1388 | pre_buffer=True, coerce_int96_timestamp_unit=None, |
| 1389 | decryption_properties=None, thrift_string_size_limit=None, |
| 1390 | thrift_container_size_limit=None, |
| 1391 | page_checksum_verification=False, |
| 1392 | arrow_extensions_enabled=True): |
| 1393 | import pyarrow.dataset as ds |
| 1394 | |
| 1395 | # map format arguments |
| 1396 | read_options = { |
| 1397 | "pre_buffer": pre_buffer, |
| 1398 | "coerce_int96_timestamp_unit": coerce_int96_timestamp_unit, |
| 1399 | "thrift_string_size_limit": thrift_string_size_limit, |
| 1400 | "thrift_container_size_limit": thrift_container_size_limit, |
| 1401 | "page_checksum_verification": page_checksum_verification, |
| 1402 | "arrow_extensions_enabled": arrow_extensions_enabled, |
| 1403 | "binary_type": binary_type, |
| 1404 | "list_type": list_type, |
| 1405 | } |
| 1406 | if buffer_size: |
| 1407 | read_options.update(use_buffered_stream=True, |
| 1408 | buffer_size=buffer_size) |
| 1409 | if read_dictionary is not None: |
| 1410 | read_options.update(dictionary_columns=read_dictionary) |
| 1411 | |
| 1412 | if decryption_properties is not None: |
| 1413 | read_options.update(decryption_properties=decryption_properties) |
| 1414 | |
| 1415 | self._filter_expression = None |
| 1416 | if filters is not None: |
| 1417 | self._filter_expression = filters_to_expression(filters) |
| 1418 | |
| 1419 | # map old filesystems to new one |
| 1420 | if filesystem is not None: |
| 1421 | filesystem = _ensure_filesystem( |
| 1422 | filesystem, use_mmap=memory_map) |
| 1423 | elif filesystem is None and memory_map: |
| 1424 | # if memory_map is specified, assume local file system (string |
| 1425 | # path can in principle be URI for any filesystem) |
| 1426 | filesystem = LocalFileSystem(use_mmap=memory_map) |
| 1427 | |
| 1428 | # This needs to be checked after _ensure_filesystem, because that |
| 1429 | # handles the case of an fsspec LocalFileSystem |
| 1430 | if ( |
| 1431 | hasattr(path_or_paths, "__fspath__") and |
| 1432 | filesystem is not None and |
| 1433 | not isinstance(filesystem, LocalFileSystem) |
| 1434 | ): |
| 1435 | raise TypeError( |
| 1436 | "Path-like objects with __fspath__ must only be used with " |
| 1437 | f"local file systems, not {type(filesystem)}" |
| 1438 | ) |
| 1439 | |
| 1440 | # check for single fragment dataset or dataset directory |
| 1441 | single_file = None |
nothing calls this directly
no test coverage detected