You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 891a800
Browse filesBrowse the repository at this point in the historyBrowse files
let ctx = SessionContext::with_config(SessionConfig::new().with_target_partitions(2));
1653
+
register_aggregate_csv(&ctx).await?;
1654
+
1655
+
let sql = "SELECT c2, MAX(c9) OVER (ORDER BY c2), SUM(c9) OVER (), MIN(c9) OVER (ORDER BY c2, c9) from aggregate_test_100";
1656
+
1657
+
let msg = format!("Creating logical plan for '{}'", sql);
1658
+
let plan = ctx.create_logical_plan(sql).expect(&msg);
1659
+
let state = ctx.state();
1660
+
let logical_plan = state.optimize(&plan)?;
1661
+
let physical_plan = state.create_physical_plan(&logical_plan).await?;
1662
+
let formatted = displayable(physical_plan.as_ref()).indent().to_string();
1663
+
// Only 1 SortExec was added
1664
+
let expected = {
1665
+
vec![
1666
+
"ProjectionExec: expr=[c2@3 as c2, MAX(aggregate_test_100.c9) ORDER BY [aggregate_test_100.c2 ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW@1 as MAX(aggregate_test_100.c9), SUM(aggregate_test_100.c9) ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING@0 as SUM(aggregate_test_100.c9), MIN(aggregate_test_100.c9) ORDER BY [aggregate_test_100.c2 ASC NULLS LAST, aggregate_test_100.c9 ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW@2 as MIN(aggregate_test_100.c9)]",
let ctx = SessionContext::with_config(SessionConfig::new().with_target_partitions(2));
1689
+
register_aggregate_csv(&ctx).await?;
1690
+
1691
+
let sql = "SELECT c2, MAX(c9) OVER (ORDER BY c9, c2), SUM(c9) OVER (), MIN(c9) OVER (ORDER BY c2, c9) from aggregate_test_100 ORDER BY c2";
1692
+
let msg = format!("Creating logical plan for '{}'", sql);
1693
+
let plan = ctx.create_logical_plan(sql).expect(&msg);
1694
+
let state = ctx.state();
1695
+
let logical_plan = state.optimize(&plan)?;
1696
+
let physical_plan = state.create_physical_plan(&logical_plan).await?;
1697
+
let formatted = displayable(physical_plan.as_ref()).indent().to_string();
1698
+
// 3 SortExec are added
1699
+
let expected = {
1700
+
vec![
1701
+
"SortExec: [c2@0 ASC NULLS LAST]",
1702
+
" CoalescePartitionsExec",
1703
+
" ProjectionExec: expr=[c2@3 as c2, MAX(aggregate_test_100.c9) ORDER BY [aggregate_test_100.c9 ASC NULLS LAST, aggregate_test_100.c2 ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW@1 as MAX(aggregate_test_100.c9), SUM(aggregate_test_100.c9) ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING@0 as SUM(aggregate_test_100.c9), MIN(aggregate_test_100.c9) ORDER BY [aggregate_test_100.c2 ASC NULLS LAST, aggregate_test_100.c9 ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW@2 as MIN(aggregate_test_100.c9)]",
let ctx = SessionContext::with_config(SessionConfig::new().with_target_partitions(2));
1727
+
register_aggregate_csv(&ctx).await?;
1728
+
1729
+
let sql = "SELECT \
1730
+
SUM(c4) OVER(PARTITION BY c1, c2 ORDER BY c2 ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING),\
1731
+
COUNT(*) OVER(PARTITION BY c1 ORDER BY c2 ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) \
1732
+
FROM aggregate_test_100";
1733
+
1734
+
let msg = format!("Creating logical plan for '{}'", sql);
1735
+
let plan = ctx.create_logical_plan(sql).expect(&msg);
1736
+
let state = ctx.state();
1737
+
let logical_plan = state.optimize(&plan)?;
1738
+
let physical_plan = state.create_physical_plan(&logical_plan).await?;
1739
+
let formatted = displayable(physical_plan.as_ref()).indent().to_string();
1740
+
// Only 1 SortExec was added
1741
+
let expected = {
1742
+
vec![
1743
+
"ProjectionExec: expr=[SUM(aggregate_test_100.c4) PARTITION BY [aggregate_test_100.c1, aggregate_test_100.c2] ORDER BY [aggregate_test_100.c2 ASC NULLS LAST] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING@0 as SUM(aggregate_test_100.c4), COUNT(UInt8(1)) PARTITION BY [aggregate_test_100.c1] ORDER BY [aggregate_test_100.c2 ASC NULLS LAST] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING@1 as COUNT(UInt8(1))]",
0 commit comments