MCPcopy Create free account
hub / github.com/apache/arrow / scan_contents

Method scan_contents

python/pyarrow/parquet/core.py:642–678  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

test_scan_contentsFunction · 0.95

Calls 1

_get_column_indicesMethod · 0.95

Tested by 1

test_scan_contentsFunction · 0.76