Skip to content

Commit c631d4c

Browse files
authored
Chore: use item imports in bench-vortex (#5554)
I'm guessing we didnt do this before because of the lance feature flags, I just added `#[rustfmt::skip]` in those cases Signed-off-by: Connor Tsui <[email protected]>
1 parent 32d834a commit c631d4c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+515
-208
lines changed

bench-vortex/rustfmt.toml

Lines changed: 0 additions & 1 deletion
This file was deleted.

bench-vortex/src/bench_run.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
use std::future::Future;
55
use std::hint::black_box;
6-
use std::time::{Duration, Instant};
6+
use std::time::Duration;
7+
use std::time::Instant;
78

89
use tokio::runtime::Runtime;
910

bench-vortex/src/benchmark_driver.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,25 @@ use log::warn;
1212
use vortex::error::VortexExpect;
1313
use vortex_datafusion::metrics::VortexMetricsFinder;
1414

15+
use crate::Engine;
16+
use crate::Format;
17+
use crate::Target;
1518
use crate::benchmark_trait::Benchmark;
19+
use crate::df;
1620
use crate::display::DisplayFormat;
17-
use crate::engines::{EngineCtx, benchmark_datafusion_query};
18-
use crate::measurements::{MemoryMeasurement, QueryMeasurement};
21+
use crate::engines::EngineCtx;
22+
use crate::engines::benchmark_datafusion_query;
23+
use crate::measurements::MemoryMeasurement;
24+
use crate::measurements::QueryMeasurement;
1925
use crate::memory::BenchmarkMemoryTracker;
20-
use crate::metrics::{MetricsSetExt, export_plan_spans};
21-
use crate::query_bench::{filter_queries, print_memory_usage, print_results};
22-
use crate::utils::{new_tokio_runtime, url_scheme_to_storage};
23-
use crate::{Engine, Format, Target, df, vortex_panic};
26+
use crate::metrics::MetricsSetExt;
27+
use crate::metrics::export_plan_spans;
28+
use crate::query_bench::filter_queries;
29+
use crate::query_bench::print_memory_usage;
30+
use crate::query_bench::print_results;
31+
use crate::utils::new_tokio_runtime;
32+
use crate::utils::url_scheme_to_storage;
33+
use crate::vortex_panic;
2434

2535
/// Mode for EXPLAIN queries
2636
#[derive(Debug, Clone, Copy)]

bench-vortex/src/benchmark_trait.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
use anyhow::Result;
77
use url::Url;
88

9+
use crate::BenchmarkDataset;
10+
use crate::Engine;
11+
use crate::Format;
12+
use crate::Target;
13+
use crate::df;
914
use crate::engines::EngineCtx;
10-
use crate::{BenchmarkDataset, Engine, Format, Target, df};
1115

1216
/// Core benchmark operations that all benchmark types implement
1317
pub trait Benchmark {

bench-vortex/src/bin/compress.rs

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,48 @@
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

44
use std::fs::File;
5-
use std::io::{Write, stdout};
5+
use std::io::Write;
6+
use std::io::stdout;
67
use std::path::PathBuf;
78
use std::time::Duration;
89

9-
use bench_vortex::compress::bench::{self as compress, CompressMeasurements, CompressOp};
10+
use bench_vortex::Engine;
11+
use bench_vortex::Format;
12+
use bench_vortex::Target;
13+
use bench_vortex::compress::bench::CompressMeasurements;
14+
use bench_vortex::compress::bench::CompressOp;
15+
use bench_vortex::compress::bench::{self as compress};
1016
use bench_vortex::datasets::Dataset;
1117
use bench_vortex::datasets::struct_list_of_ints::StructListOfInts;
1218
use bench_vortex::datasets::taxi_data::TaxiData;
13-
use bench_vortex::datasets::tpch_l_comment::{TPCHLCommentCanonical, TPCHLCommentChunked};
14-
use bench_vortex::display::{DisplayFormat, print_measurements_json, render_table};
19+
use bench_vortex::datasets::tpch_l_comment::TPCHLCommentCanonical;
20+
use bench_vortex::datasets::tpch_l_comment::TPCHLCommentChunked;
21+
use bench_vortex::display::DisplayFormat;
22+
use bench_vortex::display::print_measurements_json;
23+
use bench_vortex::display::render_table;
1524
use bench_vortex::downloadable_dataset::DownloadableDataset;
16-
use bench_vortex::measurements::{CompressionTimingMeasurement, CustomUnitMeasurement};
25+
use bench_vortex::measurements::CompressionTimingMeasurement;
26+
use bench_vortex::measurements::CustomUnitMeasurement;
1727
use bench_vortex::public_bi::PBI_DATASETS;
18-
use bench_vortex::public_bi::PBIDataset::{Arade, Bimbo, CMSprovider, Euro2016, Food, HashTags};
28+
use bench_vortex::public_bi::PBIDataset::Arade;
29+
use bench_vortex::public_bi::PBIDataset::Bimbo;
30+
use bench_vortex::public_bi::PBIDataset::CMSprovider;
31+
use bench_vortex::public_bi::PBIDataset::Euro2016;
32+
use bench_vortex::public_bi::PBIDataset::Food;
33+
use bench_vortex::public_bi::PBIDataset::HashTags;
34+
use bench_vortex::setup_logging_and_tracing;
1935
use bench_vortex::utils::new_tokio_runtime;
20-
use bench_vortex::{Engine, Format, Target, setup_logging_and_tracing};
2136
use clap::Parser;
2237
use indicatif::ProgressBar;
2338
use itertools::Itertools;
2439
use regex::Regex;
2540
use tokio::runtime::Runtime;
26-
use vortex::arrays::{ChunkedArray, ChunkedVTable};
41+
use vortex::Array;
42+
use vortex::IntoArray;
43+
use vortex::arrays::ChunkedArray;
44+
use vortex::arrays::ChunkedVTable;
2745
use vortex::builders::builder_with_capacity;
2846
use vortex::utils::aliases::hash_map::HashMap;
29-
use vortex::{Array, IntoArray};
3047

3148
#[derive(Parser, Debug)]
3249
#[command(version, about, long_about = None)]

bench-vortex/src/bin/public_bi.rs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,34 @@
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

44
use std::fs::File;
5-
use std::io::{Write, stdout};
5+
use std::io::Write;
6+
use std::io::stdout;
67
use std::path::PathBuf;
78
use std::time::Instant;
89

9-
use bench_vortex::display::{DisplayFormat, print_measurements_json, render_table};
10+
use bench_vortex::BenchmarkDataset;
11+
use bench_vortex::Format;
12+
use bench_vortex::Target;
13+
use bench_vortex::df;
14+
use bench_vortex::display::DisplayFormat;
15+
use bench_vortex::display::print_measurements_json;
16+
use bench_vortex::display::render_table;
1017
use bench_vortex::measurements::QueryMeasurement;
1118
use bench_vortex::metrics::MetricsSetExt;
12-
use bench_vortex::public_bi::{FileType, PBI_DATASETS, PBIDataset};
19+
use bench_vortex::public_bi::FileType;
20+
use bench_vortex::public_bi::PBI_DATASETS;
21+
use bench_vortex::public_bi::PBIDataset;
22+
use bench_vortex::setup_logging_and_tracing;
1323
use bench_vortex::utils::constants::STORAGE_NVME;
1424
use bench_vortex::utils::new_tokio_runtime;
15-
use bench_vortex::{BenchmarkDataset, Format, Target, df, setup_logging_and_tracing};
16-
use clap::{Parser, value_parser};
25+
use clap::Parser;
26+
use clap::value_parser;
1727
use indicatif::ProgressBar;
1828
use itertools::Itertools;
19-
use tracing::{Instrument, info_span};
20-
use vortex::error::{VortexExpect, vortex_panic};
29+
use tracing::Instrument;
30+
use tracing::info_span;
31+
use vortex::error::VortexExpect;
32+
use vortex::error::vortex_panic;
2133
use vortex_datafusion::metrics::VortexMetricsFinder;
2234

2335
#[derive(Parser, Debug)]

bench-vortex/src/bin/query_bench.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,22 @@
33

44
use std::path::PathBuf;
55

6-
use bench_vortex::benchmark_driver::{DriverConfig, run_benchmark};
7-
use bench_vortex::clickbench::{ClickBenchBenchmark, Flavor};
6+
use bench_vortex::IdempotentPath as _;
7+
use bench_vortex::Target;
8+
use bench_vortex::benchmark_driver::DriverConfig;
9+
use bench_vortex::benchmark_driver::run_benchmark;
10+
use bench_vortex::clickbench::ClickBenchBenchmark;
11+
use bench_vortex::clickbench::Flavor;
812
use bench_vortex::display::DisplayFormat;
913
use bench_vortex::fineweb::Fineweb;
1014
use bench_vortex::realnest::gharchive::GithubArchive;
15+
use bench_vortex::setup_logging_and_tracing;
1116
use bench_vortex::statpopgen::StatPopGenBenchmark;
1217
use bench_vortex::tpcds::TpcDsBenchmark;
1318
use bench_vortex::tpch::tpch_benchmark::TpcHBenchmark;
14-
use bench_vortex::{IdempotentPath as _, Target, setup_logging_and_tracing};
15-
use clap::{Parser, Subcommand, value_parser};
19+
use clap::Parser;
20+
use clap::Subcommand;
21+
use clap::value_parser;
1622
use url::Url;
1723

1824
#[derive(Parser, Debug)]

bench-vortex/src/bin/random_access.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,37 @@
33

44
use std::fs::File;
55
use std::future::Future;
6-
use std::io::{Write, stdout};
6+
use std::io::Write;
7+
use std::io::stdout;
78
use std::path::PathBuf;
89

10+
use bench_vortex::Engine;
11+
use bench_vortex::Format;
12+
use bench_vortex::Target;
913
use bench_vortex::bench_run::run_timed_with_setup;
1014
use bench_vortex::datasets::taxi_data::*;
11-
use bench_vortex::display::{DisplayFormat, print_measurements_json, render_table};
15+
use bench_vortex::display::DisplayFormat;
16+
use bench_vortex::display::print_measurements_json;
17+
use bench_vortex::display::render_table;
1218
use bench_vortex::measurements::TimingMeasurement;
1319
#[cfg(feature = "lance")]
1420
use bench_vortex::random_access::take::take_lance;
15-
use bench_vortex::random_access::take::{take_parquet, take_vortex_tokio};
21+
use bench_vortex::random_access::take::take_parquet;
22+
use bench_vortex::random_access::take::take_vortex_tokio;
23+
use bench_vortex::setup_logging_and_tracing;
1624
use bench_vortex::utils::constants::STORAGE_NVME;
1725
use bench_vortex::utils::new_tokio_runtime;
18-
use bench_vortex::{Engine, Format, Target, setup_logging_and_tracing};
1926
use clap::Parser;
2027
use indicatif::ProgressBar;
2128
use tokio::runtime::Runtime;
22-
use vortex::buffer::{Buffer, buffer};
29+
use vortex::Array;
30+
use vortex::ArrayRef;
31+
use vortex::ToCanonical;
32+
use vortex::buffer::Buffer;
33+
use vortex::buffer::buffer;
2334
use vortex::dtype::Nullability::NonNullable;
2435
use vortex::error::VortexExpect;
2536
use vortex::scalar::Scalar;
26-
use vortex::{Array, ArrayRef, ToCanonical};
2737

2838
#[derive(Parser, Debug)]
2939
#[command(version, about, long_about = None)]

bench-vortex/src/clickbench/clickbench_benchmark.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ use tokio::runtime::Runtime;
99
use url::Url;
1010
use vortex::error::VortexExpect;
1111

12+
use crate::BenchmarkDataset;
13+
use crate::CompactionStrategy;
14+
use crate::Format;
15+
use crate::IdempotentPath;
16+
use crate::Target;
1217
use crate::benchmark_trait::Benchmark;
1318
use crate::clickbench::*;
1419
use crate::engines::EngineCtx;
15-
use crate::{BenchmarkDataset, CompactionStrategy, Format, IdempotentPath, Target};
1620

1721
/// ClickBench benchmark implementation
1822
pub struct ClickBenchBenchmark {

bench-vortex/src/clickbench/clickbench_data.rs

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,55 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4+
use std::fmt;
45
use std::fmt::Display;
6+
use std::fs;
57
use std::fs::File;
6-
use std::path::{Path, PathBuf};
7-
use std::sync::{Arc, LazyLock};
8+
use std::path::Path;
9+
use std::path::PathBuf;
10+
use std::sync::Arc;
11+
use std::sync::LazyLock;
812
use std::time::Duration;
9-
use std::{fmt, fs};
1013

11-
use arrow_schema::{DataType, Field, Schema, TimeUnit};
14+
use arrow_schema::DataType;
15+
use arrow_schema::Field;
16+
use arrow_schema::Schema;
17+
use arrow_schema::TimeUnit;
1218
use clap::ValueEnum;
1319
use datafusion::datasource::file_format::parquet::ParquetFormat;
14-
use datafusion::datasource::listing::{
15-
ListingOptions, ListingTable, ListingTableConfig, ListingTableUrl,
16-
};
20+
use datafusion::datasource::listing::ListingOptions;
21+
use datafusion::datasource::listing::ListingTable;
22+
use datafusion::datasource::listing::ListingTableConfig;
23+
use datafusion::datasource::listing::ListingTableUrl;
1724
use datafusion::prelude::SessionContext;
18-
use futures::{StreamExt, TryStreamExt, stream};
25+
use futures::StreamExt;
26+
use futures::TryStreamExt;
27+
use futures::stream;
1928
use glob::Pattern;
2029
use log::trace;
21-
use rayon::prelude::{IntoParallelIterator, ParallelIterator};
30+
use rayon::prelude::IntoParallelIterator;
31+
use rayon::prelude::ParallelIterator;
2232
use reqwest::IntoUrl;
2333
use reqwest::blocking::Response;
2434
use serde::Serialize;
25-
use tokio::fs::{OpenOptions, create_dir_all};
26-
use tracing::{Instrument, info, warn};
35+
use tokio::fs::OpenOptions;
36+
use tokio::fs::create_dir_all;
37+
use tracing::Instrument;
38+
use tracing::info;
39+
use tracing::warn;
2740
use url::Url;
2841
use vortex::error::VortexExpect;
2942
use vortex::file::WriteOptionsSessionExt;
3043
use vortex_datafusion::VortexFormat;
3144

45+
use crate::CompactionStrategy;
46+
use crate::Format;
47+
use crate::SESSION;
3248
use crate::conversions::parquet_to_vortex;
3349
#[cfg(feature = "lance")]
3450
use crate::utils;
35-
use crate::utils::file_utils::{idempotent, idempotent_async};
36-
use crate::{CompactionStrategy, Format, SESSION};
51+
use crate::utils::file_utils::idempotent;
52+
use crate::utils::file_utils::idempotent_async;
3753

3854
pub static HITS_SCHEMA: LazyLock<Schema> = LazyLock::new(|| {
3955
use DataType::*;

0 commit comments

Comments
 (0)