Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ jobs:
- uses: ./.github/actions/setup
- run: cargo test --features integration

tpch-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: cargo test --features tpch --test tpch_validation_test

format-check:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ integration = [
"arrow",
"tokio-stream",
]
tpch = ["integration"]

[dev-dependencies]
structopt = "0.3"
Expand Down
5 changes: 1 addition & 4 deletions src/errors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ pub fn tonic_status_to_datafusion_error(status: &tonic::Status) -> Option<DataFu
}

match DataFusionErrorProto::decode(status.details()) {
Ok(err_proto) => {
dbg!(&err_proto);
Some(err_proto.to_datafusion_err())
}
Ok(err_proto) => Some(err_proto.to_datafusion_err()),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR, but saw some dbg! statement pending here.

Err(err) => Some(internal_datafusion_err!(
"Cannot decode DataFusionError: {err}"
)),
Expand Down
54 changes: 26 additions & 28 deletions src/test_utils/tpch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ pub fn tpch_query_from_dir(queries_dir: &std::path::Path, num: u8) -> String {
}
pub const NUM_QUERIES: u8 = 22; // number of queries in the TPCH benchmark numbered from 1 to 22

const SCALE_FACTOR: f64 = 0.001;

pub fn tpch_table(name: &str) -> Arc<dyn TableProvider> {
let schema = Arc::new(get_tpch_table_schema(name));
Arc::new(MemTable::try_new(schema, vec![]).unwrap())
Expand Down Expand Up @@ -158,33 +156,33 @@ where
Ok(())
}

macro_rules! must_generate_tpch_table {
($generator:ident, $arrow:ident, $name:literal, $data_dir:expr) => {
let data_dir = $data_dir.join($name);
fs::create_dir_all(data_dir.clone()).expect("Failed to create data directory");
// create three partitions for the table
(1..=3).for_each(|part| {
generate_table(
// TODO: Consider adjusting the partitions and batch sizes.
$arrow::new($generator::new(SCALE_FACTOR, part, 3)).with_batch_size(1000),
&format!("{part}"),
&data_dir.clone().into_boxed_path(),
)
.expect(concat!("Failed to generate ", $name, " table"));
});
};
}

// generate_tpch_data generates all TPC-H tables in the specified data directory.
pub fn generate_tpch_data(data_dir: &std::path::Path) {
pub fn generate_tpch_data(data_dir: &std::path::Path, sf: f64, parts: i32) {
fs::create_dir_all(data_dir).expect("Failed to create data directory");

must_generate_tpch_table!(RegionGenerator, RegionArrow, "region", data_dir);
must_generate_tpch_table!(NationGenerator, NationArrow, "nation", data_dir);
must_generate_tpch_table!(CustomerGenerator, CustomerArrow, "customer", data_dir);
must_generate_tpch_table!(SupplierGenerator, SupplierArrow, "supplier", data_dir);
must_generate_tpch_table!(PartGenerator, PartArrow, "part", data_dir);
must_generate_tpch_table!(PartSuppGenerator, PartSuppArrow, "partsupp", data_dir);
must_generate_tpch_table!(OrderGenerator, OrderArrow, "orders", data_dir);
must_generate_tpch_table!(LineItemGenerator, LineItemArrow, "lineitem", data_dir);
macro_rules! must_generate_tpch_table {
($generator:ident, $arrow:ident, $name:literal) => {
let data_dir = data_dir.join($name);
fs::create_dir_all(data_dir.clone()).expect("Failed to create data directory");
// create three partitions for the table
(1..=parts).for_each(|part| {
generate_table(
// TODO: Consider adjusting the partitions and batch sizes.
$arrow::new($generator::new(sf, part, parts)).with_batch_size(1000),
&format!("{part}"),
&data_dir,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏽

)
.expect(concat!("Failed to generate ", $name, " table"));
});
};
}

must_generate_tpch_table!(RegionGenerator, RegionArrow, "region");
must_generate_tpch_table!(NationGenerator, NationArrow, "nation");
must_generate_tpch_table!(CustomerGenerator, CustomerArrow, "customer");
must_generate_tpch_table!(SupplierGenerator, SupplierArrow, "supplier");
must_generate_tpch_table!(PartGenerator, PartArrow, "part");
must_generate_tpch_table!(PartSuppGenerator, PartSuppArrow, "partsupp");
must_generate_tpch_table!(OrderGenerator, OrderArrow, "orders");
must_generate_tpch_table!(LineItemGenerator, LineItemArrow, "lineitem");
}
28 changes: 0 additions & 28 deletions tests/common.rs

This file was deleted.

Loading