jhorstmann commented on code in PR #3570:
URL: https://github.com/apache/arrow-datafusion/pull/3570#discussion_r979411553
##########
datafusion/core/tests/sql/window.rs:
##########
@@ -471,3 +471,297 @@ async fn window_with_agg_in_expression() -> Result<()> {
assert_batches_eq!(expected, &actual);
Ok(())
}
+
+#[tokio::test]
+async fn window_frame_empty() -> Result<()> {
+ let ctx = SessionContext::new();
+ register_aggregate_csv(&ctx).await?;
+ let sql = "SELECT \
+ SUM(c3) OVER(),\
+ COUNT(*) OVER ()\
+ FROM aggregate_test_100 \
+ ORDER BY c9 \
+ LIMIT 5";
+ let actual = execute_to_batches(&ctx, sql).await;
+ let expected = vec![
+ "+----------------------------+-----------------+",
+ "| SUM(aggregate_test_100.c3) | COUNT(UInt8(1)) |",
+ "+----------------------------+-----------------+",
+ "| 781 | 100 |",
+ "| 781 | 100 |",
+ "| 781 | 100 |",
+ "| 781 | 100 |",
+ "| 781 | 100 |",
+ "+----------------------------+-----------------+",
+ ];
+ assert_batches_eq!(expected, &actual);
+ Ok(())
+}
+
+#[tokio::test]
+async fn window_frame_rows_preceding() -> Result<()> {
+ let ctx = SessionContext::new();
+ register_aggregate_csv(&ctx).await?;
+ let sql = "SELECT \
+ SUM(c4) OVER(ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING),\
Review Comment:
I believe the `ORDER BY c9` below makes this deterministic. Except when
there are duplicates in `c9` with different values in `c4`, as you also note
below. In that case it would probably be best to extend the `ORDER BY` with
another column that makes it stable.
--
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]