You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/05/02 14:16:46 UTC

[GitHub] [arrow-datafusion] andygrove commented on a diff in pull request #2402: nested query fix

andygrove commented on code in PR #2402:
URL: https://github.com/apache/arrow-datafusion/pull/2402#discussion_r862884307


##########
datafusion/core/tests/sql/expr.rs:
##########
@@ -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

Review Comment:
   I think this comment can be removed since the test actually is executing and producing the correct result?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org