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/04/29 15:53:28 UTC

[GitHub] [arrow-datafusion] andygrove opened a new issue, #2379: Cannot resolve CTE in subquery expression

andygrove opened a new issue, #2379:
URL: https://github.com/apache/arrow-datafusion/issues/2379

   **Describe the bug**
   It is not possible to reference CTEs from subquery expressions. See test case below.
   
   **To Reproduce**
   ``` rust
   #[tokio::test]
   async fn subquery_references_cte() -> 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)?;
       let sql = "WITH \
           v1 AS (SELECT * FROM t1) \
           SELECT * FROM t1 WHERE EXISTS (SELECT * FROM v1 WHERE id = t1.id)";
       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!["++", "++"];
       assert_batches_eq!(expected, &actual);
       Ok(())
   }
   ```
   
   Fails with:
   
   ```
   Table or CTE with name 'v1' not found
   ```
   
   **Expected behavior**
   Test should pass
   
   **Additional context**
   None
   


-- 
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.apache.org

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


[GitHub] [arrow-datafusion] andygrove closed issue #2379: Cannot resolve CTE in subquery expression

Posted by GitBox <gi...@apache.org>.
andygrove closed issue #2379: Cannot resolve CTE in subquery expression
URL: https://github.com/apache/arrow-datafusion/issues/2379


-- 
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