MCPcopy Create free account
hub / github.com/apache/datafusion / powerset

Function powerset

datafusion/expr/src/utils.rs:103–111  ·  view source on GitHub ↗

The [power set] (or powerset) of a set S is the set of all subsets of S, \ including the empty set and S itself. Example: If S is the set {x, y, z}, then all the subsets of S are \ {} \ {x} \ {y} \ {z} \ {x, y} \ {x, z} \ {y, z} \ {x, y, z} \ and hence the power set of S is {{}, {x}, {y}, {z}, {x, y}, {x, z}, {y, z}, {x, y, z}}. [power set]: https://en.wikipedia.org/wiki/Power_set

(slice: &[T])

Source from the content-addressed store, hash-verified

101///
102/// [power set]: https://en.wikipedia.org/wiki/Power_set
103pub fn powerset<T>(slice: &[T]) -> Result<Vec<Vec<&T>>> {
104 if slice.len() >= 64 {
105 return plan_err!("The size of the set must be less than 64");
106 }
107
108 Ok(powerset_indices(slice.len())
109 .map(|indices| indices.iter().map(|&idx| &slice[idx]).collect())
110 .collect())
111}
112
113/// check the number of expressions contained in the grouping_set
114fn check_grouping_set_size_limit(size: usize) -> Result<()> {

Callers 2

enumerate_grouping_setsFunction · 0.85
to_substrait_groupingsFunction · 0.85

Calls 5

powerset_indicesFunction · 0.85
collectMethod · 0.80
lenMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…