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

Function test_file_format_inspect_fsspec

python/pyarrow/tests/test_dataset.py:3075–3097  ·  view source on GitHub ↗
(tempdir)

Source from the content-addressed store, hash-verified

3073
3074@pytest.mark.parquet
3075def test_file_format_inspect_fsspec(tempdir):
3076 # https://issues.apache.org/jira/browse/ARROW-16413
3077 fsspec = pytest.importorskip("fsspec")
3078
3079 # create bucket + file with pyarrow
3080 table = pa.table({'a': [1, 2, 3]})
3081 path = tempdir / "data.parquet"
3082 pq.write_table(table, path)
3083
3084 # read using fsspec filesystem
3085 fsspec_fs = fsspec.filesystem("file")
3086 assert fsspec_fs.ls(tempdir)[0].endswith("data.parquet")
3087
3088 # inspect using dataset file format
3089 format = ds.ParquetFileFormat()
3090 # manually creating a PyFileSystem instead of using fs._ensure_filesystem
3091 # which would convert an fsspec local filesystem to a native one
3092 filesystem = fs.PyFileSystem(fs.FSSpecHandler(fsspec_fs))
3093 schema = format.inspect(path, filesystem)
3094 assert schema.equals(table.schema)
3095
3096 fragment = format.make_fragment(path, filesystem)
3097 assert fragment.physical_schema.equals(table.schema)
3098
3099
3100@pytest.mark.pandas

Callers

nothing calls this directly

Calls 6

filesystemMethod · 0.80
ParquetFileFormatMethod · 0.80
PyFileSystemMethod · 0.80
equalsMethod · 0.80
write_tableMethod · 0.45
inspectMethod · 0.45

Tested by

no test coverage detected