Commit 8ca1768
committed
zephyr: address review — ScatterWriter/Reader classes, cloudpickle, exact memory budget
Review feedback from rjpower on #4782:
- cloudpickle on write: `_write_chunk_frame` now uses `cloudpickle.dump`
so lambdas, local classes, and dynamically-defined callables survive
scatter serialization. Read side stays stdlib `pickle.load`.
- ScatterWriter class: extracts `_write_scatter` into a class with
`write(item)` / `close()` / context manager. Nonlocal state becomes
instance attributes. `_write_scatter` remains as a thin wrapper.
- ScatterReader class: collapses `ScatterShard` + `ScatterFileIterator`
+ `_build_scatter_shard_from_manifest`. `ScatterShard = ScatterReader`
alias preserves backward compat for isinstance checks.
`ScatterReader.from_manifest()` classmethod replaces the factory fn.
- url_to_fs resolved once per file: `ScatterFileIterator.__post_init__`
resolves (fs, fs_path) once; `_iter_chunk` receives them directly.
- Memory budget from chunk compressed sizes: fan-in computation uses
`max_compressed_chunk_bytes` (exact from sidecar) instead of
`max_chunk_rows * avg_item_bytes` heuristic. `avg_item_bytes` kept
only for `compute_write_batch_size`.
- Removed stats-unavailable fallback in plan.py: stats are always
written by the scatter writer; the dead-code fallback path is gone.1 parent bf00f9e commit 8ca1768
3 files changed
+216
-140
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
638 | | - | |
| 638 | + | |
639 | 639 | | |
640 | 640 | | |
641 | 641 | | |
| |||
648 | 648 | | |
649 | 649 | | |
650 | 650 | | |
651 | | - | |
652 | | - | |
653 | | - | |
654 | | - | |
| 651 | + | |
| 652 | + | |
655 | 653 | | |
656 | 654 | | |
657 | 655 | | |
| |||
674 | 672 | | |
675 | 673 | | |
676 | 674 | | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
| 675 | + | |
682 | 676 | | |
683 | 677 | | |
684 | 678 | | |
| |||
0 commit comments