| 805 | |
| 806 | |
| 807 | def test_recordbatch_select_column(): |
| 808 | data = [ |
| 809 | pa.array(range(5)), |
| 810 | pa.array([-10, -5, 0, 5, 10]), |
| 811 | pa.array(range(5, 10)) |
| 812 | ] |
| 813 | batch = pa.RecordBatch.from_arrays(data, names=('a', 'b', 'c')) |
| 814 | |
| 815 | assert batch.column('a').equals(batch.column(0)) |
| 816 | |
| 817 | with pytest.raises( |
| 818 | KeyError, match='Field "d" does not exist in schema'): |
| 819 | batch.column('d') |
| 820 | |
| 821 | with pytest.raises(TypeError): |
| 822 | batch.column(None) |
| 823 | |
| 824 | with pytest.raises(IndexError): |
| 825 | batch.column(4) |
| 826 | |
| 827 | |
| 828 | def test_recordbatch_select(): |