-
Notifications
You must be signed in to change notification settings - Fork 1.9k
nested query fix #2402
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
nested query fix #2402
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,8 @@ | |
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| use datafusion::datasource::empty::EmptyTable; | ||
|
|
||
| use super::*; | ||
|
|
||
| #[tokio::test] | ||
|
|
@@ -1127,3 +1129,25 @@ async fn csv_query_sqrt_sqrt() -> Result<()> { | |
| assert_float_eq(&expected, &actual); | ||
| Ok(()) | ||
| } | ||
|
|
||
| #[tokio::test] | ||
| async fn nested_subquery() -> Result<()> { | ||
| let ctx = SessionContext::new(); | ||
| let schema = Schema::new(vec![ | ||
| Field::new("id", DataType::Int16, false), | ||
| Field::new("a", DataType::Int16, false), | ||
| ]); | ||
| let empty_table = Arc::new(EmptyTable::new(Arc::new(schema))); | ||
| ctx.register_table("t1", empty_table.clone())?; | ||
| ctx.register_table("t2", empty_table)?; | ||
| let sql = "SELECT COUNT(*) as cnt \ | ||
| FROM (\ | ||
| (SELECT id FROM t1) EXCEPT \ | ||
| (SELECT id FROM t2)\ | ||
| ) foo"; | ||
| let actual = execute_to_batches(&ctx, sql).await; | ||
| // the purpose of this test is just to make sure the query produces a valid plan | ||
| let expected = vec!["+-----+", "| cnt |", "+-----+", "| 0 |", "+-----+"]; | ||
|
Member
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. Could you disable rustfmt for this line and format it so that it is easier to read, as shown in #2413
Member
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. I'm going to go ahead and merge this. Perhaps we can improve the test formatting as a separate PR. |
||
| assert_batches_eq!(expected, &actual); | ||
| Ok(()) | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.