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

Method _simplify_down

dask/dataframe/dask_expr/_expr.py:3039–3062  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3037 return Alias(name, (self.frame._name, self.partitions[index])) # type: ignore[return-value]
3038
3039 def _simplify_down(self):
3040 from dask.dataframe.dask_expr import SetIndexBlockwise
3041 from dask.dataframe.tseries.resample import ResampleAggregation
3042
3043 if isinstance(self.frame, Blockwise) and not isinstance(
3044 self.frame, (BlockwiseIO, Fused, SetIndexBlockwise, ResampleAggregation)
3045 ):
3046 operands = [
3047 (
3048 Partitions(op, self.partitions)
3049 if (isinstance(op, Expr) and not self.frame._broadcast_dep(op))
3050 else op
3051 )
3052 for op in self.frame.operands
3053 ]
3054 return type(self.frame)(*operands)
3055 elif isinstance(self.frame, PartitionsFiltered):
3056 if self.frame._partitions:
3057 partitions = [self.frame._partitions[p] for p in self.partitions]
3058 else:
3059 partitions = self.partitions
3060 # We assume that expressions defining a special "_partitions"
3061 # parameter can internally capture the same logic as `Partitions`
3062 return self.frame.substitute_parameters({"_partitions": partitions})
3063
3064 def _node_label_args(self):
3065 return [self.frame, self.partitions]

Callers

nothing calls this directly

Calls 3

PartitionsClass · 0.85
substitute_parametersMethod · 0.80
_broadcast_depMethod · 0.45

Tested by

no test coverage detected