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

Function test_read_table_schema

python/pyarrow/tests/parquet/test_dataset.py:1183–1203  ·  view source on GitHub ↗
(tempdir)

Source from the content-addressed store, hash-verified

1181
1182
1183def test_read_table_schema(tempdir):
1184 # test that schema keyword is passed through in read_table
1185 table = pa.table({'a': pa.array([1, 2, 3], pa.int32())})
1186 pq.write_table(table, tempdir / "data1.parquet")
1187 pq.write_table(table, tempdir / "data2.parquet")
1188
1189 schema = pa.schema([('a', 'int64')])
1190
1191 # reading single file (which is special cased in the code)
1192 result = pq.read_table(tempdir / "data1.parquet", schema=schema)
1193 expected = pa.table({'a': [1, 2, 3]}, schema=schema)
1194 assert result.equals(expected)
1195
1196 # reading multiple fields
1197 result = pq.read_table(tempdir, schema=schema)
1198 expected = pa.table({'a': [1, 2, 3, 1, 2, 3]}, schema=schema)
1199 assert result.equals(expected)
1200
1201 result = pq.ParquetDataset(tempdir, schema=schema)
1202 expected = pa.table({'a': [1, 2, 3, 1, 2, 3]}, schema=schema)
1203 assert result.read().equals(expected)
1204
1205
1206def test_read_table_duplicate_column_selection(tempdir):

Callers

nothing calls this directly

Calls 6

equalsMethod · 0.95
readMethod · 0.95
arrayMethod · 0.45
write_tableMethod · 0.45
schemaMethod · 0.45
read_tableMethod · 0.45

Tested by

no test coverage detected