Skip to content

Commit

Permalink
fix(sqlsmith): stub grouping set gen (#10921)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwannoel authored Jul 12, 2023
1 parent 8d9476b commit dc6f647
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/tests/sqlsmith/src/sql_gen/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,20 +261,22 @@ impl<'a, R: Rng> SqlGenerator<'a, R> {
fn gen_group_by(&mut self) -> Vec<Expr> {
// 90% generate simple group by.
// 10% generate grouping sets.
match self.rng.gen_range(0..=9) {
0 => self.gen_grouping_sets(),
1..=9 => {
match self.rng.gen_range(0..=8) {
0..=8 => {
let group_by_cols = self.gen_random_bound_columns();
self.bound_columns = group_by_cols.clone();
group_by_cols
.into_iter()
.map(|c| Expr::Identifier(Ident::new_unchecked(c.name)))
.collect_vec()
}
// FIXME: See https://github.com/risingwavelabs/risingwave/pull/10918 for details.
// 9 => self.gen_grouping_sets(),
_ => unreachable!(),
}
}

#[allow(dead_code)]
/// GROUPING SETS will constrain the generated columns.
fn gen_grouping_sets(&mut self) -> Vec<Expr> {
let grouping_num = self.rng.gen_range(0..=5);
Expand Down

0 comments on commit dc6f647

Please sign in to comment.