You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/03/05 19:08:00 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #5481: Propagate timezone to created arrays

alamb commented on code in PR #5481:
URL: https://github.com/apache/arrow-datafusion/pull/5481#discussion_r1125717470


##########
datafusion/core/tests/sql/parquet.rs:
##########
@@ -165,6 +165,39 @@ async fn fixed_size_binary_columns() {
     }
 }
 
+#[tokio::test]
+async fn window_fn_timestamp_tz() {
+    let ctx = SessionContext::new();
+    ctx.register_parquet(
+        "t0",
+        "tests/parquet/data/timestamp_with_tz.parquet",
+        ParquetReadOptions::default(),
+    )
+    .await
+    .unwrap();
+
+    let sql = "SELECT count, LAG(timestamp, 1) OVER (ORDER BY timestamp) FROM t0";
+    let dataframe = ctx.sql(sql).await.unwrap();
+    let results = dataframe.collect().await.unwrap();
+
+    let mut num_rows = 0;
+    for batch in results {
+        num_rows += batch.num_rows();
+        assert_eq!(2, batch.num_columns());
+
+        let ty = batch.column(0).data_type().clone();
+        assert_eq!(DataType::Int64, ty);
+
+        let ty = batch.column(1).data_type().clone();
+        assert_eq!(
+            DataType::Timestamp(TimeUnit::Millisecond, Some("UTC".to_owned())),
+            ty
+        );
+    }
+
+    assert_eq!(131072, num_rows);

Review Comment:
   👍 
   
   
   In the future you could also use sqllogictest to write this kind of test. Something like https://github.com/apache/arrow-datafusion/blob/eb9541380964a5fd5aa92302a82ec189c3be792e/datafusion/core/tests/sqllogictests/test_files/window.slt#L18-L36
   
   



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org