Skip to content

Commit

Permalink
chore: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
CookiePieWw committed Apr 26, 2024
1 parent f569e32 commit 6ca29f5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
16 changes: 4 additions & 12 deletions tests-fuzz/src/generator/create_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ use crate::generator::{ColumnOptionGenerator, ConcreteDataTypeGenerator, Random}
use crate::ir::create_expr::{ColumnOption, CreateDatabaseExprBuilder, CreateTableExprBuilder};
use crate::ir::{
column_options_generator, generate_columns, generate_random_value,
partible_column_options_generator, primary_key_and_not_null_column_options_generator,
ts_column_options_generator, Column, ColumnTypeGenerator, CreateDatabaseExpr, CreateTableExpr,
Ident, PartibleColumnTypeGenerator, StringColumnTypeGenerator, TsColumnTypeGenerator,
partible_column_options_generator, primary_key_options_generator, ts_column_options_generator,
Column, ColumnTypeGenerator, CreateDatabaseExpr, CreateTableExpr, Ident,
PartibleColumnTypeGenerator, StringColumnTypeGenerator, TsColumnTypeGenerator,
};

#[derive(Builder)]
Expand Down Expand Up @@ -286,17 +286,9 @@ impl<R: Rng + 'static> Generator<CreateTableExpr, R> for CreateLogicalTableExprG
rng,
column_names,
&StringColumnTypeGenerator,
Box::new(primary_key_and_not_null_column_options_generator),
Box::new(primary_key_options_generator),
));

logical_table.columns.iter_mut().for_each(|column| {
if column.column_type == ConcreteDataType::string_datatype() {
column
.options
.retain(|option| option == &ColumnOption::PrimaryKey);
}
});

// Currently only the `primary key` option is kept in physical table,
// so we only keep the `primary key` option in the logical table for fuzz test.
let mut primary_keys = vec![];
Expand Down
7 changes: 7 additions & 0 deletions tests-fuzz/src/ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,13 @@ pub fn primary_key_and_not_null_column_options_generator<R: Rng + 'static>(
vec![ColumnOption::PrimaryKey, ColumnOption::NotNull]
}

pub fn primary_key_options_generator<R: Rng + 'static>(
_: &mut R,
_: &ConcreteDataType,
) -> Vec<ColumnOption> {
vec![ColumnOption::PrimaryKey]
}

/// Generates columns with given `names`.
pub fn generate_columns<R: Rng + 'static>(
rng: &mut R,
Expand Down

0 comments on commit 6ca29f5

Please sign in to comment.