Skip to content

Commit 12f7411

Browse files
committed
fix
1 parent 9d005ff commit 12f7411

1 file changed

Lines changed: 20 additions & 19 deletions

File tree

datafusion/substrait/tests/cases/roundtrip_logical_plan.rs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -983,25 +983,6 @@ async fn roundtrip_is_not_unknown() -> Result<()> {
983983
roundtrip("SELECT * FROM data WHERE d IS NOT UNKNOWN").await
984984
}
985985

986-
#[tokio::test]
987-
async fn roundtrip_union() -> Result<()> {
988-
assert_expected_plan(
989-
"SELECT a, e FROM data UNION SELECT a, e FROM data",
990-
"Aggregate: groupBy=[[data.a, data.e]], aggr=[[]]\n TableScan: data projection=[a, e]",
991-
false,
992-
)
993-
.await
994-
}
995-
996-
#[tokio::test]
997-
async fn roundtrip_union2() -> Result<()> {
998-
assert_expected_plan(
999-
"SELECT a, b FROM data UNION SELECT a, b FROM data UNION SELECT a, b FROM data",
1000-
"Aggregate: groupBy=[[data.a, data.b]], aggr=[[]]\n TableScan: data projection=[a, b]",
1001-
false,
1002-
)
1003-
.await
1004-
}
1005986

1006987
#[tokio::test]
1007988
async fn roundtrip_union_all() -> Result<()> {
@@ -2058,6 +2039,26 @@ async fn generate_plan_from_sql(
20582039
Ok(plan2)
20592040
}
20602041

2042+
async fn assert_expected_plan_with_ctx(
2043+
ctx: SessionContext,
2044+
sql: &str,
2045+
expected_plan_str: &str,
2046+
assert_schema: bool,
2047+
) -> Result<()> {
2048+
let df = ctx.sql(sql).await?;
2049+
let plan = df.into_optimized_plan()?;
2050+
let plan2 = substrait_roundtrip(&plan, &ctx).await?;
2051+
2052+
if assert_schema {
2053+
assert_eq!(plan.schema(), plan2.schema());
2054+
}
2055+
2056+
let plan2str = format!("{plan2}");
2057+
assert_eq!(expected_plan_str, &plan2str);
2058+
2059+
Ok(())
2060+
}
2061+
20612062
async fn assert_expected_plan(
20622063
sql: &str,
20632064
expected_plan_str: &str,

0 commit comments

Comments
 (0)