-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add ParquetScanTask for all parquet scan tasks
#23953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/26.10
Are you sure you want to change the base?
Changes from all commits
1615e0d
d3699ef
e3c2d08
0ebcc5c
b16adaf
18eb8af
ebd78c9
4ce5e77
78a213f
84b312b
ae2c728
92dfbb0
dcd5a08
57e2d42
780d8f5
b327ec7
6426ead
c380db9
018aa0b
b3c11e2
b716987
6e1d5fc
5e1278b
5358c6f
30eda0d
e165d5e
7f6d5e3
00cc0b9
518ed51
6e1d01c
3aec20e
95d27b3
9cf1ea1
c7161b8
89d302b
5c4c971
20f28a1
76b652b
848337f
867e0ad
aa6fdbe
d6d264a
f139694
f09f6ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,11 @@ | |
|
|
||
| from cudf_polars.dsl.tracing import nvtx_annotate_cudf_polars | ||
| from cudf_polars.dsl.traversal import traversal | ||
| from cudf_polars.streaming.io import Scan, StreamingScan | ||
| from cudf_polars.streaming.io import ( | ||
| ParquetSourceInfo, | ||
| Scan, | ||
| StreamingScan, | ||
| ) | ||
|
|
||
| if TYPE_CHECKING: | ||
| from cudf_polars.dsl.ir import IR | ||
|
|
@@ -181,14 +185,12 @@ def prefetch_parquet_file_metadata_for_ir( | |
| ------- | ||
| A dictionary mapping each individual path to its cached parquet metadata. | ||
| """ | ||
| from cudf_polars.streaming.io import ParquetSourceInfo, StreamingScan | ||
|
|
||
| all_paths: set[str] = set() | ||
|
|
||
| for node in traversal([root]): | ||
| if isinstance(node, StreamingScan) and node.base_scan.typ == "parquet": | ||
| for scan in node.scans: | ||
| for path in scan.paths: | ||
| for task in node.tasks: | ||
| for path in task.paths: | ||
| all_paths.add(path) | ||
| elif isinstance(node, Scan) and node.typ == "parquet": # pragma: no cover | ||
| raise RuntimeError("Unexpected parquet 'Scan' node in lowered IR graph.") | ||
|
|
@@ -241,7 +243,7 @@ def attach_cached_parquet_metadata( | |
| cached_parquet_info_map: dict[str, CachedParquetInfo], | ||
| ) -> None: | ||
| """ | ||
| Attach prefetched metadata to scan nodes. | ||
| Attach prefetched metadata to parquet scan tasks. | ||
|
|
||
| This is an optimization only and does not affect IR identity. | ||
|
|
||
|
|
@@ -254,10 +256,15 @@ def attach_cached_parquet_metadata( | |
| """ | ||
| for node in traversal([root]): | ||
| if isinstance(node, StreamingScan) and node.base_scan.typ == "parquet": | ||
| for scan in node.scans: | ||
| if not all(path in cached_parquet_info_map for path in scan.paths): | ||
| continue | ||
| cached = [cached_parquet_info_map[path] for path in scan.paths] | ||
| Scan._validate_cached_parquet_info(scan.paths, cached) | ||
| scan.cached_parquet_info = cached | ||
| scan._non_child_args = (*scan._non_child_args[:-1], cached) | ||
| base_scan = node.base_scan | ||
| task_paths = {path for task in node.tasks for path in task.paths} | ||
| cached_paths = [ | ||
| path | ||
| for path in base_scan.paths | ||
| if path in task_paths and path in cached_parquet_info_map | ||
| ] | ||
| cached = [cached_parquet_info_map[path] for path in cached_paths] | ||
| if not cached: | ||
| continue | ||
| Scan._validate_cached_parquet_info(cached_paths, cached) | ||
| base_scan.cached_parquet_info = cached | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We keep the cache on the |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lots of this diff is just renaming "scan(s)" to "task(s)" to clearly distinguish between the full-table Scan node and the individual Scan "tasks" used to generate each chunk.