(self, parent, dependents)
| 3650 | _expr_cls = Assign |
| 3651 | |
| 3652 | def _simplify_up(self, parent, dependents): |
| 3653 | # TODO: de-duplicate |
| 3654 | if isinstance(parent, Projection): |
| 3655 | columns = determine_column_projection(self, parent, dependents) |
| 3656 | if not isinstance(columns, list): |
| 3657 | columns = [columns] |
| 3658 | |
| 3659 | cols = set(columns) - {self.column} |
| 3660 | if cols == set(self.frame.columns): |
| 3661 | # Protect against pushing the same projection twice |
| 3662 | return |
| 3663 | |
| 3664 | diff = {self.column} - set(columns) |
| 3665 | if len(diff) == 1: |
| 3666 | return type(parent)(self.frame, *parent.operands[1:]) |
| 3667 | else: |
| 3668 | new_args = self.operands[1:] |
| 3669 | |
| 3670 | columns = [col for col in self.frame.columns if col in cols] |
| 3671 | return type(parent)( |
| 3672 | type(self)(self.frame[sorted(columns)], *new_args), |
| 3673 | *parent.operands[1:], |
| 3674 | ) |
| 3675 | |
| 3676 | |
| 3677 | class MaskAlign(MaybeAlignPartitions): |
nothing calls this directly
no test coverage detected