Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sqllogictest for modeling-rs end-to-end test #604

Merged
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
1 change: 1 addition & 0 deletions wren-modeling-rs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Cargo.lock
target/
sqllogictest/test_sql_files/scratch/
6 changes: 5 additions & 1 deletion wren-modeling-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace]
members = ["core"]
members = ["core", "sqllogictest"]
resolver = "2"

[workspace.package]
authors = ["Canner <[email protected]>"]
Expand All @@ -14,6 +15,9 @@ version = "0.1.0"
[workspace.dependencies]
arrow-schema = { version = "51.0.0", default-features = false }
datafusion = { version = "38.0.0" }
log = { version = "0.4.14" }
petgraph = "0.6.5"
petgraph-evcxr = "*"
serde = { version = "1.0.201", features = ["derive", "rc"] }
serde_json = { version = "1.0.117" }
tokio = { version = "1.4.0", features = ["rt", "rt-multi-thread", "macros"] }
4 changes: 4 additions & 0 deletions wren-modeling-rs/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ repository = { workspace = true }
license = { workspace = true }
authors = { workspace = true }

[lib]
name = "wren_core"
path = "src/lib.rs"

[dependencies]
arrow-schema = { workspace = true }
datafusion = { workspace = true }
Expand Down
5 changes: 4 additions & 1 deletion wren-modeling-rs/core/src/logical_plan/utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{collections::HashMap, sync::Arc};

use arrow_schema::{DataType, Field, Schema, SchemaRef};
use arrow_schema::{DataType, Field, Schema, SchemaRef, TimeUnit};
use datafusion::logical_expr::{builder::LogicalTableSource, TableSource};

use crate::mdl::{
Expand All @@ -12,6 +12,9 @@ pub fn map_data_type(data_type: &str) -> DataType {
match data_type {
"integer" => DataType::Int32,
"varchar" => DataType::Utf8,
"double" => DataType::Float64,
"timestamp" => DataType::Timestamp(TimeUnit::Nanosecond, None),
"date" => DataType::Date32,
_ => unimplemented!("{}", &data_type),
}
}
Expand Down
6 changes: 6 additions & 0 deletions wren-modeling-rs/core/src/mdl/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ pub struct ManifestBuilder {
pub manifest: Manifest,
}

impl Default for ManifestBuilder {
fn default() -> Self {
Self::new()
}
}

impl ManifestBuilder {
pub fn new() -> Self {
Self {
grieve54706 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
2 changes: 1 addition & 1 deletion wren-modeling-rs/core/src/mdl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::{
mdl::manifest::{Column, Manifest, Metric, Model},
};

mod builder;
pub mod builder;
pub mod lineage;
pub mod manifest;
pub mod utils;
Expand Down
43 changes: 43 additions & 0 deletions wren-modeling-rs/sqllogictest/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[package]
name = "wren-sqllogictest"
authors.workspace = true
edition.workspace = true
homepage.workspace = true
license.workspace = true
readme.workspace = true
repository.workspace = true
rust-version.workspace = true
version.workspace = true

[lib]
name = "wren_sqllogictest"
path = "src/lib.rs"

[dependencies]
async-trait = "0.1.80"
bigdecimal = "0.4.3"
datafusion = { workspace = true }
half = { version = "2.4.1", default-features = true }
log = { workspace = true }
rust_decimal = { version = "1.27.0" }
sqllogictest = "0.20.4"
thiserror = "1.0.61"
tokio = { workspace = true }
wren-core = { path = "../core" }

itertools = "0.13.0"
object_store = { version = "0.10.1", default-features = false }

clap = { version = "4.4.8", features = ["derive", "env"] }
futures = "0.3.17"
tempfile = "3.10.1"

[dev-dependencies]
env_logger = "0.11.3"
num_cpus = "1.16.0"
tokio = { workspace = true, features = ["rt-multi-thread"] }

[[test]]
harness = false
name = "sqllogictests"
path = "bin/sqllogictests.rs"
Loading