iffyio commented on code in PR #2333:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2333#discussion_r3231560525


##########
tests/sqlparser_clickhouse.rs:
##########
@@ -1845,6 +1845,56 @@ fn parse_inner_array_join() {
     }
 }
 
+#[test]
+fn parse_with_clause_common_scalar_expression() {
+    let dialects = all_dialects_where(|d| 
d.supports_common_scalar_expressions());
+
+    // Plain literal scalar.
+    let query = dialects.verified_query("WITH 42 AS answer SELECT answer FROM 
t");
+    let with = query.with.as_ref().unwrap();
+    assert!(!with.recursive);
+    assert_eq!(with.exprs.len(), 1);
+    match &with.exprs[0] {
+        WithExpression::Cse(ExprWithAlias { expr, alias }) => {
+            assert_eq!(alias.as_ref().unwrap().value, "answer");
+            assert!(matches!(expr, Expr::Value(_)));
+        }
+        other => panic!("expected a common scalar expression, got {other:?}"),
+    }
+
+    // String literal scalar (from the ClickHouse docs).
+    dialects.verified_stmt(
+        "WITH '2019-08-01 15:23:00' AS ts_upper_bound SELECT * FROM hits \

Review Comment:
   for the line breaks can we use concat like e.g. 
[here](https://github.com/alrevuelta/datafusion-sqlparser-rs/blob/3b868426bd4f1cc15017efbc3648f1b7cfab4a2a/tests/sqlparser_clickhouse.rs#L241)
 to format the sql strings?



-- 
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]

Reply via email to