You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by zu...@apache.org on 2016/04/19 18:44:24 UTC

[11/24] incubator-quickstep git commit: Adds support for IN predicate (#167)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0fd8c039/query_optimizer/tests/physical_generator/Select.test
----------------------------------------------------------------------
diff --git a/query_optimizer/tests/physical_generator/Select.test b/query_optimizer/tests/physical_generator/Select.test
index 61ba01c..2fa3720 100644
--- a/query_optimizer/tests/physical_generator/Select.test
+++ b/query_optimizer/tests/physical_generator/Select.test
@@ -1802,3 +1802,314 @@ TopLevelPlan
 |     relation=generate_series,type=Int]
 +-output_attributes=
   +-AttributeReference[id=1,name=i,relation=,type=Int]
+==
+
+# IN predicate
+SELECT char_col
+FROM test
+WHERE int_col IN (1, 2, 3);
+--
+[Optimized Logical Plan]
+TopLevelPlan
++-plan=Project
+| +-input=Filter
+| | +-input=TableReference[relation_name=Test,relation_alias=test]
+| | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| | | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
+| | | +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
+| | | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL]
+| | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+| | | +-AttributeReference[id=5,name=vchar_col,relation=test,
+| | |   type=VarChar(20) NULL]
+| | +-filter_predicate=InValueList
+| |   +-test_expression=AttributeReference[id=0,name=int_col,relation=test,
+| |   | type=Int NULL]
+| |   +-match_expressions=
+| |     +-Literal[value=1,type=Int]
+| |     +-Literal[value=2,type=Int]
+| |     +-Literal[value=3,type=Int]
+| +-project_list=
+|   +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
++-output_attributes=
+  +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+[Physical Plan]
+TopLevelPlan
++-plan=Selection
+| +-input=TableReference[relation=Test,alias=test]
+| | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
+| | +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
+| | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL]
+| | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+| | +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL]
+| +-filter_predicate=InValueList
+| | +-test_expression=AttributeReference[id=0,name=int_col,relation=test,
+| | | type=Int NULL]
+| | +-match_expressions=
+| |   +-Literal[value=1,type=Int]
+| |   +-Literal[value=2,type=Int]
+| |   +-Literal[value=3,type=Int]
+| +-project_expressions=
+|   +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
++-output_attributes=
+  +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+==
+
+SELECT char_col
+FROM test
+WHERE int_col*2 NOT IN (
+        long_col+1,
+        CASE WHEN float_col > 0 THEN 1
+             ELSE double_col END);
+--
+[Optimized Logical Plan]
+TopLevelPlan
++-plan=Project
+| +-input=Filter
+| | +-input=TableReference[relation_name=Test,relation_alias=test]
+| | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| | | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
+| | | +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
+| | | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL]
+| | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+| | | +-AttributeReference[id=5,name=vchar_col,relation=test,
+| | |   type=VarChar(20) NULL]
+| | +-filter_predicate=NOT
+| |   +-InValueList
+| |     +-test_expression=Multiply
+| |     | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| |     | +-Literal[value=2,type=Int]
+| |     +-match_expressions=
+| |       +-Add
+| |       | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
+| |       | +-Literal[value=1,type=Int]
+| |       +-SearchedCase
+| |         +-else_result_expression=AttributeReference[id=3,name=double_col,
+| |         | relation=test,type=Double NULL]
+| |         +-condition_perdicates=
+| |         | +-Greater
+| |         |   +-AttributeReference[id=2,name=float_col,relation=test,
+| |         |   | type=Float]
+| |         |   +-Literal[value=0,type=Int]
+| |         +-conditional_result_expressions=
+| |           +-Cast[target_type=Double NULL]
+| |             +-operand=Literal[value=1,type=Int]
+| +-project_list=
+|   +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
++-output_attributes=
+  +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+[Physical Plan]
+TopLevelPlan
++-plan=Selection
+| +-input=TableReference[relation=Test,alias=test]
+| | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
+| | +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
+| | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL]
+| | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+| | +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL]
+| +-filter_predicate=NOT
+| | +-InValueList
+| |   +-test_expression=Multiply
+| |   | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| |   | +-Literal[value=2,type=Int]
+| |   +-match_expressions=
+| |     +-Add
+| |     | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
+| |     | +-Literal[value=1,type=Int]
+| |     +-SearchedCase
+| |       +-else_result_expression=AttributeReference[id=3,name=double_col,
+| |       | relation=test,type=Double NULL]
+| |       +-condition_perdicates=
+| |       | +-Greater
+| |       |   +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
+| |       |   +-Literal[value=0,type=Int]
+| |       +-conditional_result_expressions=
+| |         +-Cast[target_type=Double NULL]
+| |           +-operand=Literal[value=1,type=Int]
+| +-project_expressions=
+|   +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
++-output_attributes=
+  +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+==
+
+SELECT char_col
+FROM test
+WHERE int_col IN (
+  SELECT SUM(long_col) - 10
+  FROM test
+  GROUP BY vchar_col
+);
+--
+[Optimized Logical Plan]
+TopLevelPlan
++-plan=Project
+| +-input=HashLeftSemiJoin
+| | +-left=TableReference[relation_name=Test,relation_alias=test]
+| | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| | | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
+| | | +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
+| | | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL]
+| | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+| | | +-AttributeReference[id=5,name=vchar_col,relation=test,
+| | |   type=VarChar(20) NULL]
+| | +-right=Project
+| | | +-input=Aggregate
+| | | | +-input=TableReference[relation_name=Test,relation_alias=test]
+| | | | | +-AttributeReference[id=6,name=int_col,relation=test,type=Int NULL]
+| | | | | +-AttributeReference[id=7,name=long_col,relation=test,type=Long]
+| | | | | +-AttributeReference[id=8,name=float_col,relation=test,type=Float]
+| | | | | +-AttributeReference[id=9,name=double_col,relation=test,
+| | | | | | type=Double NULL]
+| | | | | +-AttributeReference[id=10,name=char_col,relation=test,type=Char(20)]
+| | | | | +-AttributeReference[id=11,name=vchar_col,relation=test,
+| | | | |   type=VarChar(20) NULL]
+| | | | +-grouping_expressions=
+| | | | | +-AttributeReference[id=11,name=vchar_col,relation=test,
+| | | | |   type=VarChar(20) NULL]
+| | | | +-aggregate_expressions=
+| | | |   +-Alias[id=12,name=,alias=$aggregate0,relation=$aggregate,
+| | | |     type=Long NULL]
+| | | |     +-AggregateFunction[function=SUM]
+| | | |       +-AttributeReference[id=7,name=long_col,relation=test,type=Long]
+| | | +-project_list=
+| | |   +-Alias[id=13,name=,alias=(SUM(long_col)-10),relation=,type=Long NULL]
+| | |     +-Subtract
+| | |       +-AttributeReference[id=12,name=,alias=$aggregate0,
+| | |       | relation=$aggregate,type=Long NULL]
+| | |       +-Literal[value=10,type=Int]
+| | +-left_join_attributes=
+| | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| | +-right_join_attributes=
+| |   +-AttributeReference[id=13,name=,alias=(SUM(long_col)-10),relation=,
+| |     type=Long NULL]
+| +-project_list=
+|   +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
++-output_attributes=
+  +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+[Physical Plan]
+TopLevelPlan
++-plan=HashLeftSemiJoin
+| +-left=TableReference[relation=Test,alias=test]
+| | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
+| | +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
+| | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL]
+| | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+| | +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL]
+| +-right=Selection
+| | +-input=Aggregate
+| | | +-input=TableReference[relation=Test,alias=test]
+| | | | +-AttributeReference[id=6,name=int_col,relation=test,type=Int NULL]
+| | | | +-AttributeReference[id=7,name=long_col,relation=test,type=Long]
+| | | | +-AttributeReference[id=8,name=float_col,relation=test,type=Float]
+| | | | +-AttributeReference[id=9,name=double_col,relation=test,type=Double NULL]
+| | | | +-AttributeReference[id=10,name=char_col,relation=test,type=Char(20)]
+| | | | +-AttributeReference[id=11,name=vchar_col,relation=test,
+| | | |   type=VarChar(20) NULL]
+| | | +-grouping_expressions=
+| | | | +-AttributeReference[id=11,name=vchar_col,relation=test,
+| | | |   type=VarChar(20) NULL]
+| | | +-aggregate_expressions=
+| | |   +-Alias[id=12,name=,alias=$aggregate0,relation=$aggregate,type=Long NULL]
+| | |     +-AggregateFunction[function=SUM]
+| | |       +-AttributeReference[id=7,name=long_col,relation=test,type=Long]
+| | +-project_expressions=
+| |   +-Alias[id=13,name=,alias=(SUM(long_col)-10),relation=,type=Long NULL]
+| |     +-Subtract
+| |       +-AttributeReference[id=12,name=,alias=$aggregate0,
+| |       | relation=$aggregate,type=Long NULL]
+| |       +-Literal[value=10,type=Int]
+| +-project_expressions=
+| | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+| +-left_join_attributes=
+| | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| +-right_join_attributes=
+|   +-AttributeReference[id=13,name=,alias=(SUM(long_col)-10),relation=,
+|     type=Long NULL]
++-output_attributes=
+  +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+==
+
+SELECT char_col
+FROM test
+WHERE int_col NOT IN (
+  SELECT long_col
+  FROM test
+  WHERE long_col IN (1, 2)
+);
+--
+[Optimized Logical Plan]
+TopLevelPlan
++-plan=Project
+| +-input=HashLeftAntiJoin
+| | +-left=TableReference[relation_name=Test,relation_alias=test]
+| | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| | | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
+| | | +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
+| | | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL]
+| | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+| | | +-AttributeReference[id=5,name=vchar_col,relation=test,
+| | |   type=VarChar(20) NULL]
+| | +-right=Project
+| | | +-input=Filter
+| | | | +-input=TableReference[relation_name=Test,relation_alias=test]
+| | | | | +-AttributeReference[id=6,name=int_col,relation=test,type=Int NULL]
+| | | | | +-AttributeReference[id=7,name=long_col,relation=test,type=Long]
+| | | | | +-AttributeReference[id=8,name=float_col,relation=test,type=Float]
+| | | | | +-AttributeReference[id=9,name=double_col,relation=test,
+| | | | | | type=Double NULL]
+| | | | | +-AttributeReference[id=10,name=char_col,relation=test,type=Char(20)]
+| | | | | +-AttributeReference[id=11,name=vchar_col,relation=test,
+| | | | |   type=VarChar(20) NULL]
+| | | | +-filter_predicate=InValueList
+| | | |   +-test_expression=AttributeReference[id=7,name=long_col,relation=test,
+| | | |   | type=Long]
+| | | |   +-match_expressions=
+| | | |     +-Literal[value=1,type=Long]
+| | | |     +-Literal[value=2,type=Long]
+| | | +-project_list=
+| | |   +-AttributeReference[id=7,name=long_col,relation=test,type=Long]
+| | +-left_join_attributes=
+| | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| | +-right_join_attributes=
+| |   +-AttributeReference[id=7,name=long_col,relation=test,type=Long]
+| +-project_list=
+|   +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
++-output_attributes=
+  +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+[Physical Plan]
+TopLevelPlan
++-plan=HashLeftAntiJoin
+| +-left=TableReference[relation=Test,alias=test]
+| | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
+| | +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
+| | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL]
+| | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+| | +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL]
+| +-right=Selection
+| | +-input=TableReference[relation=Test,alias=test]
+| | | +-AttributeReference[id=6,name=int_col,relation=test,type=Int NULL]
+| | | +-AttributeReference[id=7,name=long_col,relation=test,type=Long]
+| | | +-AttributeReference[id=8,name=float_col,relation=test,type=Float]
+| | | +-AttributeReference[id=9,name=double_col,relation=test,type=Double NULL]
+| | | +-AttributeReference[id=10,name=char_col,relation=test,type=Char(20)]
+| | | +-AttributeReference[id=11,name=vchar_col,relation=test,
+| | |   type=VarChar(20) NULL]
+| | +-filter_predicate=InValueList
+| | | +-test_expression=AttributeReference[id=7,name=long_col,relation=test,
+| | | | type=Long]
+| | | +-match_expressions=
+| | |   +-Literal[value=1,type=Long]
+| | |   +-Literal[value=2,type=Long]
+| | +-project_expressions=
+| |   +-AttributeReference[id=7,name=long_col,relation=test,type=Long]
+| +-project_expressions=
+| | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+| +-left_join_attributes=
+| | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| +-right_join_attributes=
+|   +-AttributeReference[id=7,name=long_col,relation=test,type=Long]
++-output_attributes=
+  +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0fd8c039/query_optimizer/tests/resolver/Select.test
----------------------------------------------------------------------
diff --git a/query_optimizer/tests/resolver/Select.test b/query_optimizer/tests/resolver/Select.test
index 2276de3..82bdb55 100644
--- a/query_optimizer/tests/resolver/Select.test
+++ b/query_optimizer/tests/resolver/Select.test
@@ -2599,3 +2599,197 @@ TopLevelPlan
 |       type=Long NULL]
 +-output_attributes=
   +-AttributeReference[id=6,name=result,relation=,type=Long NULL]
