(mockfs, pickled, pickle_module)
| 1967 | @pytest.mark.parametrize( |
| 1968 | "pickled", [lambda x, m: x, lambda x, m: m.loads(m.dumps(x))]) |
| 1969 | def test_partitioning_factory(mockfs, pickled, pickle_module): |
| 1970 | paths_or_selector = fs.FileSelector('subdir', recursive=True) |
| 1971 | format = ds.ParquetFileFormat() |
| 1972 | |
| 1973 | options = ds.FileSystemFactoryOptions('subdir') |
| 1974 | partitioning_factory = ds.DirectoryPartitioning.discover(['group', 'key']) |
| 1975 | partitioning_factory = pickled(partitioning_factory, pickle_module) |
| 1976 | assert isinstance(partitioning_factory, ds.PartitioningFactory) |
| 1977 | options.partitioning_factory = partitioning_factory |
| 1978 | |
| 1979 | factory = ds.FileSystemDatasetFactory( |
| 1980 | mockfs, paths_or_selector, format, options |
| 1981 | ) |
| 1982 | inspected_schema = factory.inspect() |
| 1983 | # i64/f64 from data, group/key from "/1/xxx" and "/2/yyy" paths |
| 1984 | expected_schema = pa.schema([ |
| 1985 | ("i64", pa.int64()), |
| 1986 | ("f64", pa.float64()), |
| 1987 | ("str", pa.string()), |
| 1988 | ("const", pa.int64()), |
| 1989 | ("struct", pa.struct({'a': pa.int64(), 'b': pa.string()})), |
| 1990 | ("group", pa.int32()), |
| 1991 | ("key", pa.string()), |
| 1992 | ]) |
| 1993 | assert inspected_schema.equals(expected_schema) |
| 1994 | |
| 1995 | hive_partitioning_factory = ds.HivePartitioning.discover() |
| 1996 | assert isinstance(hive_partitioning_factory, ds.PartitioningFactory) |
| 1997 | |
| 1998 | |
| 1999 | @pytest.mark.parquet |
nothing calls this directly
no test coverage detected