timsaucer commented on issue #6747:
URL: https://github.com/apache/datafusion/issues/6747#issuecomment-2125128453

   I think you're doing a great job, and good point on the sqllogictest. TBH I 
find those tests harder to wrap my head around than the rust tests, but that's 
more personal preference. 
   
   About the test function, I realize we can probably make it simpler:
   
   ```
   macro_rules! assert_unordered_fn_batches {
       ($EXPRS:expr, $EXPECTED: expr) => {
           let df = create_test_table().await?;
           let df = df.select($EXPRS)?.limit(0, Some(10))?;
           let batches = df.collect().await?;
   
           assert_batches_sorted_eq!($EXPECTED, &batches);
       };
   }
   ```
   
   ```
   #[tokio::test]
   async fn test_fn_lead() -> Result<()> {
   
       let expr = lead(col("b"), Some(1), Some(ScalarValue::Int32(Some(-1))))
           .with_partition_by(vec![col("c")])
           .with_order_by(vec![col("b").sort(true, true)])
           .build()
           .alias("lead_b");
   
       let expected = [
           "+-----------+----+--------+",
           "| a         | c  | lead_b |",
           "+-----------+----+--------+",
           "| 123AbcDef | 10 | -1     |",
           "| CBAdef    | 1  | -1     |",
           "| abc123    | 1  | 10     |",
           "| abcDEF    | 1  | 10     |",
           "+-----------+----+--------+",
       ];
   
       let select_expr = vec![col("a"), col("c"), expr];
   
       assert_unordered_fn_batches!(select_expr, expected);
   
       Ok(())
   }
   ``` 
   
   What do you think?


-- 
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-unsubscr...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to