villebro commented on code in PR #2791:
URL: 
https://github.com/apache/datafusion-ballista/pull/2791#discussion_r4502727338


##########
ballista/client/tests/standalone_push_staged.rs:
##########
@@ -22,115 +22,57 @@ mod common;
 #[cfg(test)]
 #[cfg(feature = "standalone")]
 mod standalone_push_staged {
-    use crate::common::setup_test_cluster_with_executors;
-    use ballista::prelude::SessionContextExt;
-    use ballista_core::config::{
-        BALLISTA_STANDALONE_PARALLELISM, 
BALLISTA_STANDALONE_TASK_SCHEDULING_POLICY,
+    use crate::common::{
+        ORDERS_QUERIES, ballista_state, collect_text, orders_customers_dir,
+        register_orders_customers, setup_test_cluster_with_executors,
     };
-    use ballista_core::extension::SessionConfigExt;
+    use ballista::prelude::SessionContextExt;
+    use ballista_core::config::BALLISTA_STANDALONE_TASK_SCHEDULING_POLICY;
     use ballista_core::serde::protobuf::PollWorkParams;
     use 
ballista_core::serde::protobuf::scheduler_grpc_client::SchedulerGrpcClient;
-    use datafusion::arrow::util::pretty::pretty_format_batches;
-    use datafusion::execution::{SessionState, SessionStateBuilder};
-    use datafusion::prelude::{CsvReadOptions, SessionConfig, SessionContext};
-    use std::io::Write;
+    use datafusion::execution::SessionState;
+    use datafusion::prelude::SessionContext;
     use std::path::Path;
-    use tempfile::TempDir;
-
-    /// Writes an `orders` table split over four files, so its scan has four
-    /// partitions, and a small `customers` table.
-    fn write_tables(dir: &Path) {
-        let orders = dir.join("orders");
-        std::fs::create_dir(&orders).unwrap();
-        for file in 0..4 {
-            let mut out =
-                
std::fs::File::create(orders.join(format!("part-{file}.csv"))).unwrap();
-            writeln!(out, "o_id,o_cust,o_amount").unwrap();
-            for i in 0..250 {
-                let id = file * 250 + i;
-                writeln!(out, "{id},{},{}", id % 97, (id * 7) % 1000).unwrap();
-            }
-        }
-        let mut out = 
std::fs::File::create(dir.join("customers.csv")).unwrap();
-        writeln!(out, "c_id,c_name,c_region").unwrap();
-        for id in 0..100 {
-            writeln!(out, "{id},customer-{id},region-{}", id % 5).unwrap();
-        }
-    }
 
     fn state(policy: &str) -> SessionState {
-        let config = SessionConfig::new_with_ballista()
-            .with_target_partitions(4)
-            .set_str(BALLISTA_STANDALONE_PARALLELISM, "4")
-            .set_str(BALLISTA_STANDALONE_TASK_SCHEDULING_POLICY, policy);
-        SessionStateBuilder::new()
-            .with_config(config)
-            .with_default_features()
-            .build()
-    }
-
-    async fn register_tables(ctx: &SessionContext, dir: &Path) {
-        ctx.register_csv(
-            "orders",
-            dir.join("orders").to_str().unwrap(),
-            CsvReadOptions::new(),
-        )
-        .await
-        .unwrap();
-        ctx.register_csv(
-            "customers",
-            dir.join("customers.csv").to_str().unwrap(),
-            CsvReadOptions::new(),
-        )
-        .await
-        .unwrap();
+        ballista_state(&[(BALLISTA_STANDALONE_TASK_SCHEDULING_POLICY, policy)])
     }
 
-    async fn rows(ctx: &SessionContext, sql: &str) -> String {
-        let batches = ctx.sql(sql).await.unwrap().collect().await.unwrap();
-        pretty_format_batches(&batches).unwrap().to_string()
+    /// The scan, aggregate and join of [`ORDERS_QUERIES`], none of which has 
an
+    /// unspecified row order.
+    fn queries() -> impl Iterator<Item = &'static str> {
+        ORDERS_QUERIES[..3].iter().map(|(sql, _)| *sql)

Review Comment:
   Good idea, added the note on `ORDERS_QUERIES` in  
https://github.com/apache/datafusion-ballista/pull/2791/changes/cebcecf87051235a5febde80390e1c65182d0041.
 A follow-up PR consolidates these tests, including `standalone_push_staged`, 
and I will remove the dependency on position there properly.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to