()
| 676 | |
| 677 | |
| 678 | def test_from_delayed_to_dask_array(): |
| 679 | # Check that `from_delayed`` can be followed |
| 680 | # by `to_dask_array` without breaking |
| 681 | # optimization behavior |
| 682 | # See: https://github.com/dask-contrib/dask-sql/issues/497 |
| 683 | from dask.blockwise import optimize_blockwise |
| 684 | |
| 685 | dfs = [delayed(pd.DataFrame)(np.ones((3, 2))) for i in range(3)] |
| 686 | ddf = dd.from_delayed(dfs) |
| 687 | arr = ddf.to_dask_array() |
| 688 | |
| 689 | # If we optimize this graph without calling |
| 690 | # `fuse_roots`, the underlying `BlockwiseDep` |
| 691 | # `mapping` keys will be 1-D (e.g. `(4,)`), |
| 692 | # while the collection keys will be 2-D |
| 693 | # (e.g. `(4, 0)`) |
| 694 | keys = [k[0] for k in arr.__dask_keys__()] |
| 695 | dsk = optimize_blockwise(arr.dask, keys=keys) |
| 696 | dsk.cull(keys) |
| 697 | |
| 698 | result = arr.compute() |
| 699 | assert result.shape == (9, 2) |
| 700 | |
| 701 | |
| 702 | def test_from_delayed_misordered_meta(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…