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/27 19:47:14 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #2354: Add SQL query planner support for Scalar Subqueries

alamb commented on code in PR #2354:
URL: https://github.com/apache/arrow-datafusion/pull/2354#discussion_r860185643


##########
datafusion/core/src/sql/planner.rs:
##########
@@ -1913,6 +1911,16 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
         })
     }
 
+    fn parse_scalar_subquery(
+        &self,
+        subquery: &Query,
+        input_schema: &DFSchema,
+    ) -> Result<Expr> {
+        Ok(Expr::ScalarSubquery(Subquery {
+            subquery: Arc::new(self.subquery_to_plan(subquery.clone(), input_schema)?),

Review Comment:
   So the scalar subquery must produce a single row typically otherwise it is a runtime error
   
   Do you have thoughts about in what stage a query like the following would throw an error?
   
   ```
   "SELECT p.id, (SELECT id FROM person) FROM person p"
   ```



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