devinjdangelo commented on code in PR #9578:
URL: https://github.com/apache/arrow-datafusion/pull/9578#discussion_r1524024461


##########
datafusion/sql/src/unparser/expr.rs:
##########
@@ -316,14 +490,81 @@ mod tests {
 
     #[test]
     fn expr_to_sql_ok() -> Result<()> {
-        let tests: Vec<(Expr, &str)> = vec![(
-            Expr::Column(Column {
-                relation: Some(TableReference::partial("a", "b")),
-                name: "c".to_string(),
-            })
-            .gt(lit(4)),
-            r#"a.b.c > 4"#,
-        )];
+        let tests: Vec<(Expr, &str)> = vec![
+            ((col("a") + col("b")).gt(lit(4)), r#"((a + b) > 4)"#),
+            (
+                Expr::Column(Column {
+                    relation: Some(TableReference::partial("a", "b")),
+                    name: "c".to_string(),
+                })
+                .gt(lit(4)),
+                r#"(a.b.c > 4)"#,
+            ),
+            (
+                Expr::Cast(Cast {
+                    expr: Box::new(col("a")),
+                    data_type: DataType::Date64,
+                }),
+                r#"CAST(a AS DATETIME)"#,
+            ),
+            (
+                Expr::Cast(Cast {
+                    expr: Box::new(col("a")),
+                    data_type: DataType::UInt32,
+                }),
+                r#"CAST(a AS INTEGER UNSIGNED)"#,
+            ),
+            (
+                Expr::Literal(ScalarValue::Date64(Some(0))),

Review Comment:
   Since it is not possible to directly represent a Date scalar in a SQL 
string, these non round trip tests are still needed.



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

Reply via email to