Partition-wise aggregation component of `ApplyConcatApply` This class is used within `ApplyConcatApply._lower`. See Also -------- ApplyConcatApply
| 88 | |
| 89 | |
| 90 | class Aggregate(Chunk): |
| 91 | """Partition-wise aggregation component of `ApplyConcatApply` |
| 92 | |
| 93 | This class is used within `ApplyConcatApply._lower`. |
| 94 | See Also |
| 95 | -------- |
| 96 | ApplyConcatApply |
| 97 | """ |
| 98 | |
| 99 | _parameters = ["frame", "kind", "aggregate", "aggregate_kwargs"] |
| 100 | |
| 101 | @functools.cached_property |
| 102 | def aggregate_args(self): |
| 103 | return self.operands[len(self._parameters) :] |
| 104 | |
| 105 | @staticmethod |
| 106 | def _call_with_list_arg(func, *args, **kwargs): |
| 107 | return func(list(args), **kwargs) |
| 108 | |
| 109 | @property |
| 110 | def operation(self): |
| 111 | return functools.partial(self._call_with_list_arg, self.aggregate) |
| 112 | |
| 113 | @functools.cached_property |
| 114 | def _args(self) -> list: |
| 115 | args = [self.frame] |
| 116 | if self.aggregate_args is not None: |
| 117 | args.extend(self.aggregate_args) |
| 118 | return args |
| 119 | |
| 120 | @functools.cached_property |
| 121 | def _kwargs(self) -> dict: |
| 122 | return self.aggregate_kwargs or {} |
| 123 | |
| 124 | |
| 125 | class ShuffleReduce(Expr): |