Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sqlsmith): fuzz test support read Sqlite and Duckdb test #17301

Merged
merged 1 commit into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 2 additions & 20 deletions src/query/ast/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1088,32 +1088,15 @@ pub fn expr_element(i: Input) -> IResult<WithSpan<ExprElement>> {
#function_name
~ "(" ~ #comma_separated_list1(subexpr(0)) ~ ")"
~ "(" ~ DISTINCT? ~ #comma_separated_list0(subexpr(0))? ~ ")"
~ #window_function
~ #window_function?
},
|(name, _, params, _, _, opt_distinct, opt_args, _, window)| ExprElement::FunctionCall {
func: FunctionCall {
distinct: opt_distinct.is_some(),
name,
args: opt_args.unwrap_or_default(),
params,
window: Some(window),
lambda: None,
},
},
);
let function_call_with_params = map(
rule! {
#function_name
~ "(" ~ #comma_separated_list1(subexpr(0)) ~ ")"
~ "(" ~ DISTINCT? ~ #comma_separated_list0(subexpr(0))? ~ ")"
},
|(name, _, params, _, _, opt_distinct, opt_args, _)| ExprElement::FunctionCall {
func: FunctionCall {
distinct: opt_distinct.is_some(),
name,
args: opt_args.unwrap_or_default(),
params,
window: None,
window,
lambda: None,
},
},
Expand Down Expand Up @@ -1406,7 +1389,6 @@ pub fn expr_element(i: Input) -> IResult<WithSpan<ExprElement>> {
| #function_call_with_lambda : "`function(..., x -> ...)`"
| #function_call_with_window : "`function(...) OVER ([ PARTITION BY <expr>, ... ] [ ORDER BY <expr>, ... ] [ <window frame> ])`"
| #function_call_with_params_window : "`function(...)(...) OVER ([ PARTITION BY <expr>, ... ] [ ORDER BY <expr>, ... ] [ <window frame> ])`"
| #function_call_with_params : "`function(...)(...)`"
| #function_call : "`function(...)`"
),
rule!(
Expand Down
5 changes: 5 additions & 0 deletions src/tests/sqlsmith/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ pub struct Args {
/// The fuzz query test file path.
#[clap(long, default_value = "")]
fuzz_path: String,

/// The log path to write executed SQLs..
#[clap(long, default_value = ".databend/sqlsmithlog")]
log_path: String,
}

#[tokio::main(flavor = "multi_thread", worker_threads = 5)]
Expand All @@ -69,6 +73,7 @@ async fn main() -> Result<()> {
args.user.clone(),
args.pass.clone(),
args.db.clone(),
args.log_path.clone(),
args.count,
None,
args.timeout,
Expand Down
1 change: 1 addition & 0 deletions src/tests/sqlsmith/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ mod query_fuzzer;
mod reducer;
mod runner;
mod sql_gen;
mod util;

pub use runner::Runner;
Loading
Loading