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

Method _simplify_up

dask/dataframe/dask_expr/_expr.py:2052–2077  ·  view source on GitHub ↗
(self, parent, dependents)

Source from the content-addressed store, hash-verified

2050 return bool(set(input_columns) & set(child.keys))
2051
2052 def _simplify_up(self, parent, dependents):
2053 if isinstance(parent, Projection):
2054 columns = determine_column_projection(self, parent, dependents)
2055 columns = _convert_to_list(columns)
2056
2057 cols = set(columns) - set(self.keys)
2058 if cols == set(self.frame.columns):
2059 # Protect against pushing the same projection twice
2060 return
2061
2062 diff = set(self.keys) - set(columns)
2063 if len(diff) == len(self.keys):
2064 return type(parent)(self.frame, *parent.operands[1:])
2065 elif len(diff) > 0:
2066 new_args = []
2067 for k, v in zip(self.keys, self.vals):
2068 if k in columns:
2069 new_args.extend([k, v])
2070 else:
2071 new_args = self.operands[1:]
2072
2073 columns = [col for col in self.frame.columns if col in cols]
2074 return type(parent)(
2075 type(self)(self.frame[sorted(columns)], *new_args),
2076 *parent.operands[1:],
2077 )
2078
2079
2080class Eval(Elemwise):

Callers

nothing calls this directly

Calls 3

_convert_to_listFunction · 0.90
setClass · 0.85

Tested by

no test coverage detected