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

test(substrait): update TPCH tests #12462

Merged
merged 9 commits into from
Sep 16, 2024
9 changes: 7 additions & 2 deletions datafusion/substrait/src/logical_plan/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2064,14 +2064,19 @@ fn from_substrait_literal(
// DF only supports millisecond precision, so for any more granular type we lose precision
let milliseconds = match precision_mode {
Some(PrecisionMode::Microseconds(ms)) => ms / 1000,
None =>
if *subseconds != 0 {
return substrait_err!("Cannot set subseconds field of IntervalDayToSecond without setting precision");
} else {
0_i32
}
Some(PrecisionMode::Precision(0)) => *subseconds as i32 * 1000,
Some(PrecisionMode::Precision(3)) => *subseconds as i32,
Some(PrecisionMode::Precision(6)) => (subseconds / 1000) as i32,
Some(PrecisionMode::Precision(9)) => (subseconds / 1000 / 1000) as i32,
_ => {
return not_impl_err!(
"Unsupported Substrait interval day to second precision mode"
)
"Unsupported Substrait interval day to second precision mode: {precision_mode:?}")
}
};

Expand Down
796 changes: 331 additions & 465 deletions datafusion/substrait/tests/cases/consumer_integration.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion datafusion/substrait/tests/cases/function_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ mod tests {
#[tokio::test]
async fn contains_function_test() -> Result<()> {
let proto_plan = read_json("tests/testdata/contains_plan.substrait.json");
let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto_plan);
let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto_plan)?;
let plan = from_substrait_plan(&ctx, &proto_plan).await?;

let plan_str = format!("{}", plan);
Expand Down
6 changes: 3 additions & 3 deletions datafusion/substrait/tests/cases/logical_plans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ mod tests {
// ./isthmus-cli/build/graal/isthmus --create "create table data (d boolean)" "select not d from data"
let proto_plan =
read_json("tests/testdata/test_plans/select_not_bool.substrait.json");
let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto_plan);
let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto_plan)?;
let plan = from_substrait_plan(&ctx, &proto_plan).await?;

assert_eq!(
Expand All @@ -62,7 +62,7 @@ mod tests {
// ./isthmus-cli/build/graal/isthmus --create "create table data (d int, part int, ord int)" "select sum(d) OVER (PARTITION BY part ORDER BY ord ROWS BETWEEN 1 PRECEDING AND UNBOUNDED FOLLOWING) AS lead_expr from data"
let proto_plan =
read_json("tests/testdata/test_plans/select_window.substrait.json");
let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto_plan);
let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto_plan)?;
let plan = from_substrait_plan(&ctx, &proto_plan).await?;

assert_eq!(
Expand All @@ -81,7 +81,7 @@ mod tests {
// This test confirms that reading a plan with non-nullable lists works as expected.
let proto_plan =
read_json("tests/testdata/test_plans/non_nullable_lists.substrait.json");
let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto_plan);
let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto_plan)?;
let plan = from_substrait_plan(&ctx, &proto_plan).await?;

assert_eq!(format!("{}", &plan), "Values: (List([1, 2]))");
Expand Down
2 changes: 0 additions & 2 deletions datafusion/substrait/tests/testdata/tpch/customer.csv

This file was deleted.

2 changes: 0 additions & 2 deletions datafusion/substrait/tests/testdata/tpch/lineitem.csv

This file was deleted.

2 changes: 0 additions & 2 deletions datafusion/substrait/tests/testdata/tpch/nation.csv

This file was deleted.

2 changes: 0 additions & 2 deletions datafusion/substrait/tests/testdata/tpch/orders.csv

This file was deleted.

2 changes: 0 additions & 2 deletions datafusion/substrait/tests/testdata/tpch/part.csv

This file was deleted.

2 changes: 0 additions & 2 deletions datafusion/substrait/tests/testdata/tpch/partsupp.csv

This file was deleted.

2 changes: 0 additions & 2 deletions datafusion/substrait/tests/testdata/tpch/region.csv

This file was deleted.

2 changes: 0 additions & 2 deletions datafusion/substrait/tests/testdata/tpch/supplier.csv

This file was deleted.

Loading