Create a FileSystemDataset from a `_metadata` file created via `pyarrow.parquet.write_metadata`. Parameters ---------- metadata_path : path, Path pointing to a single file parquet metadata file schema : Schema, optional Optionally provide the Schema for the
(metadata_path, schema=None, filesystem=None, format=None,
partitioning=None, partition_base_dir=None)
| 515 | |
| 516 | |
| 517 | def parquet_dataset(metadata_path, schema=None, filesystem=None, format=None, |
| 518 | partitioning=None, partition_base_dir=None): |
| 519 | """ |
| 520 | Create a FileSystemDataset from a `_metadata` file created via |
| 521 | `pyarrow.parquet.write_metadata`. |
| 522 | |
| 523 | Parameters |
| 524 | ---------- |
| 525 | metadata_path : path, |
| 526 | Path pointing to a single file parquet metadata file |
| 527 | schema : Schema, optional |
| 528 | Optionally provide the Schema for the Dataset, in which case it will |
| 529 | not be inferred from the source. |
| 530 | filesystem : FileSystem or URI string, default None |
| 531 | If a single path is given as source and filesystem is None, then the |
| 532 | filesystem will be inferred from the path. |
| 533 | If an URI string is passed, then a filesystem object is constructed |
| 534 | using the URI's optional path component as a directory prefix. See the |
| 535 | examples below. |
| 536 | Note that the URIs on Windows must follow 'file:///C:...' or |
| 537 | 'file:/C:...' patterns. |
| 538 | format : ParquetFileFormat |
| 539 | An instance of a ParquetFileFormat if special options needs to be |
| 540 | passed. |
| 541 | partitioning : Partitioning, PartitioningFactory, str, list of str |
| 542 | The partitioning scheme specified with the ``partitioning()`` |
| 543 | function. A flavor string can be used as shortcut, and with a list of |
| 544 | field names a DirectoryPartitioning will be inferred. |
| 545 | partition_base_dir : str, optional |
| 546 | For the purposes of applying the partitioning, paths will be |
| 547 | stripped of the partition_base_dir. Files not matching the |
| 548 | partition_base_dir prefix will be skipped for partitioning discovery. |
| 549 | The ignored files will still be part of the Dataset, but will not |
| 550 | have partition information. |
| 551 | |
| 552 | Returns |
| 553 | ------- |
| 554 | FileSystemDataset |
| 555 | The dataset corresponding to the given metadata |
| 556 | """ |
| 557 | from pyarrow.fs import LocalFileSystem, _ensure_filesystem |
| 558 | |
| 559 | if format is None: |
| 560 | format = ParquetFileFormat() |
| 561 | elif not isinstance(format, ParquetFileFormat): |
| 562 | raise ValueError("format argument must be a ParquetFileFormat") |
| 563 | |
| 564 | if filesystem is None: |
| 565 | filesystem = LocalFileSystem() |
| 566 | else: |
| 567 | filesystem = _ensure_filesystem(filesystem) |
| 568 | |
| 569 | metadata_path = filesystem.normalize_path(_stringify_path(metadata_path)) |
| 570 | options = ParquetFactoryOptions( |
| 571 | partition_base_dir=partition_base_dir, |
| 572 | partitioning=_ensure_partitioning(partitioning) |
| 573 | ) |
| 574 |
nothing calls this directly
no test coverage detected