You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/12/06 11:49:18 UTC

[GitHub] [arrow] Dandandan commented on a change in pull request #8845: ARROW-10820: [Rust] [DataFusion] Complete TPC-H Benchmark Queries

Dandandan commented on a change in pull request #8845:
URL: https://github.com/apache/arrow/pull/8845#discussion_r537021940



##########
File path: rust/benchmarks/src/bin/tpch.rs
##########
@@ -145,59 +145,849 @@ async fn benchmark(opt: BenchmarkOpt) -> Result<()> {
 
 fn create_logical_plan(ctx: &mut ExecutionContext, query: usize) -> Result<LogicalPlan> {
     match query {
+
+        // original
+        // 1 => ctx.create_logical_plan(
+        //     format!(
+        //     "select
+        //         l_returnflag,
+        //         l_linestatus,
+        //         sum(l_quantity) as sum_qty,
+        //         sum(l_extendedprice) as sum_base_price,
+        //         sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
+        //         sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
+        //         avg(l_quantity) as avg_qty,
+        //         avg(l_extendedprice) as avg_price,
+        //         avg(l_discount) as avg_disc,
+        //         count(*) as count_order
+        //     from
+        //         lineitem
+        //     where
+        //         l_shipdate <= date '1998-12-01' - interval '{DELTA}' day (3)
+        //     group by
+        //         l_returnflag,
+        //         l_linestatus
+        //     order by
+        //         l_returnflag,
+        //         l_linestatus;",
+        //     DELTA="90").as_ref()
+        // ),
         1 => ctx.create_logical_plan(
+            format!(
             "select
-                    l_returnflag,
-                    l_linestatus,
-                    sum(l_quantity),
-                    sum(l_extendedprice),
-                    sum(l_extendedprice * (1 - l_discount)),
-                    sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)),
-                    avg(l_quantity),
-                    avg(l_extendedprice),
-                    avg(l_discount),
-                    count(*)
-                from
-                    lineitem
-                where
-                    l_shipdate <= '1998-12-01'
-                group by
-                    l_returnflag,
-                    l_linestatus
-                order by
-                    l_returnflag,
-                    l_linestatus",
+                l_returnflag,
+                l_linestatus,
+                sum(l_quantity) as sum_qty,
+                sum(l_extendedprice) as sum_base_price,
+                sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
+                sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
+                avg(l_quantity) as avg_qty,
+                avg(l_extendedprice) as avg_price,
+                avg(l_discount) as avg_disc,
+                count(*) as count_order
+            from
+                lineitem
+            where
+                l_shipdate <= '1998-09-02'
+            group by
+                l_returnflag,
+                l_linestatus
+            order by
+                l_returnflag,
+                l_linestatus;",
+            ).as_ref()
+        ),
+
+        2 => ctx.create_logical_plan(
+            format!(
+            "select
+                s_acctbal,
+                s_name,
+                n_name,
+                p_partkey,
+                p_mfgr,
+                s_address,
+                s_phone,
+                s_comment
+            from
+                part,
+                supplier,
+                partsupp,
+                nation,
+                region
+            where
+                p_partkey = ps_partkey
+                and s_suppkey = ps_suppkey
+                and p_size = {SIZE}

Review comment:
       Why would we put the constants here in `format!` macro. Wouldn't it be better / easier to keep them as is, as they are directly coupled to the query anyway?




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

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