You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by wa...@apache.org on 2023/04/15 13:45:08 UTC

[arrow-datafusion] branch main updated: fix: Allow values in subqueries (#6018)

This is an automated email from the ASF dual-hosted git repository.

wayne pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new e4c30d45e2 fix: Allow values in subqueries (#6018)
e4c30d45e2 is described below

commit e4c30d45e2ac362002bfb096d24572a2efd6f185
Author: Sean Smith <sc...@gmail.com>
AuthorDate: Sat Apr 15 08:45:02 2023 -0500

    fix: Allow values in subqueries (#6018)
---
 datafusion/core/tests/sqllogictests/test_files/subquery.slt | 8 ++++++++
 datafusion/optimizer/src/analyzer/mod.rs                    | 1 +
 2 files changed, 9 insertions(+)

diff --git a/datafusion/core/tests/sqllogictests/test_files/subquery.slt b/datafusion/core/tests/sqllogictests/test_files/subquery.slt
index 0c108e2c81..780b24be63 100644
--- a/datafusion/core/tests/sqllogictests/test_files/subquery.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/subquery.slt
@@ -99,3 +99,11 @@ where t1.t1_id not in ((
 ----
 22 b 2
 33 c 3
+
+# VALUES in subqueries, see 6017
+query I
+select t1_id
+from t1
+where t1_int = (select max(i) from (values (1)) as s(i));
+----
+11
diff --git a/datafusion/optimizer/src/analyzer/mod.rs b/datafusion/optimizer/src/analyzer/mod.rs
index b5a29a2876..401db7f025 100644
--- a/datafusion/optimizer/src/analyzer/mod.rs
+++ b/datafusion/optimizer/src/analyzer/mod.rs
@@ -195,6 +195,7 @@ fn check_correlations_in_subquery(
         | LogicalPlan::TableScan(_)
         | LogicalPlan::EmptyRelation(_)
         | LogicalPlan::Limit(_)
+        | LogicalPlan::Values(_)
         | LogicalPlan::Subquery(_)
         | LogicalPlan::SubqueryAlias(_) => {
             inner_plan.apply_children(&mut |plan| {