andygrove commented on code in PR #3210:
URL: https://github.com/apache/arrow-datafusion/pull/3210#discussion_r951912872


##########
datafusion/core/tests/sql/timestamp.rs:
##########
@@ -436,31 +436,82 @@ async fn test_current_timestamp_expressions() -> 
Result<()> {
 }
 
 #[tokio::test]
-async fn test_current_timestamp_expressions_non_optimized() -> Result<()> {
-    let t1 = chrono::Utc::now().timestamp();
+async fn test_now_across_statements() -> Result<()> {
     let ctx = SessionContext::new();
-    let sql = "SELECT NOW(), NOW() as t2";
 
-    let msg = format!("Creating logical plan for '{}'", sql);
-    let plan = ctx.create_logical_plan(sql).expect(&msg);
+    let actual1 = execute(&ctx, "SELECT NOW()").await;
+    let res1 = actual1[0][0].as_str();
 
-    let msg = format!("Creating physical plan for '{}': {:?}", sql, plan);
-    let plan = ctx.create_physical_plan(&plan).await.expect(&msg);
+    let actual2 = execute(&ctx, "SELECT NOW()").await;
+    let res2 = actual2[0][0].as_str();
 
-    let msg = format!("Executing physical plan for '{}': {:?}", sql, plan);
-    let task_ctx = ctx.task_ctx();
-    let res = collect(plan, task_ctx).await.expect(&msg);
-    let actual = result_vec(&res);
+    assert!(res1 < res2);
 
-    let res1 = actual[0][0].as_str();
-    let res2 = actual[0][1].as_str();
-    let t3 = chrono::Utc::now().timestamp();
-    let t2_naive =
-        chrono::NaiveDateTime::parse_from_str(res1, "%Y-%m-%d 
%H:%M:%S%.6f").unwrap();
+    Ok(())
+}
 
-    let t2 = t2_naive.timestamp();
-    assert!(t1 <= t2 && t2 <= t3);
-    assert_eq!(res2, res1);
+#[tokio::test]
+async fn test_now_across_statements_using_sql_function() -> Result<()> {

Review Comment:
   It looks like we are missing a SQL test for now() appearing twice in the 
same statement?



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