MCPcopy Create free account
hub / github.com/dask/dask / _simplify_up

Method _simplify_up

dask/dataframe/dask_expr/_expr.py:2754–2781  ·  view source on GitHub ↗
(self, parent, dependents)

Source from the content-addressed store, hash-verified

2752 return f"{self.left} {self._operator_repr} {self.right}"
2753
2754 def _simplify_up(self, parent, dependents):
2755 if isinstance(parent, Projection):
2756 changed = False
2757 columns = determine_column_projection(self, parent, dependents)
2758 columns = _convert_to_list(columns)
2759 columns = [col for col in self.columns if col in columns]
2760 if (
2761 isinstance(self.left, Expr)
2762 and self.left.ndim > 1
2763 and self.left.columns != columns
2764 ):
2765 left = self.left[columns] # TODO: filter just the correct columns
2766 changed = True
2767 else:
2768 left = self.left
2769 if (
2770 isinstance(self.right, Expr)
2771 and self.right.ndim > 1
2772 and self.right.columns != columns
2773 ):
2774 right = self.right[columns] # TODO: filter just the correct columns
2775 changed = True
2776 else:
2777 right = self.right
2778 if not changed:
2779 return
2780
2781 return type(parent)(type(self)(left, right), *parent.operands[1:])
2782
2783 def _node_label_args(self):
2784 return [self.left, self.right]

Callers

nothing calls this directly

Calls 2

_convert_to_listFunction · 0.90

Tested by

no test coverage detected