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

Method _lower

dask/dataframe/dask_expr/_shuffle.py:1162–1201  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1160 ]
1161
1162 def _lower(self):
1163 divisions = self.other._meta._constructor(self._divisions())
1164 partitions = _SetPartitionsPreSetIndex(self.other, divisions)
1165 assigned = Assign(self.frame, "_partitions", partitions)
1166 if isinstance(self._other, Expr):
1167 assigned = Assign(assigned, "_index", self._other)
1168 shuffled = Shuffle(
1169 assigned,
1170 "_partitions",
1171 npartitions_out=len(self._divisions()) - 1,
1172 ignore_index=True,
1173 method=self.shuffle_method,
1174 options=self.options,
1175 )
1176 shuffled = Projection(
1177 shuffled, [c for c in assigned.columns if c != "_partitions"]
1178 )
1179
1180 if isinstance(self._other, Expr):
1181 drop, set_name = True, "_index"
1182 else:
1183 drop, set_name = self.drop, self.other._meta.name
1184 lru_key = (
1185 self.other._name,
1186 self._npartitions_input,
1187 self.ascending,
1188 128e6,
1189 self.upsample,
1190 )
1191 computed_divisions = divisions_lru.get(lru_key)
1192 index_set = _SetIndexPost(
1193 shuffled,
1194 self.other._meta.name,
1195 drop,
1196 set_name,
1197 self.frame._meta.columns.dtype,
1198 computed_divisions,
1199 self.user_divisions,
1200 )
1201 return SortIndexBlockwise(index_set)
1202
1203
1204class _SetPartitionsPreSetIndex(Blockwise):

Callers

nothing calls this directly

Calls 9

AssignClass · 0.90
ProjectionClass · 0.90
_SetIndexPostClass · 0.85
SortIndexBlockwiseClass · 0.85
_constructorMethod · 0.80
ShuffleClass · 0.70
_divisionsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected