Read contents of file for the given columns and batch size. Notes ----- This function's primary purpose is benchmarking. The scan is executed on a single thread. Parameters ---------- columns : list of integers, default None
(self, columns=None, batch_size=65536)
| 643 | use_threads=use_threads) |
| 644 | |
| 645 | def scan_contents(self, columns=None, batch_size=65536): |
| 646 | """ |
| 647 | Read contents of file for the given columns and batch size. |
| 648 | |
| 649 | Notes |
| 650 | ----- |
| 651 | This function's primary purpose is benchmarking. |
| 652 | The scan is executed on a single thread. |
| 653 | |
| 654 | Parameters |
| 655 | ---------- |
| 656 | columns : list of integers, default None |
| 657 | Select columns to read, if None scan all columns. |
| 658 | batch_size : int, default 64K |
| 659 | Number of rows to read at a time internally. |
| 660 | |
| 661 | Returns |
| 662 | ------- |
| 663 | num_rows : int |
| 664 | Number of rows in file |
| 665 | |
| 666 | Examples |
| 667 | -------- |
| 668 | >>> import pyarrow as pa |
| 669 | >>> table = pa.table({'n_legs': [2, 2, 4, 4, 5, 100], |
| 670 | ... 'animal': ["Flamingo", "Parrot", "Dog", "Horse", |
| 671 | ... "Brittle stars", "Centipede"]}) |
| 672 | >>> import pyarrow.parquet as pq |
| 673 | >>> pq.write_table(table, 'example.parquet') |
| 674 | >>> parquet_file = pq.ParquetFile('example.parquet') |
| 675 | |
| 676 | >>> parquet_file.scan_contents() |
| 677 | 6 |
| 678 | """ |
| 679 | column_indices = self._get_column_indices(columns) |
| 680 | return self.reader.scan_contents(column_indices, |
| 681 | batch_size=batch_size) |
| 682 | |
| 683 | def _get_column_indices(self, column_names, use_pandas_metadata=False): |
| 684 | if column_names is None: |