- lance.LanceFragment.count_rows(self, Expression filter=None, int batch_size=_DEFAULT_BATCH_SIZE, int batch_readahead=_DEFAULT_BATCH_READAHEAD, int fragment_readahead=_DEFAULT_FRAGMENT_READAHEAD, FragmentScanOptions fragment_scan_options=None, bool use_threads=True, MemoryPool memory_pool=None)
Count rows matching the scanner filter.
- Parameters:
- filter : Expression, default None
Scan will return only the rows matching the filter. If possible the predicate will be pushed down to exploit the partition information or internal metadata found in the data source, e.g. Parquet statistics. Otherwise filters the loaded RecordBatches before yielding them.
- batch_size : int, default 131_072
The maximum row count for scanned record batches. If scanned record batches are overflowing memory then this method can be called to reduce their size.
- batch_readahead : int, default 16
The number of batches to read ahead in a file. This might not work for all file formats. Increasing this number will increase RAM usage but could also improve IO utilization.
- fragment_readahead : int, default 4
The number of files to read ahead. Increasing this number will increase RAM usage but could also improve IO utilization.
- fragment_scan_options : FragmentScanOptions, default None
Options specific to a particular scan and fragment type, which can change between different scans of the same dataset.
- use_threads : bool, default True
If enabled, then maximum parallelism will be used determined by the number of available CPU cores.
- memory_pool : MemoryPool, default None
For memory allocations, if required. If not specified, uses the default pool.
- Returns:
count
- Return type:
int