Dandandan commented on code in PR #2881:
URL: https://github.com/apache/arrow-datafusion/pull/2881#discussion_r919945755


##########
benchmarks/src/bin/h2o.rs:
##########
@@ -0,0 +1,92 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! DataFusion h2o benchmarks
+
+use datafusion::{
+    arrow::util::pretty,
+    error::Result,
+    prelude::{CsvReadOptions, SessionContext},
+};
+use std::path::PathBuf;
+use structopt::StructOpt;
+use tokio::time::Instant;
+
+#[derive(Debug, StructOpt)]
+#[structopt(name = "datafusion-h2o", about = "DataFusion h2o benchmarks")]
+enum Opt {
+    GroupBy(GroupBy), //TODO add Join queries
+}
+
+#[derive(Debug, StructOpt)]
+struct GroupBy {
+    /// Query number
+    #[structopt(short, long)]
+    query: usize,
+    /// Path to data file
+    #[structopt(parse(from_os_str), required = true, short = "p", long = 
"path")]
+    path: PathBuf,
+    /// Activate debug mode to see query results
+    #[structopt(short, long)]
+    debug: bool,
+}
+
+#[tokio::main]
+async fn main() -> Result<()> {
+    let opt = Opt::from_args();
+    println!("Running benchmarks with the following options: {:?}", opt);
+    match opt {
+        Opt::GroupBy(config) => group_by(&config).await,
+    }
+}
+
+async fn group_by(config: &GroupBy) -> Result<()> {
+    let start = Instant::now();
+    let path = config.path.to_str().unwrap();
+    let ctx = SessionContext::new();
+    ctx.register_csv("x", path, CsvReadOptions::default())

Review Comment:
   Glad you found it. Some solutions also use specific (such as dictionary) 
encoding to get better results and lower memory usage.
   
   The old PR for the rust solution is here:
   https://github.com/h2oai/db-benchmark/pull/182
   
   This also includes some performance tweaks like changing the allocator, 
compile flags, prepartioning and batch size.
   
   
   
   



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

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

Reply via email to