qstommyshu commented on code in PR #15567:
URL: https://github.com/apache/datafusion/pull/15567#discussion_r2027712552
##########
datafusion/sql/tests/sql_integration.rs:
##########
@@ -3388,26 +3389,15 @@ fn
ident_normalization_parser_options_ident_normalization() -> ParserOptions {
}
}
-fn prepare_stmt_quick_test(
- sql: &str,
- expected_plan: &str,
- expected_data_types: &str,
-) -> LogicalPlan {
+fn generate_prepare_stmt_and_data_types(sql: &str) -> (LogicalPlan, String) {
Review Comment:
Just looked into this method 👀. `assert_debug_snapshot` does not work with
inline snapshot. We would have to store the snapshot in the `snapshot/` folder
(which I suppose that's not what we want?).
In terms of the output arguments, I probably need to use an `if let` or
another function to check the data type if we want to return `LogicalPlan`.
Then the testing procedure for a prepare statement would be:
```Rust
let plan = logical_plan(sql).unwrap();
if let LogicalPlan::Statement(Statement::Prepare(Prepare { data_types, ..
})) = plan {
assert_snapshot!(data_types, @r"SOME DATA TYPE");
}
assert_snapshot!(
plan,
@r#"
Prepare: "my_plan" [Int32]
Projection: person.id, person.age
Filter: person.age = Int64(10)
TableScan: person
"#
);
```
instead of what we have now:
```Rust
let (plan, dt) = generate_prepare_stmt_and_data_types(sql);
assert_snapshot!(
plan,
@r#"
Prepare: "my_plan" [Int32]
Projection: person.id, person.age
Filter: person.age = Int64(10)
TableScan: person
"#
);
assert_snapshot!(dt, @r#"[Int32]"#);
```
I can change it if you prefer the first testing procedure.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]