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

Method _simplify_down

dask/_expr.py:1247–1287  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1245 return iter(self.operands)
1246
1247 def _simplify_down(self):
1248 from dask.highlevelgraph import HighLevelGraph
1249
1250 issue_warning = False
1251 hlgs = []
1252 if any(
1253 isinstance(op, (HLGExpr, HLGFinalizeCompute, dict)) for op in self.operands
1254 ):
1255 for op in self.operands:
1256 if isinstance(op, (HLGExpr, HLGFinalizeCompute)):
1257 hlgs.append(op)
1258 elif isinstance(op, dict):
1259 hlgs.append(
1260 HLGExpr(
1261 dsk=HighLevelGraph.from_collections(
1262 str(id(op)), op, dependencies=()
1263 )
1264 )
1265 )
1266 else:
1267 issue_warning = True
1268 opt = op.optimize()
1269 hlgs.append(
1270 HLGExpr(
1271 dsk=HighLevelGraph.from_collections(
1272 opt._name, opt.__dask_graph__(), dependencies=()
1273 )
1274 )
1275 )
1276 if issue_warning:
1277 warnings.warn(
1278 "Computing mixed collections that are backed by "
1279 "HighlevelGraphs/dicts and Expressions. "
1280 "This forces Expressions to be materialized. "
1281 "It is recommended to use only one type and separate the dask."
1282 "compute calls if necessary.",
1283 UserWarning,
1284 )
1285 if not hlgs:
1286 return None
1287 return _HLGExprSequence(*hlgs)
1288
1289
1290class CompositeExpr(Expr):

Callers

nothing calls this directly

Calls 6

anyFunction · 0.85
HLGExprClass · 0.85
_HLGExprSequenceClass · 0.85
from_collectionsMethod · 0.80
optimizeMethod · 0.45
__dask_graph__Method · 0.45

Tested by

no test coverage detected