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

Function dataset_reader

python/pyarrow/tests/test_dataset.py:290–333  ·  view source on GitHub ↗

Fixture which allows dataset scanning operations to be run with/without threads

(request)

Source from the content-addressed store, hash-verified

288 (False)
289], ids=['threaded', 'serial'])
290def dataset_reader(request):
291 '''
292 Fixture which allows dataset scanning operations to be
293 run with/without threads
294 '''
295 use_threads = request.param
296
297 class reader:
298
299 def __init__(self):
300 self.use_threads = use_threads
301
302 def _patch_kwargs(self, kwargs):
303 if 'use_threads' in kwargs:
304 raise Exception(
305 ('Invalid use of dataset_reader, do not specify'
306 ' use_threads'))
307 kwargs['use_threads'] = use_threads
308
309 def to_table(self, dataset, **kwargs):
310 self._patch_kwargs(kwargs)
311 return dataset.to_table(**kwargs)
312
313 def to_batches(self, dataset, **kwargs):
314 self._patch_kwargs(kwargs)
315 return dataset.to_batches(**kwargs)
316
317 def scanner(self, dataset, **kwargs):
318 self._patch_kwargs(kwargs)
319 return dataset.scanner(**kwargs)
320
321 def head(self, dataset, num_rows, **kwargs):
322 self._patch_kwargs(kwargs)
323 return dataset.head(num_rows, **kwargs)
324
325 def take(self, dataset, indices, **kwargs):
326 self._patch_kwargs(kwargs)
327 return dataset.take(indices, **kwargs)
328
329 def count_rows(self, dataset, **kwargs):
330 self._patch_kwargs(kwargs)
331 return dataset.count_rows(**kwargs)
332
333 return reader()
334
335
336@pytest.mark.parquet

Callers

nothing calls this directly

Calls 1

readerClass · 0.85

Tested by

no test coverage detected