Skip to content

Commit

Permalink
Add test cases with partitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Dandandan committed Apr 19, 2021
1 parent c3de861 commit 0007743
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
1 change: 0 additions & 1 deletion datafusion/src/physical_plan/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ impl fmt::Debug for MemoryExec {
write!(f, "partitions: [...]")?;
write!(f, "schema: {:?}", self.schema)?;
write!(f, "projection: {:?}", self.projection)

}
}

Expand Down
16 changes: 13 additions & 3 deletions datafusion/tests/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1289,8 +1289,8 @@ async fn equijoin_implicit_syntax_reversed() -> Result<()> {
}

#[tokio::test]
async fn cross_join() -> Result<()> {
let mut ctx = create_join_context("t1_id", "t2_id")?;
async fn cross_join() {
let mut ctx = create_join_context("t1_id", "t2_id").unwrap();

let sql = "SELECT t1_id, t1_name, t2_name FROM t1, t2 ORDER BY t1_id";
let actual = execute(&mut ctx, sql).await;
Expand Down Expand Up @@ -1329,7 +1329,17 @@ async fn cross_join() -> Result<()> {
]
);

Ok(())
// Two partitions (from UNION) on the left
let sql = "SELECT * FROM (SELECT t1_id, t1_name FROM t1 UNION ALL SELECT t1_id, t1_name FROM t1) t1 CROSS JOIN t2";
let actual = execute(&mut ctx, sql).await;

assert_eq!(4 * 4 * 2, actual.len());

// Two partitions (from UNION) on the right
let sql = "SELECT t1_id, t1_name, t2_name FROM t1 CROSS JOIN (SELECT t2_name FROM t2 UNION ALL SELECT t2_name FROM t2)";
let actual = execute(&mut ctx, sql).await;

assert_eq!(4 * 4 * 2, actual.len());
}

fn create_join_context(
Expand Down

0 comments on commit 0007743

Please sign in to comment.