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:3076–3098  ·  view source on GitHub ↗
(tempdir)

Source from the content-addressed store, hash-verified

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