(tempdir)
| 3073 | |
| 3074 | @pytest.mark.parquet |
| 3075 | def 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 |
nothing calls this directly
no test coverage detected