+==
+
+# IN predicate
+SELECT char_col
+FROM test
+WHERE int_col IN (1, 2, 3);
+--
+TopLevelPlan
++-plan=Project
+| +-input=Filter
+| | +-input=TableReference[relation_name=Test,relation_alias=test]
+| | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| | | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
+| | | +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
+| | | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL]
+| | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+| | | +-AttributeReference[id=5,name=vchar_col,relation=test,
+| | |   type=VarChar(20) NULL]
+| | +-filter_predicate=InValueList
+| |   +-test_expression=AttributeReference[id=0,name=int_col,relation=test,
+| |   | type=Int NULL]
+| |   +-match_expressions=
+| |     +-Literal[value=1,type=Int]
+| |     +-Literal[value=2,type=Int]
+| |     +-Literal[value=3,type=Int]
+| +-project_list=
+|   +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
++-output_attributes=
+  +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+==
+
+SELECT char_col
+FROM test
+WHERE int_col*2 NOT IN (
+        long_col+1,
+        CASE WHEN float_col > 0 THEN 1
+             ELSE double_col END);
+--
+TopLevelPlan
++-plan=Project
+| +-input=Filter
+| | +-input=TableReference[relation_name=Test,relation_alias=test]
+| | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| | | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
+| | | +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
+| | | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL]
+| | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+| | | +-AttributeReference[id=5,name=vchar_col,relation=test,
+| | |   type=VarChar(20) NULL]
+| | +-filter_predicate=NOT
+| |   +-InValueList
+| |     +-test_expression=Multiply
+| |     | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| |     | +-Literal[value=2,type=Int]
+| |     +-match_expressions=
+| |       +-Add
+| |       | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
+| |       | +-Literal[value=1,type=Int]
+| |       +-SearchedCase
+| |         +-else_result_expression=AttributeReference[id=3,name=double_col,
+| |         | relation=test,type=Double NULL]
+| |         +-condition_perdicates=
+| |         | +-Greater
+| |         |   +-AttributeReference[id=2,name=float_col,relation=test,
+| |         |   | type=Float]
+| |         |   +-Literal[value=0,type=Int]
+| |         +-conditional_result_expressions=
+| |           +-Cast[target_type=Double NULL]
+| |             +-operand=Literal[value=1,type=Int]
+| +-project_list=
+|   +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
++-output_attributes=
+  +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+==
+
+SELECT char_col
+FROM test
+WHERE int_col IN (
+  SELECT SUM(long_col) - 10
+  FROM test
+  GROUP BY vchar_col
+);
+--
+TopLevelPlan
++-plan=Project
+| +-input=Filter
+| | +-input=TableReference[relation_name=Test,relation_alias=test]
+| | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| | | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
+| | | +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
+| | | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL]
+| | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+| | | +-AttributeReference[id=5,name=vchar_col,relation=test,
+| | |   type=VarChar(20) NULL]
+| | +-filter_predicate=InTableQuery
+| |   +-test_expression=AttributeReference[id=0,name=int_col,relation=test,
+| |   | type=Int NULL]
+| |   +-table_query=SubqueryExpression
+| |     +-subquery=Project
+| |       +-input=Aggregate
+| |       | +-input=TableReference[relation_name=Test,relation_alias=test]
+| |       | | +-AttributeReference[id=6,name=int_col,relation=test,type=Int NULL]
+| |       | | +-AttributeReference[id=7,name=long_col,relation=test,type=Long]
+| |       | | +-AttributeReference[id=8,name=float_col,relation=test,type=Float]
+| |       | | +-AttributeReference[id=9,name=double_col,relation=test,
+| |       | | | type=Double NULL]
+| |       | | +-AttributeReference[id=10,name=char_col,relation=test,
+| |       | | | type=Char(20)]
+| |       | | +-AttributeReference[id=11,name=vchar_col,relation=test,
+| |       | |   type=VarChar(20) NULL]
+| |       | +-grouping_expressions=
+| |       | | +-AttributeReference[id=11,name=vchar_col,relation=test,
+| |       | |   type=VarChar(20) NULL]
+| |       | +-aggregate_expressions=
+| |       |   +-Alias[id=12,name=,alias=$aggregate0,relation=$aggregate,
+| |       |     type=Long NULL]
+| |       |     +-AggregateFunction[function=SUM]
+| |       |       +-AttributeReference[id=7,name=long_col,relation=test,
+| |       |         type=Long]
+| |       +-project_list=
+| |         +-Alias[id=13,name=,alias=(SUM(long_col)-10),relation=,
+| |           type=Long NULL]
+| |           +-Subtract
+| |             +-AttributeReference[id=12,name=,alias=$aggregate0,
+| |             | relation=$aggregate,type=Long NULL]
+| |             +-Literal[value=10,type=Int]
+| +-project_list=
+|   +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
++-output_attributes=
+  +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+==
+
+SELECT char_col
+FROM test
+WHERE int_col NOT IN (
+  SELECT long_col
+  FROM test
+  WHERE long_col IN (1, 2)
+);
+--
+TopLevelPlan
++-plan=Project
+| +-input=Filter
+| | +-input=TableReference[relation_name=Test,relation_alias=test]
+| | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| | | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
+| | | +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
+| | | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL]
+| | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+| | | +-AttributeReference[id=5,name=vchar_col,relation=test,
+| | |   type=VarChar(20) NULL]
+| | +-filter_predicate=NOT
+| |   +-InTableQuery
+| |     +-test_expression=AttributeReference[id=0,name=int_col,relation=test,
+| |     | type=Int NULL]
+| |     +-table_query=SubqueryExpression
+| |       +-subquery=Project
+| |         +-input=Filter
+| |         | +-input=TableReference[relation_name=Test,relation_alias=test]
+| |         | | +-AttributeReference[id=6,name=int_col,relation=test,
+| |         | | | type=Int NULL]
+| |         | | +-AttributeReference[id=7,name=long_col,relation=test,type=Long]
+| |         | | +-AttributeReference[id=8,name=float_col,relation=test,
+| |         | | | type=Float]
+| |         | | +-AttributeReference[id=9,name=double_col,relation=test,
+| |         | | | type=Double NULL]
+| |         | | +-AttributeReference[id=10,name=char_col,relation=test,
+| |         | | | type=Char(20)]
+| |         | | +-AttributeReference[id=11,name=vchar_col,relation=test,
+| |         | |   type=VarChar(20) NULL]
+| |         | +-filter_predicate=InValueList
+| |         |   +-test_expression=AttributeReference[id=7,name=long_col,
+| |         |   | relation=test,type=Long]
+| |         |   +-match_expressions=
+| |         |     +-Literal[value=1,type=Long]
+| |         |     +-Literal[value=2,type=Long]
+| |         +-project_list=
+| |           +-AttributeReference[id=7,name=long_col,relation=test,type=Long]
+| +-project_list=
+|   +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
++-output_attributes=
+  +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+==
+
+SELECT *
+FROM generate_series(1, 10) AS gs1(i)
+WHERE i IN (
+  SELECT j, j+1
+  FROM generate_series(1, 5) AS gs2(j)
+);
+--
+ERROR: Subquery must return exactly one column (3 : 12)
+WHERE i IN (
+           ^