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

Method _simplify_down

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

Source from the content-addressed store, hash-verified

3018 return Alias(name, (self.frame._name, self.partitions[index])) # type: ignore[return-value]
3019
3020 def _simplify_down(self):
3021 from dask.dataframe.dask_expr import SetIndexBlockwise
3022 from dask.dataframe.tseries.resample import ResampleAggregation
3023
3024 if isinstance(self.frame, Blockwise) and not isinstance(
3025 self.frame, (BlockwiseIO, Fused, SetIndexBlockwise, ResampleAggregation)
3026 ):
3027 operands = [
3028 (
3029 Partitions(op, self.partitions)
3030 if (isinstance(op, Expr) and not self.frame._broadcast_dep(op))
3031 else op
3032 )
3033 for op in self.frame.operands
3034 ]
3035 return type(self.frame)(*operands)
3036 elif isinstance(self.frame, PartitionsFiltered):
3037 if self.frame._partitions:
3038 partitions = [self.frame._partitions[p] for p in self.partitions]
3039 else:
3040 partitions = self.partitions
3041 # We assume that expressions defining a special "_partitions"
3042 # parameter can internally capture the same logic as `Partitions`
3043 return self.frame.substitute_parameters({"_partitions": partitions})
3044
3045 def _node_label_args(self):
3046 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