Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sundy-li committed Dec 1, 2024
1 parent d437c39 commit 4181959
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/query/sql/src/planner/binder/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,21 +462,9 @@ impl Binder {

/// Generate GroupingSets from CUBE (expr1, expr2, ...)
fn generate_cube_sets(exprs: Vec<Expr>) -> Vec<Vec<Expr>> {
let mut result = Vec::new();
let n = exprs.len();

// Iterate through all possible subsets of the given expressions
for i in 0..(1 << n) {
let mut subset = Vec::new();
for (j, expr) in exprs.iter().enumerate() {
if (i & (1 << j)) != 0 {
subset.push(expr.clone());
}
}
result.push(subset);
}

result
(0..=exprs.len())
.flat_map(|count| exprs.clone().into_iter().combinations(count))
.collect::<Vec<_>>()
}

/// Generate GroupingSets from ROLLUP (expr1, expr2, ...)
Expand Down

0 comments on commit 4181959

Please sign in to comment.