seddonm1 commented on a change in pull request #8845:
URL: https://github.com/apache/arrow/pull/8845#discussion_r537111215
##########
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:
I am happy to change if you would like.
My rationale:
- we can retain the information of which arguments are parameterised as per
the TPC-H specification.
- we can retain 1:1 mapping of their query specification.
- the `format!` macro is compile time and should have very little
performance impact
----------------------------------------------------------------
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:
[email protected]