blaginin commented on code in PR #15262:
URL: https://github.com/apache/datafusion/pull/15262#discussion_r1998926847


##########
datafusion/core/tests/dataframe/dataframe_functions.rs:
##########
@@ -75,34 +75,28 @@ async fn create_test_table() -> Result<DataFrame> {
 }
 
 /// Executes an expression on the test dataframe as a select.
-/// Compares formatted output of a record batch with an expected
-/// vector of strings, using the assert_batch_eq! macro
-macro_rules! assert_fn_batches {
-    ($EXPR:expr, $EXPECTED: expr) => {
-        assert_fn_batches!($EXPR, $EXPECTED, 10)
-    };
-    ($EXPR:expr, $EXPECTED: expr, $LIMIT: expr) => {
-        let df = create_test_table().await?;
-        let df = df.select(vec![$EXPR])?.limit(0, Some($LIMIT))?;
-        let batches = df.collect().await?;
-
-        assert_batches_eq!($EXPECTED, &batches);
-    };
+async fn get_batches(expr: Expr, limit: usize) -> Result<Vec<RecordBatch>> {
+    let df = create_test_table().await?;
+    let df = df.select(vec![expr])?.limit(0, Some(limit))?;
+    df.collect().await

Review Comment:
   to fully replicate the original logic, you can also do `get_batches(expr)` 
and `get_batches_with_limit(expr, limit)` - that way you're reduce the magic 
number (10) across the codebase



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