(use_threads)
| 2690 | |
| 2691 | @pytest.mark.parametrize('use_threads', [False, True]) |
| 2692 | def test_scan_iterator(use_threads): |
| 2693 | batch = pa.RecordBatch.from_arrays([pa.array(range(10))], names=["a"]) |
| 2694 | table = pa.Table.from_batches([batch]) |
| 2695 | # When constructed from readers/iterators, should be one-shot |
| 2696 | match = "OneShotFragment was already scanned" |
| 2697 | for factory, schema in ( |
| 2698 | (lambda: pa.RecordBatchReader.from_batches( |
| 2699 | batch.schema, [batch]), None), |
| 2700 | (lambda: TableStreamWrapper(table), None), |
| 2701 | (lambda: (batch for _ in range(1)), batch.schema), |
| 2702 | ): |
| 2703 | # Scanning the fragment consumes the underlying iterator |
| 2704 | scanner = ds.Scanner.from_batches( |
| 2705 | factory(), schema=schema, use_threads=use_threads) |
| 2706 | assert scanner.to_table() == table |
| 2707 | with pytest.raises(pa.ArrowInvalid, match=match): |
| 2708 | scanner.to_table() |
| 2709 | |
| 2710 | |
| 2711 | def _create_partitioned_dataset(basedir): |
nothing calls this directly
no test coverage detected