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

Method _simplify_up

dask/dataframe/dask_expr/_shuffle.py:112–159  ·  view source on GitHub ↗
(self, parent, dependents)

Source from the content-addressed store, hash-verified

110 return {tuple(idx)} if isinstance(idx, list) else set()
111
112 def _simplify_up(self, parent, dependents):
113 if isinstance(parent, Filter) and self._filter_passthrough_available(
114 parent, dependents
115 ):
116 return self._filter_simplification(parent)
117 if isinstance(parent, Projection):
118 # Move the column projection to come
119 # before the abstract Shuffle
120 projection = _convert_to_list(
121 determine_column_projection(self, parent, dependents)
122 )
123 partitioning_index = self._partitioning_index
124
125 target = self.frame
126 new_projection = [
127 col
128 for col in target.columns
129 if (col in partitioning_index or col in projection)
130 ]
131 if set(new_projection) < set(target.columns):
132 return type(self)(target[new_projection], *self.operands[1:])[
133 parent.operand("columns")
134 ]
135
136 if isinstance(
137 parent,
138 (
139 Unique,
140 DropDuplicates,
141 Sum,
142 Prod,
143 Max,
144 Any,
145 All,
146 Min,
147 Len,
148 Size,
149 NBytes,
150 Mean,
151 Count,
152 Mode,
153 NLargest,
154 NSmallest,
155 ValueCounts,
156 MemoryUsage,
157 ),
158 ):
159 return type(parent)(self.frame, *parent.operands[1:])
160
161 def _layer(self):
162 raise NotImplementedError(

Callers

nothing calls this directly

Calls 6

_convert_to_listFunction · 0.90
setClass · 0.85
operandMethod · 0.80

Tested by

no test coverage detected