LucaCappelletti94 commented on code in PR #2651:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2651#discussion_r4302046694
##########
tests/sqlparser_common.rs:
##########
@@ -20682,3 +20682,24 @@ fn parse_array_suffix_after_nested_type() {
})
.verified_stmt("SELECT CAST(NULL AS MAP<INT, STRUCT<a INT>> ARRAY)");
}
+
+#[test]
+fn parse_cte_materialization() {
+ for (directive, expected) in [
+ ("", None),
+ ("MATERIALIZED ", Some(CteAsMaterialized::Materialized)),
+ (
+ "NOT MATERIALIZED ",
+ Some(CteAsMaterialized::NotMaterialized),
+ ),
+ ] {
+ let sql = format!("WITH c AS {directive}(SELECT 1) SELECT * FROM c");
+ let query = all_dialects_where(|d|
d.supports_cte_materialization()).verified_query(&sql);
Review Comment:
You should add this DuckDB red test, because nothing fails if
`DuckDbDialect::supports_cte_materialization` returns `false`. DuckDB then
moves into the rejecting set and `parse_cte_materialization` still passes. With
this line, that regression fails with `Expected: (, found: MATERIALIZED`.
```suggestion
TestedDialects::new(vec![Box::new(DuckDbDialect
{})]).verified_query(&sql);
let query = all_dialects_where(|d|
d.supports_cte_materialization()).verified_query(&sql);
```
--
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]