-
Notifications
You must be signed in to change notification settings - Fork 14
Nested Loop Joins (fixes TPCH query 22) #104
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ mod tests { | |
| use async_trait::async_trait; | ||
| use datafusion::error::DataFusionError; | ||
| use datafusion::execution::SessionStateBuilder; | ||
|
|
||
| use datafusion::prelude::{SessionConfig, SessionContext}; | ||
| use datafusion_distributed::test_utils::localhost::start_localhost_context; | ||
| use datafusion_distributed::{DistributedPhysicalOptimizerRule, SessionBuilder}; | ||
|
|
@@ -119,8 +120,6 @@ mod tests { | |
| } | ||
|
|
||
| #[tokio::test] | ||
| // TODO: Add support for NestedLoopJoinExec to support query 22. | ||
| #[ignore] | ||
|
Comment on lines
-122
to
-123
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎉 |
||
| async fn test_tpch_22() -> Result<(), Box<dyn Error>> { | ||
| test_tpch_query(22).await | ||
| } | ||
|
|
@@ -155,7 +154,6 @@ mod tests { | |
|
|
||
| config.options_mut().optimizer.prefer_hash_join = true; | ||
| // end critical options section | ||
|
|
||
| let rule = DistributedPhysicalOptimizerRule::new().with_maximum_partitions_per_task(2); | ||
| Ok(builder | ||
| .with_config(config) | ||
|
|
@@ -174,7 +172,6 @@ mod tests { | |
| // and once in a non-distributed manner. For each query, it asserts that the results are identical. | ||
| async fn run_tpch_query(ctx2: SessionContext, query_id: u8) -> Result<(), Box<dyn Error>> { | ||
| ensure_tpch_data().await; | ||
|
|
||
| let sql = get_test_tpch_query(query_id); | ||
|
|
||
| // Context 1: Non-distributed execution. | ||
|
|
@@ -205,19 +202,21 @@ mod tests { | |
| .await?; | ||
| } | ||
|
|
||
| // Query 15 has three queries in it, one creating the view, the second | ||
| // executing, which we want to capture the output of, and the third | ||
| // tearing down the view | ||
| let (stream1, stream2) = if query_id == 15 { | ||
| let queries: Vec<&str> = sql | ||
| .split(';') | ||
| .map(str::trim) | ||
| .filter(|s| !s.is_empty()) | ||
| .collect(); | ||
|
|
||
| println!("queryies: {:?}", queries); | ||
|
|
||
| ctx1.sql(queries[0]).await?.collect().await?; | ||
| ctx2.sql(queries[0]).await?.collect().await?; | ||
| let df1 = ctx1.sql(queries[1]).await?; | ||
| let df2 = ctx2.sql(queries[1]).await?; | ||
|
|
||
| let stream1 = df1.execute_stream().await?; | ||
| let stream2 = df2.execute_stream().await?; | ||
|
|
||
|
|
@@ -227,6 +226,7 @@ mod tests { | |
| } else { | ||
| let stream1 = ctx1.sql(&sql).await?.execute_stream().await?; | ||
| let stream2 = ctx2.sql(&sql).await?.execute_stream().await?; | ||
|
|
||
| (stream1, stream2) | ||
| }; | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually, if a function is only used in one place, it can be better in the long run to just place it where it's used, as it's not really a common function.
Otherwise, following the same rule, we can end-up with a massive "utils" or "common" modules with a lot of unrelated stuff that is not really commonly used across the project.
This one for example could just be placed in
physical_optimizer.rsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha! This is why i always end up with massive utils and common in my projects! Good feedback. I'll move to
physical_optimizer.rs. 😅