Skip to content
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

Add branch_id to distinguish between reusable branches and pipeline breakers #883

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update
  • Loading branch information
phofl committed Feb 20, 2024
commit f79155ac84d0c2b90cd08e1a4f288d02015dde92
7 changes: 5 additions & 2 deletions dask_expr/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ def _tree_repr_lines(self, indent=0, recursive=True):
continue
op = f" branch_id={op.branch_id}"
header = self._tree_repr_argument_construction(i, op, header)

if self._branch_id.branch_id != 0:
header = self._tree_repr_argument_construction(
i + 1, f" branch_id={self._branch_id.branch_id}", header
)
lines = [header] + lines
lines = [" " * indent + line for line in lines]

Expand Down Expand Up @@ -604,7 +607,7 @@ def substitute_parameters(self, substitutions: dict) -> Expr:
else:
new_operands.append(operand)
if changed:
return type(self)(*new_operands)
return type(self)(*new_operands, _branch_id=self._branch_id)
return self

def _node_label_args(self):
Expand Down
5 changes: 3 additions & 2 deletions dask_expr/io/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _name(self):
return (
funcname(type(self.operand("_expr"))).lower()
+ "-fused-"
+ _tokenize_deterministic(*self.operands, self._branch_id)
+ _tokenize_deterministic(*self.operands, self._expr._branch_id)
)

@functools.cached_property
Expand Down Expand Up @@ -416,7 +416,8 @@ def _simplify_up(self, parent, dependents):
return Literal(sum(_lengths))

if isinstance(parent, Projection):
return super()._simplify_up(parent, dependents)
x = super()._simplify_up(parent, dependents)
return x

def _divisions(self):
return self._divisions_and_locations[0]
Expand Down
Loading