From d59acf37a044e9b3dd9cbfb9d5c093dbb7051616 Mon Sep 17 00:00:00 2001 From: Andrew Kimball Date: Tue, 14 Aug 2018 23:58:29 -0700 Subject: [PATCH] opt: Update column formatting and rewrite all opt tests This removes the hack added in the previous commit so that the new column formatting rules can work. We now only qualify column names if it was explicitly requested via a formatting flag, or else if not qualifying would result in ambiguous column names, such as in this case: select a.x, b.x from a, b where a.x=b.x Release note: None --- pkg/sql/opt/memo/expr_view_format.go | 4 +- .../opt/memo/testdata/logprops/constraints | 138 ++-- .../memo/testdata/logprops/constraints-null | 28 +- pkg/sql/opt/memo/testdata/logprops/groupby | 14 +- pkg/sql/opt/memo/testdata/logprops/index-join | 10 +- pkg/sql/opt/memo/testdata/logprops/join | 114 +-- pkg/sql/opt/memo/testdata/logprops/limit | 2 +- pkg/sql/opt/memo/testdata/logprops/offset | 4 +- pkg/sql/opt/memo/testdata/logprops/project | 12 +- pkg/sql/opt/memo/testdata/logprops/scalar | 30 +- pkg/sql/opt/memo/testdata/logprops/select | 36 +- pkg/sql/opt/memo/testdata/logprops/set | 4 +- pkg/sql/opt/memo/testdata/logprops/values | 4 +- .../opt/memo/testdata/logprops/virtual-scan | 10 +- pkg/sql/opt/memo/testdata/memo | 28 +- pkg/sql/opt/memo/testdata/stats/groupby | 18 +- pkg/sql/opt/memo/testdata/stats/index-join | 4 +- pkg/sql/opt/memo/testdata/stats/join | 38 +- pkg/sql/opt/memo/testdata/stats/limit | 6 +- pkg/sql/opt/memo/testdata/stats/ordinality | 4 +- pkg/sql/opt/memo/testdata/stats/project | 14 +- pkg/sql/opt/memo/testdata/stats/scan | 4 +- pkg/sql/opt/memo/testdata/stats/select | 96 +-- pkg/sql/opt/memo/testdata/stats/set | 2 +- pkg/sql/opt/memo/testdata/typing | 92 +-- pkg/sql/opt/metadata.go | 8 +- pkg/sql/opt/norm/testdata/rules/agg | 24 +- pkg/sql/opt/norm/testdata/rules/bool | 130 ++-- pkg/sql/opt/norm/testdata/rules/combo | 242 +++---- pkg/sql/opt/norm/testdata/rules/comp | 68 +- pkg/sql/opt/norm/testdata/rules/decorrelate | 672 +++++++++--------- pkg/sql/opt/norm/testdata/rules/groupby | 52 +- pkg/sql/opt/norm/testdata/rules/inline | 32 +- pkg/sql/opt/norm/testdata/rules/join | 184 ++--- pkg/sql/opt/norm/testdata/rules/limit | 20 +- pkg/sql/opt/norm/testdata/rules/numeric | 42 +- pkg/sql/opt/norm/testdata/rules/ordering | 18 +- pkg/sql/opt/norm/testdata/rules/project | 2 +- pkg/sql/opt/norm/testdata/rules/prune_cols | 116 +-- pkg/sql/opt/norm/testdata/rules/reject_nulls | 32 +- pkg/sql/opt/norm/testdata/rules/scalar | 64 +- pkg/sql/opt/norm/testdata/rules/select | 176 ++--- pkg/sql/opt/norm/testdata/rules/side_effects | 32 +- pkg/sql/opt/optbuilder/testdata/aggregate | 384 +++++----- pkg/sql/opt/optbuilder/testdata/distinct | 30 +- pkg/sql/opt/optbuilder/testdata/distinct_on | 36 +- pkg/sql/opt/optbuilder/testdata/explain | 2 +- pkg/sql/opt/optbuilder/testdata/having | 40 +- pkg/sql/opt/optbuilder/testdata/join | 112 +-- pkg/sql/opt/optbuilder/testdata/limit | 2 +- pkg/sql/opt/optbuilder/testdata/orderby | 36 +- pkg/sql/opt/optbuilder/testdata/project | 20 +- pkg/sql/opt/optbuilder/testdata/scalar | 8 +- pkg/sql/opt/optbuilder/testdata/select | 52 +- pkg/sql/opt/optbuilder/testdata/srfs | 8 +- pkg/sql/opt/optbuilder/testdata/subquery | 28 +- pkg/sql/opt/optbuilder/testdata/view | 6 +- pkg/sql/opt/optbuilder/testdata/where | 30 +- pkg/sql/opt/testutils/format.go | 2 +- pkg/sql/opt/xform/testdata/coster/groupby | 4 +- pkg/sql/opt/xform/testdata/coster/join | 4 +- pkg/sql/opt/xform/testdata/coster/project | 6 +- pkg/sql/opt/xform/testdata/coster/select | 2 +- .../opt/xform/testdata/coster/virtual-scan | 2 +- .../opt/xform/testdata/external/activerecord | 26 +- pkg/sql/opt/xform/testdata/external/hibernate | 186 ++--- pkg/sql/opt/xform/testdata/external/liquibase | 16 +- pkg/sql/opt/xform/testdata/external/navicat | 16 +- pkg/sql/opt/xform/testdata/external/nova | 534 +++++++------- pkg/sql/opt/xform/testdata/external/pgadmin | 6 +- pkg/sql/opt/xform/testdata/external/pgjdbc | 2 +- pkg/sql/opt/xform/testdata/external/tpcc | 58 +- .../opt/xform/testdata/external/tpcc-no-stats | 58 +- pkg/sql/opt/xform/testdata/external/tpch | 290 ++++---- pkg/sql/opt/xform/testdata/physprops/ordering | 84 +-- .../opt/xform/testdata/physprops/presentation | 8 +- .../opt/xform/testdata/ruleprops/orderings | 14 +- pkg/sql/opt/xform/testdata/rules/combo | 60 +- pkg/sql/opt/xform/testdata/rules/groupby | 68 +- pkg/sql/opt/xform/testdata/rules/join | 194 ++--- pkg/sql/opt/xform/testdata/rules/limit | 2 +- pkg/sql/opt/xform/testdata/rules/scan | 6 +- pkg/sql/opt/xform/testdata/rules/select | 70 +- 83 files changed, 2568 insertions(+), 2574 deletions(-) diff --git a/pkg/sql/opt/memo/expr_view_format.go b/pkg/sql/opt/memo/expr_view_format.go index 774a034b04c1..a2fc87f606a3 100644 --- a/pkg/sql/opt/memo/expr_view_format.go +++ b/pkg/sql/opt/memo/expr_view_format.go @@ -449,7 +449,7 @@ func formatCol(f *ExprFmtCtx, label string, id opt.ColumnID, notNullCols opt.Col md := f.Memo.metadata if label == "" { fullyQualify := !f.HasFlags(ExprFmtHideQualifications) - label = md.QualifiedColumnLabel(id, fullyQualify, false /* useTable */) + label = md.QualifiedColumnLabel(id, fullyQualify) } if !isSimpleColumnName(label) { @@ -505,7 +505,7 @@ func formatPrivate(f *ExprFmtCtx, private interface{}, physProps *props.Physical case opt.ColumnID: fullyQualify := !f.HasFlags(ExprFmtHideQualifications) - label := f.Memo.metadata.QualifiedColumnLabel(t, fullyQualify, true /* useTable */) + label := f.Memo.metadata.QualifiedColumnLabel(t, fullyQualify) fmt.Fprintf(f.Buffer, " %s", label) case *IndexJoinDef: diff --git a/pkg/sql/opt/memo/testdata/logprops/constraints b/pkg/sql/opt/memo/testdata/logprops/constraints index 91e16118e4a8..7cad21fd718e 100644 --- a/pkg/sql/opt/memo/testdata/logprops/constraints +++ b/pkg/sql/opt/memo/testdata/logprops/constraints @@ -33,7 +33,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1), constraints=(/1: [/2 - ]; tight)] └── gt [type=bool, outer=(1), constraints=(/1: [/2 - ]; tight)] - ├── variable: a.x [type=int, outer=(1)] + ├── variable: x [type=int, outer=(1)] └── const: 1 [type=int] opt @@ -51,7 +51,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1), constraints=(/1: [/1 - ]; tight)] └── ge [type=bool, outer=(1), constraints=(/1: [/1 - ]; tight)] - ├── variable: a.x [type=int, outer=(1)] + ├── variable: x [type=int, outer=(1)] └── const: 1 [type=int] opt @@ -69,7 +69,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1), constraints=(/1: (/NULL - /0]; tight)] └── lt [type=bool, outer=(1), constraints=(/1: (/NULL - /0]; tight)] - ├── variable: a.x [type=int, outer=(1)] + ├── variable: x [type=int, outer=(1)] └── const: 1 [type=int] opt @@ -87,7 +87,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1), constraints=(/1: (/NULL - /1]; tight)] └── le [type=bool, outer=(1), constraints=(/1: (/NULL - /1]; tight)] - ├── variable: a.x [type=int, outer=(1)] + ├── variable: x [type=int, outer=(1)] └── const: 1 [type=int] opt @@ -106,7 +106,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1), constraints=(/1: [/1 - /1]; tight), fd=()-->(1)] └── eq [type=bool, outer=(1), constraints=(/1: [/1 - /1]; tight)] - ├── variable: a.x [type=int, outer=(1)] + ├── variable: x [type=int, outer=(1)] └── const: 1 [type=int] opt @@ -124,10 +124,10 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1), constraints=(/1: [/2 - /4]; tight)] ├── gt [type=bool, outer=(1), constraints=(/1: [/2 - ]; tight)] - │ ├── variable: a.x [type=int, outer=(1)] + │ ├── variable: x [type=int, outer=(1)] │ └── const: 1 [type=int] └── lt [type=bool, outer=(1), constraints=(/1: (/NULL - /4]; tight)] - ├── variable: a.x [type=int, outer=(1)] + ├── variable: x [type=int, outer=(1)] └── const: 5 [type=int] opt @@ -145,10 +145,10 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1,2), constraints=(/1: [/1 - /1]; /2: [/5 - /5]; tight), fd=()-->(1,2)] ├── eq [type=bool, outer=(1), constraints=(/1: [/1 - /1]; tight)] - │ ├── variable: a.x [type=int, outer=(1)] + │ ├── variable: x [type=int, outer=(1)] │ └── const: 1 [type=int] └── eq [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] - ├── variable: a.y [type=int, outer=(2)] + ├── variable: y [type=int, outer=(2)] └── const: 5 [type=int] opt @@ -165,16 +165,16 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1,2), constraints=(/1: [/2 - /4]; /2: [/7 - /9]; tight)] ├── gt [type=bool, outer=(1), constraints=(/1: [/2 - ]; tight)] - │ ├── variable: a.x [type=int, outer=(1)] + │ ├── variable: x [type=int, outer=(1)] │ └── const: 1 [type=int] ├── lt [type=bool, outer=(1), constraints=(/1: (/NULL - /4]; tight)] - │ ├── variable: a.x [type=int, outer=(1)] + │ ├── variable: x [type=int, outer=(1)] │ └── const: 5 [type=int] ├── ge [type=bool, outer=(2), constraints=(/2: [/7 - ]; tight)] - │ ├── variable: a.y [type=int, outer=(2)] + │ ├── variable: y [type=int, outer=(2)] │ └── const: 7 [type=int] └── le [type=bool, outer=(2), constraints=(/2: (/NULL - /9]; tight)] - ├── variable: a.y [type=int, outer=(2)] + ├── variable: y [type=int, outer=(2)] └── const: 9 [type=int] # Verify the resulting constraints are not tight. @@ -192,15 +192,15 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1,2), constraints=(/1: [/2 - /4])] ├── gt [type=bool, outer=(1), constraints=(/1: [/2 - ]; tight)] - │ ├── variable: a.x [type=int, outer=(1)] + │ ├── variable: x [type=int, outer=(1)] │ └── const: 1 [type=int] ├── lt [type=bool, outer=(1), constraints=(/1: (/NULL - /4]; tight)] - │ ├── variable: a.x [type=int, outer=(1)] + │ ├── variable: x [type=int, outer=(1)] │ └── const: 5 [type=int] └── eq [type=bool, outer=(1,2)] ├── plus [type=int, outer=(1,2)] - │ ├── variable: a.x [type=int, outer=(1)] - │ └── variable: a.y [type=int, outer=(2)] + │ ├── variable: x [type=int, outer=(1)] + │ └── variable: y [type=int, outer=(2)] └── const: 5 [type=int] opt @@ -217,17 +217,17 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1,2), constraints=(/1: [/2 - ])] ├── gt [type=bool, outer=(1), constraints=(/1: [/2 - ]; tight)] - │ ├── variable: a.x [type=int, outer=(1)] + │ ├── variable: x [type=int, outer=(1)] │ └── const: 1 [type=int] ├── ge [type=bool, outer=(1,2)] │ ├── plus [type=int, outer=(1,2)] - │ │ ├── variable: a.x [type=int, outer=(1)] - │ │ └── variable: a.y [type=int, outer=(2)] + │ │ ├── variable: x [type=int, outer=(1)] + │ │ └── variable: y [type=int, outer=(2)] │ └── const: 5 [type=int] └── le [type=bool, outer=(1,2)] ├── plus [type=int, outer=(1,2)] - │ ├── variable: a.x [type=int, outer=(1)] - │ └── variable: a.y [type=int, outer=(2)] + │ ├── variable: x [type=int, outer=(1)] + │ └── variable: y [type=int, outer=(2)] └── const: 7 [type=int] # Verify that we ignore mixed-type comparisons. @@ -246,7 +246,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1)] └── gt [type=bool, outer=(1)] - ├── variable: a.x [type=int, outer=(1)] + ├── variable: x [type=int, outer=(1)] └── const: 1.5 [type=decimal] opt @@ -268,7 +268,7 @@ select │ └── interesting orderings: (+1) └── filters [type=bool, outer=(2)] └── gt [type=bool, outer=(2)] - ├── variable: kuv.u [type=float, outer=(2)] + ├── variable: u [type=float, outer=(2)] └── const: 1 [type=int] opt @@ -290,10 +290,10 @@ select │ └── interesting orderings: (+1) └── filters [type=bool, outer=(3), constraints=(/3: [/'bar' - /'foo']; tight)] ├── le [type=bool, outer=(3), constraints=(/3: (/NULL - /'foo']; tight)] - │ ├── variable: kuv.v [type=string, outer=(3)] + │ ├── variable: v [type=string, outer=(3)] │ └── const: 'foo' [type=string] └── ge [type=bool, outer=(3), constraints=(/3: [/'bar' - ]; tight)] - ├── variable: kuv.v [type=string, outer=(3)] + ├── variable: v [type=string, outer=(3)] └── const: 'bar' [type=string] # Test IN. @@ -312,7 +312,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1), constraints=(/1: [/1 - /1] [/2 - /2] [/3 - /3]; tight)] └── in [type=bool, outer=(1), constraints=(/1: [/1 - /1] [/2 - /2] [/3 - /3]; tight)] - ├── variable: a.x [type=int, outer=(1)] + ├── variable: x [type=int, outer=(1)] └── tuple [type=tuple{unknown, int, int, int}] ├── null [type=unknown] ├── const: 1 [type=int] @@ -356,7 +356,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1), constraints=(/1: [/7 - /7] [/9 - /9]; tight)] ├── in [type=bool, outer=(1), constraints=(/1: [/1 - /1] [/3 - /3] [/5 - /5] [/7 - /7] [/9 - /9]; tight)] - │ ├── variable: a.x [type=int, outer=(1)] + │ ├── variable: x [type=int, outer=(1)] │ └── tuple [type=tuple{int, int, int, int, int}] │ ├── const: 1 [type=int] │ ├── const: 3 [type=int] @@ -364,7 +364,7 @@ select │ ├── const: 7 [type=int] │ └── const: 9 [type=int] └── gt [type=bool, outer=(1), constraints=(/1: [/7 - ]; tight)] - ├── variable: a.x [type=int, outer=(1)] + ├── variable: x [type=int, outer=(1)] └── const: 6 [type=int] # Test IN in combination with a condition on another column. @@ -382,12 +382,12 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1,2), constraints=(/1: [/1 - /1] [/3 - /3]; /2: [/5 - ]; tight)] ├── in [type=bool, outer=(1), constraints=(/1: [/1 - /1] [/3 - /3]; tight)] - │ ├── variable: a.x [type=int, outer=(1)] + │ ├── variable: x [type=int, outer=(1)] │ └── tuple [type=tuple{int, int}] │ ├── const: 1 [type=int] │ └── const: 3 [type=int] └── gt [type=bool, outer=(2), constraints=(/2: [/5 - ]; tight)] - ├── variable: a.y [type=int, outer=(2)] + ├── variable: y [type=int, outer=(2)] └── const: 4 [type=int] # Test tuple inequality. @@ -406,8 +406,8 @@ select └── filters [type=bool, outer=(1,2), constraints=(/1/2: [/1/3 - ]; tight)] └── gt [type=bool, outer=(1,2), constraints=(/1/2: [/1/3 - ]; tight)] ├── tuple [type=tuple{int, int}, outer=(1,2)] - │ ├── variable: a.x [type=int, outer=(1)] - │ └── variable: a.y [type=int, outer=(2)] + │ ├── variable: x [type=int, outer=(1)] + │ └── variable: y [type=int, outer=(2)] └── tuple [type=tuple{int, int}] ├── const: 1 [type=int] └── const: 2 [type=int] @@ -427,8 +427,8 @@ select └── filters [type=bool, outer=(1,2), constraints=(/1/2: [/1/2 - ]; tight)] └── ge [type=bool, outer=(1,2), constraints=(/1/2: [/1/2 - ]; tight)] ├── tuple [type=tuple{int, int}, outer=(1,2)] - │ ├── variable: a.x [type=int, outer=(1)] - │ └── variable: a.y [type=int, outer=(2)] + │ ├── variable: x [type=int, outer=(1)] + │ └── variable: y [type=int, outer=(2)] └── tuple [type=tuple{int, int}] ├── const: 1 [type=int] └── const: 2 [type=int] @@ -448,8 +448,8 @@ select └── filters [type=bool, outer=(1,2), constraints=(/1/2: (/NULL - /1/1]; tight)] └── lt [type=bool, outer=(1,2), constraints=(/1/2: (/NULL - /1/1]; tight)] ├── tuple [type=tuple{int, int}, outer=(1,2)] - │ ├── variable: a.x [type=int, outer=(1)] - │ └── variable: a.y [type=int, outer=(2)] + │ ├── variable: x [type=int, outer=(1)] + │ └── variable: y [type=int, outer=(2)] └── tuple [type=tuple{int, int}] ├── const: 1 [type=int] └── const: 2 [type=int] @@ -469,8 +469,8 @@ select └── filters [type=bool, outer=(1,2), constraints=(/1/2: (/NULL - /1/2]; tight)] └── le [type=bool, outer=(1,2), constraints=(/1/2: (/NULL - /1/2]; tight)] ├── tuple [type=tuple{int, int}, outer=(1,2)] - │ ├── variable: a.x [type=int, outer=(1)] - │ └── variable: a.y [type=int, outer=(2)] + │ ├── variable: x [type=int, outer=(1)] + │ └── variable: y [type=int, outer=(2)] └── tuple [type=tuple{int, int}] ├── const: 1 [type=int] └── const: 2 [type=int] @@ -491,8 +491,8 @@ select └── filters [type=bool, outer=(1,2)] └── ge [type=bool, outer=(1,2)] ├── tuple [type=tuple{int, int}, outer=(1,2)] - │ ├── variable: a.x [type=int, outer=(1)] - │ └── variable: a.y [type=int, outer=(2)] + │ ├── variable: x [type=int, outer=(1)] + │ └── variable: y [type=int, outer=(2)] └── tuple [type=tuple{int, decimal}] ├── const: 1 [type=int] └── const: 2.5 [type=decimal] @@ -513,8 +513,8 @@ select └── filters [type=bool, outer=(1,2)] └── ge [type=bool, outer=(1,2)] ├── tuple [type=tuple{int, int}, outer=(1,2)] - │ ├── variable: a.x [type=int, outer=(1)] - │ └── variable: a.y [type=int, outer=(2)] + │ ├── variable: x [type=int, outer=(1)] + │ └── variable: y [type=int, outer=(2)] └── tuple [type=tuple{int, unknown}] ├── const: 1 [type=int] └── null [type=unknown] @@ -537,7 +537,7 @@ select └── filters [type=bool, outer=(1)] └── ge [type=bool, outer=(1)] ├── tuple [type=tuple{int, int}, outer=(1)] - │ ├── variable: a.x [type=int, outer=(1)] + │ ├── variable: x [type=int, outer=(1)] │ └── const: 1 [type=int] └── tuple [type=tuple{int, int}] ├── const: 1 [type=int] @@ -569,7 +569,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1), constraints=(/1: (/NULL - /4] [/6 - ]; tight)] └── ne [type=bool, outer=(1), constraints=(/1: (/NULL - /4] [/6 - ]; tight)] - ├── variable: abc.a [type=int, outer=(1)] + ├── variable: a [type=int, outer=(1)] └── const: 5 [type=int] opt @@ -587,7 +587,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1), constraints=(/1: [ - /4] [/6 - ]; tight)] └── is-not [type=bool, outer=(1), constraints=(/1: [ - /4] [/6 - ]; tight)] - ├── variable: abc.a [type=int, outer=(1)] + ├── variable: a [type=int, outer=(1)] └── const: 5 [type=int] opt @@ -605,7 +605,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - /false]; tight)] └── ne [type=bool, outer=(2), constraints=(/2: (/NULL - /false]; tight)] - ├── variable: abc.b [type=bool, outer=(2)] + ├── variable: b [type=bool, outer=(2)] └── true [type=bool] opt @@ -623,7 +623,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(2), constraints=(/2: [/true - ]; tight)] └── ne [type=bool, outer=(2), constraints=(/2: [/true - ]; tight)] - ├── variable: abc.b [type=bool, outer=(2)] + ├── variable: b [type=bool, outer=(2)] └── false [type=bool] opt @@ -641,7 +641,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(2), constraints=(/2: [ - /false]; tight)] └── is-not [type=bool, outer=(2), constraints=(/2: [ - /false]; tight)] - ├── variable: abc.b [type=bool, outer=(2)] + ├── variable: b [type=bool, outer=(2)] └── true [type=bool] opt @@ -659,7 +659,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(2), constraints=(/2: [ - /false) [/true - ]; tight)] └── is-not [type=bool, outer=(2), constraints=(/2: [ - /false) [/true - ]; tight)] - ├── variable: abc.b [type=bool, outer=(2)] + ├── variable: b [type=bool, outer=(2)] └── false [type=bool] opt @@ -677,7 +677,7 @@ select │ ├── prune: (1-3) │ └── interesting orderings: () └── filters [type=bool, outer=(2), constraints=(/2: [/true - /true]; tight), fd=()-->(2)] - └── variable: abc.b [type=bool, outer=(2), constraints=(/2: [/true - /true]; tight)] + └── variable: b [type=bool, outer=(2), constraints=(/2: [/true - /true]; tight)] opt SELECT * FROM abc WHERE NOT b @@ -695,7 +695,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(2), constraints=(/2: [/false - /false]; tight), fd=()-->(2)] └── not [type=bool, outer=(2), constraints=(/2: [/false - /false]; tight)] - └── variable: abc.b [type=bool, outer=(2)] + └── variable: b [type=bool, outer=(2)] opt SELECT * FROM abc WHERE a > 5 AND b @@ -713,9 +713,9 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1,2), constraints=(/1: [/6 - ]; /2: [/true - /true]; tight), fd=()-->(2)] ├── gt [type=bool, outer=(1), constraints=(/1: [/6 - ]; tight)] - │ ├── variable: abc.a [type=int, outer=(1)] + │ ├── variable: a [type=int, outer=(1)] │ └── const: 5 [type=int] - └── variable: abc.b [type=bool, outer=(2), constraints=(/2: [/true - /true]; tight)] + └── variable: b [type=bool, outer=(2), constraints=(/2: [/true - /true]; tight)] opt SELECT * FROM abc WHERE c != 'foo' @@ -732,7 +732,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(3), constraints=(/3: (/NULL - /'foo') [/e'foo\x00' - ]; tight)] └── ne [type=bool, outer=(3), constraints=(/3: (/NULL - /'foo') [/e'foo\x00' - ]; tight)] - ├── variable: abc.c [type=string, outer=(3)] + ├── variable: c [type=string, outer=(3)] └── const: 'foo' [type=string] opt @@ -750,7 +750,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(3), constraints=(/3: [ - /'foo') [/e'foo\x00' - ]; tight)] └── is-not [type=bool, outer=(3), constraints=(/3: [ - /'foo') [/e'foo\x00' - ]; tight)] - ├── variable: abc.c [type=string, outer=(3)] + ├── variable: c [type=string, outer=(3)] └── const: 'foo' [type=string] opt @@ -770,8 +770,8 @@ select │ │ └── interesting orderings: () │ └── projections [outer=(1,2)] │ └── tuple [type=tuple{int, int}, outer=(1,2)] - │ ├── variable: a.x [type=int, outer=(1)] - │ └── variable: a.y [type=int, outer=(2)] + │ ├── variable: x [type=int, outer=(1)] + │ └── variable: y [type=int, outer=(2)] └── filters [type=bool, outer=(4), constraints=(/4: [/(1, 3) - ]; tight)] └── gt [type=bool, outer=(4), constraints=(/4: [/(1, 3) - ]; tight)] ├── variable: col [type=tuple{int, int}, outer=(4)] @@ -925,7 +925,7 @@ select └── filters [type=bool, outer=(3), constraints=(/3: [/1 - /1] [/3 - /3] [/5 - /5])] └── in [type=bool, outer=(3), constraints=(/3: [/1 - /1] [/3 - /3] [/5 - /5])] ├── tuple [type=tuple{int, int}, outer=(3)] - │ ├── variable: c.v [type=int, outer=(3)] + │ ├── variable: v [type=int, outer=(3)] │ └── const: 2 [type=int] └── tuple [type=tuple{tuple{int, int}, tuple{int, int}, tuple{int, int}}] ├── tuple [type=tuple{int, int}] @@ -962,10 +962,10 @@ select └── filters [type=bool, outer=(2,3), constraints=(/3: [/1 - /1] [/3 - /3] [/5 - /5])] └── in [type=bool, outer=(2,3), constraints=(/3: [/1 - /1] [/3 - /3] [/5 - /5])] ├── tuple [type=tuple{int, int}, outer=(2,3)] - │ ├── variable: c.v [type=int, outer=(3)] + │ ├── variable: v [type=int, outer=(3)] │ └── plus [type=int, outer=(2,3)] - │ ├── variable: c.u [type=int, outer=(2)] - │ └── variable: c.v [type=int, outer=(3)] + │ ├── variable: u [type=int, outer=(2)] + │ └── variable: v [type=int, outer=(3)] └── tuple [type=tuple{tuple{int, int}, tuple{int, int}, tuple{int, int}}] ├── tuple [type=tuple{int, int}] │ ├── const: 1 [type=int] @@ -996,14 +996,14 @@ select └── filters [type=bool, outer=(1-3), constraints=(/2: [/2 - /2] [/50 - /50] [/100 - /100])] └── in [type=bool, outer=(1-3), constraints=(/2: [/2 - /2] [/50 - /50] [/100 - /100])] ├── tuple [type=tuple{int, int}, outer=(2,3)] - │ ├── variable: c.v [type=int, outer=(3)] - │ └── variable: c.u [type=int, outer=(2)] + │ ├── variable: v [type=int, outer=(3)] + │ └── variable: u [type=int, outer=(2)] └── tuple [type=tuple{tuple{int, int}, tuple{int, int}, tuple{int, int}}, outer=(1)] ├── tuple [type=tuple{int, int}] │ ├── const: 1 [type=int] │ └── const: 2 [type=int] ├── tuple [type=tuple{int, int}, outer=(1)] - │ ├── variable: c.k [type=int, outer=(1)] + │ ├── variable: k [type=int, outer=(1)] │ └── const: 50 [type=int] └── tuple [type=tuple{int, int}] ├── const: 5 [type=int] @@ -1046,8 +1046,8 @@ select └── filters [type=bool, outer=(2,3), constraints=(/2/3: [/1/2 - /1/2] [/1/3 - /1/3] [/1/4 - /1/4]; /3: [/2 - /2] [/3 - /3] [/4 - /4]; tight), fd=()-->(2)] └── in [type=bool, outer=(2,3), constraints=(/2/3: [/1/2 - /1/2] [/1/3 - /1/3] [/1/4 - /1/4]; /3: [/2 - /2] [/3 - /3] [/4 - /4]; tight)] ├── tuple [type=tuple{int, int}, outer=(2,3)] - │ ├── variable: d.p [type=int, outer=(2)] - │ └── variable: d.q [type=int, outer=(3)] + │ ├── variable: p [type=int, outer=(2)] + │ └── variable: q [type=int, outer=(3)] └── tuple [type=tuple{tuple{int, int}, tuple{int, int}, tuple{int, int}}] ├── tuple [type=tuple{int, int}] │ ├── const: 1 [type=int] @@ -1081,8 +1081,8 @@ select └── filters [type=bool, outer=(2,3), constraints=(/2/3: [/2/1 - /2/1] [/3/1 - /3/1] [/4/1 - /4/1]; /3: [/1 - /1]; tight), fd=()-->(3)] └── in [type=bool, outer=(2,3), constraints=(/2/3: [/2/1 - /2/1] [/3/1 - /3/1] [/4/1 - /4/1]; /3: [/1 - /1]; tight)] ├── tuple [type=tuple{int, int}, outer=(2,3)] - │ ├── variable: d.p [type=int, outer=(2)] - │ └── variable: d.q [type=int, outer=(3)] + │ ├── variable: p [type=int, outer=(2)] + │ └── variable: q [type=int, outer=(3)] └── tuple [type=tuple{tuple{int, int}, tuple{int, int}, tuple{int, int}}] ├── tuple [type=tuple{int, int}] │ ├── const: 2 [type=int] diff --git a/pkg/sql/opt/memo/testdata/logprops/constraints-null b/pkg/sql/opt/memo/testdata/logprops/constraints-null index 56d77d04cb5e..66797f587091 100644 --- a/pkg/sql/opt/memo/testdata/logprops/constraints-null +++ b/pkg/sql/opt/memo/testdata/logprops/constraints-null @@ -47,7 +47,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1), constraints=(/1: [/NULL - /NULL]; tight), fd=()-->(1)] └── is [type=bool, outer=(1), constraints=(/1: [/NULL - /NULL]; tight)] - ├── variable: t.a [type=int, outer=(1)] + ├── variable: a [type=int, outer=(1)] └── null [type=unknown] opt @@ -65,7 +65,7 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1), constraints=(/1: (/NULL - ]; tight)] └── is-not [type=bool, outer=(1), constraints=(/1: (/NULL - ]; tight)] - ├── variable: t.a [type=int, outer=(1)] + ├── variable: a [type=int, outer=(1)] └── null [type=unknown] opt @@ -84,10 +84,10 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(2,3), constraints=(/2: [/NULL - /NULL]; /3: [/NULL - /NULL]; tight), fd=()-->(2,3)] ├── is [type=bool, outer=(2), constraints=(/2: [/NULL - /NULL]; tight)] - │ ├── variable: t.b [type=bool, outer=(2)] + │ ├── variable: b [type=bool, outer=(2)] │ └── null [type=unknown] └── is [type=bool, outer=(3), constraints=(/3: [/NULL - /NULL]; tight)] - ├── variable: t.c [type=string, outer=(3)] + ├── variable: c [type=string, outer=(3)] └── null [type=unknown] opt @@ -105,10 +105,10 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ]; tight)] ├── is-not [type=bool, outer=(2), constraints=(/2: (/NULL - ]; tight)] - │ ├── variable: t.b [type=bool, outer=(2)] + │ ├── variable: b [type=bool, outer=(2)] │ └── null [type=unknown] └── is-not [type=bool, outer=(3), constraints=(/3: (/NULL - ]; tight)] - ├── variable: t.c [type=string, outer=(3)] + ├── variable: c [type=string, outer=(3)] └── null [type=unknown] exec-ddl @@ -139,9 +139,9 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1,2), constraints=(/1: (/NULL - ])] └── gt [type=bool, outer=(1,2), constraints=(/1: (/NULL - ])] - ├── variable: xy.x [type=int, outer=(1)] + ├── variable: x [type=int, outer=(1)] └── function: abs [type=int, outer=(2)] - └── variable: xy.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # Test that we get a not-NULL constraint on x. opt @@ -159,11 +159,11 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1), constraints=(/1: (/NULL - ])] └── gt [type=bool, outer=(1), constraints=(/1: (/NULL - ])] - ├── variable: xy.x [type=int, outer=(1)] + ├── variable: x [type=int, outer=(1)] └── cast: INT [type=int, outer=(1)] └── function: sin [type=float, outer=(1)] └── cast: FLOAT [type=float, outer=(1)] - └── variable: xy.x [type=int, outer=(1)] + └── variable: x [type=int, outer=(1)] # Test that we get a not-NULL constraint on x and y. opt @@ -180,8 +180,8 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] └── gt [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] - ├── variable: xy.x [type=int, outer=(1)] - └── variable: xy.y [type=int, outer=(2)] + ├── variable: x [type=int, outer=(1)] + └── variable: y [type=int, outer=(2)] # Test that we get a not-NULL constraint on x and y. opt @@ -199,5 +199,5 @@ select │ └── interesting orderings: () └── filters [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ]), fd=(1)==(2), (2)==(1)] └── eq [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] - ├── variable: xy.x [type=int, outer=(1)] - └── variable: xy.y [type=int, outer=(2)] + ├── variable: x [type=int, outer=(1)] + └── variable: y [type=int, outer=(2)] diff --git a/pkg/sql/opt/memo/testdata/logprops/groupby b/pkg/sql/opt/memo/testdata/logprops/groupby index 66de2176c3ae..e620ea988516 100644 --- a/pkg/sql/opt/memo/testdata/logprops/groupby +++ b/pkg/sql/opt/memo/testdata/logprops/groupby @@ -57,7 +57,7 @@ project │ │ └── interesting orderings: (+1) (-4,+3,+1) │ └── aggregations [outer=(3)] │ └── sum [type=float, outer=(3)] - │ └── variable: xyzs.z [type=float, outer=(3)] + │ └── variable: z [type=float, outer=(3)] └── projections [outer=(1,2,5)] └── false [type=bool] @@ -88,9 +88,9 @@ scalar-group-by │ └── interesting orderings: (+1) (-4,+3,+1) └── aggregations [outer=(1,2)] ├── sum [type=decimal, outer=(1)] - │ └── variable: xyzs.x [type=int, outer=(1)] + │ └── variable: x [type=int, outer=(1)] └── max [type=int, outer=(2)] - └── variable: xyzs.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # Group by unique index columns. build @@ -148,7 +148,7 @@ project │ └── interesting orderings: (+1) (-4,+3,+1) └── aggregations [outer=(3)] └── sum [type=float, outer=(3)] - └── variable: xyzs.z [type=float, outer=(3)] + └── variable: z [type=float, outer=(3)] # Group by column that is subset of unique index. build @@ -175,7 +175,7 @@ group-by │ └── interesting orderings: (+1) (-4,+3,+1) └── aggregations [outer=(4)] └── max [type=string, outer=(4)] - └── variable: xyzs.s [type=string, outer=(4)] + └── variable: s [type=string, outer=(4)] # Group by all columns. build @@ -316,6 +316,6 @@ group-by │ └── interesting orderings: (+1) └── aggregations [outer=(1,3)] ├── count [type=int, outer=(3)] - │ └── variable: xyzs.z [type=float, outer=(3)] + │ └── variable: z [type=float, outer=(3)] └── const-agg [type=int, outer=(1)] - └── variable: xyzs.x [type=int, outer=(1)] + └── variable: x [type=int, outer=(1)] diff --git a/pkg/sql/opt/memo/testdata/logprops/index-join b/pkg/sql/opt/memo/testdata/logprops/index-join index 28145d23ded5..3b13976ed2da 100644 --- a/pkg/sql/opt/memo/testdata/logprops/index-join +++ b/pkg/sql/opt/memo/testdata/logprops/index-join @@ -76,8 +76,8 @@ select └── filters [type=bool, outer=(1,2)] └── eq [type=bool, outer=(1,2)] ├── plus [type=int, outer=(1,2)] - │ ├── variable: a.x [type=int, outer=(1)] - │ └── variable: a.y [type=int, outer=(2)] + │ ├── variable: x [type=int, outer=(1)] + │ └── variable: y [type=int, outer=(2)] └── const: 10 [type=int] opt @@ -110,8 +110,8 @@ project └── filters [type=bool, outer=(1,2)] └── eq [type=bool, outer=(1,2)] ├── plus [type=int, outer=(1,2)] - │ ├── variable: a.x [type=int, outer=(1)] - │ └── variable: a.y [type=int, outer=(2)] + │ ├── variable: x [type=int, outer=(1)] + │ └── variable: y [type=int, outer=(2)] └── const: 10 [type=int] # Use secondary index to join to multi-valued primary index, but project only @@ -140,5 +140,5 @@ select │ └── interesting orderings: (+1,+2) (+3,+1,+2) └── filters [type=bool, outer=(4), constraints=(/4: [/2 - /2]; tight), fd=()-->(4)] └── eq [type=bool, outer=(4), constraints=(/4: [/2 - /2]; tight)] - ├── variable: abc.d [type=int, outer=(4)] + ├── variable: d [type=int, outer=(4)] └── const: 2 [type=int] diff --git a/pkg/sql/opt/memo/testdata/logprops/join b/pkg/sql/opt/memo/testdata/logprops/join index af48b249a710..76ea0ac68641 100644 --- a/pkg/sql/opt/memo/testdata/logprops/join +++ b/pkg/sql/opt/memo/testdata/logprops/join @@ -62,8 +62,8 @@ inner-join │ └── interesting orderings: (+7) └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] └── eq [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - ├── variable: xysd.x [type=int, outer=(1)] - └── variable: uv.u [type=int, outer=(5)] + ├── variable: x [type=int, outer=(1)] + └── variable: u [type=int, outer=(5)] # Inner-join-apply. opt @@ -100,9 +100,9 @@ project │ │ ├── stats: [rows=2] │ │ ├── prune: (5) │ │ ├── tuple [type=tuple{int}, outer=(1)] - │ │ │ └── variable: xysd.x [type=int, outer=(1)] + │ │ │ └── variable: x [type=int, outer=(1)] │ │ └── tuple [type=tuple{int}, outer=(2)] - │ │ └── variable: xysd.y [type=int, outer=(2)] + │ │ └── variable: y [type=int, outer=(2)] │ └── true [type=bool] └── projections [outer=(5)] └── variable: column1 [type=int, outer=(5)] @@ -178,16 +178,16 @@ project │ │ │ └── interesting orderings: (+9) │ │ └── filters [type=bool, outer=(6,9), constraints=(/6: (/NULL - ]; /9: (/NULL - ]), fd=(6)==(9), (9)==(6)] │ │ └── eq [type=bool, outer=(6,9), constraints=(/6: (/NULL - ]; /9: (/NULL - ])] - │ │ ├── variable: mn.n [type=int, outer=(9)] - │ │ └── variable: uv.v [type=int, outer=(6)] + │ │ ├── variable: n [type=int, outer=(9)] + │ │ └── variable: v [type=int, outer=(6)] │ └── filters [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ]), fd=(1)==(9), (9)==(1)] │ └── eq [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ])] - │ ├── variable: xysd.x [type=int, outer=(1)] - │ └── variable: mn.n [type=int, outer=(9)] + │ ├── variable: x [type=int, outer=(1)] + │ └── variable: n [type=int, outer=(9)] └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] └── eq [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - ├── variable: xysd.x [type=int, outer=(1)] - └── variable: uv.v [type=int, outer=(6)] + ├── variable: x [type=int, outer=(1)] + └── variable: v [type=int, outer=(6)] # Inner-join nested in inner-join-apply with outer column reference to top-level # inner-join-apply. @@ -247,15 +247,15 @@ project │ │ └── interesting orderings: (+8) │ └── filters [type=bool, outer=(1,2,8), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /8: (/NULL - ]), fd=(2)==(1,8), (8)==(1,2), (1)==(2,8)] │ ├── eq [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ])] - │ │ ├── variable: mn.m [type=int, outer=(8)] - │ │ └── variable: xysd.y [type=int, outer=(2)] + │ │ ├── variable: m [type=int, outer=(8)] + │ │ └── variable: y [type=int, outer=(2)] │ └── eq [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ])] - │ ├── variable: xysd.x [type=int, outer=(1)] - │ └── variable: mn.m [type=int, outer=(8)] + │ ├── variable: x [type=int, outer=(1)] + │ └── variable: m [type=int, outer=(8)] └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] └── eq [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - ├── variable: xysd.x [type=int, outer=(1)] - └── variable: uv.v [type=int, outer=(6)] + ├── variable: x [type=int, outer=(1)] + └── variable: v [type=int, outer=(6)] # Left-join. build @@ -285,8 +285,8 @@ left-join │ └── interesting orderings: (+7) └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] └── eq [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - ├── variable: xysd.x [type=int, outer=(1)] - └── variable: uv.u [type=int, outer=(5)] + ├── variable: x [type=int, outer=(1)] + └── variable: u [type=int, outer=(5)] # Left-join-apply. opt @@ -341,12 +341,12 @@ project │ │ │ └── interesting orderings: () │ │ └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] │ │ └── eq [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - │ │ ├── variable: uv.u [type=int, outer=(5)] - │ │ └── variable: xysd.x [type=int, outer=(1)] + │ │ ├── variable: u [type=int, outer=(5)] + │ │ └── variable: x [type=int, outer=(1)] │ └── true [type=bool] └── filters [type=bool, outer=(5), constraints=(/5: [/NULL - /NULL]; tight), fd=()-->(5)] └── is [type=bool, outer=(5), constraints=(/5: [/NULL - /NULL]; tight)] - ├── variable: uv.u [type=int, outer=(5)] + ├── variable: u [type=int, outer=(5)] └── null [type=unknown] # Right-join. @@ -377,8 +377,8 @@ right-join │ └── interesting orderings: (+7) └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] └── eq [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - ├── variable: xysd.x [type=int, outer=(1)] - └── variable: uv.u [type=int, outer=(5)] + ├── variable: x [type=int, outer=(1)] + └── variable: u [type=int, outer=(5)] # Right-join-apply. opt @@ -447,7 +447,7 @@ right-join │ │ │ │ └── filters [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)] │ │ │ │ └── eq [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ])] │ │ │ │ ├── variable: uv.u [type=int, outer=(8)] - │ │ │ │ └── variable: xysd.x [type=int, outer=(1)] + │ │ │ │ └── variable: x [type=int, outer=(1)] │ │ │ └── const: 1 [type=int] │ │ └── true [type=bool] │ └── filters [type=bool, outer=(8), constraints=(/8: [/NULL - /NULL]; tight), fd=()-->(8)] @@ -489,8 +489,8 @@ full-join │ └── interesting orderings: (+7) └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] └── eq [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - ├── variable: xysd.x [type=int, outer=(1)] - └── variable: uv.u [type=int, outer=(5)] + ├── variable: x [type=int, outer=(1)] + └── variable: u [type=int, outer=(5)] # Full-join-apply. opt @@ -556,7 +556,7 @@ project │ │ │ └── filters [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)] │ │ │ └── eq [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ])] │ │ │ ├── variable: uv.u [type=int, outer=(8)] - │ │ │ └── variable: xysd.x [type=int, outer=(1)] + │ │ │ └── variable: x [type=int, outer=(1)] │ │ └── const: 1 [type=int] │ └── true [type=bool] └── filters [type=bool, outer=(8), constraints=(/8: [/NULL - /NULL]; tight), fd=()-->(8)] @@ -589,8 +589,8 @@ semi-join │ └── interesting orderings: () └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] └── eq [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - ├── variable: xysd.x [type=int, outer=(1)] - └── variable: uv.u [type=int, outer=(5)] + ├── variable: x [type=int, outer=(1)] + └── variable: u [type=int, outer=(5)] # Semi-join-apply. opt @@ -631,8 +631,8 @@ semi-join-apply │ │ │ └── interesting orderings: () │ │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] │ │ └── eq [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - │ │ ├── variable: uv.v [type=int, outer=(6)] - │ │ └── variable: xysd.x [type=int, outer=(1)] + │ │ ├── variable: v [type=int, outer=(6)] + │ │ └── variable: x [type=int, outer=(1)] │ └── const: 1 [type=int] └── true [type=bool] @@ -675,11 +675,11 @@ semi-join-apply │ │ └── interesting orderings: (+8) (+9,+8) │ └── filters [type=bool, outer=(1,6,8), constraints=(/1: (/NULL - ]; /6: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(6,8), (8)==(1,6), (6)==(1,8)] │ ├── eq [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ])] - │ │ ├── variable: xysd.x [type=int, outer=(1)] - │ │ └── variable: mn.m [type=int, outer=(8)] + │ │ ├── variable: x [type=int, outer=(1)] + │ │ └── variable: m [type=int, outer=(8)] │ └── eq [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - │ ├── variable: xysd.x [type=int, outer=(1)] - │ └── variable: uv.v [type=int, outer=(6)] + │ ├── variable: x [type=int, outer=(1)] + │ └── variable: v [type=int, outer=(6)] └── true [type=bool] # Anti-join. @@ -707,8 +707,8 @@ anti-join │ └── interesting orderings: () └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] └── eq [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - ├── variable: xysd.x [type=int, outer=(1)] - └── variable: uv.u [type=int, outer=(5)] + ├── variable: x [type=int, outer=(1)] + └── variable: u [type=int, outer=(5)] # Anti-join-apply. opt @@ -749,8 +749,8 @@ anti-join-apply │ │ │ └── interesting orderings: () │ │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] │ │ └── eq [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - │ │ ├── variable: uv.v [type=int, outer=(6)] - │ │ └── variable: xysd.x [type=int, outer=(1)] + │ │ ├── variable: v [type=int, outer=(6)] + │ │ └── variable: x [type=int, outer=(1)] │ └── const: 1 [type=int] └── true [type=bool] @@ -876,7 +876,7 @@ select └── eq [type=bool, outer=(3,5)] ├── cast: STRING [type=string, outer=(5)] │ └── variable: x [type=int, outer=(5)] - └── variable: xysd.s [type=string, outer=(3)] + └── variable: s [type=string, outer=(3)] # Calculate semi-join cardinality when left side has non-zero cardinality. opt @@ -959,8 +959,8 @@ semi-join-apply │ │ │ └── interesting orderings: () │ │ └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] │ │ └── eq [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - │ │ ├── variable: xysd.x [type=int, outer=(1)] - │ │ └── variable: uv.u [type=int, outer=(5)] + │ │ ├── variable: x [type=int, outer=(1)] + │ │ └── variable: u [type=int, outer=(5)] │ └── const: 5 [type=int] └── true [type=bool] @@ -990,7 +990,7 @@ anti-join │ └── interesting orderings: () └── filters [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ]), fd=(1)==(2), (2)==(1)] └── eq [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] - ├── variable: uv.u [type=int, outer=(2)] + ├── variable: u [type=int, outer=(2)] └── variable: column1 [type=int, outer=(1)] # Calculate anti-join-apply cardinality. @@ -1035,8 +1035,8 @@ anti-join-apply │ │ │ └── interesting orderings: () │ │ └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] │ │ └── eq [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - │ │ ├── variable: xysd.x [type=int, outer=(1)] - │ │ └── variable: uv.u [type=int, outer=(5)] + │ │ ├── variable: x [type=int, outer=(1)] + │ │ └── variable: u [type=int, outer=(5)] │ └── const: 5 [type=int] └── true [type=bool] @@ -1340,10 +1340,10 @@ left-join │ │ └── interesting orderings: (+7) │ └── aggregations [outer=(6)] │ └── sum [type=decimal, outer=(6)] - │ └── variable: uv.v [type=int, outer=(6)] + │ └── variable: v [type=int, outer=(6)] └── filters [type=bool, outer=(5), constraints=(/5: (/NULL - ]; tight)] └── is-not [type=bool, outer=(5), constraints=(/5: (/NULL - ]; tight)] - ├── variable: uv.u [type=int, outer=(5)] + ├── variable: u [type=int, outer=(5)] └── null [type=unknown] # Not-null FD determinant on right side of left-join stays strict. @@ -1392,11 +1392,11 @@ left-join │ │ │ └── interesting orderings: (+7) │ │ └── filters [type=bool, outer=(5), constraints=(/5: (/NULL - ]; tight)] │ │ └── is-not [type=bool, outer=(5), constraints=(/5: (/NULL - ]; tight)] - │ │ ├── variable: uv.u [type=int, outer=(5)] + │ │ ├── variable: u [type=int, outer=(5)] │ │ └── null [type=unknown] │ └── aggregations [outer=(6)] │ └── sum [type=decimal, outer=(6)] - │ └── variable: uv.v [type=int, outer=(6)] + │ └── variable: v [type=int, outer=(6)] └── filters [type=bool] └── true [type=bool] @@ -1432,7 +1432,7 @@ right-join │ │ └── interesting orderings: (+3) │ └── aggregations [outer=(2)] │ └── sum [type=decimal, outer=(2)] - │ └── variable: uv.v [type=int, outer=(2)] + │ └── variable: v [type=int, outer=(2)] ├── scan xysd │ ├── columns: x:5(int!null) y:6(int) s:7(string) d:8(decimal!null) │ ├── stats: [rows=1000] @@ -1442,7 +1442,7 @@ right-join │ └── interesting orderings: (+5) (-7,+8,+5) └── filters [type=bool, outer=(1), constraints=(/1: (/NULL - ]; tight)] └── is-not [type=bool, outer=(1), constraints=(/1: (/NULL - ]; tight)] - ├── variable: uv.u [type=int, outer=(1)] + ├── variable: u [type=int, outer=(1)] └── null [type=unknown] # Not-null FD determinant on left side of right-join stays strict. @@ -1484,11 +1484,11 @@ right-join │ │ │ └── interesting orderings: (+3) │ │ └── filters [type=bool, outer=(1), constraints=(/1: (/NULL - ]; tight)] │ │ └── is-not [type=bool, outer=(1), constraints=(/1: (/NULL - ]; tight)] - │ │ ├── variable: uv.u [type=int, outer=(1)] + │ │ ├── variable: u [type=int, outer=(1)] │ │ └── null [type=unknown] │ └── aggregations [outer=(2)] │ └── sum [type=decimal, outer=(2)] - │ └── variable: uv.v [type=int, outer=(2)] + │ └── variable: v [type=int, outer=(2)] ├── scan xysd │ ├── columns: x:5(int!null) y:6(int) s:7(string) d:8(decimal!null) │ ├── stats: [rows=1000] @@ -1538,10 +1538,10 @@ full-join │ │ └── interesting orderings: (+7) │ └── aggregations [outer=(6)] │ └── sum [type=decimal, outer=(6)] - │ └── variable: uv.v [type=int, outer=(6)] + │ └── variable: v [type=int, outer=(6)] └── filters [type=bool, outer=(5), constraints=(/5: (/NULL - ]; tight)] └── is-not [type=bool, outer=(5), constraints=(/5: (/NULL - ]; tight)] - ├── variable: uv.u [type=int, outer=(5)] + ├── variable: u [type=int, outer=(5)] └── null [type=unknown] # Nullable FD determinant on left side of full-join becomes lax. @@ -1576,7 +1576,7 @@ full-join │ │ └── interesting orderings: (+3) │ └── aggregations [outer=(2)] │ └── sum [type=decimal, outer=(2)] - │ └── variable: uv.v [type=int, outer=(2)] + │ └── variable: v [type=int, outer=(2)] ├── scan xysd │ ├── columns: x:5(int!null) y:6(int) s:7(string) d:8(decimal!null) │ ├── stats: [rows=1000] @@ -1586,5 +1586,5 @@ full-join │ └── interesting orderings: (+5) (-7,+8,+5) └── filters [type=bool, outer=(1), constraints=(/1: (/NULL - ]; tight)] └── is-not [type=bool, outer=(1), constraints=(/1: (/NULL - ]; tight)] - ├── variable: uv.u [type=int, outer=(1)] + ├── variable: u [type=int, outer=(1)] └── null [type=unknown] diff --git a/pkg/sql/opt/memo/testdata/logprops/limit b/pkg/sql/opt/memo/testdata/logprops/limit index 21ae877d22eb..13762bc25d31 100644 --- a/pkg/sql/opt/memo/testdata/logprops/limit +++ b/pkg/sql/opt/memo/testdata/logprops/limit @@ -177,7 +177,7 @@ project │ │ └── interesting orderings: (+5) │ └── projections [outer=(1)] │ └── variable: xyzs.x [type=int, outer=(1)] - └── variable: xyzs.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # Test very high limit (> max uint32). opt diff --git a/pkg/sql/opt/memo/testdata/logprops/offset b/pkg/sql/opt/memo/testdata/logprops/offset index dbc179c552c4..f0f947306c04 100644 --- a/pkg/sql/opt/memo/testdata/logprops/offset +++ b/pkg/sql/opt/memo/testdata/logprops/offset @@ -145,7 +145,7 @@ project │ │ └── interesting orderings: (+5) │ └── projections [outer=(1)] │ └── variable: xyzs.x [type=int, outer=(1)] - └── variable: xyzs.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # Reduce cardinality of input set. build @@ -227,6 +227,6 @@ offset │ │ └── interesting orderings: (+1) (-4) │ └── filters [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight), fd=()-->(4)] │ └── eq [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] - │ ├── variable: xyzs.s [type=string, outer=(4)] + │ ├── variable: s [type=string, outer=(4)] │ └── const: 'foo' [type=string] └── const: 4294967296 [type=int] diff --git a/pkg/sql/opt/memo/testdata/logprops/project b/pkg/sql/opt/memo/testdata/logprops/project index a218ffb8d16f..edf7dc247252 100644 --- a/pkg/sql/opt/memo/testdata/logprops/project +++ b/pkg/sql/opt/memo/testdata/logprops/project @@ -42,7 +42,7 @@ project │ └── interesting orderings: (+1) (-3,+4,+1) └── projections [outer=(1,2)] ├── plus [type=int, outer=(1)] - │ ├── variable: xysd.x [type=int, outer=(1)] + │ ├── variable: x [type=int, outer=(1)] │ └── const: 1 [type=int] └── const: 1 [type=int] @@ -116,8 +116,8 @@ select │ │ │ └── interesting orderings: (+5) │ │ └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] │ │ └── eq [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - │ │ ├── variable: kuv.k [type=int, outer=(5)] - │ │ └── variable: xysd.x [type=int, outer=(1)] + │ │ ├── variable: k [type=int, outer=(5)] + │ │ └── variable: x [type=int, outer=(1)] │ └── projections [outer=(2)] │ └── subquery [type=int, outer=(2)] │ └── max1-row @@ -265,8 +265,8 @@ project │ └── interesting orderings: (+4) (-6,+7,+4) └── filters [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ]), fd=(1)==(4), (4)==(1)] └── eq [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ])] - ├── variable: xysd.x [type=int, outer=(4)] - └── variable: kuv.k [type=int, outer=(1)] + ├── variable: x [type=int, outer=(4)] + └── variable: k [type=int, outer=(1)] # Project nested correlated subquery. build @@ -330,7 +330,7 @@ project └── filters [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)] └── eq [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ])] ├── variable: xysd.x [type=int, outer=(8)] - └── variable: kuv.k [type=int, outer=(1)] + └── variable: k [type=int, outer=(1)] # We have the FD: y --> y::TEXT. build diff --git a/pkg/sql/opt/memo/testdata/logprops/scalar b/pkg/sql/opt/memo/testdata/logprops/scalar index 6269ecabb972..edf0dc90112b 100644 --- a/pkg/sql/opt/memo/testdata/logprops/scalar +++ b/pkg/sql/opt/memo/testdata/logprops/scalar @@ -36,7 +36,7 @@ select │ └── interesting orderings: (+1) └── filters [type=bool, outer=(1), constraints=(/1: (/NULL - /4]; tight)] └── lt [type=bool, outer=(1), constraints=(/1: (/NULL - /4]; tight)] - ├── variable: xy.x [type=int, outer=(1)] + ├── variable: x [type=int, outer=(1)] └── const: 5 [type=int] build @@ -71,15 +71,15 @@ project └── projections [outer=(1,2,5)] ├── eq [type=bool, outer=(1,2)] │ ├── plus [type=int, outer=(1)] - │ │ ├── variable: xy.x [type=int, outer=(1)] + │ │ ├── variable: x [type=int, outer=(1)] │ │ └── const: 1 [type=int] │ └── plus [type=int, outer=(2)] │ ├── function: length [type=int] │ │ └── const: 'foo' [type=string] - │ └── variable: xy.y [type=int, outer=(2)] + │ └── variable: y [type=int, outer=(2)] └── mult [type=int, outer=(1,5)] - ├── variable: uv.rowid [type=int, outer=(5)] - └── variable: xy.x [type=int, outer=(1)] + ├── variable: rowid [type=int, outer=(5)] + └── variable: x [type=int, outer=(1)] build SELECT * FROM xy WHERE EXISTS(SELECT * FROM uv WHERE u=x) @@ -123,8 +123,8 @@ select │ └── interesting orderings: (+5) └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] └── eq [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] - ├── variable: uv.u [type=int, outer=(3)] - └── variable: xy.x [type=int, outer=(1)] + ├── variable: u [type=int, outer=(3)] + └── variable: x [type=int, outer=(1)] build SELECT * FROM xy WHERE y IN (SELECT v FROM uv WHERE u=x) @@ -166,9 +166,9 @@ select │ │ └── interesting orderings: (+5) │ └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] │ └── eq [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] - │ ├── variable: uv.u [type=int, outer=(3)] - │ └── variable: xy.x [type=int, outer=(1)] - └── variable: xy.y [type=int, outer=(2)] + │ ├── variable: u [type=int, outer=(3)] + │ └── variable: x [type=int, outer=(1)] + └── variable: y [type=int, outer=(2)] # Side-effects: test DivOp and impure FuncOp. build @@ -217,8 +217,8 @@ group-by │ │ │ └── interesting orderings: (+1) │ │ └── projections [outer=(1,2), side-effects] │ │ └── div [type=decimal, outer=(1,2), side-effects] - │ │ ├── variable: xy.x [type=int, outer=(1)] - │ │ └── variable: xy.y [type=int, outer=(2)] + │ │ ├── variable: x [type=int, outer=(1)] + │ │ └── variable: y [type=int, outer=(2)] │ ├── project │ │ ├── columns: u:4(int) v:5(int!null) │ │ ├── side-effects @@ -245,8 +245,8 @@ group-by │ │ └── const: '2018-01-01 00:00:00+00:00' [type=timestamptz] │ └── filters [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ]), fd=(1)==(4), (4)==(1)] │ └── eq [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ])] - │ ├── variable: xy.x [type=int, outer=(1)] - │ └── variable: uv.u [type=int, outer=(4)] + │ ├── variable: x [type=int, outer=(1)] + │ └── variable: u [type=int, outer=(4)] └── aggregations [outer=(1)] └── sum [type=decimal, outer=(1)] - └── variable: xy.x [type=int, outer=(1)] + └── variable: x [type=int, outer=(1)] diff --git a/pkg/sql/opt/memo/testdata/logprops/select b/pkg/sql/opt/memo/testdata/logprops/select index b05fa30b147a..19f130962c84 100644 --- a/pkg/sql/opt/memo/testdata/logprops/select +++ b/pkg/sql/opt/memo/testdata/logprops/select @@ -37,7 +37,7 @@ select │ └── interesting orderings: (+1) └── filters [type=bool, outer=(1), constraints=(/1: [/1 - /1]; tight), fd=()-->(1)] └── eq [type=bool, outer=(1), constraints=(/1: [/1 - /1]; tight)] - ├── variable: xy.x [type=int, outer=(1)] + ├── variable: x [type=int, outer=(1)] └── const: 1 [type=int] build @@ -74,8 +74,8 @@ select │ └── true [type=bool] └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] └── eq [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] - ├── variable: xy.x [type=int, outer=(1)] - └── variable: kuv.k [type=int, outer=(3)] + ├── variable: x [type=int, outer=(1)] + └── variable: k [type=int, outer=(3)] # Propagate outer columns. build @@ -123,12 +123,12 @@ select │ │ └── interesting orderings: (+3) │ └── filters [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ]), fd=(2)==(3), (3)==(2)] │ └── eq [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] - │ ├── variable: kuv.k [type=int, outer=(3)] - │ └── variable: xy.y [type=int, outer=(2)] + │ ├── variable: k [type=int, outer=(3)] + │ └── variable: y [type=int, outer=(2)] └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] └── eq [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] - ├── variable: kuv.k [type=int, outer=(3)] - └── variable: xy.x [type=int, outer=(1)] + ├── variable: k [type=int, outer=(3)] + └── variable: x [type=int, outer=(1)] # Reduce min cardinality. build @@ -240,7 +240,7 @@ project │ └── interesting orderings: (+5) └── filters [type=bool, outer=(3), constraints=(/3: (/NULL - ]; tight)] └── is-not [type=bool, outer=(3), constraints=(/3: (/NULL - ]; tight)] - ├── variable: abcd.c [type=int, outer=(3)] + ├── variable: c [type=int, outer=(3)] └── null [type=unknown] build @@ -267,8 +267,8 @@ project │ └── interesting orderings: (+5) └── filters [type=bool, outer=(3,4), constraints=(/3: (/NULL - ]; /4: (/NULL - ]), fd=(3)==(4), (4)==(3)] └── eq [type=bool, outer=(3,4), constraints=(/3: (/NULL - ]; /4: (/NULL - ])] - ├── variable: abcd.c [type=int, outer=(3)] - └── variable: abcd.d [type=int, outer=(4)] + ├── variable: c [type=int, outer=(3)] + └── variable: d [type=int, outer=(4)] build SELECT * FROM abcd WHERE a > c @@ -293,8 +293,8 @@ project │ └── interesting orderings: (+5) └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] └── gt [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] - ├── variable: abcd.a [type=int, outer=(1)] - └── variable: abcd.c [type=int, outer=(3)] + ├── variable: a [type=int, outer=(1)] + └── variable: c [type=int, outer=(3)] build SELECT * FROM (SELECT * FROM abcd WHERE a = c) WHERE b < d @@ -325,12 +325,12 @@ select │ │ └── interesting orderings: (+5) │ └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] │ └── eq [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] - │ ├── variable: abcd.a [type=int, outer=(1)] - │ └── variable: abcd.c [type=int, outer=(3)] + │ ├── variable: a [type=int, outer=(1)] + │ └── variable: c [type=int, outer=(3)] └── filters [type=bool, outer=(2,4), constraints=(/2: (/NULL - ]; /4: (/NULL - ])] └── lt [type=bool, outer=(2,4), constraints=(/2: (/NULL - ]; /4: (/NULL - ])] - ├── variable: abcd.b [type=int, outer=(2)] - └── variable: abcd.d [type=int, outer=(4)] + ├── variable: b [type=int, outer=(2)] + └── variable: d [type=int, outer=(4)] # Test outer column in select filter that is part of a not-null constraint. build @@ -392,8 +392,8 @@ project │ │ │ └── interesting orderings: (+6) │ │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] │ │ └── eq [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] - │ │ ├── variable: xy.y [type=int, outer=(7)] - │ │ └── variable: abcd.b [type=int, outer=(2)] + │ │ ├── variable: y [type=int, outer=(7)] + │ │ └── variable: b [type=int, outer=(2)] │ └── aggregations │ └── count-rows [type=int] └── const: 0 [type=int] diff --git a/pkg/sql/opt/memo/testdata/logprops/set b/pkg/sql/opt/memo/testdata/logprops/set index 8c241333f09c..8332ba690abb 100644 --- a/pkg/sql/opt/memo/testdata/logprops/set +++ b/pkg/sql/opt/memo/testdata/logprops/set @@ -77,7 +77,7 @@ intersect │ └── interesting orderings: (+5) └── filters [type=bool, outer=(3), constraints=(/3: [/1 - /1]; tight), fd=()-->(3)] └── eq [type=bool, outer=(3), constraints=(/3: [/1 - /1]; tight)] - ├── variable: uv.u [type=int, outer=(3)] + ├── variable: u [type=int, outer=(3)] └── const: 1 [type=int] build @@ -117,7 +117,7 @@ except │ └── interesting orderings: (+5) └── filters [type=bool, outer=(3), constraints=(/3: [/1 - /1]; tight), fd=()-->(3)] └── eq [type=bool, outer=(3), constraints=(/3: [/1 - /1]; tight)] - ├── variable: uv.u [type=int, outer=(3)] + ├── variable: u [type=int, outer=(3)] └── const: 1 [type=int] # Propagate outer columns. diff --git a/pkg/sql/opt/memo/testdata/logprops/values b/pkg/sql/opt/memo/testdata/logprops/values index 247b57037c71..29d305930e51 100644 --- a/pkg/sql/opt/memo/testdata/logprops/values +++ b/pkg/sql/opt/memo/testdata/logprops/values @@ -56,10 +56,10 @@ project ├── stats: [rows=2] ├── prune: (3) ├── tuple [type=tuple{int}, outer=(1)] - │ └── variable: xy.x [type=int, outer=(1)] + │ └── variable: x [type=int, outer=(1)] └── tuple [type=tuple{int}, outer=(2)] └── plus [type=int, outer=(2)] - ├── variable: xy.y [type=int, outer=(2)] + ├── variable: y [type=int, outer=(2)] └── const: 1 [type=int] # Single row. diff --git a/pkg/sql/opt/memo/testdata/logprops/virtual-scan b/pkg/sql/opt/memo/testdata/logprops/virtual-scan index 88580a91d628..50575b9d0682 100644 --- a/pkg/sql/opt/memo/testdata/logprops/virtual-scan +++ b/pkg/sql/opt/memo/testdata/logprops/virtual-scan @@ -54,7 +54,7 @@ project │ │ └── stats: [rows=1000, distinct(2)=700] │ └── filters [type=bool, outer=(2), constraints=(/2: [/'public' - /'public']; tight), fd=()-->(2)] │ └── eq [type=bool, outer=(2), constraints=(/2: [/'public' - /'public']; tight)] - │ ├── variable: schemata.schema_name [type=string, outer=(2)] + │ ├── variable: schema_name [type=string, outer=(2)] │ └── const: 'public' [type=string] ├── virtual-scan system.information_schema.tables │ ├── columns: table_catalog:5(string) table_schema:6(string) table_name:7(string) table_type:8(string) is_insertable_into:9(string) version:10(int) @@ -62,8 +62,8 @@ project └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ])] └── and [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ])] ├── eq [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - │ ├── variable: schemata.catalog_name [type=string, outer=(1)] - │ └── variable: tables.table_catalog [type=string, outer=(5)] + │ ├── variable: catalog_name [type=string, outer=(1)] + │ └── variable: table_catalog [type=string, outer=(5)] └── eq [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] - ├── variable: schemata.schema_name [type=string, outer=(2)] - └── variable: tables.table_schema [type=string, outer=(6)] + ├── variable: schema_name [type=string, outer=(2)] + └── variable: table_schema [type=string, outer=(6)] diff --git a/pkg/sql/opt/memo/testdata/memo b/pkg/sql/opt/memo/testdata/memo index 316466e66ab5..6e05e5a9bb88 100644 --- a/pkg/sql/opt/memo/testdata/memo +++ b/pkg/sql/opt/memo/testdata/memo @@ -63,7 +63,7 @@ limit │ │ └── filters [type=bool, outer=(1-3), constraints=(/2: [/2 - ])] │ │ └── and [type=bool, outer=(1-3), constraints=(/2: [/2 - ])] │ │ ├── gt [type=bool, outer=(2), constraints=(/2: [/2 - ]; tight)] - │ │ │ ├── variable: a.y [type=int, outer=(2)] + │ │ │ ├── variable: y [type=int, outer=(2)] │ │ │ └── const: 1 [type=int] │ │ └── eq [type=bool, outer=(1,3)] │ │ ├── cast: STRING [type=string, outer=(1)] @@ -71,7 +71,7 @@ limit │ │ └── variable: b.x [type=string, outer=(3)] │ └── projections [outer=(2,3)] │ └── plus [type=int, outer=(2)] - │ ├── variable: a.y [type=int, outer=(2)] + │ ├── variable: y [type=int, outer=(2)] │ └── const: 1 [type=int] └── const: 10 [type=int] @@ -123,7 +123,7 @@ project │ │ │ │ └── fd: (1)-->(2) │ │ │ └── filters [type=bool, outer=(2), constraints=(/2: [/2 - ]; tight)] │ │ │ └── gt [type=bool, outer=(2), constraints=(/2: [/2 - ]; tight)] - │ │ │ ├── variable: a.y [type=int, outer=(2)] + │ │ │ ├── variable: y [type=int, outer=(2)] │ │ │ └── const: 1 [type=int] │ │ └── filters [type=bool, outer=(1,3), constraints=(/3: (/NULL - ])] │ │ └── eq [type=bool, outer=(1,3), constraints=(/3: (/NULL - ])] @@ -133,7 +133,7 @@ project │ └── const: 10 [type=int] └── projections [outer=(2,3)] └── plus [type=int, outer=(2)] - ├── variable: a.y [type=int, outer=(2)] + ├── variable: y [type=int, outer=(2)] └── const: 1 [type=int] memo @@ -186,7 +186,7 @@ memo (optimized) ├── G13: (gt G16 G17) ├── G14: (variable b.x) ├── G15: (cast G18 STRING) - ├── G16: (variable a.y) + ├── G16: (variable y) ├── G17: (const 1) └── G18: (variable a.x) @@ -218,12 +218,12 @@ memo (optimized) ├── G10: (eq G13 G14) ├── G11: (eq G15 G15) ├── G12: (function G18 G16 left) - ├── G13: (variable b.z) + ├── G13: (variable z) ├── G14: (const 1) ├── G15: (function G18 G17 G18 concat) ├── G16: (const 10) ├── G17: (const 'foo') - └── G18: (variable b.x) + └── G18: (variable x) # Test topological sorting memo @@ -253,8 +253,8 @@ memo (optimized) ├── G9: (eq G10 G11) ├── G10: (plus G12 G13) ├── G11: (const 1) - ├── G12: (variable a.x) - └── G13: (variable a.y) + ├── G12: (variable x) + └── G13: (variable y) memo raw-memo SELECT x FROM a WHERE x = 1 AND x+y = 1 @@ -265,10 +265,10 @@ memo (optimized) │ └── "" │ ├── best: (scan a) │ └── cost: 1040.00 - ├── G2: (variable a.x) + ├── G2: (variable x) ├── G3: (const 1) ├── G4: (eq G2 G3) - ├── G5: (variable a.y) + ├── G5: (variable y) ├── G6: (plus G2 G5) ├── G7: (eq G6 G3) ├── G8: (and G4 G7) @@ -330,7 +330,7 @@ memo (optimized) │ └── cost: 1030.00 ├── G3: (aggregations G4) ├── G4: (array-agg G5) - └── G5: (variable a.x) + └── G5: (variable x) memo SELECT array_agg(x) FROM (SELECT * FROM a) GROUP BY y @@ -351,7 +351,7 @@ memo (optimized) │ └── cost: 1040.00 ├── G5: (aggregations G6) ├── G6: (array-agg G7) - └── G7: (variable a.x) + └── G7: (variable x) memo SELECT array_agg(x) FROM (SELECT * FROM a ORDER BY y) @@ -370,7 +370,7 @@ memo (optimized) │ └── cost: 1249.32 ├── G3: (aggregations G4) ├── G4: (array-agg G5) - └── G5: (variable a.x) + └── G5: (variable x) memo SELECT DISTINCT field FROM [EXPLAIN SELECT 123 AS k] diff --git a/pkg/sql/opt/memo/testdata/stats/groupby b/pkg/sql/opt/memo/testdata/stats/groupby index 92c5184fdb74..bdb8eb64b637 100644 --- a/pkg/sql/opt/memo/testdata/stats/groupby +++ b/pkg/sql/opt/memo/testdata/stats/groupby @@ -92,7 +92,7 @@ project │ └── fd: (1)-->(2-4), (3,4)~~>(1,2) └── aggregations [outer=(2)] └── max [type=int, outer=(2)] - └── variable: a.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # Group by non-key. build @@ -114,7 +114,7 @@ group-by │ └── fd: (1)-->(2-4), (3,4)~~>(1,2) └── aggregations [outer=(3)] └── sum [type=float, outer=(3)] - └── variable: a.z [type=float, outer=(3)] + └── variable: z [type=float, outer=(3)] build SELECT max(x) FROM a GROUP BY y, z, s @@ -135,7 +135,7 @@ project │ └── fd: (1)-->(2-4), (3,4)~~>(1,2) └── aggregations [outer=(1)] └── max [type=int, outer=(1)] - └── variable: a.x [type=int, outer=(1)] + └── variable: x [type=int, outer=(1)] build SELECT min(x) FROM a GROUP BY y, z @@ -161,7 +161,7 @@ project │ └── fd: (1)-->(2-4), (3,4)~~>(1,2) └── aggregations [outer=(1)] └── min [type=int, outer=(1)] - └── variable: a.x [type=int, outer=(1)] + └── variable: x [type=int, outer=(1)] build SELECT max(x) FROM a GROUP BY y, z, s HAVING s IN ('a', 'b') @@ -187,10 +187,10 @@ project │ │ └── fd: (1)-->(2-4), (3,4)~~>(1,2) │ └── aggregations [outer=(1)] │ └── max [type=int, outer=(1)] - │ └── variable: a.x [type=int, outer=(1)] + │ └── variable: x [type=int, outer=(1)] └── filters [type=bool, outer=(4), constraints=(/4: [/'a' - /'a'] [/'b' - /'b']; tight)] └── in [type=bool, outer=(4), constraints=(/4: [/'a' - /'a'] [/'b' - /'b']; tight)] - ├── variable: a.s [type=string, outer=(4)] + ├── variable: s [type=string, outer=(4)] └── tuple [type=tuple{string, string}] ├── const: 'a' [type=string] └── const: 'b' [type=string] @@ -222,7 +222,7 @@ select │ │ └── fd: (1)-->(2-4), (3,4)~~>(1,2) │ └── aggregations [outer=(1)] │ └── sum [type=decimal, outer=(1)] - │ └── variable: a.x [type=int, outer=(1)] + │ └── variable: x [type=int, outer=(1)] └── filters [type=bool, outer=(5), constraints=(/5: [/5 - /5]; tight), fd=()-->(5)] └── eq [type=bool, outer=(5), constraints=(/5: [/5 - /5]; tight)] ├── variable: column5 [type=decimal, outer=(5)] @@ -254,9 +254,9 @@ select │ │ └── fd: (1)-->(2-4), (3,4)~~>(1,2) │ └── aggregations [outer=(2,3)] │ ├── sum [type=float, outer=(3)] - │ │ └── variable: a.z [type=float, outer=(3)] + │ │ └── variable: z [type=float, outer=(3)] │ └── max [type=int, outer=(2)] - │ └── variable: a.y [type=int, outer=(2)] + │ └── variable: y [type=int, outer=(2)] └── filters [type=bool, outer=(5), constraints=(/5: [/5.0 - /5.0]; tight), fd=()-->(5)] └── eq [type=bool, outer=(5), constraints=(/5: [/5.0 - /5.0]; tight)] ├── variable: column5 [type=float, outer=(5)] diff --git a/pkg/sql/opt/memo/testdata/stats/index-join b/pkg/sql/opt/memo/testdata/stats/index-join index 79e026d75343..940862680ef7 100644 --- a/pkg/sql/opt/memo/testdata/stats/index-join +++ b/pkg/sql/opt/memo/testdata/stats/index-join @@ -76,8 +76,8 @@ project │ └── filters [type=bool, outer=(1,2)] │ └── eq [type=bool, outer=(1,2)] │ ├── plus [type=int, outer=(1,2)] - │ │ ├── variable: a.x [type=int, outer=(1)] - │ │ └── variable: a.y [type=int, outer=(2)] + │ │ ├── variable: x [type=int, outer=(1)] + │ │ └── variable: y [type=int, outer=(2)] │ └── const: 10 [type=int] └── aggregations └── count-rows [type=int] diff --git a/pkg/sql/opt/memo/testdata/stats/join b/pkg/sql/opt/memo/testdata/stats/join index 24910da5faec..14303bccd069 100644 --- a/pkg/sql/opt/memo/testdata/stats/join +++ b/pkg/sql/opt/memo/testdata/stats/join @@ -264,7 +264,7 @@ project │ └── true [type=bool] └── filters [type=bool, outer=(6), constraints=(/6: [/5 - /5]; tight), fd=()-->(6)] └── eq [type=bool, outer=(6), constraints=(/6: [/5 - /5]; tight)] - ├── variable: b.z [type=int, outer=(6)] + ├── variable: z [type=int, outer=(6)] └── const: 5 [type=int] # Force calculation of the distinct count for the column set spanning both @@ -299,7 +299,7 @@ group-by │ └── true [type=bool] └── aggregations [outer=(6)] └── sum [type=decimal, outer=(6)] - └── variable: b.z [type=int, outer=(6)] + └── variable: z [type=int, outer=(6)] # Join selectivity: 1/max(distinct(a.x), distinct(b.x)) = 1/5000. norm @@ -328,7 +328,7 @@ group-by │ └── variable: b.x [type=int, outer=(5)] └── aggregations [outer=(6)] └── sum [type=decimal, outer=(6)] - └── variable: b.z [type=int, outer=(6)] + └── variable: z [type=int, outer=(6)] # Semi-join. norm @@ -395,8 +395,8 @@ inner-join │ ├── variable: a.x [type=int, outer=(1)] │ └── variable: b.x [type=int, outer=(5)] └── eq [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] - ├── variable: a.y [type=int, outer=(2)] - └── variable: b.z [type=int, outer=(6)] + ├── variable: y [type=int, outer=(2)] + └── variable: z [type=int, outer=(6)] # Equality condition + extra filters. norm @@ -418,10 +418,10 @@ inner-join │ │ └── fd: (1)-->(2-4), (3,4)~~>(1,2) │ └── filters [type=bool, outer=(2), constraints=(/2: [/1 - /299]; tight)] │ ├── gt [type=bool, outer=(2), constraints=(/2: [/1 - ]; tight)] - │ │ ├── variable: a.y [type=int, outer=(2)] + │ │ ├── variable: y [type=int, outer=(2)] │ │ └── const: 0 [type=int] │ └── lt [type=bool, outer=(2), constraints=(/2: (/NULL - /299]; tight)] - │ ├── variable: a.y [type=int, outer=(2)] + │ ├── variable: y [type=int, outer=(2)] │ └── const: 300 [type=int] ├── scan b │ ├── columns: b.x:5(int) z:6(int!null) @@ -432,8 +432,8 @@ inner-join │ └── variable: b.x [type=int, outer=(5)] └── eq [type=bool, outer=(2,6)] ├── plus [type=int, outer=(2,6)] - │ ├── variable: a.y [type=int, outer=(2)] - │ └── variable: b.z [type=int, outer=(6)] + │ ├── variable: y [type=int, outer=(2)] + │ └── variable: z [type=int, outer=(6)] └── const: 5 [type=int] # Force column statistics calculation for semi-join. @@ -470,8 +470,8 @@ project │ │ └── variable: b.x [type=int, outer=(5)] │ └── eq [type=bool, outer=(2,6)] │ ├── plus [type=int, outer=(2,6)] - │ │ ├── variable: a.y [type=int, outer=(2)] - │ │ └── variable: b.z [type=int, outer=(6)] + │ │ ├── variable: y [type=int, outer=(2)] + │ │ └── variable: z [type=int, outer=(6)] │ └── const: 5 [type=int] └── aggregations └── count-rows [type=int] @@ -510,8 +510,8 @@ project │ │ └── variable: b.x [type=int, outer=(5)] │ └── eq [type=bool, outer=(2,6)] │ ├── plus [type=int, outer=(2,6)] - │ │ ├── variable: a.y [type=int, outer=(2)] - │ │ └── variable: b.z [type=int, outer=(6)] + │ │ ├── variable: y [type=int, outer=(2)] + │ │ └── variable: z [type=int, outer=(6)] │ └── const: 5 [type=int] └── aggregations └── count-rows [type=int] @@ -549,8 +549,8 @@ project │ │ └── variable: b.x [type=int, outer=(5)] │ └── eq [type=bool, outer=(2,6)] │ ├── plus [type=int, outer=(2,6)] - │ │ ├── variable: a.y [type=int, outer=(2)] - │ │ └── variable: b.z [type=int, outer=(6)] + │ │ ├── variable: y [type=int, outer=(2)] + │ │ └── variable: z [type=int, outer=(6)] │ └── const: 5 [type=int] └── aggregations └── count-rows [type=int] @@ -588,8 +588,8 @@ project │ │ └── variable: b.x [type=int, outer=(5)] │ └── eq [type=bool, outer=(2,6)] │ ├── plus [type=int, outer=(2,6)] - │ │ ├── variable: a.y [type=int, outer=(2)] - │ │ └── variable: b.z [type=int, outer=(6)] + │ │ ├── variable: y [type=int, outer=(2)] + │ │ └── variable: z [type=int, outer=(6)] │ └── const: 5 [type=int] └── aggregations └── count-rows [type=int] @@ -627,8 +627,8 @@ project │ │ └── variable: b.x [type=int, outer=(5)] │ └── eq [type=bool, outer=(2,6)] │ ├── plus [type=int, outer=(2,6)] - │ │ ├── variable: a.y [type=int, outer=(2)] - │ │ └── variable: b.z [type=int, outer=(6)] + │ │ ├── variable: y [type=int, outer=(2)] + │ │ └── variable: z [type=int, outer=(6)] │ └── const: 5 [type=int] └── aggregations └── count-rows [type=int] diff --git a/pkg/sql/opt/memo/testdata/stats/limit b/pkg/sql/opt/memo/testdata/stats/limit index 765138ce45e7..16817d44fd61 100644 --- a/pkg/sql/opt/memo/testdata/stats/limit +++ b/pkg/sql/opt/memo/testdata/stats/limit @@ -63,7 +63,7 @@ limit │ │ └── fd: (1)-->(2-4), (3,4)~~>(1,2) │ └── filters [type=bool, outer=(3), constraints=(/3: [/'foo' - /'foo']; tight), fd=()-->(3)] │ └── eq [type=bool, outer=(3), constraints=(/3: [/'foo' - /'foo']; tight)] - │ ├── variable: a.s [type=string, outer=(3)] + │ ├── variable: s [type=string, outer=(3)] │ └── const: 'foo' [type=string] └── const: 5 [type=int] @@ -87,7 +87,7 @@ limit │ │ └── fd: (1)-->(2-4), (3,4)~~>(1,2) │ └── filters [type=bool, outer=(3), constraints=(/3: [/'foo' - /'foo']; tight), fd=()-->(3)] │ └── eq [type=bool, outer=(3), constraints=(/3: [/'foo' - /'foo']; tight)] - │ ├── variable: a.s [type=string, outer=(3)] + │ ├── variable: s [type=string, outer=(3)] │ └── const: 'foo' [type=string] └── subquery [type=int] └── max1-row @@ -140,5 +140,5 @@ select │ └── const: 5 [type=int] └── filters [type=bool, outer=(3), constraints=(/3: [/'foo' - /'foo']; tight), fd=()-->(3)] └── eq [type=bool, outer=(3), constraints=(/3: [/'foo' - /'foo']; tight)] - ├── variable: a.s [type=string, outer=(3)] + ├── variable: s [type=string, outer=(3)] └── const: 'foo' [type=string] diff --git a/pkg/sql/opt/memo/testdata/stats/ordinality b/pkg/sql/opt/memo/testdata/stats/ordinality index 1590af3847df..229ea7dad83d 100644 --- a/pkg/sql/opt/memo/testdata/stats/ordinality +++ b/pkg/sql/opt/memo/testdata/stats/ordinality @@ -70,10 +70,10 @@ select │ └── fd: (1)-->(2) └── filters [type=bool, outer=(2), constraints=(/2: [/1 - /10]; tight)] ├── gt [type=bool, outer=(2), constraints=(/2: [/1 - ]; tight)] - │ ├── variable: a.y [type=int, outer=(2)] + │ ├── variable: y [type=int, outer=(2)] │ └── const: 0 [type=int] └── le [type=bool, outer=(2), constraints=(/2: (/NULL - /10]; tight)] - ├── variable: a.y [type=int, outer=(2)] + ├── variable: y [type=int, outer=(2)] └── const: 10 [type=int] norm diff --git a/pkg/sql/opt/memo/testdata/stats/project b/pkg/sql/opt/memo/testdata/stats/project index 275b23caf496..3dead52bb95c 100644 --- a/pkg/sql/opt/memo/testdata/stats/project +++ b/pkg/sql/opt/memo/testdata/stats/project @@ -110,9 +110,9 @@ select │ │ └── fd: (1)-->(2-4), (3,4)~~>(1,2) │ └── projections [outer=(2,3)] │ └── function: concat [type=string, outer=(2,3)] - │ ├── variable: a.s [type=string, outer=(3)] + │ ├── variable: s [type=string, outer=(3)] │ └── cast: STRING [type=string, outer=(2)] - │ └── variable: a.y [type=int, outer=(2)] + │ └── variable: y [type=int, outer=(2)] └── filters [type=bool, outer=(5), constraints=(/5: [/'foo' - /'foo']; tight), fd=()-->(5)] └── eq [type=bool, outer=(5), constraints=(/5: [/'foo' - /'foo']; tight)] ├── variable: concat [type=string, outer=(5)] @@ -140,9 +140,9 @@ group-by │ └── fd: (1)-->(2-4), (3,4)~~>(1,2) └── projections [outer=(1-3)] └── function: concat [type=string, outer=(2,3)] - ├── variable: a.s [type=string, outer=(3)] + ├── variable: s [type=string, outer=(3)] └── cast: STRING [type=string, outer=(2)] - └── variable: a.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # No available stats for column y. build @@ -161,7 +161,7 @@ select │ │ └── fd: (1)-->(2-4), (3,4)~~>(1,2) │ └── projections [outer=(2)] │ └── plus [type=int, outer=(2)] - │ ├── variable: a.y [type=int, outer=(2)] + │ ├── variable: y [type=int, outer=(2)] │ └── const: 3 [type=int] └── filters [type=bool, outer=(5), constraints=(/5: [/1 - /100]; tight)] └── and [type=bool, outer=(5), constraints=(/5: [/1 - /100]; tight)] @@ -232,5 +232,5 @@ select │ └── fd: (5)-->(6,7) └── projections [outer=(3,7)] └── lt [type=bool, outer=(3,7)] - ├── variable: a.s [type=string, outer=(3)] - └── variable: kuv.v [type=string, outer=(7)] + ├── variable: s [type=string, outer=(3)] + └── variable: v [type=string, outer=(7)] diff --git a/pkg/sql/opt/memo/testdata/stats/scan b/pkg/sql/opt/memo/testdata/stats/scan index 1937fe02b67f..96198820450a 100644 --- a/pkg/sql/opt/memo/testdata/stats/scan +++ b/pkg/sql/opt/memo/testdata/stats/scan @@ -50,7 +50,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5), (3,4)~~>(1,2,5) └── filters [type=bool, outer=(5), constraints=(/5: [/true - /true]; tight), fd=()-->(5)] - └── variable: a.b [type=bool, outer=(5), constraints=(/5: [/true - /true]; tight)] + └── variable: b [type=bool, outer=(5), constraints=(/5: [/true - /true]; tight)] exec-ddl ALTER TABLE a INJECT STATISTICS '[ @@ -137,7 +137,7 @@ group-by └── aggregations [outer=(2)] ├── count-rows [type=int] └── const-agg [type=int, outer=(2)] - └── variable: a.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # Test calculation of multi-column stats. opt diff --git a/pkg/sql/opt/memo/testdata/stats/select b/pkg/sql/opt/memo/testdata/stats/select index 2b43357f2314..f84d64e2af35 100644 --- a/pkg/sql/opt/memo/testdata/stats/select +++ b/pkg/sql/opt/memo/testdata/stats/select @@ -96,16 +96,16 @@ project │ └── fd: (3)-->(1,2) └── filters [type=bool, outer=(1-3), constraints=(/1: [/1 - /1]; /2: [/2 - /2]; /3: [/5 - /8]; tight), fd=()-->(1,2)] ├── eq [type=bool, outer=(1), constraints=(/1: [/1 - /1]; tight)] - │ ├── variable: b.x [type=int, outer=(1)] + │ ├── variable: x [type=int, outer=(1)] │ └── const: 1 [type=int] ├── eq [type=bool, outer=(2), constraints=(/2: [/2 - /2]; tight)] - │ ├── variable: b.z [type=int, outer=(2)] + │ ├── variable: z [type=int, outer=(2)] │ └── const: 2 [type=int] ├── ge [type=bool, outer=(3), constraints=(/3: [/5 - ]; tight)] - │ ├── variable: b.rowid [type=int, outer=(3)] + │ ├── variable: rowid [type=int, outer=(3)] │ └── const: 5 [type=int] └── le [type=bool, outer=(3), constraints=(/3: (/NULL - /8]; tight)] - ├── variable: b.rowid [type=int, outer=(3)] + ├── variable: rowid [type=int, outer=(3)] └── const: 8 [type=int] # Can't determine stats from filter. @@ -125,8 +125,8 @@ select └── filters [type=bool, outer=(1,2)] └── lt [type=bool, outer=(1,2)] ├── plus [type=int, outer=(1,2)] - │ ├── variable: a.x [type=int, outer=(1)] - │ └── variable: a.y [type=int, outer=(2)] + │ ├── variable: x [type=int, outer=(1)] + │ └── variable: y [type=int, outer=(2)] └── const: 10 [type=int] # Remaining filter. @@ -145,12 +145,12 @@ select │ └── fd: (1)-->(2) └── filters [type=bool, outer=(1,2), constraints=(/2: [/5 - /5]), fd=()-->(2)] ├── eq [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] - │ ├── variable: a.y [type=int, outer=(2)] + │ ├── variable: y [type=int, outer=(2)] │ └── const: 5 [type=int] └── lt [type=bool, outer=(1,2)] ├── plus [type=int, outer=(1,2)] - │ ├── variable: a.x [type=int, outer=(1)] - │ └── variable: a.y [type=int, outer=(2)] + │ ├── variable: x [type=int, outer=(1)] + │ └── variable: y [type=int, outer=(2)] └── const: 10 [type=int] # Contradiction. @@ -170,7 +170,7 @@ select │ └── fd: (1)-->(2) └── filters [type=bool, outer=(1), constraints=(/1: [/NULL - /NULL]; tight), fd=()-->(1)] └── is [type=bool, outer=(1), constraints=(/1: [/NULL - /NULL]; tight)] - ├── variable: a.x [type=int, outer=(1)] + ├── variable: x [type=int, outer=(1)] └── null [type=unknown] norm @@ -193,14 +193,14 @@ project │ │ └── stats: [rows=10000, distinct(1)=5000, distinct(2)=100] │ └── filters [type=bool, outer=(1), constraints=(/1: [/1001 - /2000]; tight)] │ ├── gt [type=bool, outer=(1), constraints=(/1: [/1001 - ]; tight)] - │ │ ├── variable: b.x [type=int, outer=(1)] + │ │ ├── variable: x [type=int, outer=(1)] │ │ └── const: 1000 [type=int] │ └── le [type=bool, outer=(1), constraints=(/1: (/NULL - /2000]; tight)] - │ ├── variable: b.x [type=int, outer=(1)] + │ ├── variable: x [type=int, outer=(1)] │ └── const: 2000 [type=int] └── aggregations [outer=(1)] └── sum [type=decimal, outer=(1)] - └── variable: b.x [type=int, outer=(1)] + └── variable: x [type=int, outer=(1)] # Regression: statistics builder panics when end key is NULL when it's trying # to compute start/end int boundaries. @@ -233,7 +233,7 @@ project │ └── stats: [rows=333.333333] └── filters [type=bool, outer=(3), constraints=(/3: (/NULL - /9]; tight)] └── lt [type=bool, outer=(3), constraints=(/3: (/NULL - /9]; tight)] - ├── variable: idx.z [type=int, outer=(3)] + ├── variable: z [type=int, outer=(3)] └── const: 10 [type=int] # Regression: certain queries could cause a NaN expected number of rows via a divide-by-zero. @@ -342,10 +342,10 @@ select │ └── fd: (1,2)-->(3) └── filters [type=bool, outer=(1,3), constraints=(/1: [/1 - /1]; /3: [/'bobs_burgers' - /'bobs_burgers']; tight), fd=()-->(1,3)] ├── eq [type=bool, outer=(1), constraints=(/1: [/1 - /1]; tight)] - │ ├── variable: district.d_id [type=int, outer=(1)] + │ ├── variable: d_id [type=int, outer=(1)] │ └── const: 1 [type=int] └── eq [type=bool, outer=(3), constraints=(/3: [/'bobs_burgers' - /'bobs_burgers']; tight)] - ├── variable: district.d_name [type=string, outer=(3)] + ├── variable: d_name [type=string, outer=(3)] └── const: 'bobs_burgers' [type=string] # In this case we expect to use unknownFilterSelectivity @@ -366,10 +366,10 @@ select │ └── fd: (1,2)-->(3) └── filters [type=bool, outer=(1,3), constraints=(/1: [/1 - /1]), fd=()-->(1)] ├── eq [type=bool, outer=(1), constraints=(/1: [/1 - /1]; tight)] - │ ├── variable: district.d_id [type=int, outer=(1)] + │ ├── variable: d_id [type=int, outer=(1)] │ └── const: 1 [type=int] └── like [type=bool, outer=(3)] - ├── variable: district.d_name [type=string, outer=(3)] + ├── variable: d_name [type=string, outer=(3)] └── const: 'bob' [type=string] # This tests selectivityFromReducedCols. @@ -392,16 +392,16 @@ select │ └── fd: (1,2)-->(3) └── filters [type=bool, outer=(1-3), constraints=(/1: [/2 - /9]; /2: [/10 - /10]; /3: [/'bobs_burgers' - /'bobs_burgers']; tight), fd=()-->(2,3)] ├── gt [type=bool, outer=(1), constraints=(/1: [/2 - ]; tight)] - │ ├── variable: district.d_id [type=int, outer=(1)] + │ ├── variable: d_id [type=int, outer=(1)] │ └── const: 1 [type=int] ├── lt [type=bool, outer=(1), constraints=(/1: (/NULL - /9]; tight)] - │ ├── variable: district.d_id [type=int, outer=(1)] + │ ├── variable: d_id [type=int, outer=(1)] │ └── const: 10 [type=int] ├── eq [type=bool, outer=(2), constraints=(/2: [/10 - /10]; tight)] - │ ├── variable: district.d_w_id [type=int, outer=(2)] + │ ├── variable: d_w_id [type=int, outer=(2)] │ └── const: 10 [type=int] └── eq [type=bool, outer=(3), constraints=(/3: [/'bobs_burgers' - /'bobs_burgers']; tight)] - ├── variable: district.d_name [type=string, outer=(3)] + ├── variable: d_name [type=string, outer=(3)] └── const: 'bobs_burgers' [type=string] # This tests selectivityFromReducedCols @@ -422,13 +422,13 @@ select │ └── fd: (1,2)-->(3) └── filters [type=bool, outer=(1-3), constraints=(/1: [/1 - /1]; /2: [/10 - /10]; /3: [/'hello' - /'hello']; tight), fd=()-->(1-3)] ├── eq [type=bool, outer=(1), constraints=(/1: [/1 - /1]; tight)] - │ ├── variable: district.d_id [type=int, outer=(1)] + │ ├── variable: d_id [type=int, outer=(1)] │ └── const: 1 [type=int] ├── eq [type=bool, outer=(2), constraints=(/2: [/10 - /10]; tight)] - │ ├── variable: district.d_w_id [type=int, outer=(2)] + │ ├── variable: d_w_id [type=int, outer=(2)] │ └── const: 10 [type=int] └── eq [type=bool, outer=(3), constraints=(/3: [/'hello' - /'hello']; tight)] - ├── variable: district.d_name [type=string, outer=(3)] + ├── variable: d_name [type=string, outer=(3)] └── const: 'hello' [type=string] exec-ddl @@ -493,11 +493,11 @@ select │ │ └── true [type=bool] │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] │ └── eq [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - │ ├── variable: customers.id [type=int, outer=(1)] - │ └── variable: order_history.customer_id [type=int, outer=(6)] + │ ├── variable: id [type=int, outer=(1)] + │ └── variable: customer_id [type=int, outer=(6)] └── filters [type=bool, outer=(2), constraints=(/2: [/'andy' - /'andy']; tight), fd=()-->(2)] └── eq [type=bool, outer=(2), constraints=(/2: [/'andy' - /'andy']; tight)] - ├── variable: customers.name [type=string, outer=(2)] + ├── variable: name [type=string, outer=(2)] └── const: 'andy' [type=string] # This tests selectivityFromReducedCols @@ -545,15 +545,15 @@ select │ │ └── true [type=bool] │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] │ └── eq [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - │ ├── variable: customers.id [type=int, outer=(1)] - │ └── variable: order_history.customer_id [type=int, outer=(6)] + │ ├── variable: id [type=int, outer=(1)] + │ └── variable: customer_id [type=int, outer=(6)] └── filters [type=bool, outer=(1,2), constraints=(/1: [/1 - /1]; /2: [/'andy' - /'andy']; tight), fd=()-->(1,2)] └── and [type=bool, outer=(1,2), constraints=(/1: [/1 - /1]; /2: [/'andy' - /'andy']; tight)] ├── eq [type=bool, outer=(1), constraints=(/1: [/1 - /1]; tight)] - │ ├── variable: customers.id [type=int, outer=(1)] + │ ├── variable: id [type=int, outer=(1)] │ └── const: 1 [type=int] └── eq [type=bool, outer=(2), constraints=(/2: [/'andy' - /'andy']; tight)] - ├── variable: customers.name [type=string, outer=(2)] + ├── variable: name [type=string, outer=(2)] └── const: 'andy' [type=string] # Test equality conditions where all have distinct count 1. @@ -569,13 +569,13 @@ select │ └── stats: [rows=1000, distinct(1)=700, distinct(2)=700, distinct(3)=700] └── filters [type=bool, outer=(1-3), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /3: [/5 - /5]), fd=()-->(1-3), (1)==(2,3), (2)==(1,3), (3)==(1,2)] ├── eq [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] - │ ├── variable: order_history.item_id [type=int, outer=(2)] - │ └── variable: order_history.order_id [type=int, outer=(1)] + │ ├── variable: item_id [type=int, outer=(2)] + │ └── variable: order_id [type=int, outer=(1)] ├── eq [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] - │ ├── variable: order_history.item_id [type=int, outer=(2)] - │ └── variable: order_history.customer_id [type=int, outer=(3)] + │ ├── variable: item_id [type=int, outer=(2)] + │ └── variable: customer_id [type=int, outer=(3)] └── eq [type=bool, outer=(3), constraints=(/3: [/5 - /5]; tight)] - ├── variable: order_history.customer_id [type=int, outer=(3)] + ├── variable: customer_id [type=int, outer=(3)] └── const: 5 [type=int] # Test equality condition with another condition on one of the attributes. @@ -591,13 +591,13 @@ select │ └── stats: [rows=1000, distinct(1)=700, distinct(2)=700] └── filters [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: [/1 - /4]), fd=(1)==(2), (2)==(1)] ├── eq [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] - │ ├── variable: order_history.item_id [type=int, outer=(2)] - │ └── variable: order_history.order_id [type=int, outer=(1)] + │ ├── variable: item_id [type=int, outer=(2)] + │ └── variable: order_id [type=int, outer=(1)] ├── lt [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] - │ ├── variable: order_history.item_id [type=int, outer=(2)] + │ ├── variable: item_id [type=int, outer=(2)] │ └── const: 5 [type=int] └── gt [type=bool, outer=(2), constraints=(/2: [/1 - ]; tight)] - ├── variable: order_history.item_id [type=int, outer=(2)] + ├── variable: item_id [type=int, outer=(2)] └── const: 0 [type=int] # Test equality condition with another condition on a different attribute. @@ -613,13 +613,13 @@ select │ └── stats: [rows=1000, distinct(1)=700, distinct(2)=700] └── filters [type=bool, outer=(1-3), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /3: [/1 - /4]), fd=(1)==(2), (2)==(1)] ├── eq [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] - │ ├── variable: order_history.item_id [type=int, outer=(2)] - │ └── variable: order_history.order_id [type=int, outer=(1)] + │ ├── variable: item_id [type=int, outer=(2)] + │ └── variable: order_id [type=int, outer=(1)] ├── lt [type=bool, outer=(3), constraints=(/3: (/NULL - /4]; tight)] - │ ├── variable: order_history.customer_id [type=int, outer=(3)] + │ ├── variable: customer_id [type=int, outer=(3)] │ └── const: 5 [type=int] └── gt [type=bool, outer=(3), constraints=(/3: [/1 - ]; tight)] - ├── variable: order_history.customer_id [type=int, outer=(3)] + ├── variable: customer_id [type=int, outer=(3)] └── const: 0 [type=int] # Test equality condition with another filter condition without a constraint. @@ -635,10 +635,10 @@ select │ └── stats: [rows=1000, distinct(1)=700, distinct(2)=700] └── filters [type=bool, outer=(1-3), constraints=(/1: (/NULL - ]; /2: (/NULL - ]), fd=(1)==(2), (2)==(1)] ├── eq [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] - │ ├── variable: order_history.item_id [type=int, outer=(2)] - │ └── variable: order_history.order_id [type=int, outer=(1)] + │ ├── variable: item_id [type=int, outer=(2)] + │ └── variable: order_id [type=int, outer=(1)] └── eq [type=bool, outer=(3)] ├── mod [type=int, outer=(3)] - │ ├── variable: order_history.customer_id [type=int, outer=(3)] + │ ├── variable: customer_id [type=int, outer=(3)] │ └── const: 2 [type=int] └── const: 0 [type=int] diff --git a/pkg/sql/opt/memo/testdata/stats/set b/pkg/sql/opt/memo/testdata/stats/set index 3dec4e33bbf9..33b2e8275b74 100644 --- a/pkg/sql/opt/memo/testdata/stats/set +++ b/pkg/sql/opt/memo/testdata/stats/set @@ -577,5 +577,5 @@ select │ └── fd: (7)-->(4-6) └── filters [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight), fd=()-->(2)] └── eq [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] - ├── variable: a.y [type=int, outer=(2)] + ├── variable: y [type=int, outer=(2)] └── const: 5 [type=int] diff --git a/pkg/sql/opt/memo/testdata/typing b/pkg/sql/opt/memo/testdata/typing index 54c235e42882..7e578b6fab51 100644 --- a/pkg/sql/opt/memo/testdata/typing +++ b/pkg/sql/opt/memo/testdata/typing @@ -57,7 +57,7 @@ select ├── scan a │ └── columns: x:1(int!null) y:2(int) └── filters [type=bool] - └── a.x = $1 [type=bool] + └── x = $1 [type=bool] # Tuple, Projections build @@ -68,7 +68,7 @@ project ├── scan a │ └── columns: x:1(int!null) y:2(int) └── projections - └── (a.x, 1.5) [type=tuple{int, decimal}] + └── (x, 1.5) [type=tuple{int, decimal}] # And, Or, Not build @@ -79,7 +79,7 @@ select ├── scan a │ └── columns: x:1(int!null) y:2(int) └── filters [type=bool] - └── (a.x = 1) AND (NOT ((a.y = 2) OR (a.y = 3.5))) [type=bool] + └── (x = 1) AND (NOT ((y = 2) OR (y = 3.5))) [type=bool] # Eq, Ne build @@ -90,7 +90,7 @@ select ├── scan a │ └── columns: x:1(int!null) y:2(int) └── filters [type=bool] - └── (a.x = 1) AND (a.x != 2) [type=bool] + └── (x = 1) AND (x != 2) [type=bool] # Le, Ge, Lt, Gt build @@ -101,7 +101,7 @@ select ├── scan a │ └── columns: x:1(int!null) y:2(int) └── filters [type=bool] - └── (((a.x >= 1) AND (a.x <= 10)) AND (a.y > 1)) AND (a.y < 10) [type=bool] + └── (((x >= 1) AND (x <= 10)) AND (y > 1)) AND (y < 10) [type=bool] # In, NotIn build @@ -112,7 +112,7 @@ select ├── scan a │ └── columns: x:1(int!null) y:2(int) └── filters [type=bool] - └── (a.x IN (1, 2)) AND (a.y NOT IN (3, 4)) [type=bool] + └── (x IN (1, 2)) AND (y NOT IN (3, 4)) [type=bool] # Like, NotLike build @@ -123,7 +123,7 @@ select ├── scan b │ └── columns: x:1(string!null) z:2(decimal!null) └── filters [type=bool] - └── (b.x LIKE '%foo%') AND (b.x NOT LIKE '%bar%') [type=bool] + └── (x LIKE '%foo%') AND (x NOT LIKE '%bar%') [type=bool] # ILike, INotLike build @@ -134,7 +134,7 @@ select ├── scan b │ └── columns: x:1(string!null) z:2(decimal!null) └── filters [type=bool] - └── (b.x ILIKE '%foo%') AND (b.x NOT ILIKE '%bar%') [type=bool] + └── (x ILIKE '%foo%') AND (x NOT ILIKE '%bar%') [type=bool] # RegMatch, NotRegMatch, RegIMatch, NotRegIMatch build @@ -145,7 +145,7 @@ select ├── scan b │ └── columns: x:1(string!null) z:2(decimal!null) └── filters [type=bool] - └── (((b.x ~ 'foo') AND (b.x !~ 'bar')) AND (b.x ~* 'foo')) AND (b.x !~* 'bar') [type=bool] + └── (((x ~ 'foo') AND (x !~ 'bar')) AND (x ~* 'foo')) AND (x !~* 'bar') [type=bool] # Is, IsNot build @@ -156,7 +156,7 @@ select ├── scan a │ └── columns: x:1(int!null) y:2(int) └── filters [type=bool] - └── (a.x IS DISTINCT FROM a.y) AND (a.x IS NULL) [type=bool] + └── (x IS DISTINCT FROM y) AND (x IS NULL) [type=bool] # Bitand, Bitor, Bitxor build @@ -167,9 +167,9 @@ project ├── scan a │ └── columns: x:1(int!null) y:2(int) └── projections - ├── a.x & a.y [type=int] - ├── a.x | a.y [type=int] - └── a.x # a.y [type=int] + ├── x & y [type=int] + ├── x | y [type=int] + └── x # y [type=int] # Plus, Minus, Mult, Div, FloorDiv build @@ -185,11 +185,11 @@ project ├── scan a │ └── columns: x:1(int!null) y:2(int) └── projections - ├── a.x + 1.5 [type=decimal] + ├── x + 1.5 [type=decimal] ├── '2000-01-01' - 15 [type=date] - ├── 10.10 * a.x [type=decimal] - ├── 1 / a.y [type=decimal] - └── a.x // 1.5 [type=decimal] + ├── 10.10 * x [type=decimal] + ├── 1 / y [type=decimal] + └── x // 1.5 [type=decimal] # Mod, Pow, LShift, RShift build @@ -204,10 +204,10 @@ project ├── scan a │ └── columns: x:1(int!null) y:2(int) └── projections - ├── 100.1 % a.x [type=decimal] - ├── a.x ^ 2.5 [type=decimal] - ├── a.x << 3 [type=int] - └── a.y >> 2 [type=int] + ├── 100.1 % x [type=decimal] + ├── x ^ 2.5 [type=decimal] + ├── x << 3 [type=int] + └── y >> 2 [type=int] # TODO(justin): re-enable when we support inverted index queries. # FetchVal, FetchText, FetchValPath, FetchTextPath @@ -237,7 +237,7 @@ project ├── scan b │ └── columns: x:1(string!null) z:2(decimal!null) └── projections - └── b.x || 'more' [type=string] + └── x || 'more' [type=string] # UnaryMinus, UnaryComplement build @@ -248,8 +248,8 @@ project ├── scan a │ └── columns: x:1(int!null) y:2(int) └── projections - ├── -a.y [type=int] - └── ~a.x [type=int] + ├── -y [type=int] + └── ~x [type=int] # Array Concat build @@ -260,9 +260,9 @@ project ├── scan unusual │ └── columns: x:1(int!null) arr:2(int[]) └── projections - ├── unusual.arr || unusual.arr [type=int[]] - ├── unusual.arr || NULL::INT[] [type=int[]] - └── NULL::INT[] || unusual.arr [type=int[]] + ├── arr || arr [type=int[]] + ├── arr || NULL::INT[] [type=int[]] + └── NULL::INT[] || arr [type=int[]] # Array Element Concat build @@ -273,10 +273,10 @@ project ├── scan unusual │ └── columns: x:1(int!null) arr:2(int[]) └── projections - ├── unusual.x || unusual.arr [type=int[]] - ├── unusual.arr || unusual.x [type=int[]] - ├── unusual.x || NULL::INT[] [type=int[]] - └── NULL::INT[] || unusual.x [type=int[]] + ├── x || arr [type=int[]] + ├── arr || x [type=int[]] + ├── x || NULL::INT[] [type=int[]] + └── NULL::INT[] || x [type=int[]] # Function with fixed return type. build @@ -337,38 +337,38 @@ scalar-group-by │ ├── scan b │ │ └── columns: x:1(string!null) z:2(decimal!null) │ └── projections - │ ├── b.z = 0 [type=bool] - │ ├── b.x::INT [type=int] - │ ├── b.x::JSON [type=jsonb] - │ └── b.x::JSONB [type=jsonb] + │ ├── z = 0 [type=bool] + │ ├── x::INT [type=int] + │ ├── x::JSON [type=jsonb] + │ └── x::JSONB [type=jsonb] └── aggregations ├── array-agg [type=decimal[]] - │ └── variable: b.z [type=decimal] + │ └── variable: z [type=decimal] ├── avg [type=decimal] - │ └── variable: b.z [type=decimal] + │ └── variable: z [type=decimal] ├── bool-and [type=bool] │ └── variable: column5 [type=bool] ├── bool-or [type=bool] │ └── variable: column5 [type=bool] ├── concat-agg [type=string] - │ └── variable: b.x [type=string] + │ └── variable: x [type=string] ├── count [type=int] - │ └── variable: b.z [type=decimal] + │ └── variable: z [type=decimal] ├── count-rows [type=int] ├── max [type=string] - │ └── variable: b.x [type=string] + │ └── variable: x [type=string] ├── max [type=decimal] - │ └── variable: b.z [type=decimal] + │ └── variable: z [type=decimal] ├── sum-int [type=int] │ └── variable: column13 [type=int] ├── sum [type=decimal] - │ └── variable: b.z [type=decimal] + │ └── variable: z [type=decimal] ├── sqr-diff [type=decimal] - │ └── variable: b.z [type=decimal] + │ └── variable: z [type=decimal] ├── variance [type=decimal] │ └── variable: column13 [type=int] ├── std-dev [type=decimal] - │ └── variable: b.z [type=decimal] + │ └── variable: z [type=decimal] ├── xor-agg [type=int] │ └── variable: column13 [type=int] ├── json-agg [type=jsonb] @@ -394,12 +394,12 @@ project │ │ │ ├── scan b │ │ │ │ └── columns: b.x:4(string!null) z:5(decimal!null) │ │ │ └── filters [type=bool] - │ │ │ └── a.y = b.z::INT [type=bool] + │ │ │ └── y = z::INT [type=bool] │ │ └── aggregations │ │ ├── max [type=string] │ │ │ └── variable: b.x [type=string] │ │ └── const-agg [type=int] - │ │ └── variable: a.y [type=int] + │ │ └── variable: y [type=int] │ └── filters [type=bool] │ └── max > 'foo' [type=bool] └── projections diff --git a/pkg/sql/opt/metadata.go b/pkg/sql/opt/metadata.go index 61a63e0c5c29..0c7b448d4799 100644 --- a/pkg/sql/opt/metadata.go +++ b/pkg/sql/opt/metadata.go @@ -222,9 +222,7 @@ func (md *Metadata) ColumnOrdinal(id ColumnID) int { // // If the column label is qualified, the table is prefixed to it and separated // by a "." character. -// -// TODO(andyk): useTable is a hack that will be removed in the next commit. -func (md *Metadata) QualifiedColumnLabel(id ColumnID, fullyQualify bool, useTable bool) string { +func (md *Metadata) QualifiedColumnLabel(id ColumnID, fullyQualify bool) string { col := md.cols[id-1] if col.tabID == 0 { // Column doesn't belong to a table, so no need to qualify it further. @@ -249,10 +247,6 @@ func (md *Metadata) QualifiedColumnLabel(id ColumnID, fullyQualify bool, useTabl } } - if useTable { - ambiguous = true - } - if !ambiguous { return col.label } diff --git a/pkg/sql/opt/norm/testdata/rules/agg b/pkg/sql/opt/norm/testdata/rules/agg index aec8eec48c66..8cea0997098c 100644 --- a/pkg/sql/opt/norm/testdata/rules/agg +++ b/pkg/sql/opt/norm/testdata/rules/agg @@ -28,12 +28,12 @@ scalar-group-by │ ├── scan a │ │ └── columns: i:2(int) f:3(float) │ └── projections [outer=(2,3)] - │ └── a.i > a.f [type=bool, outer=(2,3)] + │ └── i > f [type=bool, outer=(2,3)] └── aggregations [outer=(2,9)] ├── min [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] ├── max [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] ├── bool-and [type=bool, outer=(9)] │ └── variable: column9 [type=bool, outer=(9)] └── bool-or [type=bool, outer=(9)] @@ -63,32 +63,32 @@ scalar-group-by │ ├── scan a │ │ └── columns: i:2(int) f:3(float) s:4(string) j:5(jsonb) │ └── projections [outer=(2-5)] - │ └── a.s::BYTES [type=bytes, outer=(4)] + │ └── s::BYTES [type=bytes, outer=(4)] └── aggregations [outer=(2,3,5,13)] ├── count [type=int, outer=(2)] │ └── agg-distinct [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] ├── sum [type=decimal, outer=(2)] │ └── agg-distinct [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] ├── sum-int [type=int, outer=(2)] │ └── agg-distinct [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] ├── avg [type=decimal, outer=(2)] │ └── agg-distinct [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] ├── std-dev [type=float, outer=(3)] │ └── agg-distinct [type=float, outer=(3)] - │ └── variable: a.f [type=float, outer=(3)] + │ └── variable: f [type=float, outer=(3)] ├── variance [type=float, outer=(3)] │ └── agg-distinct [type=float, outer=(3)] - │ └── variable: a.f [type=float, outer=(3)] + │ └── variable: f [type=float, outer=(3)] ├── xor-agg [type=bytes, outer=(13)] │ └── agg-distinct [type=bytes, outer=(13)] │ └── variable: column13 [type=bytes, outer=(13)] ├── array-agg [type=int[], outer=(2)] │ └── agg-distinct [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] └── json-agg [type=jsonb, outer=(5)] └── agg-distinct [type=jsonb, outer=(5)] - └── variable: a.j [type=jsonb, outer=(5)] + └── variable: j [type=jsonb, outer=(5)] diff --git a/pkg/sql/opt/norm/testdata/rules/bool b/pkg/sql/opt/norm/testdata/rules/bool index cc7f63dd8188..036f252b9bbe 100644 --- a/pkg/sql/opt/norm/testdata/rules/bool +++ b/pkg/sql/opt/norm/testdata/rules/bool @@ -73,7 +73,7 @@ project ├── scan a │ └── columns: i:2(int) s:4(string) └── projections [outer=(2,4)] - └── (a.i = 5) AND (a.s < 'foo') [type=bool, outer=(2,4)] + └── (i = 5) AND (s < 'foo') [type=bool, outer=(2,4)] # -------------------------------------------------- # SimplifyAnd @@ -110,7 +110,7 @@ project │ ├── columns: k:1(int!null) │ └── key: (1) └── projections [outer=(1)] - └── a.k = 1 [type=bool, outer=(1)] + └── k = 1 [type=bool, outer=(1)] opt SELECT k=1 AND i=2 AND true AS r FROM a @@ -122,7 +122,7 @@ project │ ├── key: (1) │ └── fd: (1)-->(2) └── projections [outer=(1,2)] - └── (a.k = 1) AND (a.i = 2) [type=bool, outer=(1,2)] + └── (k = 1) AND (i = 2) [type=bool, outer=(1,2)] # No conditions left after rule. opt @@ -144,7 +144,7 @@ project │ ├── key: (1) │ └── fd: (1)-->(3,4) └── projections [outer=(1,3,4)] - └── (((a.k > 1) AND (a.k < 5)) AND (a.f = 3.5)) AND (a.s = 'foo') [type=bool, outer=(1,3,4)] + └── (((k > 1) AND (k < 5)) AND (f = 3.5)) AND (s = 'foo') [type=bool, outer=(1,3,4)] # -------------------------------------------------- # SimplifyOr @@ -181,7 +181,7 @@ project │ ├── columns: k:1(int!null) │ └── key: (1) └── projections [outer=(1)] - └── a.k = 1 [type=bool, outer=(1)] + └── k = 1 [type=bool, outer=(1)] opt SELECT * FROM a WHERE k=1 OR i=2 OR false @@ -195,7 +195,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(1,2)] - └── (a.k = 1) OR (a.i = 2) [type=bool, outer=(1,2)] + └── (k = 1) OR (i = 2) [type=bool, outer=(1,2)] # No conditions left after rule. opt @@ -220,7 +220,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(1-4)] - └── (((a.k = 1) OR (a.i = 2)) OR (a.f = 3.5)) OR (a.s = 'foo') [type=bool, outer=(1-4)] + └── (((k = 1) OR (i = 2)) OR (f = 3.5)) OR (s = 'foo') [type=bool, outer=(1-4)] # -------------------------------------------------- # SimplifyAnd + SimplifyOr @@ -234,7 +234,7 @@ project │ ├── columns: k:1(int!null) │ └── key: (1) └── projections [outer=(1)] - └── (a.k = 1) AND (a.k = 2) [type=bool, outer=(1)] + └── (k = 1) AND (k = 2) [type=bool, outer=(1)] # Use parentheses to make and/or tree right-heavy instead of left-heavy. opt @@ -247,7 +247,7 @@ project │ ├── key: (1) │ └── fd: (1)-->(2-4) └── projections [outer=(1-4)] - └── ((((a.k = 1) OR (a.i = 2)) OR (a.f = 3.5)) AND (a.s = 'foo')) AND (a.s != 'bar') [type=bool, outer=(1-4)] + └── ((((k = 1) OR (i = 2)) OR (f = 3.5)) AND (s = 'foo')) AND (s != 'bar') [type=bool, outer=(1-4)] # -------------------------------------------------- # SimplifyFilters @@ -331,8 +331,8 @@ project │ ├── columns: k:1(int!null) │ └── key: (1) └── projections [outer=(1)] - ├── NULL OR (a.k = 1) [type=bool, outer=(1)] - └── NULL AND (a.k = 1) [type=bool, outer=(1)] + ├── NULL OR (k = 1) [type=bool, outer=(1)] + └── NULL AND (k = 1) [type=bool, outer=(1)] # -------------------------------------------------- # NegateComparison @@ -351,12 +351,12 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(1-3), constraints=(/1: (/NULL - ]; /2: [/2 - ]; /3: [/1.0 - ]), fd=(2)==(3), (3)==(2)] - ├── a.i != 1 [type=bool, outer=(2), constraints=(/2: (/NULL - /0] [/2 - ]; tight)] - ├── a.f = a.i [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] - ├── a.i <= a.k [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] - ├── a.i < a.f [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] - ├── a.f >= 1.0 [type=bool, outer=(3), constraints=(/3: [/1.0 - ]; tight)] - └── a.i > 1 [type=bool, outer=(2), constraints=(/2: [/2 - ]; tight)] + ├── i != 1 [type=bool, outer=(2), constraints=(/2: (/NULL - /0] [/2 - ]; tight)] + ├── f = i [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] + ├── i <= k [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] + ├── i < f [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] + ├── f >= 1.0 [type=bool, outer=(3), constraints=(/3: [/1.0 - ]; tight)] + └── i > 1 [type=bool, outer=(2), constraints=(/2: [/2 - ]; tight)] # IN and IS comparisons. opt @@ -373,10 +373,10 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(2-4), constraints=(/3: [/3.0 - /3.0] [/4.0 - /4.0]; /4: [/NULL - /NULL]), fd=()-->(4)] - ├── a.i NOT IN (1, 2) [type=bool, outer=(2)] - ├── a.f IN (3.0, 4.0) [type=bool, outer=(3), constraints=(/3: [/3.0 - /3.0] [/4.0 - /4.0]; tight)] - ├── a.f IS NOT NULL [type=bool, outer=(3), constraints=(/3: (/NULL - ]; tight)] - └── a.s IS NULL [type=bool, outer=(4), constraints=(/4: [/NULL - /NULL]; tight)] + ├── i NOT IN (1, 2) [type=bool, outer=(2)] + ├── f IN (3.0, 4.0) [type=bool, outer=(3), constraints=(/3: [/3.0 - /3.0] [/4.0 - /4.0]; tight)] + ├── f IS NOT NULL [type=bool, outer=(3), constraints=(/3: (/NULL - ]; tight)] + └── s IS NULL [type=bool, outer=(4), constraints=(/4: [/NULL - /NULL]; tight)] # Like comparisons. opt @@ -393,10 +393,10 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(4)] - ├── a.s NOT LIKE 'foo' [type=bool, outer=(4)] - ├── a.s LIKE 'foo' [type=bool, outer=(4)] - ├── a.s NOT ILIKE 'foo' [type=bool, outer=(4)] - └── a.s ILIKE 'foo' [type=bool, outer=(4)] + ├── s NOT LIKE 'foo' [type=bool, outer=(4)] + ├── s LIKE 'foo' [type=bool, outer=(4)] + ├── s NOT ILIKE 'foo' [type=bool, outer=(4)] + └── s ILIKE 'foo' [type=bool, outer=(4)] # SimilarTo comparisons. opt @@ -411,8 +411,8 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(4)] - ├── a.s NOT SIMILAR TO 'foo' [type=bool, outer=(4)] - └── a.s SIMILAR TO 'foo' [type=bool, outer=(4)] + ├── s NOT SIMILAR TO 'foo' [type=bool, outer=(4)] + └── s SIMILAR TO 'foo' [type=bool, outer=(4)] # RegMatch comparisons. opt @@ -427,10 +427,10 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(4)] - ├── a.s !~ 'foo' [type=bool, outer=(4)] - ├── a.s ~ 'foo' [type=bool, outer=(4)] - ├── a.s !~* 'foo' [type=bool, outer=(4)] - └── a.s ~* 'foo' [type=bool, outer=(4)] + ├── s !~ 'foo' [type=bool, outer=(4)] + ├── s ~ 'foo' [type=bool, outer=(4)] + ├── s !~* 'foo' [type=bool, outer=(4)] + └── s ~* 'foo' [type=bool, outer=(4)] opt SELECT * FROM a WHERE @@ -448,11 +448,11 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(5)] - ├── NOT ('[1, 2]' @> a.j) [type=bool, outer=(5)] - ├── NOT ('[3, 4]' @> a.j) [type=bool, outer=(5)] - ├── NOT (a.j ? 'foo') [type=bool, outer=(5)] - ├── NOT (a.j ?| ARRAY['foo']) [type=bool, outer=(5)] - └── NOT (a.j ?& ARRAY['foo']) [type=bool, outer=(5)] + ├── NOT ('[1, 2]' @> j) [type=bool, outer=(5)] + ├── NOT ('[3, 4]' @> j) [type=bool, outer=(5)] + ├── NOT (j ? 'foo') [type=bool, outer=(5)] + ├── NOT (j ?| ARRAY['foo']) [type=bool, outer=(5)] + └── NOT (j ?& ARRAY['foo']) [type=bool, outer=(5)] # -------------------------------------------------- # EliminateNot @@ -469,7 +469,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(5), constraints=(/5: [/'{}' - /'{}']; tight), fd=()-->(5)] - └── a.j = '{}' [type=bool, outer=(5), constraints=(/5: [/'{}' - /'{}']; tight)] + └── j = '{}' [type=bool, outer=(5), constraints=(/5: [/'{}' - /'{}']; tight)] # -------------------------------------------------- # NegateAnd + NegateComparison @@ -486,7 +486,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(1-3)] - └── (a.k < a.i) OR (a.i >= a.f) [type=bool, outer=(1-3)] + └── (k < i) OR (i >= f) [type=bool, outer=(1-3)] opt SELECT * FROM a WHERE NOT (k >= i AND i < f AND (i > 5 AND i < 10 AND f > 1)) @@ -500,7 +500,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(1-3)] - └── ((((a.k < a.i) OR (a.i >= a.f)) OR (a.i <= 5)) OR (a.i >= 10)) OR (a.f <= 1.0) [type=bool, outer=(1-3)] + └── ((((k < i) OR (i >= f)) OR (i <= 5)) OR (i >= 10)) OR (f <= 1.0) [type=bool, outer=(1-3)] # -------------------------------------------------- @@ -518,9 +518,9 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(1-3), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /3: (/NULL - ])] - ├── a.k < a.i [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] - ├── a.i >= a.f [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] - └── a.f <= (a.k + a.i) [type=bool, outer=(1-3), constraints=(/3: (/NULL - ])] + ├── k < i [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] + ├── i >= f [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] + └── f <= (k + i) [type=bool, outer=(1-3), constraints=(/3: (/NULL - ])] opt SELECT * FROM a WHERE NOT (k >= i OR i < f OR (i > 10 OR i < 5 OR f > 1)) @@ -534,11 +534,11 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(1-3), constraints=(/1: (/NULL - ]; /2: [/5 - /10]; /3: (/NULL - /1.0])] - ├── a.k < a.i [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] - ├── a.i >= a.f [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] - ├── a.i <= 10 [type=bool, outer=(2), constraints=(/2: (/NULL - /10]; tight)] - ├── a.i >= 5 [type=bool, outer=(2), constraints=(/2: [/5 - ]; tight)] - └── a.f <= 1.0 [type=bool, outer=(3), constraints=(/3: (/NULL - /1.0]; tight)] + ├── k < i [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] + ├── i >= f [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] + ├── i <= 10 [type=bool, outer=(2), constraints=(/2: (/NULL - /10]; tight)] + ├── i >= 5 [type=bool, outer=(2), constraints=(/2: [/5 - ]; tight)] + └── f <= 1.0 [type=bool, outer=(3), constraints=(/3: (/NULL - /1.0]; tight)] # -------------------------------------------------- # NegateAnd + NegateOr + NegateComparison @@ -555,7 +555,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(1-3)] - └── ((a.k < a.i) AND (a.i >= a.f)) OR ((a.i <= 5) AND (a.f <= 1.0)) [type=bool, outer=(1-3)] + └── ((k < i) AND (i >= f)) OR ((i <= 5) AND (f <= 1.0)) [type=bool, outer=(1-3)] opt SELECT * FROM a WHERE NOT ((k >= i AND i < f) OR (i > 5 AND f > 1)) @@ -569,8 +569,8 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(1-3)] - ├── (a.k < a.i) OR (a.i >= a.f) [type=bool, outer=(1-3)] - └── (a.i <= 5) OR (a.f <= 1.0) [type=bool, outer=(2,3)] + ├── (k < i) OR (i >= f) [type=bool, outer=(1-3)] + └── (i <= 5) OR (f <= 1.0) [type=bool, outer=(2,3)] # -------------------------------------------------- # ExtractRedundantClause + ExtractRedundantSubclause @@ -583,7 +583,7 @@ project ├── scan c │ └── columns: b:2(bool) └── projections [outer=(2)] - └── variable: c.b [type=bool, outer=(2)] + └── variable: b [type=bool, outer=(2)] opt SELECT a OR (a AND b) OR (a AND c) FROM c @@ -593,7 +593,7 @@ project ├── scan c │ └── columns: a:1(bool) └── projections [outer=(1)] - └── variable: c.a [type=bool, outer=(1)] + └── variable: a [type=bool, outer=(1)] opt SELECT (a AND b) OR a OR (a AND c) FROM c @@ -603,7 +603,7 @@ project ├── scan c │ └── columns: a:1(bool) └── projections [outer=(1)] - └── variable: c.a [type=bool, outer=(1)] + └── variable: a [type=bool, outer=(1)] opt SELECT (a AND b) OR (b AND a) FROM c @@ -613,7 +613,7 @@ project ├── scan c │ └── columns: a:1(bool) b:2(bool) └── projections [outer=(1,2)] - └── c.a AND c.b [type=bool, outer=(1,2)] + └── a AND b [type=bool, outer=(1,2)] opt SELECT (a AND b) OR (c AND a) FROM c @@ -623,7 +623,7 @@ project ├── scan c │ └── columns: a:1(bool) b:2(bool) c:3(bool) └── projections [outer=(1-3)] - └── c.a AND (c.b OR c.c) [type=bool, outer=(1-3)] + └── a AND (b OR c) [type=bool, outer=(1-3)] opt SELECT * FROM c WHERE (a AND b) OR (a AND b AND c) OR (b AND a) @@ -634,8 +634,8 @@ select ├── scan c │ └── columns: a:1(bool) b:2(bool) c:3(bool) d:4(bool) e:5(bool) └── filters [type=bool, outer=(1,2), constraints=(/1: [/true - /true]; /2: [/true - /true]; tight), fd=()-->(1,2)] - ├── variable: c.a [type=bool, outer=(1), constraints=(/1: [/true - /true]; tight)] - └── variable: c.b [type=bool, outer=(2), constraints=(/2: [/true - /true]; tight)] + ├── variable: a [type=bool, outer=(1), constraints=(/1: [/true - /true]; tight)] + └── variable: b [type=bool, outer=(2), constraints=(/2: [/true - /true]; tight)] opt SELECT * FROM c WHERE (b AND a AND c) OR (d AND e AND a) @@ -646,8 +646,8 @@ select ├── scan c │ └── columns: a:1(bool) b:2(bool) c:3(bool) d:4(bool) e:5(bool) └── filters [type=bool, outer=(1-5), constraints=(/1: [/true - /true]), fd=()-->(1)] - ├── variable: c.a [type=bool, outer=(1), constraints=(/1: [/true - /true]; tight)] - └── (c.b AND c.c) OR (c.d AND c.e) [type=bool, outer=(2-5)] + ├── variable: a [type=bool, outer=(1), constraints=(/1: [/true - /true]; tight)] + └── (b AND c) OR (d AND e) [type=bool, outer=(2-5)] opt SELECT * FROM a WHERE ((k > 5) AND (i < 2) AND (i > 0)) OR ((k > 5) AND (i < 2) AND (s = 'foo')) @@ -662,8 +662,8 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(2,4), constraints=(/2: (/NULL - /1])] - ├── a.i < 2 [type=bool, outer=(2), constraints=(/2: (/NULL - /1]; tight)] - └── (a.i > 0) OR (a.s = 'foo') [type=bool, outer=(2,4)] + ├── i < 2 [type=bool, outer=(2), constraints=(/2: (/NULL - /1]; tight)] + └── (i > 0) OR (s = 'foo') [type=bool, outer=(2,4)] opt SELECT * FROM a WHERE (k > 5) OR ((k > 5) AND (i < 2) AND (s = 'foo')) @@ -694,7 +694,7 @@ project │ ├── columns: k:1(int!null) │ └── key: (1) └── projections [outer=(1)] - └── NULL AND ((a.k = 2) OR (a.k = 1)) [type=bool, outer=(1)] + └── NULL AND ((k = 2) OR (k = 1)) [type=bool, outer=(1)] # Check that we don't match non-redundant cases. opt @@ -705,7 +705,7 @@ project ├── scan c │ └── columns: a:1(bool) b:2(bool) └── projections [outer=(1,2)] - └── (c.a OR c.b) OR c.b [type=bool, outer=(1,2)] + └── (a OR b) OR b [type=bool, outer=(1,2)] opt SELECT (a AND b) OR (a OR c) FROM c @@ -715,7 +715,7 @@ project ├── scan c │ └── columns: a:1(bool) b:2(bool) c:3(bool) └── projections [outer=(1-3)] - └── ((c.a AND c.b) OR c.a) OR c.c [type=bool, outer=(1-3)] + └── ((a AND b) OR a) OR c [type=bool, outer=(1-3)] opt SELECT (a AND b) OR (NOT a AND c) FROM c @@ -725,4 +725,4 @@ project ├── scan c │ └── columns: a:1(bool) b:2(bool) c:3(bool) └── projections [outer=(1-3)] - └── (c.a AND c.b) OR ((NOT c.a) AND c.c) [type=bool, outer=(1-3)] + └── (a AND b) OR ((NOT a) AND c) [type=bool, outer=(1-3)] diff --git a/pkg/sql/opt/norm/testdata/rules/combo b/pkg/sql/opt/norm/testdata/rules/combo index f197ab304359..7bad14ce0011 100644 --- a/pkg/sql/opt/norm/testdata/rules/combo +++ b/pkg/sql/opt/norm/testdata/rules/combo @@ -56,7 +56,7 @@ Initial expression │ ├── key: (6) │ └── fd: (6)-->(7) └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── (a.k = xy.x) AND ((a.i + 1) = 10) [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── (k = x) AND ((i + 1) = 10) [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] ================================================================================ NormalizeCmpPlusConst Cost: 2910.74 @@ -77,9 +77,9 @@ NormalizeCmpPlusConst │ ├── key: (6) │ └── fd: (6)-->(7) - └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - - └── (a.k = xy.x) AND ((a.i + 1) = 10) [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + - └── (k = x) AND ((i + 1) = 10) [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /6: (/NULL - ])] - + └── (a.k = xy.x) AND (a.i = (10 - 1)) [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /6: (/NULL - ])] + + └── (k = x) AND (i = (10 - 1)) [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /6: (/NULL - ])] ================================================================================ SimplifyFilters Cost: 2176.67 @@ -101,10 +101,10 @@ SimplifyFilters │ ├── key: (6) │ └── fd: (6)-->(7) - └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /6: (/NULL - ])] - - └── (a.k = xy.x) AND (a.i = (10 - 1)) [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /6: (/NULL - ])] + - └── (k = x) AND (i = (10 - 1)) [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /6: (/NULL - ])] + └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - + ├── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - + └── a.i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + + ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + + └── i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] ================================================================================ PushFilterIntoJoinLeft Cost: 2178.33 @@ -127,16 +127,16 @@ PushFilterIntoJoinLeft + │ │ ├── key: (1) + │ │ └── fd: (1)-->(2-5), (3,4)~~>(1,2,5) + │ └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - + │ └── a.i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + + │ └── i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] ├── scan xy │ ├── columns: x:6(int!null) y:7(int) │ ├── key: (6) │ └── fd: (6)-->(7) - └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - - ├── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - - └── a.i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + - ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + - └── i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - + └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] ================================================================================ PruneJoinLeftCols Cost: 2181.67 @@ -160,7 +160,7 @@ PruneJoinLeftCols - │ │ ├── key: (1) - │ │ └── fd: (1)-->(2-5), (3,4)~~>(1,2,5) - │ └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - - │ └── a.i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + - │ └── i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + │ ├── fd: (1)-->(2,4) + │ └── select + │ ├── columns: k:1(int!null) i:2(int!null) f:3(float) s:4(string) j:5(jsonb) @@ -171,13 +171,13 @@ PruneJoinLeftCols + │ │ ├── key: (1) + │ │ └── fd: (1)-->(2-5), (3,4)~~>(1,2,5) + │ └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - + │ └── a.i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + + │ └── i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] ├── scan xy │ ├── columns: x:6(int!null) y:7(int) │ ├── key: (6) │ └── fd: (6)-->(7) └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] ================================================================================ PruneSelectCols Cost: 2161.67 @@ -205,13 +205,13 @@ PruneSelectCols - │ │ └── fd: (1)-->(2-5), (3,4)~~>(1,2,5) + │ │ └── fd: (1)-->(2,4) │ └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - │ └── a.i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + │ └── i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] ├── scan xy │ ├── columns: x:6(int!null) y:7(int) │ ├── key: (6) │ └── fd: (6)-->(7) └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] ================================================================================ EliminateProject Cost: 2158.33 @@ -236,19 +236,19 @@ EliminateProject - │ │ ├── key: (1) - │ │ └── fd: (1)-->(2,4) - │ └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - - │ └── a.i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + - │ └── i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + │ ├── scan a + │ │ ├── columns: k:1(int!null) i:2(int) s:4(string) + │ │ ├── key: (1) + │ │ └── fd: (1)-->(2,4) + │ └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - + │ └── a.i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + + │ └── i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] ├── scan xy │ ├── columns: x:6(int!null) y:7(int) │ ├── key: (6) │ └── fd: (6)-->(7) └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] ================================================================================ PruneJoinRightCols Cost: 2148.33 @@ -270,7 +270,7 @@ PruneJoinRightCols │ │ ├── key: (1) │ │ └── fd: (1)-->(2,4) │ └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - │ └── a.i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + │ └── i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] ├── scan xy - │ ├── columns: x:6(int!null) y:7(int) - │ ├── key: (6) @@ -278,7 +278,7 @@ PruneJoinRightCols + │ ├── columns: x:6(int!null) + │ └── key: (6) └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] -------------------------------------------------------------------------------- GenerateIndexScans (higher cost) -------------------------------------------------------------------------------- @@ -303,12 +303,12 @@ GenerateIndexScans (higher cost) + │ │ ├── key: (1) + │ │ └── fd: (1)-->(4) │ └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - │ └── a.i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + │ └── i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] ├── scan xy │ ├── columns: x:6(int!null) │ └── key: (6) └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] -------------------------------------------------------------------------------- GenerateIndexScans (no changes) -------------------------------------------------------------------------------- @@ -334,12 +334,12 @@ CommuteJoin │ │ ├── key: (1) │ │ └── fd: (1)-->(2,4) │ └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - │ └── a.i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + │ └── i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - ├── scan xy - │ ├── columns: x:6(int!null) - │ └── key: (6) └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] ================================================================================ GenerateMergeJoins Cost: 2140.00 @@ -366,9 +366,9 @@ GenerateMergeJoins + │ │ ├── fd: (1)-->(2,4) + │ │ └── ordering: +1 │ └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - │ └── a.i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + │ └── i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + - └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── scan xy + │ ├── columns: x:6(int!null) + │ ├── key: (6) @@ -377,7 +377,7 @@ GenerateMergeJoins + ├── left ordering: +1 + ├── right ordering: +6 + └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - + └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] -------------------------------------------------------------------------------- GenerateLookupJoin (higher cost) -------------------------------------------------------------------------------- @@ -401,7 +401,7 @@ GenerateLookupJoin (higher cost) - │ │ └── ordering: +1 + │ │ └── fd: (1)-->(2,4) │ └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - │ └── a.i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + │ └── i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - ├── scan xy - │ ├── columns: x:6(int!null) - │ ├── key: (6) @@ -410,9 +410,9 @@ GenerateLookupJoin (higher cost) - ├── left ordering: +1 - ├── right ordering: +6 - └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + - └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - + └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] -------------------------------------------------------------------------------- CommuteJoin (no changes) -------------------------------------------------------------------------------- @@ -441,7 +441,7 @@ GenerateLookupJoinWithFilter (higher cost) - │ │ ├── fd: (1)-->(2,4) - │ │ └── ordering: +1 - │ └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - - │ └── a.i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + - │ └── i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] ├── scan xy │ ├── columns: x:6(int!null) - │ ├── key: (6) @@ -450,11 +450,11 @@ GenerateLookupJoinWithFilter (higher cost) - ├── left ordering: +1 - ├── right ordering: +6 - └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + - └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ └── key: (6) + └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - + ├── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - + └── a.i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + + ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + + └── i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] ================================================================================ Final best expression Cost: 2140.00 @@ -476,7 +476,7 @@ Final best expression │ │ ├── fd: (1)-->(2,4) │ │ └── ordering: +1 │ └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - │ └── a.i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + │ └── i = (10 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] ├── scan xy │ ├── columns: x:6(int!null) │ ├── key: (6) @@ -485,7 +485,7 @@ Final best expression ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Exploration patterns with varying costs. optsteps @@ -508,7 +508,7 @@ Initial expression │ ├── key: (1) │ └── fd: (1)-->(2-5), (3,4)~~>(1,2,5) └── filters [type=bool, outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight), fd=()-->(4)] - └── (a.s = 'foo') AND (a.f > 100.0) [type=bool, outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight)] + └── (s = 'foo') AND (f > 100.0) [type=bool, outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight)] ================================================================================ SimplifyFilters Cost: 1110.00 @@ -526,9 +526,9 @@ SimplifyFilters │ ├── key: (1) │ └── fd: (1)-->(2-5), (3,4)~~>(1,2,5) └── filters [type=bool, outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight), fd=()-->(4)] - - └── (a.s = 'foo') AND (a.f > 100.0) [type=bool, outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight)] - + ├── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] - + └── a.f > 100.0 [type=bool, outer=(3), constraints=(/3: [/100.00000000000001 - ]; tight)] + - └── (s = 'foo') AND (f > 100.0) [type=bool, outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight)] + + ├── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + + └── f > 100.0 [type=bool, outer=(3), constraints=(/3: [/100.00000000000001 - ]; tight)] ================================================================================ PruneSelectCols Cost: 1090.00 @@ -550,8 +550,8 @@ PruneSelectCols - │ └── fd: (1)-->(2-5), (3,4)~~>(1,2,5) + │ └── fd: (1)-->(3,4), (3,4)~~>(1) └── filters [type=bool, outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight), fd=()-->(4)] - ├── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] - └── a.f > 100.0 [type=bool, outer=(3), constraints=(/3: [/100.00000000000001 - ]; tight)] + ├── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + └── f > 100.0 [type=bool, outer=(3), constraints=(/3: [/100.00000000000001 - ]; tight)] ================================================================================ GenerateIndexScans Cost: 1080.00 @@ -570,8 +570,8 @@ GenerateIndexScans │ ├── key: (1) │ └── fd: (1)-->(3,4), (3,4)~~>(1) └── filters [type=bool, outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight), fd=()-->(4)] - ├── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] - └── a.f > 100.0 [type=bool, outer=(3), constraints=(/3: [/100.00000000000001 - ]; tight)] + ├── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + └── f > 100.0 [type=bool, outer=(3), constraints=(/3: [/100.00000000000001 - ]; tight)] ================================================================================ ConstrainScan Cost: 1.55 @@ -591,8 +591,8 @@ ConstrainScan │ ├── key: (1) - │ └── fd: (1)-->(3,4), (3,4)~~>(1) - └── filters [type=bool, outer=(3,4), constraints=(/3: [/100.00000000000001 - ]; /4: [/'foo' - /'foo']; tight), fd=()-->(4)] - - ├── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] - - └── a.f > 100.0 [type=bool, outer=(3), constraints=(/3: [/100.00000000000001 - ]; tight)] + - ├── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + - └── f > 100.0 [type=bool, outer=(3), constraints=(/3: [/100.00000000000001 - ]; tight)] + │ └── fd: ()-->(4), (1)-->(3), (3)-->(1) + └── filters [type=bool] + ├── true [type=bool] @@ -662,7 +662,7 @@ Initial expression │ ├── key: (6) │ └── fd: (6)-->(7) └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] ================================================================================ HoistSelectExists Cost: 2182.53 @@ -688,7 +688,7 @@ HoistSelectExists - │ ├── key: (6) - │ └── fd: (6)-->(7) - └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - - └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + - └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ ├── fd: (1)-->(2-5), (3,4)~~>(1,2,5) + │ ├── scan a + │ │ ├── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb) @@ -704,7 +704,7 @@ HoistSelectExists + │ │ │ ├── key: (6) + │ │ │ └── fd: (6)-->(7) + │ │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - + │ │ └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + + │ │ └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ └── true [type=bool] + └── filters [type=bool] ================================================================================ @@ -737,11 +737,11 @@ TryDecorrelateSelect - │ │ │ ├── key: (6) - │ │ │ └── fd: (6)-->(7) - │ │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - - │ │ └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + - │ │ └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] - │ └── true [type=bool] + │ │ └── fd: (6)-->(7) + │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - + │ └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + + │ └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] └── filters [type=bool] ================================================================================ DecorrelateJoin @@ -767,7 +767,7 @@ DecorrelateJoin │ │ ├── key: (6) │ │ └── fd: (6)-->(7) │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - │ └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] └── filters [type=bool] ================================================================================ EliminateEmptyAnd @@ -790,7 +790,7 @@ EliminateEmptyAnd │ │ ├── key: (6) │ │ └── fd: (6)-->(7) │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - │ └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] - └── filters [type=bool] + └── true [type=bool] ================================================================================ @@ -816,7 +816,7 @@ EliminateSelect - │ │ ├── key: (6) - │ │ └── fd: (6)-->(7) - │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - - │ └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + - │ └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] - └── true [type=bool] + │ └── fd: (1)-->(2-5), (3,4)~~>(1,2,5) + ├── scan xy @@ -824,7 +824,7 @@ EliminateSelect + │ ├── key: (6) + │ └── fd: (6)-->(7) + └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - + └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + + └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] -------------------------------------------------------------------------------- GenerateIndexScans (higher cost) -------------------------------------------------------------------------------- @@ -847,7 +847,7 @@ GenerateIndexScans (higher cost) │ ├── key: (6) │ └── fd: (6)-->(7) └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] -------------------------------------------------------------------------------- GenerateIndexScans (no changes) -------------------------------------------------------------------------------- @@ -871,7 +871,7 @@ Final best expression │ ├── key: (6) │ └── fd: (6)-->(7) └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] # Decorrelation pattern using ANY function. optsteps @@ -896,7 +896,7 @@ Initial expression │ ├── columns: k:3(int!null) i:4(int) f:5(float) s:6(string) j:7(jsonb) │ ├── key: (3) │ └── fd: (3)-->(4-7), (5,6)~~>(3,4,7) - └── variable: xy.x [type=int, outer=(1)] + └── variable: x [type=int, outer=(1)] ================================================================================ PruneScanCols Cost: 2130.00 @@ -918,7 +918,7 @@ PruneScanCols - │ └── fd: (3)-->(4-7), (5,6)~~>(3,4,7) + │ ├── columns: k:3(int!null) + │ └── key: (3) - └── variable: xy.x [type=int, outer=(1)] + └── variable: x [type=int, outer=(1)] ================================================================================ EliminateProject Cost: 2120.00 @@ -939,7 +939,7 @@ EliminateProject - │ ├── columns: k:3(int!null) - │ └── key: (3) + │ └── key: (3) - └── variable: xy.x [type=int, outer=(1)] + └── variable: x [type=int, outer=(1)] ================================================================================ PruneScanCols Cost: 2110.00 @@ -957,7 +957,7 @@ PruneScanCols ├── scan a │ ├── columns: k:3(int!null) │ └── key: (3) - └── variable: xy.x [type=int, outer=(1)] + └── variable: x [type=int, outer=(1)] ================================================================================ HoistProjectSubquery Cost: 2152.55 @@ -972,7 +972,7 @@ HoistProjectSubquery - ├── scan a - │ ├── columns: k:3(int!null) - │ └── key: (3) - - └── variable: xy.x [type=int, outer=(1)] + - └── variable: x [type=int, outer=(1)] + ├── inner-join-apply + │ ├── columns: x:1(int!null) case:11(bool) + │ ├── key: (1) @@ -1002,14 +1002,14 @@ HoistProjectSubquery + │ │ │ │ │ ├── scan a + │ │ │ │ │ │ ├── columns: k:3(int!null) + │ │ │ │ │ │ └── key: (3) - + │ │ │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + + │ │ │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] + │ │ │ │ └── projections [outer=(3)] - + │ │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + + │ │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] + │ │ │ └── aggregations [outer=(9)] + │ │ │ └── bool-or [type=bool, outer=(9)] + │ │ │ └── variable: notnull [type=bool, outer=(9)] + │ │ └── projections [outer=(1,10)] - + │ │ └── CASE WHEN bool_or AND (xy.x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] + + │ │ └── CASE WHEN bool_or AND (x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] + │ └── true [type=bool] + └── projections [outer=(11)] + └── variable: case [type=bool, outer=(11)] @@ -1048,16 +1048,16 @@ EnsureSelectFilters │ │ │ │ │ ├── scan a │ │ │ │ │ │ ├── columns: k:3(int!null) │ │ │ │ │ │ └── key: (3) - - │ │ │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + - │ │ │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] + │ │ │ │ │ └── filters [type=bool, outer=(1,3)] - + │ │ │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + + │ │ │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] │ │ │ │ └── projections [outer=(3)] - │ │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + │ │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] │ │ │ └── aggregations [outer=(9)] │ │ │ └── bool-or [type=bool, outer=(9)] │ │ │ └── variable: notnull [type=bool, outer=(9)] │ │ └── projections [outer=(1,10)] - │ │ └── CASE WHEN bool_or AND (xy.x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] + │ │ └── CASE WHEN bool_or AND (x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] │ └── true [type=bool] └── projections [outer=(11)] └── variable: case [type=bool, outer=(11)] @@ -1116,9 +1116,9 @@ TryDecorrelateProject │ │ │ │ │ │ ├── columns: k:3(int!null) - │ │ │ │ │ │ └── key: (3) - │ │ │ │ │ └── filters [type=bool, outer=(1,3)] - - │ │ │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + - │ │ │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] - │ │ │ │ └── projections [outer=(3)] - - │ │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + - │ │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] - │ │ │ └── aggregations [outer=(9)] - │ │ │ └── bool-or [type=bool, outer=(9)] - │ │ │ └── variable: notnull [type=bool, outer=(9)] @@ -1128,15 +1128,15 @@ TryDecorrelateProject + │ │ │ │ │ │ │ ├── columns: k:3(int!null) + │ │ │ │ │ │ │ └── key: (3) + │ │ │ │ │ │ └── filters [type=bool, outer=(1,3)] - + │ │ │ │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + + │ │ │ │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] + │ │ │ │ │ └── projections [outer=(3)] - + │ │ │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + + │ │ │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] + │ │ │ │ └── aggregations [outer=(9)] + │ │ │ │ └── bool-or [type=bool, outer=(9)] + │ │ │ │ └── variable: notnull [type=bool, outer=(9)] + │ │ │ └── true [type=bool] │ │ └── projections [outer=(1,10)] - │ │ └── CASE WHEN bool_or AND (xy.x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] + │ │ └── CASE WHEN bool_or AND (x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] │ └── true [type=bool] └── projections [outer=(11)] └── variable: case [type=bool, outer=(11)] @@ -1192,25 +1192,25 @@ TryDecorrelateScalarGroupBy │ │ │ │ │ │ │ ├── columns: k:3(int!null) - │ │ │ │ │ │ │ └── key: (3) - │ │ │ │ │ │ └── filters [type=bool, outer=(1,3)] - - │ │ │ │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + - │ │ │ │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] - │ │ │ │ │ └── projections [outer=(3)] - - │ │ │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + - │ │ │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] + │ │ │ │ │ │ │ ├── outer: (1) + │ │ │ │ │ │ │ ├── key: (3) + │ │ │ │ │ │ │ ├── scan a + │ │ │ │ │ │ │ │ ├── columns: k:3(int!null) + │ │ │ │ │ │ │ │ └── key: (3) + │ │ │ │ │ │ │ └── filters [type=bool, outer=(1,3)] - + │ │ │ │ │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + + │ │ │ │ │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] + │ │ │ │ │ │ └── projections [outer=(3)] - + │ │ │ │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + + │ │ │ │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] + │ │ │ │ │ └── true [type=bool] │ │ │ │ └── aggregations [outer=(9)] │ │ │ │ └── bool-or [type=bool, outer=(9)] │ │ │ │ └── variable: notnull [type=bool, outer=(9)] │ │ │ └── true [type=bool] │ │ └── projections [outer=(1,10)] - │ │ └── CASE WHEN bool_or AND (xy.x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] + │ │ └── CASE WHEN bool_or AND (x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] │ └── true [type=bool] └── projections [outer=(11)] └── variable: case [type=bool, outer=(11)] @@ -1254,9 +1254,9 @@ TryDecorrelateProjectSelect - │ │ │ │ │ │ │ │ ├── columns: k:3(int!null) - │ │ │ │ │ │ │ │ └── key: (3) - │ │ │ │ │ │ │ └── filters [type=bool, outer=(1,3)] - - │ │ │ │ │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + - │ │ │ │ │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] - │ │ │ │ │ │ └── projections [outer=(3)] - - │ │ │ │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + - │ │ │ │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] - │ │ │ │ │ └── true [type=bool] + │ │ │ │ │ └── left-join-apply + │ │ │ │ │ ├── columns: x:1(int!null) k:3(int) notnull:9(bool) @@ -1273,15 +1273,15 @@ TryDecorrelateProjectSelect + │ │ │ │ │ │ │ ├── columns: k:3(int!null) + │ │ │ │ │ │ │ └── key: (3) + │ │ │ │ │ │ └── projections [outer=(3)] - + │ │ │ │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + + │ │ │ │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] + │ │ │ │ │ └── filters [type=bool, outer=(1,3)] - + │ │ │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + + │ │ │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] │ │ │ │ └── aggregations [outer=(9)] │ │ │ │ └── bool-or [type=bool, outer=(9)] │ │ │ │ └── variable: notnull [type=bool, outer=(9)] │ │ │ └── true [type=bool] │ │ └── projections [outer=(1,10)] - │ │ └── CASE WHEN bool_or AND (xy.x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] + │ │ └── CASE WHEN bool_or AND (x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] │ └── true [type=bool] └── projections [outer=(11)] └── variable: case [type=bool, outer=(11)] @@ -1327,15 +1327,15 @@ DecorrelateJoin │ │ │ │ │ │ │ ├── columns: k:3(int!null) │ │ │ │ │ │ │ └── key: (3) │ │ │ │ │ │ └── projections [outer=(3)] - │ │ │ │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + │ │ │ │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] │ │ │ │ │ └── filters [type=bool, outer=(1,3)] - │ │ │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + │ │ │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] │ │ │ │ └── aggregations [outer=(9)] │ │ │ │ └── bool-or [type=bool, outer=(9)] │ │ │ │ └── variable: notnull [type=bool, outer=(9)] │ │ │ └── true [type=bool] │ │ └── projections [outer=(1,10)] - │ │ └── CASE WHEN bool_or AND (xy.x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] + │ │ └── CASE WHEN bool_or AND (x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] │ └── true [type=bool] └── projections [outer=(11)] └── variable: case [type=bool, outer=(11)] @@ -1379,9 +1379,9 @@ EliminateGroupByProject - │ │ │ │ │ │ │ ├── columns: k:3(int!null) - │ │ │ │ │ │ │ └── key: (3) - │ │ │ │ │ │ └── projections [outer=(3)] - - │ │ │ │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + - │ │ │ │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] - │ │ │ │ │ └── filters [type=bool, outer=(1,3)] - - │ │ │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + - │ │ │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] + │ │ │ │ ├── left-join + │ │ │ │ │ ├── columns: x:1(int!null) k:3(int) notnull:9(bool) + │ │ │ │ │ ├── key: (1,3) @@ -1397,15 +1397,15 @@ EliminateGroupByProject + │ │ │ │ │ │ │ ├── columns: k:3(int!null) + │ │ │ │ │ │ │ └── key: (3) + │ │ │ │ │ │ └── projections [outer=(3)] - + │ │ │ │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + + │ │ │ │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] + │ │ │ │ │ └── filters [type=bool, outer=(1,3)] - + │ │ │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + + │ │ │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] │ │ │ │ └── aggregations [outer=(9)] │ │ │ │ └── bool-or [type=bool, outer=(9)] │ │ │ │ └── variable: notnull [type=bool, outer=(9)] │ │ │ └── true [type=bool] │ │ └── projections [outer=(1,10)] - │ │ └── CASE WHEN bool_or AND (xy.x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] + │ │ └── CASE WHEN bool_or AND (x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] │ └── true [type=bool] └── projections [outer=(11)] └── variable: case [type=bool, outer=(11)] @@ -1459,9 +1459,9 @@ EliminateSelect - │ │ │ │ │ │ │ ├── columns: k:3(int!null) - │ │ │ │ │ │ │ └── key: (3) - │ │ │ │ │ │ └── projections [outer=(3)] - - │ │ │ │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + - │ │ │ │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] - │ │ │ │ │ └── filters [type=bool, outer=(1,3)] - - │ │ │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + - │ │ │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] - │ │ │ │ └── aggregations [outer=(9)] - │ │ │ │ └── bool-or [type=bool, outer=(9)] - │ │ │ │ └── variable: notnull [type=bool, outer=(9)] @@ -1470,14 +1470,14 @@ EliminateSelect + │ │ │ │ │ │ ├── columns: k:3(int!null) + │ │ │ │ │ │ └── key: (3) + │ │ │ │ │ └── projections [outer=(3)] - + │ │ │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + + │ │ │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] + │ │ │ │ └── filters [type=bool, outer=(1,3)] - + │ │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + + │ │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] + │ │ │ └── aggregations [outer=(9)] + │ │ │ └── bool-or [type=bool, outer=(9)] + │ │ │ └── variable: notnull [type=bool, outer=(9)] │ │ └── projections [outer=(1,10)] - │ │ └── CASE WHEN bool_or AND (xy.x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] + │ │ └── CASE WHEN bool_or AND (x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] │ └── true [type=bool] └── projections [outer=(11)] └── variable: case [type=bool, outer=(11)] @@ -1531,27 +1531,27 @@ EliminateSelect - │ │ │ │ │ │ ├── columns: k:3(int!null) - │ │ │ │ │ │ └── key: (3) - │ │ │ │ │ └── projections [outer=(3)] - - │ │ │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + - │ │ │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] - │ │ │ │ └── filters [type=bool, outer=(1,3)] - - │ │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + - │ │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] - │ │ │ └── aggregations [outer=(9)] - │ │ │ └── bool-or [type=bool, outer=(9)] - │ │ │ └── variable: notnull [type=bool, outer=(9)] - │ │ └── projections [outer=(1,10)] - - │ │ └── CASE WHEN bool_or AND (xy.x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] + - │ │ └── CASE WHEN bool_or AND (x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] - │ └── true [type=bool] + │ │ │ │ ├── scan a + │ │ │ │ │ ├── columns: k:3(int!null) + │ │ │ │ │ └── key: (3) + │ │ │ │ └── projections [outer=(3)] - + │ │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + + │ │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] + │ │ │ └── filters [type=bool, outer=(1,3)] - + │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + + │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] + │ │ └── aggregations [outer=(9)] + │ │ └── bool-or [type=bool, outer=(9)] + │ │ └── variable: notnull [type=bool, outer=(9)] + │ └── projections [outer=(1,10)] - + │ └── CASE WHEN bool_or AND (xy.x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] + + │ └── CASE WHEN bool_or AND (x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] └── projections [outer=(11)] └── variable: case [type=bool, outer=(11)] ================================================================================ @@ -1585,14 +1585,14 @@ PruneProjectCols │ │ │ │ │ ├── columns: k:3(int!null) │ │ │ │ │ └── key: (3) │ │ │ │ └── projections [outer=(3)] - │ │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + │ │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] │ │ │ └── filters [type=bool, outer=(1,3)] - │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] │ │ └── aggregations [outer=(9)] │ │ └── bool-or [type=bool, outer=(9)] │ │ └── variable: notnull [type=bool, outer=(9)] │ └── projections [outer=(1,10)] - │ └── CASE WHEN bool_or AND (xy.x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] + │ └── CASE WHEN bool_or AND (x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] └── projections [outer=(11)] └── variable: case [type=bool, outer=(11)] ================================================================================ @@ -1638,28 +1638,28 @@ InlineProjectInProject - │ │ │ │ │ ├── columns: k:3(int!null) - │ │ │ │ │ └── key: (3) - │ │ │ │ └── projections [outer=(3)] - - │ │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + - │ │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] - │ │ │ └── filters [type=bool, outer=(1,3)] - - │ │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + - │ │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] - │ │ └── aggregations [outer=(9)] - │ │ └── bool-or [type=bool, outer=(9)] - │ │ └── variable: notnull [type=bool, outer=(9)] - │ └── projections [outer=(1,10)] - - │ └── CASE WHEN bool_or AND (xy.x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] + - │ └── CASE WHEN bool_or AND (x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] - └── projections [outer=(11)] - └── variable: case [type=bool, outer=(11)] + │ │ │ ├── scan a + │ │ │ │ ├── columns: k:3(int!null) + │ │ │ │ └── key: (3) + │ │ │ └── projections [outer=(3)] - + │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + + │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] + │ │ └── filters [type=bool, outer=(1,3)] - + │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + + │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] + │ └── aggregations [outer=(9)] + │ └── bool-or [type=bool, outer=(9)] + │ └── variable: notnull [type=bool, outer=(9)] + └── projections [outer=(1,10)] - + └── CASE WHEN bool_or AND (xy.x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] + + └── CASE WHEN bool_or AND (x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] -------------------------------------------------------------------------------- GenerateIndexScans (no changes) -------------------------------------------------------------------------------- @@ -1690,14 +1690,14 @@ GenerateIndexScans │ │ │ │ ├── columns: k:3(int!null) │ │ │ │ └── key: (3) │ │ │ └── projections [outer=(3)] - │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] │ │ └── filters [type=bool, outer=(1,3)] - │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] │ └── aggregations [outer=(9)] │ └── bool-or [type=bool, outer=(9)] │ └── variable: notnull [type=bool, outer=(9)] └── projections [outer=(1,10)] - └── CASE WHEN bool_or AND (xy.x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] + └── CASE WHEN bool_or AND (x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] -------------------------------------------------------------------------------- CommuteLeftJoin (higher cost) -------------------------------------------------------------------------------- @@ -1724,17 +1724,17 @@ CommuteLeftJoin (higher cost) │ │ │ │ ├── columns: k:3(int!null) │ │ │ │ └── key: (3) │ │ │ └── projections [outer=(3)] - │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] + │ │ ├── scan xy + │ │ │ ├── columns: x:1(int!null) + │ │ │ └── key: (1) │ │ └── filters [type=bool, outer=(1,3)] - │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] │ └── aggregations [outer=(9)] │ └── bool-or [type=bool, outer=(9)] │ └── variable: notnull [type=bool, outer=(9)] └── projections [outer=(1,10)] - └── CASE WHEN bool_or AND (xy.x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] + └── CASE WHEN bool_or AND (x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] -------------------------------------------------------------------------------- GenerateMergeJoins (no changes) -------------------------------------------------------------------------------- @@ -1770,11 +1770,11 @@ Final best expression │ │ │ │ ├── columns: k:3(int!null) │ │ │ │ └── key: (3) │ │ │ └── projections [outer=(3)] - │ │ │ └── a.k IS NOT NULL [type=bool, outer=(3)] + │ │ │ └── k IS NOT NULL [type=bool, outer=(3)] │ │ └── filters [type=bool, outer=(1,3)] - │ │ └── (xy.x = a.k) IS NOT false [type=bool, outer=(1,3)] + │ │ └── (x = k) IS NOT false [type=bool, outer=(1,3)] │ └── aggregations [outer=(9)] │ └── bool-or [type=bool, outer=(9)] │ └── variable: notnull [type=bool, outer=(9)] └── projections [outer=(1,10)] - └── CASE WHEN bool_or AND (xy.x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] + └── CASE WHEN bool_or AND (x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(1,10)] diff --git a/pkg/sql/opt/norm/testdata/rules/comp b/pkg/sql/opt/norm/testdata/rules/comp index d4461d36f877..59a8e38953ff 100644 --- a/pkg/sql/opt/norm/testdata/rules/comp +++ b/pkg/sql/opt/norm/testdata/rules/comp @@ -29,10 +29,10 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(1,2), side-effects, constraints=(/1: (/NULL - ]; /2: (/NULL - ])] - ├── a.k > (a.i + 1) [type=bool, outer=(1,2), constraints=(/1: (/NULL - ])] - ├── a.i >= (a.k - 1) [type=bool, outer=(1,2), constraints=(/2: (/NULL - ])] - ├── a.k < (a.i * a.i) [type=bool, outer=(1,2), constraints=(/1: (/NULL - ])] - └── a.i <= (a.k / 2) [type=bool, outer=(1,2), side-effects, constraints=(/2: (/NULL - ])] + ├── k > (i + 1) [type=bool, outer=(1,2), constraints=(/1: (/NULL - ])] + ├── i >= (k - 1) [type=bool, outer=(1,2), constraints=(/2: (/NULL - ])] + ├── k < (i * i) [type=bool, outer=(1,2), constraints=(/1: (/NULL - ])] + └── i <= (k / 2) [type=bool, outer=(1,2), side-effects, constraints=(/2: (/NULL - ])] # -------------------------------------------------- # CommuteConstInequality @@ -49,10 +49,10 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(1,2,4), constraints=(/2: (/NULL - /4]; /4: (/NULL - /'foo'])] - ├── (a.i + a.k) > (length('foo') + 1) [type=bool, outer=(1,2)] - ├── (a.i * 2) >= length('bar') [type=bool, outer=(2)] - ├── a.i < 5 [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] - └── a.s <= 'foo' [type=bool, outer=(4), constraints=(/4: (/NULL - /'foo']; tight)] + ├── (i + k) > (length('foo') + 1) [type=bool, outer=(1,2)] + ├── (i * 2) >= length('bar') [type=bool, outer=(2)] + ├── i < 5 [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] + └── s <= 'foo' [type=bool, outer=(4), constraints=(/4: (/NULL - /'foo']; tight)] # Impure function should not be considered constant. opt @@ -68,7 +68,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(2), side-effects] - └── random()::INT > (a.i + a.i) [type=bool, outer=(2), side-effects] + └── random()::INT > (i + i) [type=bool, outer=(2), side-effects] # -------------------------------------------------- # NormalizeCmpPlusConst @@ -92,11 +92,11 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(2,3), constraints=(/2: (/NULL - ])] - ├── a.i = (2 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - ├── (a.f + a.f) < (5.0 - 2.0) [type=bool, outer=(3)] - ├── a.i <= (length('foo') - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - ├── a.i > ((10 - 2) - 2) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - └── a.i::INTERVAL >= ('02:00:00' - '01:00:00') [type=bool, outer=(2)] + ├── i = (2 - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + ├── (f + f) < (5.0 - 2.0) [type=bool, outer=(3)] + ├── i <= (length('foo') - 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + ├── i > ((10 - 2) - 2) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + └── i::INTERVAL >= ('02:00:00' - '01:00:00') [type=bool, outer=(2)] # Try case that should not match pattern because Minus overload is not defined. opt @@ -111,7 +111,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(4)] - └── (a.s::DATE + '02:00:00') = '2000-01-01 02:00:00+00:00' [type=bool, outer=(4)] + └── (s::DATE + '02:00:00') = '2000-01-01 02:00:00+00:00' [type=bool, outer=(4)] # -------------------------------------------------- # NormalizeCmpMinusConst @@ -135,11 +135,11 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(2,3), constraints=(/2: (/NULL - ])] - ├── a.i = (2 + 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - ├── (a.f + a.f) < (5.0 + 2.0) [type=bool, outer=(3)] - ├── a.i <= (length('foo') + 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - ├── a.i > ((10 + 2) + 2) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - └── (a.f + a.i::FLOAT) >= (100.0 + 10.0) [type=bool, outer=(2,3)] + ├── i = (2 + 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + ├── (f + f) < (5.0 + 2.0) [type=bool, outer=(3)] + ├── i <= (length('foo') + 1) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + ├── i > ((10 + 2) + 2) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + └── (f + i::FLOAT) >= (100.0 + 10.0) [type=bool, outer=(2,3)] # Try case that should not match pattern because Plus overload is not defined. opt @@ -154,7 +154,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(4)] - └── (a.s::JSON - 1) = '[1]' [type=bool, outer=(4)] + └── (s::JSON - 1) = '[1]' [type=bool, outer=(4)] # -------------------------------------------------- # NormalizeCmpConstMinus @@ -178,11 +178,11 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(2,3), constraints=(/2: (/NULL - ])] - ├── a.i = (1 - 2) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - ├── (a.f + a.f) > (2.0 - 5.0) [type=bool, outer=(3)] - ├── a.i >= (1 - length('foo')) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - ├── a.i > (2 - (2 - 10)) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - └── (a.f + a.i::FLOAT) <= (10.0 - 100.0) [type=bool, outer=(2,3)] + ├── i = (1 - 2) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + ├── (f + f) > (2.0 - 5.0) [type=bool, outer=(3)] + ├── i >= (1 - length('foo')) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + ├── i > (2 - (2 - 10)) [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + └── (f + i::FLOAT) <= (10.0 - 100.0) [type=bool, outer=(2,3)] # Try case that should not match pattern because Minus overload is not defined. opt @@ -197,7 +197,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(2)] - └── ('[1, 2]' - a.i) = '[1]' [type=bool, outer=(2)] + └── ('[1, 2]' - i) = '[1]' [type=bool, outer=(2)] # -------------------------------------------------- # NormalizeTupleEquality @@ -214,9 +214,9 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(2-4), constraints=(/2: [/1 - /1]; /3: [/3.5 - /3.5]; /4: [/'foo' - /'foo']; tight), fd=()-->(2-4)] - ├── a.i = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] - ├── a.f = 3.5 [type=bool, outer=(3), constraints=(/3: [/3.5 - /3.5]; tight)] - └── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + ├── i = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] + ├── f = 3.5 [type=bool, outer=(3), constraints=(/3: [/3.5 - /3.5]; tight)] + └── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] # -------------------------------------------------- # NormalizeTupleEquality, FlattenAnd @@ -238,8 +238,8 @@ select │ ├── key: () │ └── fd: ()-->(1-5) └── filters [type=bool, outer=(2,4), constraints=(/2: [/2 - /2]; /4: [/'foo' - /'foo']; tight), fd=()-->(2,4)] - ├── a.i = 2 [type=bool, outer=(2), constraints=(/2: [/2 - /2]; tight)] - └── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + ├── i = 2 [type=bool, outer=(2), constraints=(/2: [/2 - /2]; tight)] + └── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] # -------------------------------------------------- # FoldNullComparisonLeft, FoldNullComparisonRight @@ -350,8 +350,8 @@ project │ └── fd: (1)-->(2) └── projections [outer=(1,2)] ├── true [type=bool] - ├── a.k IS NOT NULL [type=bool, outer=(1)] - └── a.i IS NOT NULL [type=bool, outer=(2)] + ├── k IS NOT NULL [type=bool, outer=(1)] + └── i IS NOT NULL [type=bool, outer=(2)] # -------------------------------------------------- # CommuteNullIs diff --git a/pkg/sql/opt/norm/testdata/rules/decorrelate b/pkg/sql/opt/norm/testdata/rules/decorrelate index 69ff8dae79f3..ae001ee2d615 100644 --- a/pkg/sql/opt/norm/testdata/rules/decorrelate +++ b/pkg/sql/opt/norm/testdata/rules/decorrelate @@ -61,7 +61,7 @@ semi-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] opt SELECT * FROM a WHERE NOT EXISTS(SELECT * FROM xy WHERE x=k) @@ -84,7 +84,7 @@ anti-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # -------------------------------------------------- # TryDecorrelateSelect @@ -104,10 +104,10 @@ semi-join-apply │ ├── columns: column1:6(int) │ ├── outer: (1,2) │ ├── cardinality: [2 - 2] - │ ├── (a.k,) [type=tuple{int}, outer=(1)] - │ └── (a.i,) [type=tuple{int}, outer=(2)] + │ ├── (k,) [type=tuple{int}, outer=(1)] + │ └── (i,) [type=tuple{int}, outer=(2)] └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── column1 = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── column1 = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] opt SELECT * FROM a WHERE NOT EXISTS(SELECT * FROM (VALUES (k), (i)) WHERE column1=k) @@ -124,10 +124,10 @@ anti-join-apply │ ├── columns: column1:6(int) │ ├── outer: (1,2) │ ├── cardinality: [2 - 2] - │ ├── (a.k,) [type=tuple{int}, outer=(1)] - │ └── (a.i,) [type=tuple{int}, outer=(2)] + │ ├── (k,) [type=tuple{int}, outer=(1)] + │ └── (i,) [type=tuple{int}, outer=(2)] └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── column1 = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── column1 = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Attempt to decorrelate query by pulling up outer select. But since limit query # cannot be decorrelated, push the outer select back down again (and make sure @@ -165,10 +165,10 @@ semi-join-apply │ │ │ │ ├── key: (6) │ │ │ │ └── fd: (6)-->(7) │ │ │ └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - │ │ │ └── xy.y = a.k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + │ │ │ └── y = k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] │ │ └── const: 1 [type=int] │ └── filters [type=bool, outer=(7), constraints=(/7: [/10 - /10]; tight), fd=()-->(7)] - │ └── xy.y = 10 [type=bool, outer=(7), constraints=(/7: [/10 - /10]; tight)] + │ └── y = 10 [type=bool, outer=(7), constraints=(/7: [/10 - /10]; tight)] └── true [type=bool] # Same as previous, but using anti-join. @@ -205,10 +205,10 @@ anti-join-apply │ │ │ │ ├── key: (6) │ │ │ │ └── fd: (6)-->(7) │ │ │ └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - │ │ │ └── xy.y = a.k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + │ │ │ └── y = k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] │ │ └── const: 1 [type=int] │ └── filters [type=bool, outer=(7), constraints=(/7: [/10 - /10]; tight), fd=()-->(7)] - │ └── xy.y = 10 [type=bool, outer=(7), constraints=(/7: [/10 - /10]; tight)] + │ └── y = 10 [type=bool, outer=(7), constraints=(/7: [/10 - /10]; tight)] └── true [type=bool] # Decorrelate Select with reference to outer column and no limit. @@ -236,9 +236,9 @@ project │ │ ├── key: (6) │ │ └── fd: (6)-->(7) │ └── filters [type=bool, outer=(7), constraints=(/7: [/101 - ]; tight)] - │ └── xy.y > 100 [type=bool, outer=(7), constraints=(/7: [/101 - ]; tight)] + │ └── y > 100 [type=bool, outer=(7), constraints=(/7: [/101 - ]; tight)] └── filters [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ]), fd=(2)==(6), (6)==(2)] - └── xy.x = a.i [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + └── x = i [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] # Decorrelate Select with LeftJoinApply. opt @@ -266,10 +266,10 @@ project │ │ ├── key: () │ │ └── fd: ()-->(6) │ └── filters [type=bool, outer=(6), constraints=(/6: [/101 - ]; tight)] - │ └── xy.x > 100 [type=bool, outer=(6), constraints=(/6: [/101 - ]; tight)] + │ └── x > 100 [type=bool, outer=(6), constraints=(/6: [/101 - ]; tight)] └── filters [type=bool, outer=(1,6), constraints=(/1: [/101 - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - ├── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── a.k > 100 [type=bool, outer=(1), constraints=(/1: [/101 - ]; tight)] + ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k > 100 [type=bool, outer=(1), constraints=(/1: [/101 - ]; tight)] # Decorrelate with non-apply operator because of multi-level nesting. opt @@ -301,9 +301,9 @@ semi-join-apply │ │ ├── key: () │ │ └── fd: ()-->(8,9) │ └── filters [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight), fd=()-->(4)] - │ └── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + │ └── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # -------------------------------------------------- # TryDecorrelateProject + @@ -349,14 +349,14 @@ project │ │ │ │ │ ├── fd: (6)-->(7) │ │ │ │ │ └── ordering: +6 │ │ │ │ └── filters [type=bool, outer=(7)] - │ │ │ │ └── (xy.y = 5) IS NOT false [type=bool, outer=(7)] + │ │ │ │ └── (y = 5) IS NOT false [type=bool, outer=(7)] │ │ │ └── projections [outer=(6,7)] - │ │ │ └── xy.y IS NOT NULL [type=bool, outer=(7)] + │ │ │ └── y IS NOT NULL [type=bool, outer=(7)] │ │ └── merge-on │ │ ├── left ordering: +1 │ │ ├── right ordering: +6 │ │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ │ └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ │ └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] │ └── aggregations [outer=(9)] │ └── bool-or [type=bool, outer=(9)] │ └── variable: notnull [type=bool, outer=(9)] @@ -389,9 +389,9 @@ project │ │ ├── key: () │ │ └── fd: ()-->(6,7) │ └── filters [type=bool, outer=(7)] - │ └── (xy.y + 1) > 10 [type=bool, outer=(7)] + │ └── (y + 1) > 10 [type=bool, outer=(7)] └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Any clause with constant. opt @@ -428,14 +428,14 @@ project │ │ │ │ │ ├── fd: (6)-->(7) │ │ │ │ │ └── ordering: +6 │ │ │ │ └── filters [type=bool, outer=(7)] - │ │ │ │ └── (xy.y = 5) IS NOT false [type=bool, outer=(7)] + │ │ │ │ └── (y = 5) IS NOT false [type=bool, outer=(7)] │ │ │ └── projections [outer=(6,7)] - │ │ │ └── xy.y IS NOT NULL [type=bool, outer=(7)] + │ │ │ └── y IS NOT NULL [type=bool, outer=(7)] │ │ └── merge-on │ │ ├── left ordering: +1 │ │ ├── right ordering: +6 │ │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ │ └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ │ └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] │ └── aggregations [outer=(9)] │ └── bool-or [type=bool, outer=(9)] │ └── variable: notnull [type=bool, outer=(9)] @@ -473,20 +473,20 @@ project │ │ │ │ ├── fd: (6)-->(7) │ │ │ │ └── ordering: +6 │ │ │ └── projections [outer=(6,7)] - │ │ │ └── xy.y IS NOT NULL [type=bool, outer=(7)] + │ │ │ └── y IS NOT NULL [type=bool, outer=(7)] │ │ └── merge-on │ │ ├── left ordering: +1 │ │ ├── right ordering: +6 │ │ └── filters [type=bool, outer=(1,2,6,7), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ │ ├── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - │ │ └── (a.i = xy.y) IS NOT false [type=bool, outer=(2,7)] + │ │ ├── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ │ └── (i = y) IS NOT false [type=bool, outer=(2,7)] │ └── aggregations [outer=(2,9)] │ ├── bool-or [type=bool, outer=(9)] │ │ └── variable: notnull [type=bool, outer=(9)] │ └── const-agg [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] └── projections [outer=(2,10)] - └── CASE WHEN bool_or AND (a.i IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(2,10)] + └── CASE WHEN bool_or AND (i IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(2,10)] # Any clause with more complex expression that must be cached. opt @@ -518,7 +518,7 @@ project │ │ │ │ ├── fd: (1)-->(2) │ │ │ │ └── ordering: +1 │ │ │ └── projections [outer=(1,2), side-effects] - │ │ │ └── (a.i * a.i) / 5 [type=decimal, outer=(2), side-effects] + │ │ │ └── (i * i) / 5 [type=decimal, outer=(2), side-effects] │ │ ├── project │ │ │ ├── columns: notnull:10(bool) x:6(int!null) y:7(int) │ │ │ ├── key: (6) @@ -530,13 +530,13 @@ project │ │ │ │ ├── fd: (6)-->(7) │ │ │ │ └── ordering: +6 │ │ │ └── projections [outer=(6,7)] - │ │ │ └── xy.y IS NOT NULL [type=bool, outer=(7)] + │ │ │ └── y IS NOT NULL [type=bool, outer=(7)] │ │ └── merge-on │ │ ├── left ordering: +1 │ │ ├── right ordering: +6 │ │ └── filters [type=bool, outer=(1,6,7,9), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ │ ├── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - │ │ └── (scalar = xy.y) IS NOT false [type=bool, outer=(7,9)] + │ │ ├── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ │ └── (scalar = y) IS NOT false [type=bool, outer=(7,9)] │ └── aggregations [outer=(9,10)] │ ├── bool-or [type=bool, outer=(10)] │ │ └── variable: notnull [type=bool, outer=(10)] @@ -590,12 +590,12 @@ distinct-on │ │ │ │ ├── key: (1) │ │ │ │ └── fd: (1)-->(2) │ │ │ └── filters [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight), fd=()-->(2)] - │ │ │ └── a.i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] + │ │ │ └── i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] │ │ └── true [type=bool] │ └── projections [outer=(1,6,8), side-effects] - │ └── uv.u / 1.1 [type=decimal, outer=(8), side-effects] + │ └── u / 1.1 [type=decimal, outer=(8), side-effects] └── filters [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ]), fd=(6)==(10), (10)==(6)] - └── xy.x = div [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ])] + └── x = div [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ])] # Don't hoist Project operator in right join case. opt @@ -637,11 +637,11 @@ project │ │ │ │ ├── columns: u:8(int!null) │ │ │ │ └── key: (8) │ │ │ └── filters [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight), fd=()-->(2)] - │ │ │ └── a.i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] + │ │ │ └── i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] │ │ └── projections [outer=(8), side-effects] - │ │ └── uv.u / 1.1 [type=decimal, outer=(8), side-effects] + │ │ └── u / 1.1 [type=decimal, outer=(8), side-effects] │ └── filters [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ]), fd=(6)==(10), (10)==(6)] - │ └── xy.x = div [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ])] + │ └── x = div [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ])] └── true [type=bool] # -------------------------------------------------- @@ -682,11 +682,11 @@ project │ │ │ │ ├── columns: u:8(int!null) │ │ │ │ └── key: (8) │ │ │ └── filters [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight), fd=()-->(2)] - │ │ │ └── a.i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] + │ │ │ └── i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] │ │ └── projections [outer=(8)] - │ │ └── uv.u + 1 [type=int, outer=(8)] + │ │ └── u + 1 [type=int, outer=(8)] │ └── filters [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ]), fd=(6)==(10), (10)==(6)] - │ └── xy.x = plus [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ])] + │ └── x = plus [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ])] └── true [type=bool] # Don't decorrelate FULL JOIN case. @@ -725,11 +725,11 @@ project │ │ │ │ ├── columns: u:8(int!null) │ │ │ │ └── key: (8) │ │ │ └── filters [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight), fd=()-->(2)] - │ │ │ └── a.i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] + │ │ │ └── i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] │ │ └── projections [outer=(8)] - │ │ └── uv.u + 1 [type=int, outer=(8)] + │ │ └── u + 1 [type=int, outer=(8)] │ └── filters [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ]), fd=(6)==(10), (10)==(6)] - │ └── xy.x = plus [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ])] + │ └── x = plus [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ])] └── true [type=bool] # -------------------------------------------------- @@ -777,14 +777,14 @@ project │ │ │ │ ├── left ordering: +6 │ │ │ │ ├── right ordering: +8 │ │ │ │ └── filters [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ]), fd=(6)==(8), (8)==(6)] - │ │ │ │ └── xy.x = uv.u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] + │ │ │ │ └── x = u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] │ │ │ └── projections [outer=(6,7,9)] - │ │ │ └── xy.y + uv.v [type=int, outer=(7,9)] + │ │ │ └── y + v [type=int, outer=(7,9)] │ │ └── merge-on │ │ ├── left ordering: +1 │ │ ├── right ordering: +6 │ │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ │ └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ │ └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] │ └── aggregations [outer=(10)] │ └── sum [type=decimal, outer=(10)] │ └── variable: column10 [type=int, outer=(10)] @@ -828,12 +828,12 @@ semi-join (merge) │ ├── left ordering: +6 │ ├── right ordering: +8 │ └── filters [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ]), fd=(6)==(8), (8)==(6)] - │ └── xy.x = uv.u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] + │ └── x = u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] └── merge-on ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Anti-join as outer. opt @@ -869,12 +869,12 @@ anti-join (merge) │ ├── left ordering: +6 │ ├── right ordering: +8 │ └── filters [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ]), fd=(6)==(8), (8)==(6)] - │ └── xy.x = uv.u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] + │ └── x = u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] └── merge-on ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Right-join as outer. opt @@ -924,15 +924,15 @@ project │ │ │ ├── left ordering: +6 │ │ │ ├── right ordering: +8 │ │ │ └── filters [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ]), fd=(6)==(8), (8)==(6)] - │ │ │ └── xy.x = uv.u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] + │ │ │ └── x = u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] │ │ └── merge-on │ │ ├── left ordering: +1 │ │ ├── right ordering: +6 │ │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ │ └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ │ └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] │ └── aggregations [outer=(6)] │ └── count [type=int, outer=(6)] - │ └── variable: xy.x [type=int, outer=(6)] + │ └── variable: x [type=int, outer=(6)] └── filters [type=bool, outer=(10), constraints=(/10: [ - /0] [/2 - ]; tight)] └── count IS DISTINCT FROM 1 [type=bool, outer=(10), constraints=(/10: [ - /0] [/2 - ]; tight)] @@ -969,8 +969,8 @@ semi-join-apply │ ├── left ordering: +6 │ ├── right ordering: +8 │ └── filters [type=bool, outer=(1,6,8), constraints=(/1: (/NULL - ]; /6: (/NULL - ]; /8: (/NULL - ]), fd=(6)==(1,8), (8)==(1,6), (1)==(6,8)] - │ ├── xy.x = uv.u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] - │ └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ ├── x = u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] + │ └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] └── true [type=bool] # Can't decorrelate semi-join as inner. @@ -1016,7 +1016,7 @@ semi-join-apply │ │ │ └── fd: (10)-->(11) │ │ └── true [type=bool] │ └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - │ └── uv.u = a.k [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + │ └── uv.u = k [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] └── true [type=bool] # -------------------------------------------------- @@ -1060,8 +1060,8 @@ semi-join-apply │ │ │ ├── key: (7) │ │ │ └── fd: (7)-->(8) │ │ └── filters [type=bool, outer=(2,3,7,8), constraints=(/2: (/NULL - ]; /3: (/NULL - ]; /7: (/NULL - ]; /8: (/NULL - ]), fd=(2)==(7), (7)==(2), (3)==(8), (8)==(3)] - │ │ ├── xy.x = a.k [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] - │ │ └── a.i = xy.y [type=bool, outer=(3,8), constraints=(/3: (/NULL - ]; /8: (/NULL - ])] + │ │ ├── x = k [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ │ └── i = y [type=bool, outer=(3,8), constraints=(/3: (/NULL - ]; /8: (/NULL - ])] │ ├── project │ │ ├── columns: v1:11(int) │ │ ├── outer: (1) @@ -1074,7 +1074,7 @@ semi-join-apply │ │ └── projections [outer=(1)] │ │ └── variable: column1 [type=int, outer=(1)] │ └── filters [type=bool, outer=(7,11), constraints=(/7: (/NULL - ]; /11: (/NULL - ]), fd=(7)==(11), (11)==(7)] - │ └── xy.x = v1 [type=bool, outer=(7,11), constraints=(/7: (/NULL - ]; /11: (/NULL - ])] + │ └── x = v1 [type=bool, outer=(7,11), constraints=(/7: (/NULL - ]; /11: (/NULL - ])] └── true [type=bool] opt @@ -1111,9 +1111,9 @@ project │ │ ├── key: (5) │ │ └── fd: (5)-->(6) │ └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - │ └── a.k = xy.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + │ └── k = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] └── filters [type=bool, outer=(3,6)] - └── uv.u IS DISTINCT FROM a.i [type=bool, outer=(3,6)] + └── u IS DISTINCT FROM i [type=bool, outer=(3,6)] opt SELECT generate_series(1, (SELECT u FROM uv WHERE u=x)) @@ -1140,12 +1140,12 @@ project │ ├── left ordering: +1 │ ├── right ordering: +3 │ └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] - │ └── uv.u = xy.x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + │ └── u = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] ├── zip │ ├── columns: column5:5(int) │ ├── outer: (3) │ ├── side-effects - │ └── generate_series(1, uv.u) [type=int, outer=(3), side-effects] + │ └── generate_series(1, u) [type=int, outer=(3), side-effects] └── true [type=bool] # -------------------------------------------------- @@ -1193,29 +1193,29 @@ group-by │ │ │ │ │ ├── key: (1) │ │ │ │ │ └── fd: (1)-->(2-5) │ │ │ │ └── filters [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight), fd=()-->(2)] - │ │ │ │ └── a.i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] + │ │ │ │ └── i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] │ │ │ └── true [type=bool] │ │ └── aggregations [outer=(2-5)] │ │ ├── count-rows [type=int] │ │ ├── const-agg [type=int, outer=(2)] - │ │ │ └── variable: a.i [type=int, outer=(2)] + │ │ │ └── variable: i [type=int, outer=(2)] │ │ ├── const-agg [type=float, outer=(3)] - │ │ │ └── variable: a.f [type=float, outer=(3)] + │ │ │ └── variable: f [type=float, outer=(3)] │ │ ├── const-agg [type=string, outer=(4)] - │ │ │ └── variable: a.s [type=string, outer=(4)] + │ │ │ └── variable: s [type=string, outer=(4)] │ │ └── const-agg [type=jsonb, outer=(5)] - │ │ └── variable: a.j [type=jsonb, outer=(5)] + │ │ └── variable: j [type=jsonb, outer=(5)] │ └── filters [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ]), fd=(6)==(10), (10)==(6)] - │ └── xy.x = cnt [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ])] + │ └── x = cnt [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ])] └── aggregations [outer=(2-5)] ├── const-agg [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] ├── const-agg [type=float, outer=(3)] - │ └── variable: a.f [type=float, outer=(3)] + │ └── variable: f [type=float, outer=(3)] ├── const-agg [type=string, outer=(4)] - │ └── variable: a.s [type=string, outer=(4)] + │ └── variable: s [type=string, outer=(4)] └── const-agg [type=jsonb, outer=(5)] - └── variable: a.j [type=jsonb, outer=(5)] + └── variable: j [type=jsonb, outer=(5)] opt SELECT * @@ -1259,31 +1259,31 @@ group-by │ │ │ │ │ ├── key: (1) │ │ │ │ │ └── fd: (1)-->(2-5) │ │ │ │ └── filters [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight), fd=()-->(2)] - │ │ │ │ └── a.i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] + │ │ │ │ └── i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] │ │ │ └── true [type=bool] │ │ └── aggregations [outer=(2-5,9)] │ │ ├── count [type=int, outer=(9)] │ │ │ └── agg-distinct [type=int, outer=(9)] - │ │ │ └── variable: uv.v [type=int, outer=(9)] + │ │ │ └── variable: v [type=int, outer=(9)] │ │ ├── const-agg [type=int, outer=(2)] - │ │ │ └── variable: a.i [type=int, outer=(2)] + │ │ │ └── variable: i [type=int, outer=(2)] │ │ ├── const-agg [type=float, outer=(3)] - │ │ │ └── variable: a.f [type=float, outer=(3)] + │ │ │ └── variable: f [type=float, outer=(3)] │ │ ├── const-agg [type=string, outer=(4)] - │ │ │ └── variable: a.s [type=string, outer=(4)] + │ │ │ └── variable: s [type=string, outer=(4)] │ │ └── const-agg [type=jsonb, outer=(5)] - │ │ └── variable: a.j [type=jsonb, outer=(5)] + │ │ └── variable: j [type=jsonb, outer=(5)] │ └── filters [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ]), fd=(6)==(10), (10)==(6)] - │ └── xy.x = cnt [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ])] + │ └── x = cnt [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ])] └── aggregations [outer=(2-5)] ├── const-agg [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] ├── const-agg [type=float, outer=(3)] - │ └── variable: a.f [type=float, outer=(3)] + │ └── variable: f [type=float, outer=(3)] ├── const-agg [type=string, outer=(4)] - │ └── variable: a.s [type=string, outer=(4)] + │ └── variable: s [type=string, outer=(4)] └── const-agg [type=jsonb, outer=(5)] - └── variable: a.j [type=jsonb, outer=(5)] + └── variable: j [type=jsonb, outer=(5)] # Indirectly decorrelate GROUP BY after decorrelating scalar GROUP BY. opt @@ -1321,7 +1321,7 @@ project │ │ │ │ ├── key: (3) │ │ │ │ └── fd: (3)-->(4) │ │ │ └── filters [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ]), fd=(1)==(4), (4)==(1)] - │ │ │ └── xy.x = uv.v [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ])] + │ │ │ └── x = v [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ])] │ │ ├── select │ │ │ ├── columns: k:5(int!null) i:6(int!null) │ │ │ ├── key: (5) @@ -1331,20 +1331,20 @@ project │ │ │ │ ├── key: (5) │ │ │ │ └── fd: (5)-->(6) │ │ │ └── filters [type=bool, outer=(6), constraints=(/6: (/NULL - ]; tight)] - │ │ │ └── a.i IS NOT NULL [type=bool, outer=(6), constraints=(/6: (/NULL - ]; tight)] + │ │ │ └── i IS NOT NULL [type=bool, outer=(6), constraints=(/6: (/NULL - ]; tight)] │ │ └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - │ │ └── a.k = xy.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + │ │ └── k = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] │ └── aggregations [outer=(1,2,4,6)] │ ├── max [type=int, outer=(6)] - │ │ └── variable: a.i [type=int, outer=(6)] + │ │ └── variable: i [type=int, outer=(6)] │ ├── const-agg [type=int, outer=(4)] - │ │ └── variable: uv.v [type=int, outer=(4)] + │ │ └── variable: v [type=int, outer=(4)] │ ├── const-agg [type=int, outer=(2)] - │ │ └── variable: xy.y [type=int, outer=(2)] + │ │ └── variable: y [type=int, outer=(2)] │ └── const-agg [type=int, outer=(1)] - │ └── variable: xy.x [type=int, outer=(1)] + │ └── variable: x [type=int, outer=(1)] └── filters [type=bool, outer=(3,10), constraints=(/3: (/NULL - ]; /10: (/NULL - ]), fd=(3)==(10), (10)==(3)] - └── uv.u = max [type=bool, outer=(3,10), constraints=(/3: (/NULL - ]; /10: (/NULL - ])] + └── u = max [type=bool, outer=(3,10), constraints=(/3: (/NULL - ]; /10: (/NULL - ])] # Indirectly decorrelate GROUP BY after decorrelating scalar GROUP BY. Use # IS DISTINCT FROM to retain left join. @@ -1383,24 +1383,24 @@ project │ │ │ │ ├── key: (3) │ │ │ │ └── fd: (3)-->(4) │ │ │ └── filters [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ]), fd=(1)==(4), (4)==(1)] - │ │ │ └── xy.x = uv.v [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ])] + │ │ │ └── x = v [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ])] │ │ ├── scan a │ │ │ ├── columns: k:5(int!null) i:6(int) │ │ │ ├── key: (5) │ │ │ └── fd: (5)-->(6) │ │ └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - │ │ └── a.k = xy.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + │ │ └── k = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] │ └── aggregations [outer=(1,2,4,6)] │ ├── max [type=int, outer=(6)] - │ │ └── variable: a.i [type=int, outer=(6)] + │ │ └── variable: i [type=int, outer=(6)] │ ├── const-agg [type=int, outer=(4)] - │ │ └── variable: uv.v [type=int, outer=(4)] + │ │ └── variable: v [type=int, outer=(4)] │ ├── const-agg [type=int, outer=(2)] - │ │ └── variable: xy.y [type=int, outer=(2)] + │ │ └── variable: y [type=int, outer=(2)] │ └── const-agg [type=int, outer=(1)] - │ └── variable: xy.x [type=int, outer=(1)] + │ └── variable: x [type=int, outer=(1)] └── filters [type=bool, outer=(3,10)] - └── uv.u IS DISTINCT FROM max [type=bool, outer=(3,10)] + └── u IS DISTINCT FROM max [type=bool, outer=(3,10)] # Synthesize key when one is not present. opt @@ -1439,12 +1439,12 @@ project │ │ │ │ ├── key: () │ │ │ │ └── fd: ()-->(4,7) │ │ │ └── filters [type=bool, outer=(2,4), constraints=(/2: (/NULL - ]; /4: (/NULL - ]), fd=(2)==(4), (4)==(2)] - │ │ │ └── a.k = xy.y [type=bool, outer=(2,4), constraints=(/2: (/NULL - ]; /4: (/NULL - ])] + │ │ │ └── k = y [type=bool, outer=(2,4), constraints=(/2: (/NULL - ]; /4: (/NULL - ])] │ │ └── aggregations [outer=(2,7)] │ │ ├── max [type=string, outer=(7)] - │ │ │ └── variable: a.s [type=string, outer=(7)] + │ │ │ └── variable: s [type=string, outer=(7)] │ │ └── const-agg [type=int, outer=(2)] - │ │ └── variable: xy.y [type=int, outer=(2)] + │ │ └── variable: y [type=int, outer=(2)] │ └── filters [type=bool, outer=(9), constraints=(/9: [/'bar' - /'bar']; tight), fd=()-->(9)] │ └── max = 'bar' [type=bool, outer=(9), constraints=(/9: [/'bar' - /'bar']; tight)] └── projections [outer=(2)] @@ -1500,30 +1500,30 @@ group-by │ │ │ │ │ ├── key: (1) │ │ │ │ │ └── fd: (1)-->(2-5) │ │ │ │ └── filters [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight), fd=()-->(2)] - │ │ │ │ └── a.i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] + │ │ │ │ └── i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] │ │ │ └── true [type=bool] │ │ └── aggregations [outer=(2-5,8)] │ │ ├── first-agg [type=int, outer=(8)] - │ │ │ └── variable: uv.u [type=int, outer=(8)] + │ │ │ └── variable: u [type=int, outer=(8)] │ │ ├── const-agg [type=int, outer=(2)] - │ │ │ └── variable: a.i [type=int, outer=(2)] + │ │ │ └── variable: i [type=int, outer=(2)] │ │ ├── const-agg [type=float, outer=(3)] - │ │ │ └── variable: a.f [type=float, outer=(3)] + │ │ │ └── variable: f [type=float, outer=(3)] │ │ ├── const-agg [type=string, outer=(4)] - │ │ │ └── variable: a.s [type=string, outer=(4)] + │ │ │ └── variable: s [type=string, outer=(4)] │ │ └── const-agg [type=jsonb, outer=(5)] - │ │ └── variable: a.j [type=jsonb, outer=(5)] + │ │ └── variable: j [type=jsonb, outer=(5)] │ └── filters [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ]), fd=(6)==(8), (8)==(6)] - │ └── xy.x = uv.u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] + │ └── x = u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] └── aggregations [outer=(2-5)] ├── const-agg [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] ├── const-agg [type=float, outer=(3)] - │ └── variable: a.f [type=float, outer=(3)] + │ └── variable: f [type=float, outer=(3)] ├── const-agg [type=string, outer=(4)] - │ └── variable: a.s [type=string, outer=(4)] + │ └── variable: s [type=string, outer=(4)] └── const-agg [type=jsonb, outer=(5)] - └── variable: a.j [type=jsonb, outer=(5)] + └── variable: j [type=jsonb, outer=(5)] # -------------------------------------------------- # TryDecorrelateScalarGroupBy @@ -1572,29 +1572,29 @@ group-by │ │ │ │ └── projections │ │ │ │ └── true [type=bool] │ │ │ └── filters [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight), fd=()-->(2)] - │ │ │ └── a.i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] + │ │ │ └── i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] │ │ └── aggregations [outer=(2-5,12)] │ │ ├── count [type=int, outer=(12)] │ │ │ └── variable: canary [type=bool, outer=(12)] │ │ ├── const-agg [type=int, outer=(2)] - │ │ │ └── variable: a.i [type=int, outer=(2)] + │ │ │ └── variable: i [type=int, outer=(2)] │ │ ├── const-agg [type=float, outer=(3)] - │ │ │ └── variable: a.f [type=float, outer=(3)] + │ │ │ └── variable: f [type=float, outer=(3)] │ │ ├── const-agg [type=string, outer=(4)] - │ │ │ └── variable: a.s [type=string, outer=(4)] + │ │ │ └── variable: s [type=string, outer=(4)] │ │ └── const-agg [type=jsonb, outer=(5)] - │ │ └── variable: a.j [type=jsonb, outer=(5)] + │ │ └── variable: j [type=jsonb, outer=(5)] │ └── filters [type=bool, outer=(6,11), constraints=(/6: (/NULL - ]; /11: (/NULL - ]), fd=(6)==(11), (11)==(6)] - │ └── xy.x = cnt [type=bool, outer=(6,11), constraints=(/6: (/NULL - ]; /11: (/NULL - ])] + │ └── x = cnt [type=bool, outer=(6,11), constraints=(/6: (/NULL - ]; /11: (/NULL - ])] └── aggregations [outer=(2-5)] ├── const-agg [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] ├── const-agg [type=float, outer=(3)] - │ └── variable: a.f [type=float, outer=(3)] + │ └── variable: f [type=float, outer=(3)] ├── const-agg [type=string, outer=(4)] - │ └── variable: a.s [type=string, outer=(4)] + │ └── variable: s [type=string, outer=(4)] └── const-agg [type=jsonb, outer=(5)] - └── variable: a.j [type=jsonb, outer=(5)] + └── variable: j [type=jsonb, outer=(5)] # Synthesize key when one is not present. opt @@ -1631,14 +1631,14 @@ project │ │ │ │ │ ├── key: (7) │ │ │ │ │ └── fd: (7)-->(8) │ │ │ │ └── filters [type=bool, outer=(8), constraints=(/8: (/NULL - ]; tight)] - │ │ │ │ └── xy.y IS NOT NULL [type=bool, outer=(8), constraints=(/8: (/NULL - ]; tight)] + │ │ │ │ └── y IS NOT NULL [type=bool, outer=(8), constraints=(/8: (/NULL - ]; tight)] │ │ │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - │ │ │ └── xy.x = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ │ │ └── x = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] │ │ └── aggregations [outer=(2,8)] │ │ ├── max [type=int, outer=(8)] - │ │ │ └── variable: xy.y [type=int, outer=(8)] + │ │ │ └── variable: y [type=int, outer=(8)] │ │ └── const-agg [type=int, outer=(2)] - │ │ └── variable: a.i [type=int, outer=(2)] + │ │ └── variable: i [type=int, outer=(2)] │ └── filters [type=bool, outer=(9), constraints=(/9: [/5 - /5]; tight), fd=()-->(9)] │ └── max = 5 [type=bool, outer=(9), constraints=(/9: [/5 - /5]; tight)] └── projections [outer=(2)] @@ -1666,14 +1666,14 @@ project │ │ ├── scan xy │ │ │ └── columns: y:7(int) │ │ └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - │ │ └── xy.y = a.k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + │ │ └── y = k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] │ └── aggregations [outer=(7)] │ ├── array-agg [type=int[], outer=(7)] - │ │ └── variable: xy.y [type=int, outer=(7)] + │ │ └── variable: y [type=int, outer=(7)] │ └── any-not-null-agg [type=int, outer=(7)] - │ └── variable: xy.y [type=int, outer=(7)] + │ └── variable: y [type=int, outer=(7)] └── projections [outer=(1,7,10)] - └── CASE WHEN xy.y IS NOT NULL THEN array_agg END [type=int[], outer=(7,10)] + └── CASE WHEN y IS NOT NULL THEN array_agg END [type=int[], outer=(7,10)] # With multiple columns. Without LATERAL these tests are a bit verbose. norm @@ -1696,16 +1696,16 @@ project │ │ ├── scan xy │ │ │ └── columns: y:7(int) │ │ └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - │ │ └── xy.y = a.k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + │ │ └── y = k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] │ └── aggregations [outer=(7)] │ ├── array-agg [type=int[], outer=(7)] - │ │ └── variable: xy.y [type=int, outer=(7)] + │ │ └── variable: y [type=int, outer=(7)] │ ├── max [type=int, outer=(7)] - │ │ └── variable: xy.y [type=int, outer=(7)] + │ │ └── variable: y [type=int, outer=(7)] │ └── any-not-null-agg [type=int, outer=(7)] - │ └── variable: xy.y [type=int, outer=(7)] + │ └── variable: y [type=int, outer=(7)] └── projections [outer=(1,7,9,12)] - └── (CASE WHEN xy.y IS NOT NULL THEN r END, q) [type=tuple{int[], int}, outer=(7,9,12)] + └── (CASE WHEN y IS NOT NULL THEN r END, q) [type=tuple{int[], int}, outer=(7,9,12)] # With an aggregate that can't ignore nulls and when a non-nullable column must be synthesized. @@ -1736,10 +1736,10 @@ project │ │ │ └── projections [outer=(7)] │ │ │ └── true [type=bool] │ │ └── filters [type=bool, outer=(2,7)] - │ │ └── (xy.y = a.i) OR (xy.y IS NULL) [type=bool, outer=(2,7)] + │ │ └── (y = i) OR (y IS NULL) [type=bool, outer=(2,7)] │ └── aggregations [outer=(7,10)] │ ├── array-agg [type=int[], outer=(7)] - │ │ └── variable: xy.y [type=int, outer=(7)] + │ │ └── variable: y [type=int, outer=(7)] │ └── any-not-null-agg [type=bool, outer=(10)] │ └── variable: canary [type=bool, outer=(10)] └── projections [outer=(1,10,11)] @@ -1776,12 +1776,12 @@ project │ │ │ └── projections [outer=(7)] │ │ │ └── true [type=bool] │ │ └── filters [type=bool, outer=(1,7)] - │ │ └── (xy.y = a.k) OR NULL [type=bool, outer=(1,7)] + │ │ └── (y = k) OR NULL [type=bool, outer=(1,7)] │ └── aggregations [outer=(2,7,10)] │ ├── array-agg [type=int[], outer=(7)] - │ │ └── variable: xy.y [type=int, outer=(7)] + │ │ └── variable: y [type=int, outer=(7)] │ ├── const-agg [type=int, outer=(2)] - │ │ └── variable: a.i [type=int, outer=(2)] + │ │ └── variable: i [type=int, outer=(2)] │ └── any-not-null-agg [type=bool, outer=(10)] │ └── variable: canary [type=bool, outer=(10)] └── projections [outer=(2,10,11)] @@ -1848,26 +1848,26 @@ project │ │ │ │ │ │ ├── key: (8) │ │ │ │ │ │ └── fd: (8)-->(9) │ │ │ │ │ └── filters [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)] - │ │ │ │ │ └── uv.u = a.k [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ])] + │ │ │ │ │ └── u = k [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ])] │ │ │ │ └── aggregations [outer=(7,9)] │ │ │ │ ├── max [type=int, outer=(9)] - │ │ │ │ │ └── variable: uv.v [type=int, outer=(9)] + │ │ │ │ │ └── variable: v [type=int, outer=(9)] │ │ │ │ └── const-agg [type=int, outer=(7)] - │ │ │ │ └── variable: xy.y [type=int, outer=(7)] + │ │ │ │ └── variable: y [type=int, outer=(7)] │ │ │ └── filters [type=bool, outer=(10), constraints=(/10: [/NULL - /NULL]; tight), fd=()-->(10)] │ │ │ └── max IS NULL [type=bool, outer=(10), constraints=(/10: [/NULL - /NULL]; tight)] │ │ └── true [type=bool] │ └── aggregations [outer=(2-5,7)] │ ├── max [type=int, outer=(7)] - │ │ └── variable: xy.y [type=int, outer=(7)] + │ │ └── variable: y [type=int, outer=(7)] │ ├── const-agg [type=int, outer=(2)] - │ │ └── variable: a.i [type=int, outer=(2)] + │ │ └── variable: i [type=int, outer=(2)] │ ├── const-agg [type=float, outer=(3)] - │ │ └── variable: a.f [type=float, outer=(3)] + │ │ └── variable: f [type=float, outer=(3)] │ ├── const-agg [type=string, outer=(4)] - │ │ └── variable: a.s [type=string, outer=(4)] + │ │ └── variable: s [type=string, outer=(4)] │ └── const-agg [type=jsonb, outer=(5)] - │ └── variable: a.j [type=jsonb, outer=(5)] + │ └── variable: j [type=jsonb, outer=(5)] └── filters [type=bool, outer=(11), constraints=(/11: [/NULL - /NULL]; tight), fd=()-->(11)] └── max IS NULL [type=bool, outer=(11), constraints=(/11: [/NULL - /NULL]; tight)] @@ -1912,16 +1912,16 @@ project │ │ │ │ ├── key: (3) │ │ │ │ └── fd: (3)-->(4) │ │ │ └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] - │ │ │ └── cd.c = xy.x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + │ │ │ └── c = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] │ │ └── aggregations [outer=(2-4)] │ │ ├── array-agg [type=int[], outer=(4)] - │ │ │ └── variable: xy.y [type=int, outer=(4)] + │ │ │ └── variable: y [type=int, outer=(4)] │ │ ├── const-agg [type=int, outer=(2)] - │ │ │ └── variable: cd.d [type=int, outer=(2)] + │ │ │ └── variable: d [type=int, outer=(2)] │ │ └── any-not-null-agg [type=int, outer=(3)] - │ │ └── variable: xy.x [type=int, outer=(3)] + │ │ └── variable: x [type=int, outer=(3)] │ └── projections [outer=(1-3,6)] - │ └── CASE WHEN xy.x IS NOT NULL THEN array_agg END [type=int[], outer=(3,6)] + │ └── CASE WHEN x IS NOT NULL THEN array_agg END [type=int[], outer=(3,6)] └── filters [type=bool, outer=(5), constraints=(/5: (/NULL - ])] └── array_agg = ARRAY[] [type=bool, outer=(5), constraints=(/5: (/NULL - ])] @@ -1963,20 +1963,20 @@ project │ │ │ │ │ └── fd: (6)-->(7) │ │ │ │ └── projections [outer=(6,7)] │ │ │ │ ├── true [type=bool] - │ │ │ │ └── xy.y::STRING [type=string, outer=(7)] + │ │ │ │ └── y::STRING [type=string, outer=(7)] │ │ │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ │ │ └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ │ │ └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] │ │ └── aggregations [outer=(2-5,8,10)] │ │ ├── concat-agg [type=string, outer=(8)] │ │ │ └── variable: column8 [type=string, outer=(8)] │ │ ├── const-agg [type=int, outer=(2)] - │ │ │ └── variable: a.i [type=int, outer=(2)] + │ │ │ └── variable: i [type=int, outer=(2)] │ │ ├── const-agg [type=float, outer=(3)] - │ │ │ └── variable: a.f [type=float, outer=(3)] + │ │ │ └── variable: f [type=float, outer=(3)] │ │ ├── const-agg [type=string, outer=(4)] - │ │ │ └── variable: a.s [type=string, outer=(4)] + │ │ │ └── variable: s [type=string, outer=(4)] │ │ ├── const-agg [type=jsonb, outer=(5)] - │ │ │ └── variable: a.j [type=jsonb, outer=(5)] + │ │ │ └── variable: j [type=jsonb, outer=(5)] │ │ └── any-not-null-agg [type=bool, outer=(10)] │ │ └── variable: canary [type=bool, outer=(10)] │ └── projections [outer=(1-5,10,11)] @@ -2024,23 +2024,23 @@ project │ │ │ │ │ ├── key: (6) │ │ │ │ │ └── fd: (6)-->(7) │ │ │ │ └── projections [outer=(6,7)] - │ │ │ │ ├── xy.y::STRING [type=string, outer=(7)] - │ │ │ │ └── xy.x + xy.y [type=int, outer=(6,7)] + │ │ │ │ ├── y::STRING [type=string, outer=(7)] + │ │ │ │ └── x + y [type=int, outer=(6,7)] │ │ │ └── filters [type=bool, outer=(9), constraints=(/9: (/NULL - ]; tight)] │ │ │ └── column9 IS NOT NULL [type=bool, outer=(9), constraints=(/9: (/NULL - ]; tight)] │ │ └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - │ │ └── xy.y = a.k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + │ │ └── y = k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] │ └── aggregations [outer=(2-5,9)] │ ├── max [type=string, outer=(9)] │ │ └── variable: column9 [type=string, outer=(9)] │ ├── const-agg [type=int, outer=(2)] - │ │ └── variable: a.i [type=int, outer=(2)] + │ │ └── variable: i [type=int, outer=(2)] │ ├── const-agg [type=float, outer=(3)] - │ │ └── variable: a.f [type=float, outer=(3)] + │ │ └── variable: f [type=float, outer=(3)] │ ├── const-agg [type=string, outer=(4)] - │ │ └── variable: a.s [type=string, outer=(4)] + │ │ └── variable: s [type=string, outer=(4)] │ └── const-agg [type=jsonb, outer=(5)] - │ └── variable: a.j [type=jsonb, outer=(5)] + │ └── variable: j [type=jsonb, outer=(5)] └── filters [type=bool, outer=(10), constraints=(/10: [/'foo' - /'foo']; tight), fd=()-->(10)] └── max = 'foo' [type=bool, outer=(10), constraints=(/10: [/'foo' - /'foo']; tight)] @@ -2093,19 +2093,19 @@ group-by │ │ │ │ ├── key: (1) │ │ │ │ └── fd: (1)-->(2) │ │ │ └── filters [type=bool, outer=(2,10), constraints=(/10: (/NULL - ])] - │ │ │ └── a.f = xy.y::FLOAT [type=bool, outer=(2,10), constraints=(/10: (/NULL - ])] + │ │ │ └── a.f = y::FLOAT [type=bool, outer=(2,10), constraints=(/10: (/NULL - ])] │ │ └── aggregations [outer=(2,4,9)] │ │ ├── max [type=int, outer=(9)] │ │ │ └── variable: a.i [type=int, outer=(9)] │ │ ├── const-agg [type=int, outer=(4)] │ │ │ └── variable: a.i [type=int, outer=(4)] │ │ └── const-agg [type=int, outer=(2)] - │ │ └── variable: xy.y [type=int, outer=(2)] + │ │ └── variable: y [type=int, outer=(2)] │ └── filters [type=bool, outer=(4,13), constraints=(/4: (/NULL - ]; /13: (/NULL - ]), fd=(4)==(13), (13)==(4)] │ └── a.i = max [type=bool, outer=(4,13), constraints=(/4: (/NULL - ]; /13: (/NULL - ])] └── aggregations [outer=(2)] └── const-agg [type=int, outer=(2)] - └── variable: xy.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # Right input of SemiJoin is DistinctOn. opt @@ -2140,17 +2140,17 @@ group-by │ │ │ ├── scan a │ │ │ │ └── columns: i:4(int) f:5(float) │ │ │ └── filters [type=bool, outer=(2,5), constraints=(/2: (/NULL - ]; /5: (/NULL - ])] - │ │ │ └── xy.y > a.f [type=bool, outer=(2,5), constraints=(/2: (/NULL - ]; /5: (/NULL - ])] + │ │ │ └── y > f [type=bool, outer=(2,5), constraints=(/2: (/NULL - ]; /5: (/NULL - ])] │ │ └── aggregations [outer=(2,4)] │ │ ├── first-agg [type=int, outer=(4)] - │ │ │ └── variable: a.i [type=int, outer=(4)] + │ │ │ └── variable: i [type=int, outer=(4)] │ │ └── const-agg [type=int, outer=(2)] - │ │ └── variable: xy.y [type=int, outer=(2)] + │ │ └── variable: y [type=int, outer=(2)] │ └── filters [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ]), fd=(1)==(4), (4)==(1)] - │ └── xy.x = a.i [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ])] + │ └── x = i [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ])] └── aggregations [outer=(2)] └── const-agg [type=int, outer=(2)] - └── variable: xy.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # Right input of SemiJoin is Project. opt @@ -2190,11 +2190,11 @@ project │ │ │ ├── key: (1) │ │ │ └── fd: (1)-->(2) │ │ └── filters [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ]), fd=(2)==(8), (8)==(2)] - │ │ └── uv.u = a.i [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ])] + │ │ └── u = i [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ])] │ └── projections [outer=(1,6,8)] - │ └── COALESCE(uv.u, 10) [type=int, outer=(8)] + │ └── COALESCE(u, 10) [type=int, outer=(8)] └── filters [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ]), fd=(6)==(10), (10)==(6)] - └── xy.x = computed [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ])] + └── x = computed [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ])] # -------------------------------------------------- # TryDecorrelateLimitOne @@ -2237,9 +2237,9 @@ semi-join │ ├── left ordering: +6 │ ├── right ordering: +8 │ └── filters [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ]), fd=(6)==(8), (8)==(6)] - │ └── xy.x = uv.u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] + │ └── x = u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] └── filters [type=bool, outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)] - └── uv.v = a.i [type=bool, outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ])] + └── v = i [type=bool, outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ])] # With left join. opt @@ -2267,7 +2267,7 @@ project │ │ │ ├── key: (6) │ │ │ └── fd: (6)-->(7) │ │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - │ │ └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ │ └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] │ └── aggregations [outer=(6)] │ └── first-agg [type=int, outer=(6)] │ └── variable: xy.x [type=int, outer=(6)] @@ -2321,35 +2321,35 @@ project │ │ │ │ │ │ ├── key: (6) │ │ │ │ │ │ └── fd: (6)-->(7) │ │ │ │ │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - │ │ │ │ │ └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ │ │ │ │ └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] │ │ │ │ └── aggregations [outer=(2-6)] │ │ │ │ ├── const-agg [type=int, outer=(2)] - │ │ │ │ │ └── variable: a.i [type=int, outer=(2)] + │ │ │ │ │ └── variable: i [type=int, outer=(2)] │ │ │ │ ├── const-agg [type=float, outer=(3)] - │ │ │ │ │ └── variable: a.f [type=float, outer=(3)] + │ │ │ │ │ └── variable: f [type=float, outer=(3)] │ │ │ │ ├── const-agg [type=string, outer=(4)] - │ │ │ │ │ └── variable: a.s [type=string, outer=(4)] + │ │ │ │ │ └── variable: s [type=string, outer=(4)] │ │ │ │ ├── const-agg [type=jsonb, outer=(5)] - │ │ │ │ │ └── variable: a.j [type=jsonb, outer=(5)] + │ │ │ │ │ └── variable: j [type=jsonb, outer=(5)] │ │ │ │ └── first-agg [type=int, outer=(6)] - │ │ │ │ └── variable: xy.x [type=int, outer=(6)] + │ │ │ │ └── variable: x [type=int, outer=(6)] │ │ │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ │ │ └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ │ │ └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] │ │ └── filters [type=bool, outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)] - │ │ └── uv.v = a.i [type=bool, outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ])] + │ │ └── v = i [type=bool, outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ])] │ └── aggregations [outer=(2-5,8)] │ ├── const-agg [type=int, outer=(2)] - │ │ └── variable: a.i [type=int, outer=(2)] + │ │ └── variable: i [type=int, outer=(2)] │ ├── const-agg [type=float, outer=(3)] - │ │ └── variable: a.f [type=float, outer=(3)] + │ │ └── variable: f [type=float, outer=(3)] │ ├── const-agg [type=string, outer=(4)] - │ │ └── variable: a.s [type=string, outer=(4)] + │ │ └── variable: s [type=string, outer=(4)] │ ├── const-agg [type=jsonb, outer=(5)] - │ │ └── variable: a.j [type=jsonb, outer=(5)] + │ │ └── variable: j [type=jsonb, outer=(5)] │ └── first-agg [type=int, outer=(8)] - │ └── variable: uv.u [type=int, outer=(8)] + │ └── variable: u [type=int, outer=(8)] └── filters [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)] - └── a.k = uv.u [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ])] + └── k = u [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ])] # With nested limited queries. opt @@ -2409,29 +2409,29 @@ project │ │ │ │ │ │ ├── key: (8) │ │ │ │ │ │ └── fd: (8)-->(9) │ │ │ │ │ └── filters [type=bool, outer=(7,9), constraints=(/7: (/NULL - ]; /9: (/NULL - ]), fd=(7)==(9), (9)==(7)] - │ │ │ │ │ └── uv.v = xy.y [type=bool, outer=(7,9), constraints=(/7: (/NULL - ]; /9: (/NULL - ])] + │ │ │ │ │ └── v = y [type=bool, outer=(7,9), constraints=(/7: (/NULL - ]; /9: (/NULL - ])] │ │ │ │ └── aggregations [outer=(7,8)] │ │ │ │ ├── const-agg [type=int, outer=(7)] - │ │ │ │ │ └── variable: xy.y [type=int, outer=(7)] + │ │ │ │ │ └── variable: y [type=int, outer=(7)] │ │ │ │ └── first-agg [type=int, outer=(8)] - │ │ │ │ └── variable: uv.u [type=int, outer=(8)] + │ │ │ │ └── variable: u [type=int, outer=(8)] │ │ │ └── filters [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ]), fd=(6)==(8), (8)==(6)] - │ │ │ └── xy.x = uv.u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] + │ │ │ └── x = u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] │ │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - │ │ └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ │ └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] │ └── aggregations [outer=(2-6)] │ ├── const-agg [type=int, outer=(2)] - │ │ └── variable: a.i [type=int, outer=(2)] + │ │ └── variable: i [type=int, outer=(2)] │ ├── const-agg [type=float, outer=(3)] - │ │ └── variable: a.f [type=float, outer=(3)] + │ │ └── variable: f [type=float, outer=(3)] │ ├── const-agg [type=string, outer=(4)] - │ │ └── variable: a.s [type=string, outer=(4)] + │ │ └── variable: s [type=string, outer=(4)] │ ├── const-agg [type=jsonb, outer=(5)] - │ │ └── variable: a.j [type=jsonb, outer=(5)] + │ │ └── variable: j [type=jsonb, outer=(5)] │ └── first-agg [type=int, outer=(6)] - │ └── variable: xy.x [type=int, outer=(6)] + │ └── variable: x [type=int, outer=(6)] └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # With inner join + ORDER BY. opt @@ -2477,9 +2477,9 @@ project │ │ │ ├── left ordering: +3 │ │ │ ├── right ordering: +5 │ │ │ └── filters [type=bool, outer=(3,5), constraints=(/3: (/NULL - ]; /5: (/NULL - ]), fd=(3)==(5), (5)==(3)] - │ │ │ └── uv.u = a.k [type=bool, outer=(3,5), constraints=(/3: (/NULL - ]; /5: (/NULL - ])] + │ │ │ └── u = k [type=bool, outer=(3,5), constraints=(/3: (/NULL - ]; /5: (/NULL - ])] │ │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ │ └── a.i = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ │ └── i = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] │ └── aggregations [outer=(4)] │ └── first-agg [type=int, outer=(4)] │ └── variable: uv.v [type=int, outer=(4)] @@ -2522,14 +2522,14 @@ project │ │ │ ├── key: (3) │ │ │ └── fd: (3)-->(4-6) │ │ └── filters [type=bool, outer=(2,4), constraints=(/2: (/NULL - ]; /4: (/NULL - ]), fd=(2)==(4), (4)==(2)] - │ │ └── a.i = xy.y [type=bool, outer=(2,4), constraints=(/2: (/NULL - ]; /4: (/NULL - ])] + │ │ └── i = y [type=bool, outer=(2,4), constraints=(/2: (/NULL - ]; /4: (/NULL - ])] │ └── aggregations [outer=(2,3)] │ ├── const-agg [type=int, outer=(2)] - │ │ └── variable: xy.y [type=int, outer=(2)] + │ │ └── variable: y [type=int, outer=(2)] │ └── first-agg [type=int, outer=(3)] - │ └── variable: a.k [type=int, outer=(3)] + │ └── variable: k [type=int, outer=(3)] └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] - └── xy.x = a.k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + └── x = k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] # -------------------------------------------------- # HoistSelectExists @@ -2555,7 +2555,7 @@ semi-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Ensure that EXISTS is hoisted even when it is one of several conjuncts. opt @@ -2576,8 +2576,8 @@ semi-join (merge) │ │ ├── fd: (1)-->(2-5) │ │ └── ordering: +1 opt(4) │ └── filters [type=bool, outer=(2,4), constraints=(/2: [/2 - ]; /4: [/'foo' - /'foo']; tight), fd=()-->(4)] - │ ├── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] - │ └── a.i > 1 [type=bool, outer=(2), constraints=(/2: [/2 - ]; tight)] + │ ├── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + │ └── i > 1 [type=bool, outer=(2), constraints=(/2: [/2 - ]; tight)] ├── scan xy │ ├── columns: x:6(int!null) y:7(int) │ ├── key: (6) @@ -2587,7 +2587,7 @@ semi-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Multiple Exists operators in same Select list. opt @@ -2610,13 +2610,13 @@ semi-join │ │ ├── key: (8) │ │ └── fd: (8)-->(9) │ └── filters [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ]), fd=(2)==(8), (8)==(2)] - │ └── xy.x = a.i [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ])] + │ └── xy.x = i [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ])] ├── scan xy │ ├── columns: xy.x:6(int!null) xy.y:7(int) │ ├── key: (6) │ └── fd: (6)-->(7) └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── xy.x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Don't hoist uncorrelated subqueries. opt @@ -2669,12 +2669,12 @@ semi-join (merge) │ ├── left ordering: +6 │ ├── right ordering: +8 │ └── filters [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ]), fd=(6)==(8), (8)==(6)] - │ └── xy.x = uv.u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] + │ └── x = u [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] └── merge-on ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # -------------------------------------------------- # HoistSelectNotExists @@ -2700,7 +2700,7 @@ anti-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Ensure that NOT EXISTS is hoisted even when one of several conjuncts. opt @@ -2721,8 +2721,8 @@ anti-join (merge) │ │ ├── fd: (1)-->(2-5) │ │ └── ordering: +1 opt(4) │ └── filters [type=bool, outer=(2,4), constraints=(/2: [/2 - ]; /4: [/'foo' - /'foo']; tight), fd=()-->(4)] - │ ├── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] - │ └── a.i > 1 [type=bool, outer=(2), constraints=(/2: [/2 - ]; tight)] + │ ├── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + │ └── i > 1 [type=bool, outer=(2), constraints=(/2: [/2 - ]; tight)] ├── scan xy │ ├── columns: x:6(int!null) y:7(int) │ ├── key: (6) @@ -2732,7 +2732,7 @@ anti-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Multiple Not Exists operators in same Select list. opt @@ -2757,13 +2757,13 @@ anti-join │ │ ├── key: (8) │ │ └── fd: (8)-->(9) │ └── filters [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ]), fd=(2)==(8), (8)==(2)] - │ └── xy.x = a.i [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ])] + │ └── xy.x = i [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ])] ├── scan xy │ ├── columns: xy.x:6(int!null) xy.y:7(int) │ ├── key: (6) │ └── fd: (6)-->(7) └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── xy.x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Don't hoist uncorrelated subqueries. opt @@ -2808,13 +2808,13 @@ semi-join │ │ ├── key: (8) │ │ └── fd: (8)-->(9) │ └── filters [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ]), fd=(2)==(8), (8)==(2)] - │ └── xy.x = a.i [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ])] + │ └── xy.x = i [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ])] ├── scan xy │ ├── columns: xy.x:6(int!null) xy.y:7(int) │ ├── key: (6) │ └── fd: (6)-->(7) └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── xy.x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # -------------------------------------------------- # HoistSelectSubquery @@ -2845,20 +2845,20 @@ project │ │ ├── scan xy │ │ │ └── columns: y:7(int) │ │ └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - │ │ └── xy.y = a.k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + │ │ └── y = k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] │ └── aggregations [outer=(2-5,7)] │ ├── const-agg [type=int, outer=(2)] - │ │ └── variable: a.i [type=int, outer=(2)] + │ │ └── variable: i [type=int, outer=(2)] │ ├── const-agg [type=float, outer=(3)] - │ │ └── variable: a.f [type=float, outer=(3)] + │ │ └── variable: f [type=float, outer=(3)] │ ├── const-agg [type=string, outer=(4)] - │ │ └── variable: a.s [type=string, outer=(4)] + │ │ └── variable: s [type=string, outer=(4)] │ ├── const-agg [type=jsonb, outer=(5)] - │ │ └── variable: a.j [type=jsonb, outer=(5)] + │ │ └── variable: j [type=jsonb, outer=(5)] │ └── first-agg [type=int, outer=(7)] - │ └── variable: xy.y [type=int, outer=(7)] + │ └── variable: y [type=int, outer=(7)] └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - └── a.i = xy.y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + └── i = y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] # Multiple other conjuncts, including uncorrelated subquery (don't hoist). opt @@ -2923,22 +2923,22 @@ project │ │ ├── left ordering: +1 │ │ ├── right ordering: +7 │ │ └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - │ │ └── xy.y = a.k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + │ │ └── xy.y = k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] │ └── aggregations [outer=(1-5,7)] │ ├── const-agg [type=int, outer=(2)] - │ │ └── variable: a.i [type=int, outer=(2)] + │ │ └── variable: i [type=int, outer=(2)] │ ├── const-agg [type=float, outer=(3)] - │ │ └── variable: a.f [type=float, outer=(3)] + │ │ └── variable: f [type=float, outer=(3)] │ ├── const-agg [type=string, outer=(4)] - │ │ └── variable: a.s [type=string, outer=(4)] + │ │ └── variable: s [type=string, outer=(4)] │ ├── const-agg [type=jsonb, outer=(5)] - │ │ └── variable: a.j [type=jsonb, outer=(5)] + │ │ └── variable: j [type=jsonb, outer=(5)] │ ├── first-agg [type=int, outer=(7)] │ │ └── variable: xy.y [type=int, outer=(7)] │ └── const-agg [type=int, outer=(1)] - │ └── variable: a.k [type=int, outer=(1)] + │ └── variable: k [type=int, outer=(1)] └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - └── a.i = xy.y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + └── i = xy.y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] # Multiple correlated subqueries. opt @@ -2982,35 +2982,35 @@ project │ │ │ │ │ ├── scan xy │ │ │ │ │ │ └── columns: xy.y:7(int) │ │ │ │ │ └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - │ │ │ │ │ └── xy.y = a.k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + │ │ │ │ │ └── xy.y = k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] │ │ │ │ └── aggregations [outer=(2-5,7)] │ │ │ │ ├── count [type=int, outer=(7)] │ │ │ │ │ └── variable: xy.y [type=int, outer=(7)] │ │ │ │ ├── const-agg [type=int, outer=(2)] - │ │ │ │ │ └── variable: a.i [type=int, outer=(2)] + │ │ │ │ │ └── variable: i [type=int, outer=(2)] │ │ │ │ ├── const-agg [type=float, outer=(3)] - │ │ │ │ │ └── variable: a.f [type=float, outer=(3)] + │ │ │ │ │ └── variable: f [type=float, outer=(3)] │ │ │ │ ├── const-agg [type=string, outer=(4)] - │ │ │ │ │ └── variable: a.s [type=string, outer=(4)] + │ │ │ │ │ └── variable: s [type=string, outer=(4)] │ │ │ │ └── const-agg [type=jsonb, outer=(5)] - │ │ │ │ └── variable: a.j [type=jsonb, outer=(5)] + │ │ │ │ └── variable: j [type=jsonb, outer=(5)] │ │ │ └── filters [type=bool, outer=(8), constraints=(/8: [/1 - ]; tight)] │ │ │ └── count > 0 [type=bool, outer=(8), constraints=(/8: [/1 - ]; tight)] │ │ └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - │ │ └── xy.y = a.k [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + │ │ └── xy.y = k [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] │ └── aggregations [outer=(2-5,10)] │ ├── const-agg [type=int, outer=(2)] - │ │ └── variable: a.i [type=int, outer=(2)] + │ │ └── variable: i [type=int, outer=(2)] │ ├── const-agg [type=float, outer=(3)] - │ │ └── variable: a.f [type=float, outer=(3)] + │ │ └── variable: f [type=float, outer=(3)] │ ├── const-agg [type=string, outer=(4)] - │ │ └── variable: a.s [type=string, outer=(4)] + │ │ └── variable: s [type=string, outer=(4)] │ ├── const-agg [type=jsonb, outer=(5)] - │ │ └── variable: a.j [type=jsonb, outer=(5)] + │ │ └── variable: j [type=jsonb, outer=(5)] │ └── first-agg [type=int, outer=(10)] │ └── variable: xy.y [type=int, outer=(10)] └── filters [type=bool, outer=(2,10), constraints=(/2: (/NULL - ]; /10: (/NULL - ]), fd=(2)==(10), (10)==(2)] - └── a.i = xy.y [type=bool, outer=(2,10), constraints=(/2: (/NULL - ]; /10: (/NULL - ])] + └── i = xy.y [type=bool, outer=(2,10), constraints=(/2: (/NULL - ]; /10: (/NULL - ])] # Subquery nested below interesting scalar operators like cast, function, tuple, # or, etc). @@ -3047,20 +3047,20 @@ project │ │ ├── left ordering: +1 │ │ ├── right ordering: +6 │ │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ │ └── a.k = uv.u [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ │ └── k = u [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] │ └── aggregations [outer=(2-6)] │ ├── count [type=int, outer=(6)] - │ │ └── variable: uv.u [type=int, outer=(6)] + │ │ └── variable: u [type=int, outer=(6)] │ ├── const-agg [type=int, outer=(2)] - │ │ └── variable: a.i [type=int, outer=(2)] + │ │ └── variable: i [type=int, outer=(2)] │ ├── const-agg [type=float, outer=(3)] - │ │ └── variable: a.f [type=float, outer=(3)] + │ │ └── variable: f [type=float, outer=(3)] │ ├── const-agg [type=string, outer=(4)] - │ │ └── variable: a.s [type=string, outer=(4)] + │ │ └── variable: s [type=string, outer=(4)] │ └── const-agg [type=jsonb, outer=(5)] - │ └── variable: a.j [type=jsonb, outer=(5)] + │ └── variable: j [type=jsonb, outer=(5)] └── filters [type=bool, outer=(2,8)] - └── ((0, length(count::STRING)) > (0, 1)) OR (a.i = 1) [type=bool, outer=(2,8)] + └── ((0, length(count::STRING)) > (0, 1)) OR (i = 1) [type=bool, outer=(2,8)] # Exists within a disjunction. opt @@ -3094,20 +3094,20 @@ project │ │ │ └── projections [outer=(7)] │ │ │ └── true [type=bool] │ │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - │ │ └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ │ └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] │ └── aggregations [outer=(2-5,8)] │ ├── const-not-null-agg [type=bool, outer=(8)] │ │ └── variable: true [type=bool, outer=(8)] │ ├── const-agg [type=int, outer=(2)] - │ │ └── variable: a.i [type=int, outer=(2)] + │ │ └── variable: i [type=int, outer=(2)] │ ├── const-agg [type=float, outer=(3)] - │ │ └── variable: a.f [type=float, outer=(3)] + │ │ └── variable: f [type=float, outer=(3)] │ ├── const-agg [type=string, outer=(4)] - │ │ └── variable: a.s [type=string, outer=(4)] + │ │ └── variable: s [type=string, outer=(4)] │ └── const-agg [type=jsonb, outer=(5)] - │ └── variable: a.j [type=jsonb, outer=(5)] + │ └── variable: j [type=jsonb, outer=(5)] └── filters [type=bool, outer=(2,9)] - └── (a.i = 1) OR (true_agg IS NOT NULL) [type=bool, outer=(2,9)] + └── (i = 1) OR (true_agg IS NOT NULL) [type=bool, outer=(2,9)] # Any with IS NULL. opt @@ -3143,22 +3143,22 @@ project │ │ │ │ ├── scan xy │ │ │ │ │ └── columns: y:7(int) │ │ │ │ └── projections [outer=(7)] - │ │ │ │ └── xy.y IS NOT NULL [type=bool, outer=(7)] + │ │ │ │ └── y IS NOT NULL [type=bool, outer=(7)] │ │ │ └── filters [type=bool, outer=(2,7)] - │ │ │ └── (a.i = xy.y) IS NOT false [type=bool, outer=(2,7)] + │ │ │ └── (i = y) IS NOT false [type=bool, outer=(2,7)] │ │ └── aggregations [outer=(2-5,8)] │ │ ├── bool-or [type=bool, outer=(8)] │ │ │ └── variable: notnull [type=bool, outer=(8)] │ │ ├── const-agg [type=int, outer=(2)] - │ │ │ └── variable: a.i [type=int, outer=(2)] + │ │ │ └── variable: i [type=int, outer=(2)] │ │ ├── const-agg [type=float, outer=(3)] - │ │ │ └── variable: a.f [type=float, outer=(3)] + │ │ │ └── variable: f [type=float, outer=(3)] │ │ ├── const-agg [type=string, outer=(4)] - │ │ │ └── variable: a.s [type=string, outer=(4)] + │ │ │ └── variable: s [type=string, outer=(4)] │ │ └── const-agg [type=jsonb, outer=(5)] - │ │ └── variable: a.j [type=jsonb, outer=(5)] + │ │ └── variable: j [type=jsonb, outer=(5)] │ └── projections [outer=(1-5,9)] - │ └── CASE WHEN bool_or AND (a.i IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(2,9)] + │ └── CASE WHEN bool_or AND (i IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(2,9)] └── filters [type=bool, outer=(10), constraints=(/10: [/NULL - /NULL]; tight), fd=()-->(10)] └── case IS NULL [type=bool, outer=(10), constraints=(/10: [/NULL - /NULL]; tight)] @@ -3190,21 +3190,21 @@ project │ │ │ ├── scan a │ │ │ │ └── columns: i:2(int) s:4(string) │ │ │ └── projections [outer=(2,4), side-effects] - │ │ │ └── (a.i * a.i) / 100 [type=decimal, outer=(2), side-effects] + │ │ │ └── (i * i) / 100 [type=decimal, outer=(2), side-effects] │ │ ├── project │ │ │ ├── columns: notnull:10(bool) y:7(int) │ │ │ ├── fd: (7)-->(10) │ │ │ ├── scan xy │ │ │ │ └── columns: y:7(int) │ │ │ └── projections [outer=(7)] - │ │ │ └── xy.y IS NOT NULL [type=bool, outer=(7)] + │ │ │ └── y IS NOT NULL [type=bool, outer=(7)] │ │ └── filters [type=bool, outer=(7,9)] - │ │ └── (scalar >= xy.y) IS NOT false [type=bool, outer=(7,9)] + │ │ └── (scalar >= y) IS NOT false [type=bool, outer=(7,9)] │ └── aggregations [outer=(4,9,10)] │ ├── bool-or [type=bool, outer=(10)] │ │ └── variable: notnull [type=bool, outer=(10)] │ ├── const-agg [type=string, outer=(4)] - │ │ └── variable: a.s [type=string, outer=(4)] + │ │ └── variable: s [type=string, outer=(4)] │ └── const-agg [type=decimal, outer=(9)] │ └── variable: scalar [type=decimal, outer=(9)] └── projections [outer=(4,9,11)] @@ -3233,7 +3233,7 @@ project │ ├── left ordering: +1 │ ├── right ordering: +6 │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ └── xy.x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] └── projections [outer=(6)] └── variable: xy.x [type=int, outer=(6)] @@ -3273,11 +3273,11 @@ project │ │ │ ├── left ordering: +1 │ │ │ ├── right ordering: +7 │ │ │ └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - │ │ │ └── xy.x = a.k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + │ │ │ └── xy.x = k [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] │ │ ├── scan xy │ │ │ └── columns: xy.y:20(int) │ │ └── filters [type=bool, outer=(1,20), constraints=(/1: (/NULL - ]; /20: (/NULL - ]), fd=(1)==(20), (20)==(1)] - │ │ └── xy.y = a.k [type=bool, outer=(1,20), constraints=(/1: (/NULL - ]; /20: (/NULL - ])] + │ │ └── xy.y = k [type=bool, outer=(1,20), constraints=(/1: (/NULL - ]; /20: (/NULL - ])] │ └── aggregations [outer=(20)] │ └── count [type=int, outer=(20)] │ └── variable: xy.y [type=int, outer=(20)] @@ -3329,10 +3329,10 @@ scalar-group-by │ │ │ ├── scan xy │ │ │ │ └── columns: y:7(int) │ │ │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - │ │ │ └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ │ │ └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] │ │ └── true [type=bool] │ └── projections [outer=(7)] - │ └── variable: xy.y [type=int, outer=(7)] + │ └── variable: y [type=int, outer=(7)] └── aggregations [outer=(8)] └── max [type=int, outer=(8)] └── variable: column8 [type=int, outer=(8)] @@ -3365,7 +3365,7 @@ project │ │ │ └── projections [outer=(7)] │ │ │ └── true [type=bool] │ │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - │ │ └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ │ └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] │ └── aggregations [outer=(9)] │ └── const-not-null-agg [type=bool, outer=(9)] │ └── variable: true [type=bool, outer=(9)] @@ -3400,11 +3400,11 @@ project │ │ │ │ ├── scan xy │ │ │ │ │ └── columns: y:7(int) │ │ │ │ └── filters [type=bool, outer=(7)] - │ │ │ │ └── (xy.y > 5) IS NOT false [type=bool, outer=(7)] + │ │ │ │ └── (y > 5) IS NOT false [type=bool, outer=(7)] │ │ │ └── projections [outer=(7)] - │ │ │ └── xy.y IS NOT NULL [type=bool, outer=(7)] + │ │ │ └── y IS NOT NULL [type=bool, outer=(7)] │ │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - │ │ └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ │ └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] │ └── aggregations [outer=(9)] │ └── bool-or [type=bool, outer=(9)] │ └── variable: notnull [type=bool, outer=(9)] @@ -3443,7 +3443,7 @@ project │ └── projections [outer=(7)] │ └── true [type=bool] └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - └── xy.y = a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + └── y = i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] # -------------------------------------------------- # HoistJoinSubquery @@ -3467,7 +3467,7 @@ project │ │ ├── key: (1) │ │ └── fd: (1)-->(2) │ └── filters [type=bool, outer=(1)] - │ └── (a.k + 1) = 0 [type=bool, outer=(1)] + │ └── (k + 1) = 0 [type=bool, outer=(1)] └── true [type=bool] # Right join + multiple subqueries. @@ -3490,8 +3490,8 @@ project │ │ ├── key: (6) │ │ └── fd: (6)-->(7) │ └── projections [outer=(1,6,7)] - │ ├── xy.x + 1 [type=int, outer=(6)] - │ └── a.k + 1 [type=int, outer=(1)] + │ ├── x + 1 [type=int, outer=(6)] + │ └── k + 1 [type=int, outer=(1)] └── filters [type=bool, outer=(8,9), constraints=(/8: (/NULL - ]; /9: (/NULL - ]), fd=(8)==(9), (9)==(8)] └── ?column? = ?column? [type=bool, outer=(8,9), constraints=(/8: (/NULL - ]; /9: (/NULL - ])] @@ -3536,14 +3536,14 @@ project │ │ │ │ └── projections [outer=(8)] │ │ │ │ └── true [type=bool] │ │ │ └── filters [type=bool, outer=(7,8), constraints=(/7: (/NULL - ]; /8: (/NULL - ]), fd=(7)==(8), (8)==(7)] - │ │ │ └── uv.u = xy.y [type=bool, outer=(7,8), constraints=(/7: (/NULL - ]; /8: (/NULL - ])] + │ │ │ └── u = y [type=bool, outer=(7,8), constraints=(/7: (/NULL - ]; /8: (/NULL - ])] │ │ └── aggregations [outer=(10)] │ │ └── const-not-null-agg [type=bool, outer=(10)] │ │ └── variable: true [type=bool, outer=(10)] │ └── projections [outer=(6,11)] │ └── true_agg IS NOT NULL [type=bool, outer=(11)] └── filters [type=bool, outer=(1,6,12)] - └── exists OR (a.k = xy.x) [type=bool, outer=(1,6,12)] + └── exists OR (k = x) [type=bool, outer=(1,6,12)] # Any in Join filter disjunction. opt @@ -3586,19 +3586,19 @@ project │ │ │ │ │ │ ├── key: (8) │ │ │ │ │ │ └── fd: (8)-->(9) │ │ │ │ │ └── projections [outer=(8,9)] - │ │ │ │ │ └── uv.v IS NOT NULL [type=bool, outer=(9)] + │ │ │ │ │ └── v IS NOT NULL [type=bool, outer=(9)] │ │ │ │ └── filters [type=bool, outer=(6-9), constraints=(/7: (/NULL - ]; /8: (/NULL - ]), fd=(7)==(8), (8)==(7)] - │ │ │ │ ├── uv.u = xy.y [type=bool, outer=(7,8), constraints=(/7: (/NULL - ]; /8: (/NULL - ])] - │ │ │ │ └── (xy.x = uv.v) IS NOT false [type=bool, outer=(6,9)] + │ │ │ │ ├── u = y [type=bool, outer=(7,8), constraints=(/7: (/NULL - ]; /8: (/NULL - ])] + │ │ │ │ └── (x = v) IS NOT false [type=bool, outer=(6,9)] │ │ │ └── aggregations [outer=(7,10)] │ │ │ ├── bool-or [type=bool, outer=(10)] │ │ │ │ └── variable: notnull [type=bool, outer=(10)] │ │ │ └── const-agg [type=int, outer=(7)] - │ │ │ └── variable: xy.y [type=int, outer=(7)] + │ │ │ └── variable: y [type=int, outer=(7)] │ │ └── projections [outer=(6,7,11)] - │ │ └── CASE WHEN bool_or AND (xy.x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(6,11)] + │ │ └── CASE WHEN bool_or AND (x IS NOT NULL) THEN true WHEN bool_or IS NULL THEN false END [type=bool, outer=(6,11)] │ └── filters [type=bool, outer=(6,12)] - │ └── case OR (xy.x IS NULL) [type=bool, outer=(6,12)] + │ └── case OR (x IS NULL) [type=bool, outer=(6,12)] └── true [type=bool] # -------------------------------------------------- @@ -3643,8 +3643,8 @@ project │ │ │ │ ├── key: () │ │ │ │ └── tuple [type=tuple] │ │ │ └── projections [outer=(1,2)] - │ │ │ ├── a.k + 1 [type=int, outer=(1)] - │ │ │ └── a.i + 1 [type=int, outer=(2)] + │ │ │ ├── k + 1 [type=int, outer=(1)] + │ │ │ └── i + 1 [type=int, outer=(2)] │ │ ├── values │ │ │ ├── columns: column1:8(int) │ │ │ ├── outer: (6,7) @@ -3708,7 +3708,7 @@ project │ │ │ │ │ │ ├── key: () │ │ │ │ │ │ └── tuple [type=tuple] │ │ │ │ │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ │ │ │ │ └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ │ │ │ │ └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] │ │ │ │ └── aggregations [outer=(9)] │ │ │ │ └── const-not-null-agg [type=bool, outer=(9)] │ │ │ │ └── variable: true [type=bool, outer=(9)] @@ -3776,15 +3776,15 @@ project │ │ │ │ │ │ │ │ ├── key: (6) │ │ │ │ │ │ │ │ └── fd: (6)-->(7) │ │ │ │ │ │ │ └── filters [type=bool, outer=(7)] - │ │ │ │ │ │ │ └── (xy.y = 5) IS NOT false [type=bool, outer=(7)] + │ │ │ │ │ │ │ └── (y = 5) IS NOT false [type=bool, outer=(7)] │ │ │ │ │ │ └── projections [outer=(6,7)] - │ │ │ │ │ │ └── xy.y IS NOT NULL [type=bool, outer=(7)] + │ │ │ │ │ │ └── y IS NOT NULL [type=bool, outer=(7)] │ │ │ │ │ ├── values │ │ │ │ │ │ ├── cardinality: [1 - 1] │ │ │ │ │ │ ├── key: () │ │ │ │ │ │ └── tuple [type=tuple] │ │ │ │ │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ │ │ │ │ └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ │ │ │ │ └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] │ │ │ │ └── aggregations [outer=(9)] │ │ │ │ └── bool-or [type=bool, outer=(9)] │ │ │ │ └── variable: notnull [type=bool, outer=(9)] @@ -3833,12 +3833,12 @@ project │ ├── left ordering: +1 │ ├── right ordering: +3 │ └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] - │ └── uv.u = xy.x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + │ └── u = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] ├── zip │ ├── columns: column5:5(int) │ ├── outer: (4) │ ├── side-effects - │ └── generate_series(1, uv.v) [type=int, outer=(4), side-effects] + │ └── generate_series(1, v) [type=int, outer=(4), side-effects] └── true [type=bool] # Zip correlation within EXISTS. @@ -3877,12 +3877,12 @@ semi-join-apply │ │ │ ├── key: () │ │ │ └── tuple [type=tuple] │ │ └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] - │ │ └── uv.u = xy.x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + │ │ └── u = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] │ ├── zip │ │ ├── columns: generate_series:5(int) │ │ ├── outer: (4) │ │ ├── side-effects - │ │ └── generate_series(1, uv.v) [type=int, outer=(4), side-effects] + │ │ └── generate_series(1, v) [type=int, outer=(4), side-effects] │ └── true [type=bool] └── true [type=bool] @@ -3922,7 +3922,7 @@ project │ │ ├── left ordering: +1 │ │ ├── right ordering: +6 │ │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ │ └── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ │ └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] │ ├── scan uv │ │ ├── columns: u:8(int!null) v:9(int) │ │ ├── key: (8) @@ -3932,12 +3932,12 @@ project │ ├── left ordering: +1 │ ├── right ordering: +8 │ └── filters [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)] - │ └── uv.u = a.k [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ])] + │ └── u = k [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ])] ├── zip │ ├── columns: column10:10(int) │ ├── outer: (7,9) │ ├── side-effects - │ └── generate_series(xy.y, uv.v) [type=int, outer=(7,9), side-effects] + │ └── generate_series(y, v) [type=int, outer=(7,9), side-effects] └── true [type=bool] # Multiple functions. @@ -3976,7 +3976,7 @@ project │ │ │ ├── left ordering: +1 │ │ │ ├── right ordering: +6 │ │ │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ │ │ └── uv.u = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ │ │ └── u = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] │ │ ├── scan xy │ │ │ ├── columns: xy.x:9(int!null) │ │ │ ├── key: (9) @@ -3985,12 +3985,12 @@ project │ │ ├── left ordering: +1 │ │ ├── right ordering: +9 │ │ └── filters [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ]), fd=(1)==(9), (9)==(1)] - │ │ └── xy.x = a.k [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ])] + │ │ └── xy.x = k [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ])] │ ├── zip │ │ ├── columns: column8:8(int) x:11(int) n:12(int) │ │ ├── outer: (7,9) │ │ ├── side-effects - │ │ ├── generate_series(1, uv.v) [type=int, outer=(7), side-effects] + │ │ ├── generate_series(1, v) [type=int, outer=(7), side-effects] │ │ └── information_schema._pg_expandarray(ARRAY[xy.x]) [type=tuple{int AS x, int AS n}, outer=(9), side-effects] │ └── true [type=bool] └── projections [outer=(8,11,12)] @@ -4013,7 +4013,7 @@ semi-join ├── scan xy │ └── columns: y:7(int) └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - └── a.i = xy.y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + └── i = y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] # Any is one of several conjuncts. opt @@ -4036,11 +4036,11 @@ semi-join │ │ ├── key: () │ │ └── fd: ()-->(1-5) │ └── filters [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight), fd=()-->(4)] - │ └── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + │ └── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] ├── scan xy │ └── columns: y:7(int) └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] - └── a.i < xy.y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + └── i < y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] # Multiple ANY conjuncts. opt @@ -4065,11 +4065,11 @@ semi-join │ │ └── projections [outer=(9)] │ │ └── xy.y::STRING [type=string, outer=(9)] │ └── filters [type=bool, outer=(4,10), constraints=(/4: (/NULL - ]; /10: (/NULL - ]), fd=(4)==(10), (10)==(4)] - │ └── a.s = y [type=bool, outer=(4,10), constraints=(/4: (/NULL - ]; /10: (/NULL - ])] + │ └── s = y [type=bool, outer=(4,10), constraints=(/4: (/NULL - ]; /10: (/NULL - ])] ├── scan xy │ └── columns: xy.y:7(int) └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] - └── a.i < xy.y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + └── i < xy.y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] # Don't hoist uncorrelated ANY (but rewrite it to EXISTS). opt @@ -4091,7 +4091,7 @@ select ├── scan xy │ └── columns: y:7(int) └── filters [type=bool, outer=(7), constraints=(/7: [/5 - /5]; tight), fd=()-->(7)] - └── xy.y = 5 [type=bool, outer=(7), constraints=(/7: [/5 - /5]; tight)] + └── y = 5 [type=bool, outer=(7), constraints=(/7: [/5 - /5]; tight)] # ANY in Join On condition. opt @@ -4112,13 +4112,13 @@ inner-join │ ├── scan uv │ │ └── columns: v:9(int) │ └── filters [type=bool, outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ]), fd=(2)==(9), (9)==(2)] - │ └── a.i = uv.v [type=bool, outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ])] + │ └── i = v [type=bool, outer=(2,9), constraints=(/2: (/NULL - ]; /9: (/NULL - ])] ├── scan xy │ ├── columns: x:6(int!null) y:7(int) │ ├── key: (6) │ └── fd: (6)-->(7) └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # -------------------------------------------------- # NormalizeNotAnyFilter @@ -4137,7 +4137,7 @@ anti-join ├── scan xy │ └── columns: y:7(int) └── filters [type=bool, outer=(2,7)] - └── (a.i = xy.y) IS NOT false [type=bool, outer=(2,7)] + └── (i = y) IS NOT false [type=bool, outer=(2,7)] # NOT ANY is one of several conjuncts. Note that i > ALL(...) gets mapped to # NOT i <= ANY(...) by optbuilder. @@ -4156,7 +4156,7 @@ anti-join ├── scan xy │ └── columns: y:7(int) └── filters [type=bool, outer=(2,7)] - └── (a.i <= xy.y) IS NOT false [type=bool, outer=(2,7)] + └── (i <= y) IS NOT false [type=bool, outer=(2,7)] # Multiple NOT ANY conjuncts. opt @@ -4181,11 +4181,11 @@ anti-join │ │ └── projections [outer=(9)] │ │ └── xy.y::STRING [type=string, outer=(9)] │ └── filters [type=bool, outer=(4,10)] - │ └── (a.s = y) IS NOT false [type=bool, outer=(4,10)] + │ └── (s = y) IS NOT false [type=bool, outer=(4,10)] ├── scan xy │ └── columns: xy.y:7(int) └── filters [type=bool, outer=(2,7)] - └── (a.i >= xy.y) IS NOT false [type=bool, outer=(2,7)] + └── (i >= xy.y) IS NOT false [type=bool, outer=(2,7)] # Don't hoist uncorrelated NOT ANY (but rewrite it to NOT EXISTS). opt @@ -4207,7 +4207,7 @@ select ├── scan xy │ └── columns: y:7(int) └── filters [type=bool, outer=(7)] - └── (xy.y = 5) IS NOT false [type=bool, outer=(7)] + └── (y = 5) IS NOT false [type=bool, outer=(7)] # NOT ANY in Join On condition. opt @@ -4228,13 +4228,13 @@ inner-join │ ├── scan uv │ │ └── columns: v:9(int) │ └── filters [type=bool, outer=(2,9)] - │ └── (a.i = uv.v) IS NOT false [type=bool, outer=(2,9)] + │ └── (i = v) IS NOT false [type=bool, outer=(2,9)] ├── scan xy │ ├── columns: x:6(int!null) y:7(int) │ ├── key: (6) │ └── fd: (6)-->(7) └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # -------------------------------------------------- # NormalizeAnyFilter + NormalizeNotAnyFilter @@ -4261,8 +4261,8 @@ semi-join │ │ └── projections [outer=(9)] │ │ └── xy.y::STRING [type=string, outer=(9)] │ └── filters [type=bool, outer=(4,10)] - │ └── (a.s = y) IS NOT false [type=bool, outer=(4,10)] + │ └── (s = y) IS NOT false [type=bool, outer=(4,10)] ├── scan xy │ └── columns: xy.y:7(int) └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - └── a.i = xy.y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + └── i = xy.y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] diff --git a/pkg/sql/opt/norm/testdata/rules/groupby b/pkg/sql/opt/norm/testdata/rules/groupby index 88539e6b5017..9c6afb574f0d 100644 --- a/pkg/sql/opt/norm/testdata/rules/groupby +++ b/pkg/sql/opt/norm/testdata/rules/groupby @@ -115,7 +115,7 @@ group-by │ └── columns: f:3(float) s:4(string!null) └── aggregations [outer=(3)] └── sum [type=float, outer=(3)] - └── variable: a.f [type=float, outer=(3)] + └── variable: f [type=float, outer=(3)] # -------------------------------------------------- @@ -273,10 +273,10 @@ project │ │ ├── columns: i:2(int!null) s:4(string!null) │ │ └── key: (2,4) │ └── projections [outer=(2,4)] - │ └── a.i + 1 [type=int, outer=(2)] + │ └── i + 1 [type=int, outer=(2)] └── aggregations [outer=(4)] └── min [type=string, outer=(4)] - └── variable: a.s [type=string, outer=(4)] + └── variable: s [type=string, outer=(4)] # -------------------------------------------------- # ReduceGroupingCols @@ -295,11 +295,11 @@ group-by │ └── fd: (1)-->(2-4), (2,4)-->(1,3), (2,3)~~>(1,4) └── aggregations [outer=(2-4)] ├── min [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] ├── const-agg [type=float, outer=(3)] - │ └── variable: a.f [type=float, outer=(3)] + │ └── variable: f [type=float, outer=(3)] └── const-agg [type=string, outer=(4)] - └── variable: a.s [type=string, outer=(4)] + └── variable: s [type=string, outer=(4)] opt SELECT k, sum(DISTINCT i), f, s FROM a, xy GROUP BY s, f, k @@ -321,11 +321,11 @@ group-by └── aggregations [outer=(2-4)] ├── sum [type=decimal, outer=(2)] │ └── agg-distinct [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] ├── const-agg [type=float, outer=(3)] - │ └── variable: a.f [type=float, outer=(3)] + │ └── variable: f [type=float, outer=(3)] └── const-agg [type=string, outer=(4)] - └── variable: a.s [type=string, outer=(4)] + └── variable: s [type=string, outer=(4)] # Eliminated columns are not part of projection. opt @@ -344,7 +344,7 @@ project │ └── fd: (2,4)-->(3), (2,3)~~>(4) └── aggregations [outer=(3)] └── min [type=float, outer=(3)] - └── variable: a.f [type=float, outer=(3)] + └── variable: f [type=float, outer=(3)] # All grouping columns eliminated. opt @@ -363,9 +363,9 @@ group-by │ └── fd: ()-->(1-3) └── aggregations [outer=(2,3)] ├── sum [type=float, outer=(3)] - │ └── variable: a.f [type=float, outer=(3)] + │ └── variable: f [type=float, outer=(3)] └── const-agg [type=int, outer=(2)] - └── variable: a.i [type=int, outer=(2)] + └── variable: i [type=int, outer=(2)] opt SELECT DISTINCT ON (k, f, s) i, f, x FROM a JOIN xy ON i=y @@ -388,14 +388,14 @@ distinct-on │ │ ├── key: (6) │ │ └── fd: (6)-->(7) │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - │ └── a.i = xy.y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ └── i = y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] └── aggregations [outer=(2,3,6)] ├── first-agg [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] ├── first-agg [type=int, outer=(6)] - │ └── variable: xy.x [type=int, outer=(6)] + │ └── variable: x [type=int, outer=(6)] └── const-agg [type=float, outer=(3)] - └── variable: a.f [type=float, outer=(3)] + └── variable: f [type=float, outer=(3)] # -------------------------------------------------- # EliminateAggDistinctForKeys @@ -417,10 +417,10 @@ scalar-group-by │ └── fd: (1)-->(2) └── aggregations [outer=(1,2)] ├── sum [type=decimal, outer=(1)] - │ └── variable: a.k [type=int, outer=(1)] + │ └── variable: k [type=int, outer=(1)] └── sum [type=decimal, outer=(2)] └── agg-distinct [type=int, outer=(2)] - └── variable: a.i [type=int, outer=(2)] + └── variable: i [type=int, outer=(2)] # GroupBy with key argument. opt @@ -439,7 +439,7 @@ project │ └── fd: (1)-->(2) └── aggregations [outer=(1)] └── sum [type=decimal, outer=(1)] - └── variable: a.k [type=int, outer=(1)] + └── variable: k [type=int, outer=(1)] # GroupBy with no key. opt @@ -457,7 +457,7 @@ project └── aggregations [outer=(1)] └── sum [type=decimal, outer=(1)] └── agg-distinct [type=int, outer=(1)] - └── variable: abc.a [type=int, outer=(1)] + └── variable: a [type=int, outer=(1)] # GroupBy with composite key formed by argument plus grouping columns. opt @@ -475,7 +475,7 @@ project │ └── key: (1-3) └── aggregations [outer=(1)] └── sum [type=decimal, outer=(1)] - └── variable: abc.a [type=int, outer=(1)] + └── variable: a [type=int, outer=(1)] # GroupBy with multiple aggregations simplified. opt @@ -494,9 +494,9 @@ project │ └── fd: (1)-->(2,3), (2,3)~~>(1) └── aggregations [outer=(2,3)] ├── sum [type=decimal, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] └── avg [type=float, outer=(3)] - └── variable: a.f [type=float, outer=(3)] + └── variable: f [type=float, outer=(3)] # GroupBy where only some aggregations are simplified (the table has # keys u,v and v,w). @@ -516,9 +516,9 @@ project │ └── fd: (1,2)-->(3,4), (2,3)-->(1,4) └── aggregations [outer=(1,3,4)] ├── sum [type=decimal, outer=(1)] - │ └── variable: uvwz.u [type=int, outer=(1)] + │ └── variable: u [type=int, outer=(1)] ├── std-dev [type=decimal, outer=(3)] - │ └── variable: uvwz.w [type=int, outer=(3)] + │ └── variable: w [type=int, outer=(3)] └── avg [type=decimal, outer=(4)] └── agg-distinct [type=int, outer=(4)] - └── variable: uvwz.z [type=int, outer=(4)] + └── variable: z [type=int, outer=(4)] diff --git a/pkg/sql/opt/norm/testdata/rules/inline b/pkg/sql/opt/norm/testdata/rules/inline index 13fbe84005d9..1dd5d8b094dc 100644 --- a/pkg/sql/opt/norm/testdata/rules/inline +++ b/pkg/sql/opt/norm/testdata/rules/inline @@ -36,9 +36,9 @@ project │ │ ├── columns: k:1(int!null) │ │ └── key: (1) │ └── filters [type=bool, outer=(1)] - │ └── (a.k = 1) IS NULL [type=bool, outer=(1)] + │ └── (k = 1) IS NULL [type=bool, outer=(1)] └── projections [outer=(1)] - └── a.k = 1 [type=bool, outer=(1)] + └── k = 1 [type=bool, outer=(1)] # Inline arithmetic. opt @@ -53,9 +53,9 @@ project │ │ ├── columns: k:1(int!null) │ │ └── key: (1) │ └── filters [type=bool, outer=(1)] - │ └── ((a.k * 2) + 1) > 10 [type=bool, outer=(1)] + │ └── ((k * 2) + 1) > 10 [type=bool, outer=(1)] └── projections [outer=(1)] - └── (a.k * 2) + 1 [type=int, outer=(1)] + └── (k * 2) + 1 [type=int, outer=(1)] # Inline boolean logic. opt @@ -68,7 +68,7 @@ project │ ├── constraint: /1: [ - /1] [/6 - ] │ └── key: (1) └── projections [outer=(1)] - └── (a.k <= 1) OR (a.k > 5) [type=bool, outer=(1)] + └── (k <= 1) OR (k > 5) [type=bool, outer=(1)] # Inline constants. opt @@ -81,9 +81,9 @@ project │ ├── scan a │ │ └── columns: f:3(float) │ └── filters [type=bool, outer=(3)] - │ └── (a.f IS NULL) OR (a.f != 10.5) [type=bool, outer=(3)] + │ └── (f IS NULL) OR (f != 10.5) [type=bool, outer=(3)] └── projections [outer=(3)] - └── (a.f IS NULL) OR (a.f != 10.5) [type=bool, outer=(3)] + └── (f IS NULL) OR (f != 10.5) [type=bool, outer=(3)] # Reference the expression to inline multiple times. opt @@ -96,9 +96,9 @@ project │ ├── scan a │ │ └── columns: f:3(float) │ └── filters [type=bool, outer=(3)] - │ └── (a.f + 1.0) = (a.f + 1.0) [type=bool, outer=(3)] + │ └── (f + 1.0) = (f + 1.0) [type=bool, outer=(3)] └── projections [outer=(3)] - └── a.f + 1.0 [type=float, outer=(3)] + └── f + 1.0 [type=float, outer=(3)] # Use outer references in both inlined expression and in referencing expression. opt @@ -116,7 +116,7 @@ semi-join │ ├── columns: x:6(int!null) │ └── key: (6) └── filters [type=bool, outer=(2,6)] - └── (xy.x - a.i) > (a.i * a.i) [type=bool, outer=(2,6)] + └── (x - i) > (i * i) [type=bool, outer=(2,6)] # -------------------------------------------------- # InlineProjectInProject @@ -131,8 +131,8 @@ project │ ├── key: (1) │ └── fd: (1)-->(2) └── projections [outer=(1,2)] - ├── a.i + 1 [type=int, outer=(2)] - └── a.k = 1 [type=bool, outer=(1)] + ├── i + 1 [type=int, outer=(2)] + └── k = 1 [type=bool, outer=(1)] # Inline multiple expressions. opt @@ -145,7 +145,7 @@ project │ ├── key: (1) │ └── fd: (1)-->(2,4) └── projections [outer=(1,2,4)] - ├── (a.k + 1) + 1 [type=int, outer=(1)] + ├── (k + 1) + 1 [type=int, outer=(1)] └── (a.s || 'foo') || 'bar' [type=string, outer=(4)] # Don't inline when there are multiple references. @@ -161,7 +161,7 @@ project │ │ ├── columns: k:1(int!null) │ │ └── key: (1) │ └── projections [outer=(1)] - │ └── a.k + 1 [type=int, outer=(1)] + │ └── k + 1 [type=int, outer=(1)] └── projections [outer=(6)] └── expr * 2 [type=int, outer=(6)] @@ -182,7 +182,7 @@ project │ ├── constraint: /7: [/1 - /2] │ ├── key: (7) │ └── fd: (7)-->(8) - └── (a.k + 1) * 2 [type=int, outer=(1)] + └── (k + 1) * 2 [type=int, outer=(1)] # Correlated subquery should be hoisted as usual. opt @@ -208,7 +208,7 @@ project │ │ │ │ ├── columns: k:1(int!null) │ │ │ │ └── key: (1) │ │ │ └── projections [outer=(1)] - │ │ │ └── a.k + 1 [type=int, outer=(1)] + │ │ │ └── k + 1 [type=int, outer=(1)] │ │ ├── project │ │ │ ├── columns: true:10(bool!null) │ │ │ ├── fd: ()-->(10) diff --git a/pkg/sql/opt/norm/testdata/rules/join b/pkg/sql/opt/norm/testdata/rules/join index ac84be070c86..072fe0629144 100644 --- a/pkg/sql/opt/norm/testdata/rules/join +++ b/pkg/sql/opt/norm/testdata/rules/join @@ -43,8 +43,8 @@ inner-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,2,6,7), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /6: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(6), (6)==(1)] - ├── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── b.y < a.i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── y < i [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] # -------------------------------------------------- # EnsureJoinFilters @@ -70,7 +70,7 @@ inner-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] opt SELECT * FROM a INNER JOIN b ON a.s='foo' OR b.y<10 @@ -88,7 +88,7 @@ inner-join │ ├── key: (6) │ └── fd: (6)-->(7) └── filters [type=bool, outer=(4,7)] - └── (a.s = 'foo') OR (b.y < 10) [type=bool, outer=(4,7)] + └── (s = 'foo') OR (y < 10) [type=bool, outer=(4,7)] # -------------------------------------------------- # PushFilterIntoJoinLeft @@ -110,9 +110,9 @@ inner-join (lookup b) │ │ ├── key: (1) │ │ └── fd: (1)-->(2-5) │ └── filters [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight), fd=()-->(4)] - │ └── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + │ └── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] opt SELECT * FROM a RIGHT JOIN b ON (a.i<0 OR a.i>10) AND b.y=1 AND a.s='foo' AND a.k=b.x @@ -132,8 +132,8 @@ right-join (merge) │ │ ├── fd: (1)-->(2-5) │ │ └── ordering: +1 opt(4) │ └── filters [type=bool, outer=(2,4), constraints=(/4: [/'foo' - /'foo']), fd=()-->(4)] - │ ├── (a.i < 0) OR (a.i > 10) [type=bool, outer=(2)] - │ └── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + │ ├── (i < 0) OR (i > 10) [type=bool, outer=(2)] + │ └── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] ├── scan b │ ├── columns: x:6(int!null) y:7(int) │ ├── key: (6) @@ -143,8 +143,8 @@ right-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6,7), constraints=(/1: (/NULL - ]; /6: (/NULL - ]; /7: [/1 - /1]), fd=()-->(7), (1)==(6), (6)==(1)] - ├── b.y = 1 [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight)] - └── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── y = 1 [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight)] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # LEFT JOIN should not push down conditions to left side of join. opt @@ -168,8 +168,8 @@ left-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: [/1 - /1]; /6: (/NULL - ]), fd=()-->(2), (1)==(6), (6)==(1)] - ├── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── a.i = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] + ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── i = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] # Semi-join case. opt @@ -190,7 +190,7 @@ semi-join (merge) │ │ ├── fd: (1)-->(2-5) │ │ └── ordering: +1 opt(4) │ └── filters [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight), fd=()-->(4)] - │ └── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + │ └── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] ├── scan b │ ├── columns: x:6(int!null) y:7(int) │ ├── key: (6) @@ -200,7 +200,7 @@ semi-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── b.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Do not push anti-join conditions into left input. opt @@ -224,8 +224,8 @@ anti-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,4,6), constraints=(/1: (/NULL - ]; /4: [/'foo' - /'foo']; /6: (/NULL - ]), fd=()-->(4), (1)==(6), (6)==(1)] - ├── b.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + ├── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] # -------------------------------------------------- # PushFilterIntoJoinRight @@ -247,9 +247,9 @@ inner-join (lookup b) │ │ ├── key: (3) │ │ └── fd: (3)-->(4-7) │ └── filters [type=bool, outer=(6), constraints=(/6: [/'foo' - /'foo']; tight), fd=()-->(6)] - │ └── a.s = 'foo' [type=bool, outer=(6), constraints=(/6: [/'foo' - /'foo']; tight)] + │ └── s = 'foo' [type=bool, outer=(6), constraints=(/6: [/'foo' - /'foo']; tight)] └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] - └── b.x = a.k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + └── x = k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] opt SELECT * FROM b LEFT JOIN a ON (a.i<0 OR a.i>10) AND b.y=1 AND a.s='foo' AND b.x=a.k @@ -274,14 +274,14 @@ left-join (merge) │ │ ├── fd: (3)-->(4-7) │ │ └── ordering: +3 opt(6) │ └── filters [type=bool, outer=(4,6), constraints=(/6: [/'foo' - /'foo']), fd=()-->(6)] - │ ├── (a.i < 0) OR (a.i > 10) [type=bool, outer=(4)] - │ └── a.s = 'foo' [type=bool, outer=(6), constraints=(/6: [/'foo' - /'foo']; tight)] + │ ├── (i < 0) OR (i > 10) [type=bool, outer=(4)] + │ └── s = 'foo' [type=bool, outer=(6), constraints=(/6: [/'foo' - /'foo']; tight)] └── merge-on ├── left ordering: +1 ├── right ordering: +3 └── filters [type=bool, outer=(1-3), constraints=(/1: (/NULL - ]; /2: [/1 - /1]; /3: (/NULL - ]), fd=()-->(2), (1)==(3), (3)==(1)] - ├── b.y = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] - └── b.x = a.k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + ├── y = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] + └── x = k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] # RIGHT JOIN should not push down conditions to right side of join. opt @@ -305,8 +305,8 @@ right-join (merge) ├── left ordering: +1 ├── right ordering: +3 └── filters [type=bool, outer=(1,3,4), constraints=(/1: (/NULL - ]; /3: (/NULL - ]; /4: [/1 - /1]), fd=()-->(4), (1)==(3), (3)==(1)] - ├── b.x = a.k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] - └── a.i = 1 [type=bool, outer=(4), constraints=(/4: [/1 - /1]; tight)] + ├── x = k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + └── i = 1 [type=bool, outer=(4), constraints=(/4: [/1 - /1]; tight)] # Semi-join case. opt @@ -332,12 +332,12 @@ semi-join (merge) │ │ ├── fd: (6)-->(7) │ │ └── ordering: +6 │ └── filters [type=bool, outer=(7), constraints=(/7: [/11 - ]; tight)] - │ └── b.y > 10 [type=bool, outer=(7), constraints=(/7: [/11 - ]; tight)] + │ └── y > 10 [type=bool, outer=(7), constraints=(/7: [/11 - ]; tight)] └── merge-on ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── b.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Anti-join case. opt @@ -363,12 +363,12 @@ anti-join (merge) │ │ ├── fd: (6)-->(7) │ │ └── ordering: +6 │ └── filters [type=bool, outer=(7), constraints=(/7: [/11 - ]; tight)] - │ └── b.y > 10 [type=bool, outer=(7), constraints=(/7: [/11 - ]; tight)] + │ └── y > 10 [type=bool, outer=(7), constraints=(/7: [/11 - ]; tight)] └── merge-on ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── b.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # ------------------------------------------------------------------------------- # PushFilterIntoJoinLeftAndRight + MapFilterIntoJoinLeft + MapFilterIntoJoinRight @@ -393,7 +393,7 @@ inner-join (merge) │ │ ├── fd: (1)-->(2-5) │ │ └── ordering: +1 │ └── filters [type=bool, outer=(1,2)] - │ └── (a.k * a.i) = 3 [type=bool, outer=(1,2)] + │ └── (k * i) = 3 [type=bool, outer=(1,2)] ├── select │ ├── columns: x:6(int!null) y:7(int) │ ├── key: (6) @@ -405,12 +405,12 @@ inner-join (merge) │ │ ├── fd: (6)-->(7) │ │ └── ordering: +6 │ └── filters [type=bool, outer=(6,7)] - │ └── (b.x + b.y) > 5 [type=bool, outer=(6,7)] + │ └── (x + y) > 5 [type=bool, outer=(6,7)] └── merge-on ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Multiple equivalent columns. # TODO(rytaft): We should also infer the equality predicates a.k=a.i and b.x=b.y. @@ -431,12 +431,12 @@ inner-join (lookup b) │ │ ├── key: (1) │ │ └── fd: (1)-->(2-5) │ └── filters [type=bool, outer=(1,3,4)] - │ ├── (a.f + a.k::FLOAT) > 5.0 [type=bool, outer=(1,3)] - │ └── (a.s || a.k::STRING) = 'foo1' [type=bool, outer=(1,4)] + │ ├── (f + k::FLOAT) > 5.0 [type=bool, outer=(1,3)] + │ └── (s || k::STRING) = 'foo1' [type=bool, outer=(1,4)] └── filters [type=bool, outer=(1,2,6,7), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /6: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(2,6,7), (6)==(1,2,7), (2)==(1,6,7), (7)==(1,2,6)] - ├── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - ├── a.i = b.x [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] - └── a.i = b.y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── i = x [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + └── i = y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] # Can push to both sides with semi-join. opt @@ -459,7 +459,7 @@ semi-join (merge) │ │ ├── fd: (1)-->(2-5) │ │ └── ordering: +1 │ └── filters [type=bool, outer=(1,2)] - │ └── (a.k * a.i) = 3 [type=bool, outer=(1,2)] + │ └── (k * i) = 3 [type=bool, outer=(1,2)] ├── select │ ├── columns: x:6(int!null) y:7(int) │ ├── key: (6) @@ -471,12 +471,12 @@ semi-join (merge) │ │ ├── fd: (6)-->(7) │ │ └── ordering: +6 │ └── filters [type=bool, outer=(6,7)] - │ └── (b.x + b.y) > 5 [type=bool, outer=(6,7)] + │ └── (x + y) > 5 [type=bool, outer=(6,7)] └── merge-on ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] opt SELECT * FROM a WHERE EXISTS( @@ -503,7 +503,7 @@ semi-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Can only push to right side with left join. opt @@ -529,13 +529,13 @@ left-join (merge) │ │ ├── fd: (6)-->(7) │ │ └── ordering: +6 │ └── filters [type=bool, outer=(6,7)] - │ └── (b.x + b.y) > 5 [type=bool, outer=(6,7)] + │ └── (x + y) > 5 [type=bool, outer=(6,7)] └── merge-on ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - ├── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── (b.x * a.i) = 3 [type=bool, outer=(2,6)] + ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── (x * i) = 3 [type=bool, outer=(2,6)] opt SELECT * FROM a LEFT JOIN b ON a.k=b.x AND a.k > 5 AND b.x IN (3, 7, 10) @@ -559,7 +559,7 @@ left-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Can only push to left side with right join. opt @@ -580,7 +580,7 @@ right-join (merge) │ │ ├── fd: (1)-->(2-5) │ │ └── ordering: +1 │ └── filters [type=bool, outer=(1,2)] - │ └── (a.k * a.i) = 3 [type=bool, outer=(1,2)] + │ └── (k * i) = 3 [type=bool, outer=(1,2)] ├── scan b │ ├── columns: x:6(int!null) y:7(int) │ ├── key: (6) @@ -590,8 +590,8 @@ right-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6,7), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - ├── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── (a.k + b.y) > 5 [type=bool, outer=(1,7)] + ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── (k + y) > 5 [type=bool, outer=(1,7)] opt SELECT * FROM a RIGHT JOIN b ON a.k=b.x AND a.k > 5 AND b.x IN (3, 7, 10) @@ -615,7 +615,7 @@ right-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Cannot push with full join. opt @@ -639,9 +639,9 @@ full-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,2,6,7), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - ├── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - ├── (a.k + b.y) > 5 [type=bool, outer=(1,7)] - └── (b.x * a.i) = 3 [type=bool, outer=(2,6)] + ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── (k + y) > 5 [type=bool, outer=(1,7)] + └── (x * i) = 3 [type=bool, outer=(2,6)] opt SELECT * FROM a FULL JOIN b ON a.k=b.x AND a.k > 5 AND b.x IN (3, 7, 10) @@ -664,9 +664,9 @@ full-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: [/6 - ]; /6: [/3 - /3] [/7 - /7] [/10 - /10]), fd=(1)==(6), (6)==(1)] - ├── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - ├── a.k > 5 [type=bool, outer=(1), constraints=(/1: [/6 - ]; tight)] - └── b.x IN (3, 7, 10) [type=bool, outer=(6), constraints=(/6: [/3 - /3] [/7 - /7] [/10 - /10]; tight)] + ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── k > 5 [type=bool, outer=(1), constraints=(/1: [/6 - ]; tight)] + └── x IN (3, 7, 10) [type=bool, outer=(6), constraints=(/6: [/3 - /3] [/7 - /7] [/10 - /10]; tight)] # Can only push to right side with anti-join. opt @@ -694,13 +694,13 @@ anti-join (merge) │ │ ├── fd: (6)-->(7) │ │ └── ordering: +6 │ └── filters [type=bool, outer=(6,7)] - │ └── (b.x + b.y) > 5 [type=bool, outer=(6,7)] + │ └── (x + y) > 5 [type=bool, outer=(6,7)] └── merge-on ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - ├── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── (b.x * a.i) = 3 [type=bool, outer=(2,6)] + ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── (x * i) = 3 [type=bool, outer=(2,6)] opt SELECT * FROM a WHERE NOT EXISTS( @@ -726,7 +726,7 @@ anti-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Works with a non-correlated subquery. opt @@ -748,7 +748,7 @@ inner-join (merge) │ │ └── ordering: +1 │ └── filters [type=bool, outer=(1,2)] │ └── eq [type=bool, outer=(1,2)] - │ ├── a.k * a.i [type=int, outer=(1,2)] + │ ├── k * i [type=int, outer=(1,2)] │ └── subquery [type=int] │ └── scalar-group-by │ ├── columns: min:10(int) @@ -772,7 +772,7 @@ inner-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Optimization does not apply with correlated suqueries. opt @@ -827,17 +827,17 @@ project │ ├── const-agg [type=int, outer=(7)] │ │ └── variable: b.y [type=int, outer=(7)] │ ├── const-agg [type=int, outer=(2)] - │ │ └── variable: a.i [type=int, outer=(2)] + │ │ └── variable: i [type=int, outer=(2)] │ ├── const-agg [type=float, outer=(3)] - │ │ └── variable: a.f [type=float, outer=(3)] + │ │ └── variable: f [type=float, outer=(3)] │ ├── const-agg [type=string, outer=(4)] - │ │ └── variable: a.s [type=string, outer=(4)] + │ │ └── variable: s [type=string, outer=(4)] │ ├── const-agg [type=jsonb, outer=(5)] - │ │ └── variable: a.j [type=jsonb, outer=(5)] + │ │ └── variable: j [type=jsonb, outer=(5)] │ └── const-agg [type=int, outer=(1)] │ └── variable: a.k [type=int, outer=(1)] └── filters [type=bool, outer=(2,6,11)] - └── (b.x * a.i) = min [type=bool, outer=(2,6,11)] + └── (b.x * i) = min [type=bool, outer=(2,6,11)] # Ensure that we do not map filters for types with composite key encoding. opt @@ -887,7 +887,7 @@ inner-join │ │ ├── key: (1) │ │ └── fd: (1)-->(2-5) │ └── filters [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ]), fd=(1)==(2), (2)==(1)] - │ └── a.k = a.i [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] + │ └── k = i [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] ├── select │ ├── columns: x:6(int!null) y:7(int!null) │ ├── key: (6) @@ -897,10 +897,10 @@ inner-join │ │ ├── key: (6) │ │ └── fd: (6)-->(7) │ └── filters [type=bool, outer=(6,7), constraints=(/6: (/NULL - ]; /7: (/NULL - ]), fd=(6)==(7), (7)==(6)] - │ └── b.y = b.x [type=bool, outer=(6,7), constraints=(/6: (/NULL - ]; /7: (/NULL - ])] + │ └── y = x [type=bool, outer=(6,7), constraints=(/6: (/NULL - ]; /7: (/NULL - ])] └── filters [type=bool, outer=(1,2,6,7)] - ├── (a.k + b.y) > 5 [type=bool, outer=(1,7)] - └── (b.x * a.i) = 3 [type=bool, outer=(2,6)] + ├── (k + y) > 5 [type=bool, outer=(1,7)] + └── (x * i) = 3 [type=bool, outer=(2,6)] exec-ddl CREATE TABLE t1 (a DATE) @@ -935,9 +935,9 @@ inner-join │ ├── scan t2 │ │ └── columns: b:3(timestamptz) │ └── filters [type=bool, outer=(3)] - │ └── age(t2.b, '2017-01-01 00:00:00+00:00') > '1d' [type=bool, outer=(3)] + │ └── age(b, '2017-01-01 00:00:00+00:00') > '1d' [type=bool, outer=(3)] └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] - └── t1.a = t2.b [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + └── a = b [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] # -------------------------------------------------- # PushFilterIntoJoinLeft + PushFilterIntoJoinRight @@ -960,10 +960,10 @@ inner-join (lookup a) │ │ ├── key: (6) │ │ └── fd: (6)-->(7) │ └── filters [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight), fd=()-->(7)] - │ └── b.y = 1 [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight)] + │ └── y = 1 [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight)] └── filters [type=bool, outer=(1,2,6), constraints=(/1: (/NULL - ]; /2: [/1 - /1]; /6: (/NULL - ]), fd=()-->(2), (1)==(6), (6)==(1)] - ├── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── a.i = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] + ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── i = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] # FULL JOIN should not push down conditions to either side of join. opt @@ -987,9 +987,9 @@ full-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,2,6,7), constraints=(/1: (/NULL - ]; /2: [/1 - /1]; /6: (/NULL - ]; /7: [/1 - /1]), fd=()-->(2,7), (1)==(6), (6)==(1)] - ├── a.k = b.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - ├── a.i = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] - └── b.y = 1 [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight)] + ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── i = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] + └── y = 1 [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight)] # Nested semi/anti-join case. opt @@ -1033,9 +1033,9 @@ semi-join-apply │ │ └── filters [type=bool, outer=(9), constraints=(/9: [/10 - /10]; tight), fd=()-->(9)] │ │ └── a.i = 10 [type=bool, outer=(9), constraints=(/9: [/10 - /10]; tight)] │ └── filters [type=bool, outer=(2), constraints=(/2: [/101 - ]; tight)] - │ └── b.y > 100 [type=bool, outer=(2), constraints=(/2: [/101 - ]; tight)] + │ └── y > 100 [type=bool, outer=(2), constraints=(/2: [/101 - ]; tight)] └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] - └── a.k = b.x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + └── a.k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] # -------------------------------------------------- # SimplifyLeftJoinWithoutFilters @@ -1112,20 +1112,20 @@ project │ │ │ ├── columns: column1:6(int) │ │ │ ├── outer: (1) │ │ │ ├── cardinality: [2 - 2] - │ │ │ ├── (a.k,) [type=tuple{int}, outer=(1)] + │ │ │ ├── (k,) [type=tuple{int}, outer=(1)] │ │ │ └── (1,) [type=tuple{int}] │ │ └── true [type=bool] │ └── aggregations [outer=(2-6)] │ ├── sum [type=decimal, outer=(6)] │ │ └── variable: column1 [type=int, outer=(6)] │ ├── const-agg [type=int, outer=(2)] - │ │ └── variable: a.i [type=int, outer=(2)] + │ │ └── variable: i [type=int, outer=(2)] │ ├── const-agg [type=float, outer=(3)] - │ │ └── variable: a.f [type=float, outer=(3)] + │ │ └── variable: f [type=float, outer=(3)] │ ├── const-agg [type=string, outer=(4)] - │ │ └── variable: a.s [type=string, outer=(4)] + │ │ └── variable: s [type=string, outer=(4)] │ └── const-agg [type=jsonb, outer=(5)] - │ └── variable: a.j [type=jsonb, outer=(5)] + │ └── variable: j [type=jsonb, outer=(5)] └── filters [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight), fd=()-->(7)] └── sum = 1 [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight)] @@ -1528,7 +1528,7 @@ full-join │ └── fd: (8)-->(9-12) └── filters [type=bool, outer=(1,6,8), constraints=(/1: (/NULL - ]; /6: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(6,8), (8)==(1,6), (6)==(1,8)] ├── a.k = a.k [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ])] - └── b.x = a.k [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] + └── x = a.k [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] # Can't simplify: The a2.x column is not part of unfilteredCols. opt @@ -1556,7 +1556,7 @@ right-join │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(1,11), constraints=(/1: (/NULL - ]; /11: (/NULL - ]), fd=(1)==(11), (11)==(1)] - └── a.k = b.x [type=bool, outer=(1,11), constraints=(/1: (/NULL - ]; /11: (/NULL - ])] + └── a.k = x [type=bool, outer=(1,11), constraints=(/1: (/NULL - ]; /11: (/NULL - ])] # -------------------------------------------------- # EliminateSemiJoin @@ -1592,7 +1592,7 @@ select ├── scan a │ └── columns: s:6(string) └── filters [type=bool, outer=(6), constraints=(/6: [/'foo' - /'foo']; tight), fd=()-->(6)] - └── a.s = 'foo' [type=bool, outer=(6), constraints=(/6: [/'foo' - /'foo']; tight)] + └── s = 'foo' [type=bool, outer=(6), constraints=(/6: [/'foo' - /'foo']; tight)] # -------------------------------------------------- # EliminateJoinNoColsRight @@ -1606,7 +1606,7 @@ select ├── scan a │ └── columns: s:4(string) └── filters [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight), fd=()-->(4)] - └── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + └── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] # -------------------------------------------------- # HoistJoinProject @@ -1635,9 +1635,9 @@ project │ │ ├── key: (6) │ │ └── fd: (6)-->(7) │ └── filters [type=bool, outer=(7), constraints=(/7: [/10 - /10]; tight), fd=()-->(7)] - │ └── b.y = 10 [type=bool, outer=(7), constraints=(/7: [/10 - /10]; tight)] + │ └── y = 10 [type=bool, outer=(7), constraints=(/7: [/10 - /10]; tight)] └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── b.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Left-join case. opt @@ -1667,9 +1667,9 @@ project │ │ ├── fd: (6)-->(7) │ │ └── ordering: +6 opt(7) │ └── filters [type=bool, outer=(7), constraints=(/7: [/10 - /10]; tight), fd=()-->(7)] - │ └── b.y = 10 [type=bool, outer=(7), constraints=(/7: [/10 - /10]; tight)] + │ └── y = 10 [type=bool, outer=(7), constraints=(/7: [/10 - /10]; tight)] └── merge-on ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── b.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] diff --git a/pkg/sql/opt/norm/testdata/rules/limit b/pkg/sql/opt/norm/testdata/rules/limit index 484f07407d25..6dcf1e15195d 100644 --- a/pkg/sql/opt/norm/testdata/rules/limit +++ b/pkg/sql/opt/norm/testdata/rules/limit @@ -109,7 +109,7 @@ project │ ├── key: (1) │ └── fd: (1)-->(3) └── projections [outer=(1,3)] - └── a.f * 2.0 [type=float, outer=(3)] + └── f * 2.0 [type=float, outer=(3)] opt SELECT k, f*2.0 AS r FROM a ORDER BY k LIMIT 5 @@ -127,7 +127,7 @@ project │ ├── fd: (1)-->(3) │ └── ordering: +1 └── projections [outer=(1,3)] - └── a.f * 2.0 [type=float, outer=(3)] + └── f * 2.0 [type=float, outer=(3)] # Don't push the limit through project when the ordering is on a # synthesized column. @@ -155,7 +155,7 @@ limit │ │ ├── key: (1) │ │ └── fd: (1)-->(3) │ └── projections [outer=(1,3)] - │ └── a.f * 2.0 [type=float, outer=(3)] + │ └── f * 2.0 [type=float, outer=(3)] └── const: 5 [type=int] @@ -185,7 +185,7 @@ project │ │ └── columns: i:2(int) f:3(float) │ └── const: 5 [type=int] └── projections [outer=(3)] - └── a.f + 1.1 [type=float, outer=(3)] + └── f + 1.1 [type=float, outer=(3)] # Don't push zero limit into Scan. opt @@ -237,7 +237,7 @@ project │ │ └── fd: (1)-->(3) │ └── const: 5 [type=int] └── projections [outer=(1,3)] - └── a.f * 2.0 [type=float, outer=(3)] + └── f * 2.0 [type=float, outer=(3)] opt SELECT k, f*2.0 AS r FROM a ORDER BY k OFFSET 5 @@ -260,7 +260,7 @@ project │ │ └── ordering: +1 │ └── const: 5 [type=int] └── projections [outer=(1,3)] - └── a.f * 2.0 [type=float, outer=(3)] + └── f * 2.0 [type=float, outer=(3)] # Don't push the offset through project when the ordering is on a # synthesized column. @@ -287,7 +287,7 @@ offset │ │ ├── key: (1) │ │ └── fd: (1)-->(3) │ └── projections [outer=(1,3)] - │ └── a.f * 2.0 [type=float, outer=(3)] + │ └── f * 2.0 [type=float, outer=(3)] └── const: 5 [type=int] # Detect PushOffsetIntoProject and FilterUnusedOffsetCols dependency cycle. @@ -314,7 +314,7 @@ project │ │ └── columns: i:2(int) f:3(float) │ └── const: 5 [type=int] └── projections [outer=(3)] - └── a.f + 1.1 [type=float, outer=(3)] + └── f + 1.1 [type=float, outer=(3)] # -------------------------------------------------- # PushLimitIntoProject + PushOffsetIntoProject @@ -343,7 +343,7 @@ project │ │ └── const: 5 [type=int] │ └── const: 10 [type=int] └── projections [outer=(1,3)] - └── a.f * 2.0 [type=float, outer=(3)] + └── f * 2.0 [type=float, outer=(3)] opt SELECT f, f+1.1 AS r FROM (SELECT f, i FROM a GROUP BY f, i) a ORDER BY f OFFSET 5 LIMIT 10 @@ -376,4 +376,4 @@ project │ │ └── const: 5 [type=int] │ └── const: 10 [type=int] └── projections [outer=(3)] - └── a.f + 1.1 [type=float, outer=(3)] + └── f + 1.1 [type=float, outer=(3)] diff --git a/pkg/sql/opt/norm/testdata/rules/numeric b/pkg/sql/opt/norm/testdata/rules/numeric index f159dd069e54..e080c573f9a4 100644 --- a/pkg/sql/opt/norm/testdata/rules/numeric +++ b/pkg/sql/opt/norm/testdata/rules/numeric @@ -27,12 +27,12 @@ project ├── scan a │ └── columns: i:2(int) f:3(float) d:4(decimal) └── projections [outer=(2-4)] - ├── a.i + a.i [type=int, outer=(2)] - ├── a.i + a.i [type=int, outer=(2)] - ├── a.f + a.f [type=float, outer=(3)] - ├── a.f + a.f [type=float, outer=(3)] - ├── a.d + a.d [type=decimal, outer=(4)] - └── a.d + a.d [type=decimal, outer=(4)] + ├── i + i [type=int, outer=(2)] + ├── i + i [type=int, outer=(2)] + ├── f + f [type=float, outer=(3)] + ├── f + f [type=float, outer=(3)] + ├── d + d [type=decimal, outer=(4)] + └── d + d [type=decimal, outer=(4)] # -------------------------------------------------- # FoldMinusZero @@ -51,9 +51,9 @@ project ├── scan a │ └── columns: i:2(int) f:3(float) d:4(decimal) └── projections [outer=(2-4)] - ├── a.i + a.i [type=int, outer=(2)] - ├── a.f + a.f [type=float, outer=(3)] - └── a.d + a.d [type=decimal, outer=(4)] + ├── i + i [type=int, outer=(2)] + ├── f + f [type=float, outer=(3)] + └── d + d [type=decimal, outer=(4)] # -------------------------------------------------- # FoldMultOne, FoldOneMult @@ -72,12 +72,12 @@ project ├── scan a │ └── columns: i:2(int) f:3(float) d:4(decimal) └── projections [outer=(2-4)] - ├── a.i + a.i [type=int, outer=(2)] - ├── a.i + a.i [type=int, outer=(2)] - ├── a.f + a.f [type=float, outer=(3)] - ├── a.f + a.f [type=float, outer=(3)] - ├── a.d + a.d [type=decimal, outer=(4)] - └── a.d + a.d [type=decimal, outer=(4)] + ├── i + i [type=int, outer=(2)] + ├── i + i [type=int, outer=(2)] + ├── f + f [type=float, outer=(3)] + ├── f + f [type=float, outer=(3)] + ├── d + d [type=decimal, outer=(4)] + └── d + d [type=decimal, outer=(4)] # -------------------------------------------------- # FoldDivOne @@ -95,9 +95,9 @@ project ├── scan a │ └── columns: i:2(int) f:3(float) d:4(decimal) └── projections [outer=(2-4)] - ├── variable: a.i [type=int, outer=(2)] - ├── variable: a.f [type=float, outer=(3)] - └── variable: a.d [type=decimal, outer=(4)] + ├── variable: i [type=int, outer=(2)] + ├── variable: f [type=float, outer=(3)] + └── variable: d [type=decimal, outer=(4)] # -------------------------------------------------- # InvertMinus @@ -114,8 +114,8 @@ project ├── scan a │ └── columns: i:2(int) f:3(float) d:4(decimal) a.t:5(time) └── projections [outer=(2-5)] - ├── a.f - a.f [type=float, outer=(3)] - ├── a.i - a.d [type=decimal, outer=(2,4)] + ├── f - f [type=float, outer=(3)] + ├── i - d [type=decimal, outer=(2,4)] └── a.t - a.t [type=interval, outer=(5)] # -------------------------------------------------- @@ -129,7 +129,7 @@ project ├── scan a │ └── columns: i:2(int) └── projections [outer=(2)] - └── variable: a.i [type=int, outer=(2)] + └── variable: i [type=int, outer=(2)] # -------------------------------------------------- # FoldUnaryMinus diff --git a/pkg/sql/opt/norm/testdata/rules/ordering b/pkg/sql/opt/norm/testdata/rules/ordering index 69d189927629..f13f02fe04b0 100644 --- a/pkg/sql/opt/norm/testdata/rules/ordering +++ b/pkg/sql/opt/norm/testdata/rules/ordering @@ -65,8 +65,8 @@ limit │ │ ├── key: (1) │ │ └── fd: (1)-->(2-5), (2,3)~~>(1,4,5) │ └── filters [type=bool, outer=(4,5), constraints=(/4: [/1 - /1]; /5: [/2 - /2]; tight), fd=()-->(4,5)] - │ ├── abcde.d = 1 [type=bool, outer=(4), constraints=(/4: [/1 - /1]; tight)] - │ └── abcde.e = 2 [type=bool, outer=(5), constraints=(/5: [/2 - /2]; tight)] + │ ├── d = 1 [type=bool, outer=(4), constraints=(/4: [/1 - /1]; tight)] + │ └── e = 2 [type=bool, outer=(5), constraints=(/5: [/2 - /2]; tight)] └── const: 10 [type=int] # Remove functionally dependent column that's only used in ordering. @@ -116,9 +116,9 @@ sort │ └── fd: (1)-->(2,3), (2,3)~~>(1) └── aggregations [outer=(2,3)] ├── array-agg [type=int[], outer=(2)] - │ └── variable: abcde.b [type=int, outer=(2)] + │ └── variable: b [type=int, outer=(2)] └── const-agg [type=int, outer=(3)] - └── variable: abcde.c [type=int, outer=(3)] + └── variable: c [type=int, outer=(3)] # ScalarGroupBy case. opt @@ -137,7 +137,7 @@ scalar-group-by │ └── ordering: +1 └── aggregations [outer=(2)] └── array-agg [type=int[], outer=(2)] - └── variable: abcde.b [type=int, outer=(2)] + └── variable: b [type=int, outer=(2)] # DistinctOn case. opt @@ -157,7 +157,7 @@ distinct-on │ └── ordering: +2,+3,+1 └── aggregations [outer=(1)] └── first-agg [type=int, outer=(1)] - └── variable: abcde.a [type=int, outer=(1)] + └── variable: a [type=int, outer=(1)] # -------------------------------------------------- # SimplifyRowNumberOrdering @@ -184,8 +184,8 @@ sort │ ├── key: (1) │ └── fd: (1)-->(2-5), (2,3)~~>(1,4,5) └── filters [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ]; tight)] - ├── abcde.b IS NOT NULL [type=bool, outer=(2), constraints=(/2: (/NULL - ]; tight)] - └── abcde.c IS NOT NULL [type=bool, outer=(3), constraints=(/3: (/NULL - ]; tight)] + ├── b IS NOT NULL [type=bool, outer=(2), constraints=(/2: (/NULL - ]; tight)] + └── c IS NOT NULL [type=bool, outer=(3), constraints=(/3: (/NULL - ]; tight)] # -------------------------------------------------- # SimplifyExplainOrdering @@ -204,7 +204,7 @@ explain │ ├── columns: b:2(int) c:3(int) │ └── ordering: +2,+3 └── projections [outer=(2,3)] - └── abcde.b + 1 [type=int, outer=(2)] + └── b + 1 [type=int, outer=(2)] # Regression: Explain a statement having constant column, but with no ordering. opt diff --git a/pkg/sql/opt/norm/testdata/rules/project b/pkg/sql/opt/norm/testdata/rules/project index b5d79574a869..249e0564c1df 100644 --- a/pkg/sql/opt/norm/testdata/rules/project +++ b/pkg/sql/opt/norm/testdata/rules/project @@ -92,4 +92,4 @@ project │ └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] │ └── a.x = b.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] └── projections [outer=(2)] - └── a.y + 1 [type=int, outer=(2)] + └── y + 1 [type=int, outer=(2)] diff --git a/pkg/sql/opt/norm/testdata/rules/prune_cols b/pkg/sql/opt/norm/testdata/rules/prune_cols index db71475b7b19..3eadb39a5c6f 100644 --- a/pkg/sql/opt/norm/testdata/rules/prune_cols +++ b/pkg/sql/opt/norm/testdata/rules/prune_cols @@ -75,7 +75,7 @@ project │ ├── key: (1) │ └── fd: (1)-->(2) └── projections [outer=(1,2)] - └── a.k + a.i [type=int, outer=(1,2)] + └── k + i [type=int, outer=(1,2)] # Discard non-computed columns and keep computed column. opt @@ -90,7 +90,7 @@ project │ ├── key: (1) │ └── fd: (1)-->(4) └── projections [outer=(1,4)] - └── length(a.s) [type=int, outer=(4)] + └── length(s) [type=int, outer=(4)] # Compute column based on another computed column. opt @@ -109,7 +109,7 @@ project │ │ ├── key: (1) │ │ └── fd: (1)-->(4) │ └── projections [outer=(1,4)] - │ └── length(a.s) [type=int, outer=(4)] + │ └── length(s) [type=int, outer=(4)] └── projections [outer=(1,5)] └── l * l [type=int, outer=(5)] @@ -138,8 +138,8 @@ project │ ├── key: (1) │ └── fd: (1)-->(2) └── projections [outer=(1,2)] - ├── a.k + 1 [type=int, outer=(1)] - └── a.i + 1 [type=int, outer=(2)] + ├── k + 1 [type=int, outer=(1)] + └── i + 1 [type=int, outer=(2)] # Use columns only in computed columns. opt @@ -152,7 +152,7 @@ project │ ├── key: (1) │ └── fd: (1)-->(2) └── projections [outer=(1,2)] - └── a.k + a.i [type=int, outer=(1,2)] + └── k + i [type=int, outer=(1,2)] # Use no scan columns. opt @@ -185,7 +185,7 @@ project │ ├── key: (1) │ └── fd: (1)-->(2) └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] - └── a.i < 5 [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] + └── i < 5 [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] # Columns used by both projection and filter. opt @@ -203,7 +203,7 @@ select │ ├── key: () │ └── fd: ()-->(1,2) └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] - └── a.i < 5 [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] + └── i < 5 [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] # No needed select columns. opt @@ -234,11 +234,11 @@ project │ │ ├── key: (1) │ │ └── fd: (1)-->(2,4) │ └── filters [type=bool, outer=(1,4), constraints=(/1: (/NULL - ])] - │ ├── a.k < (5 - 1) [type=bool, outer=(1), constraints=(/1: (/NULL - ])] - │ └── (a.s || 'o') = 'foo' [type=bool, outer=(4)] + │ ├── k < (5 - 1) [type=bool, outer=(1), constraints=(/1: (/NULL - ])] + │ └── (s || 'o') = 'foo' [type=bool, outer=(4)] └── projections [outer=(1,2)] - ├── a.i - 1 [type=int, outer=(2)] - └── a.k * a.k [type=int, outer=(1)] + ├── i - 1 [type=int, outer=(2)] + └── k * k [type=int, outer=(1)] # Select nested in select. opt @@ -271,7 +271,7 @@ project │ └── projections [outer=(2,3), side-effects] │ └── a.f / 2.0 [type=float, outer=(3), side-effects] └── filters [type=bool, outer=(2,5), constraints=(/5: (/NULL - ])] - └── f = a.i::FLOAT [type=bool, outer=(2,5), constraints=(/5: (/NULL - ])] + └── f = i::FLOAT [type=bool, outer=(2,5), constraints=(/5: (/NULL - ])] # Detect PruneSelectCols and PushSelectIntoProject dependency cycle. opt @@ -294,13 +294,13 @@ project │ │ │ └── fd: (1)-->(3) │ │ └── aggregations [outer=(1,3)] │ │ ├── sum [type=decimal, outer=(1)] - │ │ │ └── variable: a.k [type=int, outer=(1)] + │ │ │ └── variable: k [type=int, outer=(1)] │ │ └── const-agg [type=float, outer=(3)] - │ │ └── variable: a.f [type=float, outer=(3)] + │ │ └── variable: f [type=float, outer=(3)] │ └── filters [type=bool, outer=(5), constraints=(/5: [/100 - /100]; tight), fd=()-->(5)] │ └── column5 = 100 [type=bool, outer=(5), constraints=(/5: [/100 - /100]; tight)] └── projections [outer=(3)] - └── a.f + 1.1 [type=float, outer=(3)] + └── f + 1.1 [type=float, outer=(3)] # -------------------------------------------------- # PruneLimitCols @@ -410,7 +410,7 @@ project │ │ └── columns: f:3(float) s:4(string) │ └── const: 5 [type=int] └── projections [outer=(3)] - └── a.f * 2.0 [type=float, outer=(3)] + └── f * 2.0 [type=float, outer=(3)] # -------------------------------------------------- # PruneOffsetCols @@ -643,7 +643,7 @@ project │ │ └── const: 5 [type=int] │ └── const: 5 [type=int] └── projections [outer=(3)] - └── a.f * 2.0 [type=float, outer=(3)] + └── f * 2.0 [type=float, outer=(3)] # -------------------------------------------------- # PruneJoinLeftCols @@ -675,7 +675,7 @@ project ├── left ordering: +1 ├── right ordering: +5 └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - └── a.k = xy.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── k = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] # Columns used by both projection and on condition, left join. opt @@ -699,8 +699,8 @@ left-join (merge) ├── left ordering: +1 ├── right ordering: +5 └── filters [type=bool, outer=(1,2,5), constraints=(/1: (/NULL - ]; /2: (/NULL - /4]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - ├── a.k = xy.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── a.i < 5 [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] + ├── k = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── i < 5 [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] # Columns only used by on condition, right join opt @@ -726,7 +726,7 @@ project ├── left ordering: +1 ├── right ordering: +5 └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - └── a.k = xy.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── k = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] # Columns needed only by projection, full join. opt @@ -748,7 +748,7 @@ project │ │ └── fd: (5)-->(6) │ └── true [type=bool] └── projections [outer=(1,5,6)] - └── a.k + 1 [type=int, outer=(1)] + └── k + 1 [type=int, outer=(1)] # No columns needed from left side of join. opt @@ -791,10 +791,10 @@ project │ │ └── filters [type=bool, outer=(4)] │ │ └── (a.s || 'o') = 'foo' [type=bool, outer=(4)] │ └── filters [type=bool, outer=(1,5), constraints=(/5: (/NULL - ])] - │ └── xy.x = (a.k * a.k) [type=bool, outer=(1,5), constraints=(/5: (/NULL - ])] + │ └── x = (k * k) [type=bool, outer=(1,5), constraints=(/5: (/NULL - ])] └── projections [outer=(1,2,5,6), side-effects] - ├── a.k + 1 [type=int, outer=(1)] - └── a.i / 2 [type=decimal, outer=(2), side-effects] + ├── k + 1 [type=int, outer=(1)] + └── i / 2 [type=decimal, outer=(2), side-effects] # Join that is nested in another join. opt @@ -831,13 +831,13 @@ project │ ├── left ordering: +1 │ ├── right ordering: +5 │ └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - │ └── a.k = xy.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + │ └── k = xy.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] ├── scan xy │ ├── columns: xy.x:7(int!null) xy.y:8(int) │ ├── key: (7) │ └── fd: (7)-->(8) └── filters [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ])] - └── a.i < xy.y [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ])] + └── i < xy.y [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ])] # ApplyJoin operator. opt @@ -880,9 +880,9 @@ project │ │ │ ├── scan xy │ │ │ │ └── columns: y:6(int) │ │ │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ │ │ └── xy.y = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ │ │ └── y = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] │ │ └── projections [outer=(1)] - │ │ └── a.k + 1 [type=int, outer=(1)] + │ │ └── k + 1 [type=int, outer=(1)] │ └── filters [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight), fd=()-->(7)] │ └── r = 1 [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight)] └── true [type=bool] @@ -920,7 +920,7 @@ project │ ├── left ordering: +1 │ ├── right ordering: +7 │ └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - │ └── a.k = xy.x [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + │ └── k = xy.x [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] ├── scan xy │ ├── columns: xy.x:5(int!null) │ ├── key: (5) @@ -929,7 +929,7 @@ project ├── left ordering: +1 ├── right ordering: +5 └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - └── a.k = xy.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── k = xy.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] # AntiJoin operator. opt @@ -964,7 +964,7 @@ project │ ├── left ordering: +1 │ ├── right ordering: +7 │ └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - │ └── a.k = xy.x [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + │ └── k = xy.x [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] ├── scan xy │ ├── columns: xy.x:5(int!null) │ ├── key: (5) @@ -973,7 +973,7 @@ project ├── left ordering: +1 ├── right ordering: +5 └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - └── a.k = xy.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── k = xy.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] # -------------------------------------------------- # PruneJoinRightCols @@ -1005,7 +1005,7 @@ project ├── left ordering: +1 ├── right ordering: +3 └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] - └── xy.x = a.k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + └── x = k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] # Columns used by both projection and on condition, left join. opt @@ -1031,12 +1031,12 @@ left-join (merge) │ │ ├── fd: (3)-->(4) │ │ └── ordering: +3 │ └── filters [type=bool, outer=(3,4), constraints=(/3: (/NULL - ]; /4: (/NULL - ])] - │ └── a.i < a.k [type=bool, outer=(3,4), constraints=(/3: (/NULL - ]; /4: (/NULL - ])] + │ └── i < k [type=bool, outer=(3,4), constraints=(/3: (/NULL - ]; /4: (/NULL - ])] └── merge-on ├── left ordering: +1 ├── right ordering: +3 └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] - └── xy.x = a.k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + └── x = k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] # Columns only used by on condition, right join opt @@ -1062,7 +1062,7 @@ project ├── left ordering: +1 ├── right ordering: +3 └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] - └── xy.x = a.k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + └── x = k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] # Columns needed only by projection, full join. opt @@ -1084,7 +1084,7 @@ project │ │ └── key: (3) │ └── true [type=bool] └── projections [outer=(1-3)] - └── a.k + 1 [type=int, outer=(3)] + └── k + 1 [type=int, outer=(3)] # No columns needed from right side of join. opt @@ -1127,10 +1127,10 @@ project │ │ └── filters [type=bool, outer=(6)] │ │ └── (a.s || 'o') = 'foo' [type=bool, outer=(6)] │ └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ])] - │ └── xy.x = (a.k * a.k) [type=bool, outer=(1,3), constraints=(/1: (/NULL - ])] + │ └── x = (k * k) [type=bool, outer=(1,3), constraints=(/1: (/NULL - ])] └── projections [outer=(1-4), side-effects] - ├── a.k + 1 [type=int, outer=(3)] - └── a.i / 2 [type=decimal, outer=(4), side-effects] + ├── k + 1 [type=int, outer=(3)] + └── i / 2 [type=decimal, outer=(4), side-effects] # Join that is nested in another join. opt @@ -1171,7 +1171,7 @@ project │ ├── left ordering: +3 │ ├── right ordering: +7 │ └── filters [type=bool, outer=(3,7), constraints=(/3: (/NULL - ]; /7: (/NULL - ]), fd=(3)==(7), (7)==(3)] - │ └── a.k = xy.x [type=bool, outer=(3,7), constraints=(/3: (/NULL - ]; /7: (/NULL - ])] + │ └── k = xy.x [type=bool, outer=(3,7), constraints=(/3: (/NULL - ]; /7: (/NULL - ])] └── filters [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ])] └── xy.y < xy.y [type=bool, outer=(2,8), constraints=(/2: (/NULL - ]; /8: (/NULL - ])] @@ -1216,9 +1216,9 @@ project │ ├── left ordering: +1 │ ├── right ordering: +5 │ └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - │ └── a.k = xy.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + │ └── k = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] └── projections [outer=(1,5)] - └── a.k + xy.x [type=int, outer=(1,5)] + └── k + x [type=int, outer=(1,5)] # -------------------------------------------------- # PruneAggCols @@ -1248,7 +1248,7 @@ group-by │ └── columns: i:2(int) s:4(string) └── aggregations [outer=(2)] └── sum [type=decimal, outer=(2)] - └── variable: a.i [type=int, outer=(2)] + └── variable: i [type=int, outer=(2)] # No aggregates to discard. opt @@ -1280,10 +1280,10 @@ scalar-group-by │ ├── scan a │ │ └── columns: i:2(int) s:4(string) │ └── projections [outer=(2,4)] - │ └── a.s || 'foo' [type=string, outer=(4)] + │ └── s || 'foo' [type=string, outer=(4)] └── aggregations [outer=(2)] └── sum [type=decimal, outer=(2)] - └── variable: a.i [type=int, outer=(2)] + └── variable: i [type=int, outer=(2)] opt SELECT f FROM (SELECT DISTINCT ON (i) f, s FROM a) @@ -1299,7 +1299,7 @@ project │ └── columns: i:2(int) f:3(float) └── aggregations [outer=(3)] └── first-agg [type=float, outer=(3)] - └── variable: a.f [type=float, outer=(3)] + └── variable: f [type=float, outer=(3)] # -------------------------------------------------- # PruneGroupByCols @@ -1318,7 +1318,7 @@ group-by │ └── columns: i:2(int) s:4(string) └── aggregations [outer=(2)] └── sum [type=decimal, outer=(2)] - └── variable: a.i [type=int, outer=(2)] + └── variable: i [type=int, outer=(2)] # Columns used by both grouping and aggregation. opt @@ -1335,7 +1335,7 @@ group-by │ ├── scan a │ │ └── columns: i:2(int) s:4(string) │ └── projections [outer=(2,4)] - │ └── a.i + a.s::INT [type=int, outer=(2,4)] + │ └── i + s::INT [type=int, outer=(2,4)] └── aggregations [outer=(5)] └── avg [type=decimal, outer=(5)] └── variable: column5 [type=int, outer=(5)] @@ -1355,9 +1355,9 @@ scalar-group-by │ └── fd: (1)-->(2) └── aggregations [outer=(1,2)] ├── min [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] └── max [type=int, outer=(1)] - └── variable: a.k [type=int, outer=(1)] + └── variable: k [type=int, outer=(1)] # Columns used only by groupings, no aggregation columns. opt @@ -1372,7 +1372,7 @@ project │ └── scan a │ └── columns: i:2(int) s:4(string) └── projections [outer=(2,4)] - └── a.i + 1 [type=int, outer=(2)] + └── i + 1 [type=int, outer=(2)] # Groupby a groupby. opt @@ -1394,7 +1394,7 @@ group-by │ │ └── fd: (1)-->(2,4) │ └── aggregations [outer=(1)] │ └── sum [type=decimal, outer=(1)] - │ └── variable: a.k [type=int, outer=(1)] + │ └── variable: k [type=int, outer=(1)] └── aggregations [outer=(5)] └── min [type=decimal, outer=(5)] └── variable: sm [type=decimal, outer=(5)] @@ -1485,7 +1485,7 @@ project │ │ ├── fd: (1)-->(2) │ │ └── ordering: +1 │ └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] - │ └── a.i < 5 [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] + │ └── i < 5 [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] ├── scan xy │ ├── columns: x:5(int!null) y:6(int) │ ├── key: (5) @@ -1495,7 +1495,7 @@ project ├── left ordering: +1 ├── right ordering: +5 └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - └── a.k = xy.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── k = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] opt SELECT k FROM (SELECT k, min(s) FROM a GROUP BY k HAVING sum(i) > 5) @@ -1518,7 +1518,7 @@ project │ │ └── fd: (1)-->(2) │ └── aggregations [outer=(2)] │ └── sum [type=decimal, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] └── filters [type=bool, outer=(5), constraints=(/5: (/5 - ]; tight)] └── column5 > 5 [type=bool, outer=(5), constraints=(/5: (/5 - ]; tight)] diff --git a/pkg/sql/opt/norm/testdata/rules/reject_nulls b/pkg/sql/opt/norm/testdata/rules/reject_nulls index 447e3fbffc30..d084183f5233 100644 --- a/pkg/sql/opt/norm/testdata/rules/reject_nulls +++ b/pkg/sql/opt/norm/testdata/rules/reject_nulls @@ -135,7 +135,7 @@ inner-join (merge) ├── left ordering: +1 ├── right ordering: +5 └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - └── xy.x = a.k [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── x = k [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] # Right-join operator. opt @@ -154,7 +154,7 @@ inner-join │ ├── key: (5) │ └── fd: (5)-->(6) └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── a.k > xy.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k > y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Full-join operator. opt @@ -221,9 +221,9 @@ right-join │ │ │ ├── key: (7) │ │ │ └── fd: (7)-->(8) │ │ └── filters [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)] - │ │ └── uv.v = a.k [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ])] + │ │ └── v = k [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ])] │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - │ └── a.i = uv.u [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ └── i = u [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] └── true [type=bool] # ---------------------------------------------------------- @@ -263,7 +263,7 @@ project │ │ └── true [type=bool] │ └── aggregations [outer=(5)] │ └── max [type=int, outer=(5)] - │ └── variable: xy.x [type=int, outer=(5)] + │ └── variable: x [type=int, outer=(5)] └── filters [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight), fd=()-->(7)] └── column7 = 1 [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight)] @@ -300,9 +300,9 @@ project │ │ └── true [type=bool] │ └── aggregations [outer=(5)] │ ├── min [type=int, outer=(5)] - │ │ └── variable: xy.x [type=int, outer=(5)] + │ │ └── variable: x [type=int, outer=(5)] │ └── max [type=int, outer=(5)] - │ └── variable: xy.x [type=int, outer=(5)] + │ └── variable: x [type=int, outer=(5)] └── filters [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight), fd=()-->(7)] └── column7 = 1 [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight)] @@ -340,18 +340,18 @@ project │ │ ├── left ordering: +1 │ │ ├── right ordering: +5 │ │ └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - │ │ └── xy.x = a.k [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + │ │ └── x = k [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] │ └── aggregations [outer=(2-5)] │ ├── sum [type=decimal, outer=(5)] - │ │ └── variable: xy.x [type=int, outer=(5)] + │ │ └── variable: x [type=int, outer=(5)] │ ├── const-agg [type=int, outer=(2)] - │ │ └── variable: a.i [type=int, outer=(2)] + │ │ └── variable: i [type=int, outer=(2)] │ ├── const-agg [type=float, outer=(3)] - │ │ └── variable: a.f [type=float, outer=(3)] + │ │ └── variable: f [type=float, outer=(3)] │ └── const-agg [type=string, outer=(4)] - │ └── variable: a.s [type=string, outer=(4)] + │ └── variable: s [type=string, outer=(4)] └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] - └── a.i < sum [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + └── i < sum [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] # Don't reject nulls when multiple columns are used. opt @@ -388,9 +388,9 @@ project │ │ └── true [type=bool] │ └── aggregations [outer=(5,6)] │ ├── min [type=int, outer=(5)] - │ │ └── variable: xy.x [type=int, outer=(5)] + │ │ └── variable: x [type=int, outer=(5)] │ └── max [type=int, outer=(6)] - │ └── variable: xy.y [type=int, outer=(6)] + │ └── variable: y [type=int, outer=(6)] └── filters [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight), fd=()-->(7)] └── column7 = 1 [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight)] @@ -428,6 +428,6 @@ project │ │ └── true [type=bool] │ └── aggregations [outer=(5)] │ └── count [type=int, outer=(5)] - │ └── variable: xy.x [type=int, outer=(5)] + │ └── variable: x [type=int, outer=(5)] └── filters [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight), fd=()-->(7)] └── column7 = 1 [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight)] diff --git a/pkg/sql/opt/norm/testdata/rules/scalar b/pkg/sql/opt/norm/testdata/rules/scalar index a872891ee363..a1f504a193ed 100644 --- a/pkg/sql/opt/norm/testdata/rules/scalar +++ b/pkg/sql/opt/norm/testdata/rules/scalar @@ -38,15 +38,15 @@ project │ ├── key: (1) │ └── fd: (1)-->(2) └── projections [outer=(1,2)] - ├── a.k = (a.i + 1) [type=bool, outer=(1,2)] - ├── a.i != (2 - a.k) [type=bool, outer=(1,2)] - ├── a.k IS NOT DISTINCT FROM (a.i + 1) [type=bool, outer=(1,2)] - ├── a.k IS DISTINCT FROM (a.i - 1) [type=bool, outer=(1,2)] - ├── a.k + (a.i * 2) [type=int, outer=(1,2)] - ├── a.k * (a.i + 2) [type=int, outer=(1,2)] - ├── a.k & (a.i ^ 2) [type=int, outer=(1,2)] - ├── a.k | (a.i ^ 2) [type=int, outer=(1,2)] - └── a.k # (a.i * a.i) [type=int, outer=(1,2)] + ├── k = (i + 1) [type=bool, outer=(1,2)] + ├── i != (2 - k) [type=bool, outer=(1,2)] + ├── k IS NOT DISTINCT FROM (i + 1) [type=bool, outer=(1,2)] + ├── k IS DISTINCT FROM (i - 1) [type=bool, outer=(1,2)] + ├── k + (i * 2) [type=int, outer=(1,2)] + ├── k * (i + 2) [type=int, outer=(1,2)] + ├── k & (i ^ 2) [type=int, outer=(1,2)] + ├── k | (i ^ 2) [type=int, outer=(1,2)] + └── k # (i * i) [type=int, outer=(1,2)] # -------------------------------------------------- # CommuteConst @@ -72,15 +72,15 @@ project │ ├── key: (1) │ └── fd: (1)-->(2,3) └── projections [outer=(1-3)] - ├── (a.i + a.k) = (length('foo') + 1) [type=bool, outer=(1,2)] - ├── (a.i * 2) != length('bar') [type=bool, outer=(2)] - ├── (1 - a.k) IS NOT DISTINCT FROM 5 [type=bool, outer=(1)] - ├── a.k IS DISTINCT FROM (10 + 1) [type=bool, outer=(1)] - ├── a.f + 1.0 [type=float, outer=(3)] - ├── (a.i * a.i) * (5 * length('foo')) [type=int, outer=(2)] - ├── (a.i + a.i) & (100 ^ 2) [type=int, outer=(2)] - ├── (a.i + a.i) | (length('foo') + 1) [type=int, outer=(2)] - └── (a.k ^ 2) # (1 - length('foo')) [type=int, outer=(1)] + ├── (i + k) = (length('foo') + 1) [type=bool, outer=(1,2)] + ├── (i * 2) != length('bar') [type=bool, outer=(2)] + ├── (1 - k) IS NOT DISTINCT FROM 5 [type=bool, outer=(1)] + ├── k IS DISTINCT FROM (10 + 1) [type=bool, outer=(1)] + ├── f + 1.0 [type=float, outer=(3)] + ├── (i * i) * (5 * length('foo')) [type=int, outer=(2)] + ├── (i + i) & (100 ^ 2) [type=int, outer=(2)] + ├── (i + i) | (length('foo') + 1) [type=int, outer=(2)] + └── (k ^ 2) # (1 - length('foo')) [type=int, outer=(1)] # -------------------------------------------------- # EliminateCoalesce @@ -93,7 +93,7 @@ project ├── scan a │ └── columns: i:2(int) └── projections [outer=(2)] - └── variable: a.i [type=int, outer=(2)] + └── variable: i [type=int, outer=(2)] # -------------------------------------------------- # SimplifyCoalesce @@ -126,7 +126,7 @@ project ├── scan a │ └── columns: s:4(string) └── projections [outer=(4)] - └── COALESCE(a.s, a.s || 'foo') [type=string, outer=(4)] + └── COALESCE(s, s || 'foo') [type=string, outer=(4)] # Trailing null can't be removed. opt @@ -137,7 +137,7 @@ project ├── scan a │ └── columns: i:2(int) └── projections [outer=(2)] - └── COALESCE(a.i, NULL, NULL) [type=int, outer=(2)] + └── COALESCE(i, NULL, NULL) [type=int, outer=(2)] # -------------------------------------------------- # EliminateCast @@ -261,10 +261,10 @@ project ├── null [type=float] ├── null [type=int] ├── null [type=int] - ├── a.arr::DECIMAL[] || CAST(NULL AS DECIMAL[]) [type=decimal[], outer=(6)] - ├── CAST(NULL AS STRING[]) || a.arr::STRING[] [type=string[], outer=(6)] - ├── a.i::DECIMAL || CAST(NULL AS DECIMAL[]) [type=decimal[], outer=(2)] - └── CAST(NULL AS FLOAT[]) || a.i::FLOAT [type=float[], outer=(2)] + ├── arr::DECIMAL[] || CAST(NULL AS DECIMAL[]) [type=decimal[], outer=(6)] + ├── CAST(NULL AS STRING[]) || arr::STRING[] [type=string[], outer=(6)] + ├── i::DECIMAL || CAST(NULL AS DECIMAL[]) [type=decimal[], outer=(2)] + └── CAST(NULL AS FLOAT[]) || i::FLOAT [type=float[], outer=(2)] opt SELECT @@ -330,7 +330,7 @@ project ├── scan a │ └── columns: i:2(int) └── projections [outer=(2)] - └── a.i IN (NULL, 1, 2, 3) [type=bool, outer=(2)] + └── i IN (NULL, 1, 2, 3) [type=bool, outer=(2)] opt SELECT s NOT IN ('foo', s || 'foo', 'bar', length(s)::string, NULL) AS r FROM a @@ -340,7 +340,7 @@ project ├── scan a │ └── columns: s:4(string) └── projections [outer=(4)] - └── a.s NOT IN (NULL, 'bar', 'foo', a.s || 'foo', length(a.s)::STRING) [type=bool, outer=(4)] + └── s NOT IN (NULL, 'bar', 'foo', s || 'foo', length(s)::STRING) [type=bool, outer=(4)] # -------------------------------------------------- # EliminateExistsProject @@ -461,7 +461,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-6) └── filters [type=bool, outer=(5)] - └── a.j @> '{"a": "b"}' [type=bool, outer=(5)] + └── j @> '{"a": "b"}' [type=bool, outer=(5)] opt SELECT * FROM a WHERE j->'a' @> '{"x": "b"}'::JSON @@ -475,7 +475,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-6) └── filters [type=bool, outer=(5)] - └── a.j @> '{"a": {"x": "b"}}' [type=bool, outer=(5)] + └── j @> '{"a": {"x": "b"}}' [type=bool, outer=(5)] opt SELECT * FROM a WHERE j->'a'->'x' = '"b"'::JSON @@ -489,7 +489,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-6) └── filters [type=bool, outer=(5)] - └── a.j @> '{"a": {"x": "b"}}' [type=bool, outer=(5)] + └── j @> '{"a": {"x": "b"}}' [type=bool, outer=(5)] # The transformation is not valid in this case. opt @@ -504,7 +504,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-6) └── filters [type=bool, outer=(5)] - └── (a.j->2) = '"b"' [type=bool, outer=(5)] + └── (j->2) = '"b"' [type=bool, outer=(5)] # The transformation is not valid in this case, since j->'a' could be an array. opt @@ -519,4 +519,4 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-6) └── filters [type=bool, outer=(5)] - └── (a.j->'a') @> '"b"' [type=bool, outer=(5)] + └── (j->'a') @> '"b"' [type=bool, outer=(5)] diff --git a/pkg/sql/opt/norm/testdata/rules/select b/pkg/sql/opt/norm/testdata/rules/select index ea6a9938bdf8..2e6a079830c4 100644 --- a/pkg/sql/opt/norm/testdata/rules/select +++ b/pkg/sql/opt/norm/testdata/rules/select @@ -43,8 +43,8 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(2,4), constraints=(/2: [/5 - /5]; /4: (/NULL - /'foo'); tight), fd=()-->(2)] - ├── a.i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] - └── a.s < 'foo' [type=bool, outer=(4), constraints=(/4: (/NULL - /'foo'); tight)] + ├── i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] + └── s < 'foo' [type=bool, outer=(4), constraints=(/4: (/NULL - /'foo'); tight)] # -------------------------------------------------- # EnsureSelectFilters @@ -61,7 +61,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] - └── a.i < 5 [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] + └── i < 5 [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] opt SELECT * FROM a WHERE i<5 OR s='foo' @@ -75,7 +75,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(2,4)] - └── (a.i < 5) OR (a.s = 'foo') [type=bool, outer=(2,4)] + └── (i < 5) OR (s = 'foo') [type=bool, outer=(2,4)] # Don't use Filters for True or False condition. opt @@ -123,7 +123,7 @@ select │ ├── key: () │ └── fd: ()-->(1-5) └── filters [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight), fd=()-->(4)] - └── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + └── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] opt SELECT * FROM (SELECT * FROM a WHERE i=1) WHERE False @@ -155,8 +155,8 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(2,4), constraints=(/2: (/NULL - /4]; /4: [/'foo' - /'foo']; tight), fd=()-->(4)] - ├── a.i < 5 [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] - └── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + ├── i < 5 [type=bool, outer=(2), constraints=(/2: (/NULL - /4]; tight)] + └── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] opt SELECT * FROM (SELECT * FROM a WHERE i>1 AND i<10) WHERE s='foo' OR k=5 @@ -170,9 +170,9 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(1,2,4), constraints=(/2: [/2 - /9])] - ├── a.i > 1 [type=bool, outer=(2), constraints=(/2: [/2 - ]; tight)] - ├── a.i < 10 [type=bool, outer=(2), constraints=(/2: (/NULL - /9]; tight)] - └── (a.s = 'foo') OR (a.k = 5) [type=bool, outer=(1,4)] + ├── i > 1 [type=bool, outer=(2), constraints=(/2: [/2 - ]; tight)] + ├── i < 10 [type=bool, outer=(2), constraints=(/2: (/NULL - /9]; tight)] + └── (s = 'foo') OR (k = 5) [type=bool, outer=(1,4)] # -------------------------------------------------- # PushSelectIntoProject @@ -189,9 +189,9 @@ project │ ├── scan a │ │ └── columns: i:2(int) f:3(float) │ └── filters [type=bool, outer=(3), constraints=(/3: [/10.0 - /10.0]; tight), fd=()-->(3)] - │ └── a.f = 10.0 [type=bool, outer=(3), constraints=(/3: [/10.0 - /10.0]; tight)] + │ └── f = 10.0 [type=bool, outer=(3), constraints=(/3: [/10.0 - /10.0]; tight)] └── projections [outer=(2,3)] - └── a.i + 1 [type=int, outer=(2)] + └── i + 1 [type=int, outer=(2)] # Don't push down select if it depends on computed column that can't be inlined. opt @@ -207,7 +207,7 @@ select │ ├── scan a │ │ └── columns: i:2(int) f:3(float) │ └── projections [outer=(2,3), side-effects] - │ └── a.i / 2 [type=decimal, outer=(2), side-effects] + │ └── i / 2 [type=decimal, outer=(2), side-effects] └── filters [type=bool, outer=(6), constraints=(/6: [/2 - /2]; tight), fd=()-->(6)] └── div = 2 [type=bool, outer=(6), constraints=(/6: [/2 - /2]; tight)] @@ -229,10 +229,10 @@ select │ │ ├── scan a │ │ │ └── columns: i:2(int) f:3(float) │ │ └── filters [type=bool, outer=(2,3), constraints=(/2: [/1 - /1]; /3: [/10.0 - /10.0]; tight), fd=()-->(2,3)] - │ │ ├── a.f = 10.0 [type=bool, outer=(3), constraints=(/3: [/10.0 - /10.0]; tight)] - │ │ └── a.i = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] + │ │ ├── f = 10.0 [type=bool, outer=(3), constraints=(/3: [/10.0 - /10.0]; tight)] + │ │ └── i = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] │ └── projections [outer=(2,3), side-effects] - │ └── a.i / 2 [type=decimal, outer=(2), side-effects] + │ └── i / 2 [type=decimal, outer=(2), side-effects] └── filters [type=bool, outer=(6), constraints=(/6: [/2 - /2]; tight), fd=()-->(6)] └── div = 2 [type=bool, outer=(6), constraints=(/6: [/2 - /2]; tight)] @@ -255,11 +255,11 @@ project │ │ │ └── columns: i:2(int) f:3(float) │ │ └── aggregations [outer=(3)] │ │ └── sum [type=float, outer=(3)] - │ │ └── variable: a.f [type=float, outer=(3)] + │ │ └── variable: f [type=float, outer=(3)] │ └── filters [type=bool, outer=(6), constraints=(/6: [/10.0 - /10.0]; tight), fd=()-->(6)] │ └── column6 = 10.0 [type=bool, outer=(6), constraints=(/6: [/10.0 - /10.0]; tight)] └── projections [outer=(3)] - └── a.f + 1.1 [type=float, outer=(3)] + └── f + 1.1 [type=float, outer=(3)] # -------------------------------------------------- # PushSelectCondLeftIntoJoinLeftAndRight @@ -294,9 +294,9 @@ select │ ├── left ordering: +1 │ ├── right ordering: +6 │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] └── filters [type=bool, outer=(6)] - └── (xy.x = 6) OR (xy.x IS NULL) [type=bool, outer=(6)] + └── (x = 6) OR (x IS NULL) [type=bool, outer=(6)] opt SELECT * FROM a WHERE EXISTS (SELECT * FROM xy WHERE a.k=xy.x) AND a.k > 5 @@ -321,7 +321,7 @@ semi-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] opt SELECT * FROM a WHERE NOT EXISTS (SELECT * FROM xy WHERE a.k=xy.x) AND a.k > 5 @@ -346,7 +346,7 @@ anti-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Only the filters bound by the right side are mapped and pushed down. opt @@ -372,16 +372,16 @@ select │ │ │ ├── key: (6) │ │ │ └── fd: (6)-->(7) │ │ └── filters [type=bool, outer=(6,7)] - │ │ ├── (xy.x + xy.y) > 5 [type=bool, outer=(6,7)] - │ │ └── (xy.y % 2) = 0 [type=bool, outer=(7)] + │ │ ├── (x + y) > 5 [type=bool, outer=(6,7)] + │ │ └── (y % 2) = 0 [type=bool, outer=(7)] │ └── filters [type=bool, outer=(1,2,6,7), constraints=(/1: [/10 - ]; /2: (/NULL - ]; /6: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(6), (6)==(1), (2)==(7), (7)==(2)] - │ ├── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - │ ├── a.i = xy.y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] - │ ├── (a.k + a.i) > 5 [type=bool, outer=(1,2)] - │ ├── (a.i % 2) = 0 [type=bool, outer=(2)] - │ └── a.k >= 10 [type=bool, outer=(1), constraints=(/1: [/10 - ]; tight)] + │ ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ ├── i = y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ ├── (k + i) > 5 [type=bool, outer=(1,2)] + │ ├── (i % 2) = 0 [type=bool, outer=(2)] + │ └── k >= 10 [type=bool, outer=(1), constraints=(/1: [/10 - ]; tight)] └── filters [type=bool, outer=(2,6)] - └── ((xy.x + a.i) = 6) OR (xy.x IS NULL) [type=bool, outer=(2,6)] + └── ((x + i) = 6) OR (x IS NULL) [type=bool, outer=(2,6)] # -------------------------------------------------- # PushSelectIntoJoinLeft @@ -403,9 +403,9 @@ inner-join (lookup xy) │ │ ├── key: (1) │ │ └── fd: (1)-->(2-5) │ └── filters [type=bool, outer=(3), constraints=(/3: [/1.1 - /1.1]; tight), fd=()-->(3)] - │ └── a.f = 1.1 [type=bool, outer=(3), constraints=(/3: [/1.1 - /1.1]; tight)] + │ └── f = 1.1 [type=bool, outer=(3), constraints=(/3: [/1.1 - /1.1]; tight)] └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] opt SELECT * FROM a LEFT JOIN xy ON a.k=xy.x @@ -429,12 +429,12 @@ select │ │ │ ├── key: (1) │ │ │ └── fd: (1)-->(2-5) │ │ └── filters [type=bool, outer=(3,4), constraints=(/3: [/1.1 - /1.1]), fd=()-->(3)] - │ │ ├── a.f = 1.1 [type=bool, outer=(3), constraints=(/3: [/1.1 - /1.1]; tight)] - │ │ └── (a.s = 'foo') OR (a.s = 'bar') [type=bool, outer=(4)] + │ │ ├── f = 1.1 [type=bool, outer=(3), constraints=(/3: [/1.1 - /1.1]; tight)] + │ │ └── (s = 'foo') OR (s = 'bar') [type=bool, outer=(4)] │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] └── filters [type=bool, outer=(2,7)] - └── (a.i < xy.y) OR (xy.y IS NULL) [type=bool, outer=(2,7)] + └── (i < y) OR (y IS NULL) [type=bool, outer=(2,7)] # Pushdown constant condition. opt @@ -464,7 +464,7 @@ inner-join │ │ └── fd: (1)-->(2-5) │ └── filters [type=bool, outer=(2), constraints=(/2: [/100 - /100]), fd=()-->(2)] │ ├── $1 > '2000-01-01T1:00:00' [type=bool] - │ └── a.i = 100 [type=bool, outer=(2), constraints=(/2: [/100 - /100]; tight)] + │ └── i = 100 [type=bool, outer=(2), constraints=(/2: [/100 - /100]; tight)] └── true [type=bool] # Don't push down conditions in case of RIGHT JOIN. @@ -493,9 +493,9 @@ select │ ├── left ordering: +1 │ ├── right ordering: +6 │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] └── filters [type=bool, outer=(2)] - └── (a.i = 100) OR (a.i IS NULL) [type=bool, outer=(2)] + └── (i = 100) OR (i IS NULL) [type=bool, outer=(2)] # Don't push down conditions in case of FULL JOIN. opt @@ -523,9 +523,9 @@ select │ ├── left ordering: +1 │ ├── right ordering: +6 │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] └── filters [type=bool, outer=(2)] - └── (a.i = 100) OR (a.i IS NULL) [type=bool, outer=(2)] + └── (i = 100) OR (i IS NULL) [type=bool, outer=(2)] # Push into semi-join. opt @@ -546,7 +546,7 @@ semi-join (merge) │ │ ├── fd: (1)-->(2-5) │ │ └── ordering: +1 opt(2) │ └── filters [type=bool, outer=(2), constraints=(/2: [/0 - /0]; tight), fd=()-->(2)] - │ └── a.i = 0 [type=bool, outer=(2), constraints=(/2: [/0 - /0]; tight)] + │ └── i = 0 [type=bool, outer=(2), constraints=(/2: [/0 - /0]; tight)] ├── scan xy │ ├── columns: x:6(int!null) y:7(int) │ ├── key: (6) @@ -556,7 +556,7 @@ semi-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Push into anti-join. opt @@ -577,7 +577,7 @@ anti-join (merge) │ │ ├── fd: (1)-->(2-5) │ │ └── ordering: +1 opt(2) │ └── filters [type=bool, outer=(2), constraints=(/2: [/0 - /0]; tight), fd=()-->(2)] - │ └── a.i = 0 [type=bool, outer=(2), constraints=(/2: [/0 - /0]; tight)] + │ └── i = 0 [type=bool, outer=(2), constraints=(/2: [/0 - /0]; tight)] ├── scan xy │ ├── columns: x:6(int!null) y:7(int) │ ├── key: (6) @@ -587,7 +587,7 @@ anti-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # -------------------------------------------------- # PushSelectIntoJoinRight @@ -609,9 +609,9 @@ inner-join (lookup xy) │ │ ├── key: (3) │ │ └── fd: (3)-->(4-7) │ └── filters [type=bool, outer=(5), constraints=(/5: [/1.1 - /1.1]; tight), fd=()-->(5)] - │ └── a.f = 1.1 [type=bool, outer=(5), constraints=(/5: [/1.1 - /1.1]; tight)] + │ └── f = 1.1 [type=bool, outer=(5), constraints=(/5: [/1.1 - /1.1]; tight)] └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] - └── xy.x = a.k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + └── x = k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] opt SELECT * FROM xy RIGHT JOIN a ON xy.x=a.k @@ -635,12 +635,12 @@ select │ │ │ ├── key: (3) │ │ │ └── fd: (3)-->(4-7) │ │ └── filters [type=bool, outer=(5,6), constraints=(/5: [/1.1 - /1.1]), fd=()-->(5)] - │ │ ├── a.f = 1.1 [type=bool, outer=(5), constraints=(/5: [/1.1 - /1.1]; tight)] - │ │ └── (a.s = 'foo') OR (a.s = 'bar') [type=bool, outer=(6)] + │ │ ├── f = 1.1 [type=bool, outer=(5), constraints=(/5: [/1.1 - /1.1]; tight)] + │ │ └── (s = 'foo') OR (s = 'bar') [type=bool, outer=(6)] │ └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] - │ └── xy.x = a.k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + │ └── x = k [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] └── filters [type=bool, outer=(2,4)] - └── (a.i < xy.y) OR (xy.y IS NULL) [type=bool, outer=(2,4)] + └── (i < y) OR (y IS NULL) [type=bool, outer=(2,4)] # Don't push down conditions in case of LEFT JOIN. opt @@ -668,9 +668,9 @@ select │ ├── left ordering: +1 │ ├── right ordering: +3 │ └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] - │ └── a.k = xy.x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + │ └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] └── filters [type=bool, outer=(4)] - └── (a.i = 100) OR (a.i IS NULL) [type=bool, outer=(4)] + └── (i = 100) OR (i IS NULL) [type=bool, outer=(4)] # Don't push down conditions in case of FULL JOIN. opt @@ -698,9 +698,9 @@ select │ ├── left ordering: +1 │ ├── right ordering: +3 │ └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] - │ └── a.k = xy.x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + │ └── k = x [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] └── filters [type=bool, outer=(4)] - └── (a.i = 100) OR (a.i IS NULL) [type=bool, outer=(4)] + └── (i = 100) OR (i IS NULL) [type=bool, outer=(4)] # -------------------------------------------------- # MergeSelectInnerJoin @@ -726,8 +726,8 @@ inner-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,4,6,7), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - ├── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── (a.s = 'foo') OR (xy.y < 100) [type=bool, outer=(4,7)] + ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── (s = 'foo') OR (y < 100) [type=bool, outer=(4,7)] opt SELECT * FROM a INNER JOIN xy ON a.k=xy.x WHERE (a.s='foo' OR xy.y<100) @@ -750,8 +750,8 @@ inner-join (merge) ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,4,6,7), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - ├── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── (a.s = 'foo') OR (xy.y < 100) [type=bool, outer=(4,7)] + ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── (s = 'foo') OR (y < 100) [type=bool, outer=(4,7)] opt SELECT * FROM a INNER JOIN xy ON a.k=xy.x WHERE False @@ -793,7 +793,7 @@ select │ │ └── fd: (6)-->(7) │ └── true [type=bool] └── filters [type=bool, outer=(1,6)] - └── (a.k = xy.x) OR (xy.x IS NULL) [type=bool, outer=(1,6)] + └── (k = x) OR (x IS NULL) [type=bool, outer=(1,6)] # Don't merge with RIGHT JOIN. opt @@ -817,7 +817,7 @@ select │ │ └── fd: (6)-->(7) │ └── true [type=bool] └── filters [type=bool, outer=(1,6)] - └── (a.k = xy.x) OR (a.k IS NULL) [type=bool, outer=(1,6)] + └── (k = x) OR (k IS NULL) [type=bool, outer=(1,6)] # Don't merge with FULL JOIN. opt @@ -841,7 +841,7 @@ select │ │ └── fd: (6)-->(7) │ └── true [type=bool] └── filters [type=bool, outer=(1,6)] - └── ((a.k = xy.x) OR (a.k IS NULL)) OR (xy.x IS NULL) [type=bool, outer=(1,6)] + └── ((k = x) OR (k IS NULL)) OR (x IS NULL) [type=bool, outer=(1,6)] # -------------------------------------------------- # PushSelectIntoJoinLeft + PushSelectIntoJoinRight + MergeSelectInnerJoin @@ -863,12 +863,12 @@ inner-join (lookup a) │ │ ├── key: (6) │ │ └── fd: (6)-->(7) │ └── filters [type=bool, outer=(7), constraints=(/7: [/10 - /10]; tight), fd=()-->(7)] - │ └── xy.y = 10 [type=bool, outer=(7), constraints=(/7: [/10 - /10]; tight)] + │ └── y = 10 [type=bool, outer=(7), constraints=(/7: [/10 - /10]; tight)] └── filters [type=bool, outer=(1-4,6,7), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /3: [/1.1 - /1.1]; /4: [/'foo' - /'foo']; /6: (/NULL - ]; /7: (/NULL - ]), fd=()-->(3,4), (1)==(6), (6)==(1)] - ├── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - ├── a.i < xy.y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] - ├── a.f = 1.1 [type=bool, outer=(3), constraints=(/3: [/1.1 - /1.1]; tight)] - └── a.s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] + ├── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── i < y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + ├── f = 1.1 [type=bool, outer=(3), constraints=(/3: [/1.1 - /1.1]; tight)] + └── s = 'foo' [type=bool, outer=(4), constraints=(/4: [/'foo' - /'foo']; tight)] opt SELECT * FROM a, xy WHERE a.i=100 AND $1>'2000-01-01T1:00:00' AND xy.x=a.k @@ -888,9 +888,9 @@ inner-join (lookup xy) │ │ └── fd: (1)-->(2-5) │ └── filters [type=bool, outer=(2), constraints=(/2: [/100 - /100]), fd=()-->(2)] │ ├── $1 > '2000-01-01T1:00:00' [type=bool] - │ └── a.i = 100 [type=bool, outer=(2), constraints=(/2: [/100 - /100]; tight)] + │ └── i = 100 [type=bool, outer=(2), constraints=(/2: [/100 - /100]; tight)] └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - ├── xy.x = a.k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── x = k [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] └── $1 > '2000-01-01T1:00:00' [type=bool] # -------------------------------------------------- @@ -912,11 +912,11 @@ group-by │ ├── scan a │ │ └── columns: i:2(int) │ └── filters [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight), fd=()-->(2)] - │ └── a.i = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] + │ └── i = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] └── aggregations [outer=(2)] ├── count-rows [type=int] └── const-agg [type=int, outer=(2)] - └── variable: a.i [type=int, outer=(2)] + └── variable: i [type=int, outer=(2)] # Push down into GroupBy with no aggregations. opt @@ -933,10 +933,10 @@ distinct-on │ ├── scan a │ │ └── columns: i:2(int) │ └── filters [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight), fd=()-->(2)] - │ └── a.i = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] + │ └── i = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] └── aggregations [outer=(2)] └── const-agg [type=int, outer=(2)] - └── variable: a.i [type=int, outer=(2)] + └── variable: i [type=int, outer=(2)] # Push down only conditions that do not depend on aggregations. opt @@ -960,12 +960,12 @@ select │ │ │ ├── key: (1) │ │ │ └── fd: (1)-->(2,4) │ │ └── filters [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ]), fd=(1)==(2), (2)==(1)] - │ │ └── a.i = a.k [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] + │ │ └── i = k [type=bool, outer=(1,2), constraints=(/1: (/NULL - ]; /2: (/NULL - ])] │ └── aggregations [outer=(2,4)] │ ├── max [type=string, outer=(4)] - │ │ └── variable: a.s [type=string, outer=(4)] + │ │ └── variable: s [type=string, outer=(4)] │ └── const-agg [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] └── filters [type=bool, outer=(6), constraints=(/6: [/'foo' - /'foo']; tight), fd=()-->(6)] └── m = 'foo' [type=bool, outer=(6), constraints=(/6: [/'foo' - /'foo']; tight)] @@ -983,10 +983,10 @@ distinct-on │ ├── scan a │ │ └── columns: i:2(int) f:3(float) s:4(string) │ └── filters [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] - │ └── a.i > a.f [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] + │ └── i > f [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] └── aggregations [outer=(4)] └── first-agg [type=string, outer=(4)] - └── variable: a.s [type=string, outer=(4)] + └── variable: s [type=string, outer=(4)] # DistinctOn case with a ConstAgg. opt @@ -1014,16 +1014,16 @@ distinct-on │ │ │ ├── key: (1) │ │ │ └── fd: (1)-->(2,3) │ │ └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] - │ │ └── a.k > a.f [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + │ │ └── k > f [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - │ └── a.i = xy.y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ └── i = y [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] └── aggregations [outer=(2,3,6)] ├── first-agg [type=int, outer=(2)] - │ └── variable: a.i [type=int, outer=(2)] + │ └── variable: i [type=int, outer=(2)] ├── first-agg [type=int, outer=(6)] - │ └── variable: xy.x [type=int, outer=(6)] + │ └── variable: x [type=int, outer=(6)] └── const-agg [type=float, outer=(3)] - └── variable: a.f [type=float, outer=(3)] + └── variable: f [type=float, outer=(3)] # Do *not* push down into scalar GroupBy. opt @@ -1092,8 +1092,8 @@ select │ ├── key: (1) │ └── fd: (1)-->(2) └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - /99]; tight)] - ├── b.i < 100 [type=bool, outer=(2), constraints=(/2: (/NULL - /99]; tight)] - └── b.i IS NOT NULL [type=bool, outer=(2), constraints=(/2: (/NULL - ]; tight)] + ├── i < 100 [type=bool, outer=(2), constraints=(/2: (/NULL - /99]; tight)] + └── i IS NOT NULL [type=bool, outer=(2), constraints=(/2: (/NULL - ]; tight)] opt SELECT k,s FROM b WHERE k IS NOT NULL AND s IS NOT NULL @@ -1116,7 +1116,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2,4) └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - ]; tight)] - └── b.i IS NOT NULL [type=bool, outer=(2), constraints=(/2: (/NULL - ]; tight)] + └── i IS NOT NULL [type=bool, outer=(2), constraints=(/2: (/NULL - ]; tight)] # RemoveNotNullCondition rule is not applied opt @@ -1127,7 +1127,7 @@ select ├── scan b │ └── columns: i:2(int) └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - ]; tight)] - └── b.i IS NOT NULL [type=bool, outer=(2), constraints=(/2: (/NULL - ]; tight)] + └── i IS NOT NULL [type=bool, outer=(2), constraints=(/2: (/NULL - ]; tight)] # RemoveNotNullCondition rule is not applied opt @@ -1145,7 +1145,7 @@ project │ ├── key: (1) │ └── fd: (1)-->(2) └── filters [type=bool, outer=(1,2)] - └── (b.i + b.k) IS NOT NULL [type=bool, outer=(1,2)] + └── (i + k) IS NOT NULL [type=bool, outer=(1,2)] # -------------------------------------------------- # DetectSelectContradiction diff --git a/pkg/sql/opt/norm/testdata/rules/side_effects b/pkg/sql/opt/norm/testdata/rules/side_effects index b63b35006fb9..05f7c759881f 100644 --- a/pkg/sql/opt/norm/testdata/rules/side_effects +++ b/pkg/sql/opt/norm/testdata/rules/side_effects @@ -74,12 +74,12 @@ project │ │ ├── scan a │ │ │ └── columns: i:2(int) f:3(float) │ │ └── filters [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight), fd=()-->(2)] - │ │ └── a.i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] + │ │ └── i = 5 [type=bool, outer=(2), constraints=(/2: [/5 - /5]; tight)] │ └── projections [outer=(2,3), side-effects] - │ └── a.i + (random() * 10.0)::INT [type=int, outer=(2), side-effects] + │ └── i + (random() * 10.0)::INT [type=int, outer=(2), side-effects] └── aggregations [outer=(3)] └── avg [type=float, outer=(3)] - └── variable: a.f [type=float, outer=(3)] + └── variable: f [type=float, outer=(3)] # Allow elimination of side effecting expressions during column pruning. opt @@ -109,7 +109,7 @@ inner-join (merge) │ │ ├── fd: (1)-->(2-5) │ │ └── ordering: +1 │ └── filters [type=bool, outer=(1), side-effects, constraints=(/1: (/NULL - ])] - │ └── a.k = random() [type=bool, outer=(1), side-effects, constraints=(/1: (/NULL - ])] + │ └── k = random() [type=bool, outer=(1), side-effects, constraints=(/1: (/NULL - ])] ├── select │ ├── columns: x:6(int!null) y:7(int) │ ├── side-effects @@ -122,12 +122,12 @@ inner-join (merge) │ │ ├── fd: (6)-->(7) │ │ └── ordering: +6 │ └── filters [type=bool, outer=(6), side-effects, constraints=(/6: (/NULL - ])] - │ └── xy.x = random() [type=bool, outer=(6), side-effects, constraints=(/6: (/NULL - ])] + │ └── x = random() [type=bool, outer=(6), side-effects, constraints=(/6: (/NULL - ])] └── merge-on ├── left ordering: +1 ├── right ordering: +6 └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── a.k = xy.x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── k = x [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Decorrelate CASE WHEN branch if there are no side effects. opt @@ -145,9 +145,9 @@ project │ │ ├── key: (6) │ │ └── fd: (6)-->(7) │ └── filters [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ]), fd=(2)==(6), (6)==(2)] - │ └── xy.x = a.i [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + │ └── x = i [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] └── projections [outer=(2,7)] - └── CASE WHEN a.i < 0 THEN xy.y ELSE 5 END [type=int, outer=(2,7)] + └── CASE WHEN i < 0 THEN y ELSE 5 END [type=int, outer=(2,7)] # Decorrelate CASE ELSE branch if there are no side effects. opt @@ -173,9 +173,9 @@ project │ │ ├── key: (6) │ │ └── fd: (6)-->(7) │ └── filters [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ]), fd=(2)==(6), (6)==(2)] - │ └── xy.x = a.i [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + │ └── x = i [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] └── filters [type=bool, outer=(1,2,7), constraints=(/1: (/NULL - ])] - └── a.k = CASE WHEN a.i < 0 THEN 5 ELSE xy.y END [type=bool, outer=(1,2,7), constraints=(/1: (/NULL - ])] + └── k = CASE WHEN i < 0 THEN 5 ELSE y END [type=bool, outer=(1,2,7), constraints=(/1: (/NULL - ])] # Don't decorrelate CASE WHEN branch if there are side effects. opt @@ -190,7 +190,7 @@ project └── case [type=int, outer=(2), side-effects] ├── true [type=bool] ├── when [type=int, outer=(2), side-effects] - │ ├── a.i < 0 [type=bool, outer=(2)] + │ ├── i < 0 [type=bool, outer=(2)] │ └── subquery [type=int, outer=(2), side-effects] │ └── project │ ├── columns: y:7(int) @@ -217,7 +217,7 @@ project │ │ │ ├── key: (6) │ │ │ └── fd: (6)-->(7) │ │ └── filters [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ]), fd=(2)==(6), (6)==(2)] - │ │ └── xy.x = a.i [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + │ │ └── x = i [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] │ └── (random() * 10.0)::INT [type=int, side-effects] └── const: 5 [type=int] @@ -236,11 +236,11 @@ select │ └── fd: (1)-->(2-5) └── filters [type=bool, outer=(1,2), side-effects, constraints=(/1: (/NULL - ])] └── eq [type=bool, outer=(1,2), side-effects, constraints=(/1: (/NULL - ])] - ├── variable: a.k [type=int, outer=(1)] + ├── variable: k [type=int, outer=(1)] └── case [type=int, outer=(2), side-effects] ├── true [type=bool] ├── when [type=int, outer=(2)] - │ ├── a.i < 0 [type=bool, outer=(2)] + │ ├── i < 0 [type=bool, outer=(2)] │ └── const: 5 [type=int] └── subquery [type=int, outer=(2), side-effects] └── project @@ -262,5 +262,5 @@ select │ ├── key: (6) │ └── fd: (6)-->(7) └── filters [type=bool, outer=(2,6,7), side-effects, constraints=(/2: (/NULL - ]; /6: (/NULL - ]), fd=(2)==(6), (6)==(2)] - ├── xy.x = a.i [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] - └── (5 / xy.y) > 1 [type=bool, outer=(7), side-effects] + ├── x = i [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + └── (5 / y) > 1 [type=bool, outer=(7), side-effects] diff --git a/pkg/sql/opt/optbuilder/testdata/aggregate b/pkg/sql/opt/optbuilder/testdata/aggregate index 723d9bc84eb0..daee16fa12b1 100644 --- a/pkg/sql/opt/optbuilder/testdata/aggregate +++ b/pkg/sql/opt/optbuilder/testdata/aggregate @@ -68,27 +68,27 @@ scalar-group-by │ └── projections │ ├── const: 1 [type=int] │ ├── eq [type=bool] - │ │ ├── variable: kv.v [type=int] + │ │ ├── variable: v [type=int] │ │ └── const: 1 [type=int] │ └── cast: BYTES [type=bytes] - │ └── variable: kv.s [type=string] + │ └── variable: s [type=string] └── aggregations ├── min [type=int] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] ├── max [type=int] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] ├── count [type=int] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] ├── sum-int [type=int] │ └── variable: column8 [type=int] ├── avg [type=decimal] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] ├── sum [type=decimal] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] ├── std-dev [type=decimal] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] ├── variance [type=decimal] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] ├── bool-and [type=bool] │ └── variable: column14 [type=bool] └── xor-agg [type=bytes] @@ -167,7 +167,7 @@ scalar-group-by │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) └── aggregations └── json-agg [type=jsonb] - └── variable: kv.v [type=int] + └── variable: v [type=int] build SELECT jsonb_agg(1) @@ -438,7 +438,7 @@ group-by │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── projections │ └── function: upper [type=string] - │ └── variable: kv.s [type=string] + │ └── variable: s [type=string] └── aggregations └── count-rows [type=int] @@ -495,7 +495,7 @@ project │ └── count-rows [type=int] └── projections └── function: upper [type=string] - └── variable: kv.s [type=string] + └── variable: s [type=string] # Selecting a value that is not grouped, even if a function of it it, does not work. build @@ -516,8 +516,8 @@ group-by │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── projections │ └── plus [type=int] - │ ├── variable: kv.k [type=int] - │ └── variable: kv.v [type=int] + │ ├── variable: k [type=int] + │ └── variable: v [type=int] └── aggregations └── count-rows [type=int] @@ -539,8 +539,8 @@ project │ └── count-rows [type=int] └── projections └── plus [type=int] - ├── variable: kv.k [type=int] - └── variable: kv.v [type=int] + ├── variable: k [type=int] + └── variable: v [type=int] # TODO(rytaft): don't qualify the column name in the error message differently # than it was qualified in the query. @@ -582,11 +582,11 @@ group-by │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── projections │ └── plus [type=int] - │ ├── variable: kv.v [type=int] - │ └── variable: kv.w [type=int] + │ ├── variable: v [type=int] + │ └── variable: w [type=int] └── aggregations └── count [type=int] - └── variable: kv.k [type=int] + └── variable: k [type=int] build SELECT count(*) @@ -609,7 +609,7 @@ scalar-group-by │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) └── aggregations └── count [type=int] - └── variable: kv.k [type=int] + └── variable: k [type=int] build SELECT count(1) @@ -661,7 +661,7 @@ sort │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) └── aggregations └── count [type=int] - └── variable: kv.k [type=int] + └── variable: k [type=int] build SELECT v, count(k) FROM kv GROUP BY v ORDER BY v DESC @@ -678,7 +678,7 @@ sort │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) └── aggregations └── count [type=int] - └── variable: kv.k [type=int] + └── variable: k [type=int] build SELECT v, count(k) FROM kv GROUP BY v ORDER BY count(k) DESC @@ -695,7 +695,7 @@ sort │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) └── aggregations └── count [type=int] - └── variable: kv.k [type=int] + └── variable: k [type=int] build SELECT v, count(k) FROM kv GROUP BY v ORDER BY v-count(k) @@ -714,10 +714,10 @@ sort │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── aggregations │ └── count [type=int] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] └── projections └── minus [type=int] - ├── variable: kv.v [type=int] + ├── variable: v [type=int] └── variable: count [type=int] build @@ -735,7 +735,7 @@ sort │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) └── aggregations └── sum [type=decimal] - └── variable: kv.k [type=int] + └── variable: k [type=int] build SELECT v, count(k) FROM kv GROUP BY v ORDER BY 1 DESC @@ -752,7 +752,7 @@ sort │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) └── aggregations └── count [type=int] - └── variable: kv.k [type=int] + └── variable: k [type=int] build SELECT count(*), count(k), count(kv.v) FROM kv @@ -766,9 +766,9 @@ scalar-group-by └── aggregations ├── count-rows [type=int] ├── count [type=int] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] └── count [type=int] - └── variable: kv.v [type=int] + └── variable: v [type=int] build SELECT count(kv.*) FROM kv @@ -781,10 +781,10 @@ scalar-group-by │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── projections │ └── tuple [type=tuple{int AS k, int AS v, int AS w, string AS s}] - │ ├── variable: kv.k [type=int] - │ ├── variable: kv.v [type=int] - │ ├── variable: kv.w [type=int] - │ └── variable: kv.s [type=string] + │ ├── variable: k [type=int] + │ ├── variable: v [type=int] + │ ├── variable: w [type=int] + │ └── variable: s [type=string] └── aggregations └── count [type=int] └── variable: column5 [type=tuple{int AS k, int AS v, int AS w, string AS s}] @@ -801,10 +801,10 @@ scalar-group-by └── aggregations ├── count [type=int] │ └── agg-distinct [type=int] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] └── count [type=int] └── agg-distinct [type=int] - └── variable: kv.v [type=int] + └── variable: v [type=int] build SELECT upper(s), count(DISTINCT k), count(DISTINCT v), count(DISTINCT (v)) FROM kv GROUP BY upper(s) @@ -818,14 +818,14 @@ group-by │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── projections │ └── function: upper [type=string] - │ └── variable: kv.s [type=string] + │ └── variable: s [type=string] └── aggregations ├── count [type=int] │ └── agg-distinct [type=int] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] └── count [type=int] └── agg-distinct [type=int] - └── variable: kv.v [type=int] + └── variable: v [type=int] build SELECT count((k, v)) FROM kv @@ -838,8 +838,8 @@ scalar-group-by │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── projections │ └── tuple [type=tuple{int, int}] - │ ├── variable: kv.k [type=int] - │ └── variable: kv.v [type=int] + │ ├── variable: k [type=int] + │ └── variable: v [type=int] └── aggregations └── count [type=int] └── variable: column5 [type=tuple{int, int}] @@ -855,8 +855,8 @@ scalar-group-by │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── projections │ └── tuple [type=tuple{int, int}] - │ ├── variable: kv.k [type=int] - │ └── variable: kv.v [type=int] + │ ├── variable: k [type=int] + │ └── variable: v [type=int] └── aggregations └── count [type=int] └── agg-distinct [type=tuple{int, int}] @@ -873,8 +873,8 @@ scalar-group-by │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── projections │ └── tuple [type=tuple{int, int}] - │ ├── variable: kv.k [type=int] - │ └── variable: kv.v [type=int] + │ ├── variable: k [type=int] + │ └── variable: v [type=int] └── aggregations └── count [type=int] └── agg-distinct [type=tuple{int, int}] @@ -909,8 +909,8 @@ limit │ │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ │ └── projections │ │ └── tuple [type=tuple{int, int}] - │ │ ├── variable: kv.k [type=int] - │ │ └── variable: kv.v [type=int] + │ │ ├── variable: k [type=int] + │ │ └── variable: v [type=int] │ └── aggregations │ └── count [type=int] │ └── variable: column5 [type=tuple{int, int}] @@ -929,8 +929,8 @@ offset │ │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ │ └── projections │ │ └── tuple [type=tuple{int, int}] - │ │ ├── variable: kv.k [type=int] - │ │ └── variable: kv.v [type=int] + │ │ ├── variable: k [type=int] + │ │ └── variable: v [type=int] │ └── aggregations │ └── count [type=int] │ └── variable: column5 [type=tuple{int, int}] @@ -949,9 +949,9 @@ project │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── aggregations │ ├── count [type=int] - │ │ └── variable: kv.k [type=int] + │ │ └── variable: k [type=int] │ └── count [type=int] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] └── projections └── plus [type=int] ├── variable: column5 [type=int] @@ -989,13 +989,13 @@ scalar-group-by │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) └── aggregations ├── min [type=int] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] ├── max [type=int] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] ├── min [type=int] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] └── max [type=int] - └── variable: kv.v [type=int] + └── variable: v [type=int] build SELECT min(k), max(k), min(v), max(v) FROM kv WHERE k > 8 @@ -1010,17 +1010,17 @@ scalar-group-by │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── filters [type=bool] │ └── gt [type=bool] - │ ├── variable: kv.k [type=int] + │ ├── variable: k [type=int] │ └── const: 8 [type=int] └── aggregations ├── min [type=int] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] ├── max [type=int] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] ├── min [type=int] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] └── max [type=int] - └── variable: kv.v [type=int] + └── variable: v [type=int] build SELECT array_agg(k), array_agg(s) FROM (SELECT k, s FROM kv ORDER BY k) @@ -1036,9 +1036,9 @@ scalar-group-by │ └── ordering: +1 └── aggregations ├── array-agg [type=int[]] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] └── array-agg [type=string[]] - └── variable: kv.s [type=string] + └── variable: s [type=string] build SELECT array_agg(k) FROM (SELECT k FROM kv ORDER BY s) @@ -1055,7 +1055,7 @@ scalar-group-by │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) └── aggregations └── array-agg [type=int[]] - └── variable: kv.k [type=int] + └── variable: k [type=int] build SELECT array_agg(k) || 1 FROM (SELECT k FROM kv ORDER BY s) @@ -1074,7 +1074,7 @@ project │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── aggregations │ └── array-agg [type=int[]] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] └── projections └── concat [type=int[]] ├── variable: column5 [type=int[]] @@ -1093,11 +1093,11 @@ scalar-group-by │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── filters [type=bool] │ └── is [type=bool] - │ ├── variable: kv.s [type=string] + │ ├── variable: s [type=string] │ └── null [type=unknown] └── aggregations └── array-agg [type=string[]] - └── variable: kv.s [type=string] + └── variable: s [type=string] build SELECT avg(k), avg(v), sum(k), sum(v) FROM kv @@ -1110,13 +1110,13 @@ scalar-group-by │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) └── aggregations ├── avg [type=decimal] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] ├── avg [type=decimal] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] ├── sum [type=decimal] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] └── sum [type=decimal] - └── variable: kv.v [type=int] + └── variable: v [type=int] build SELECT avg(k::decimal), avg(v::decimal), sum(k::decimal), sum(v::decimal) FROM kv @@ -1129,9 +1129,9 @@ scalar-group-by │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── projections │ ├── cast: DECIMAL [type=decimal] - │ │ └── variable: kv.k [type=int] + │ │ └── variable: k [type=int] │ └── cast: DECIMAL [type=decimal] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] └── aggregations ├── avg [type=decimal] │ └── variable: column5 [type=decimal] @@ -1154,16 +1154,16 @@ scalar-group-by └── aggregations ├── avg [type=decimal] │ └── agg-distinct [type=int] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] ├── avg [type=decimal] │ └── agg-distinct [type=int] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] ├── sum [type=decimal] │ └── agg-distinct [type=int] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] └── sum [type=decimal] └── agg-distinct [type=int] - └── variable: kv.v [type=int] + └── variable: v [type=int] build SELECT avg(k) * 2.0 + max(v)::DECIMAL AS r FROM kv @@ -1178,9 +1178,9 @@ project │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── aggregations │ ├── avg [type=decimal] - │ │ └── variable: kv.k [type=int] + │ │ └── variable: k [type=int] │ └── max [type=int] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] └── projections └── plus [type=decimal] ├── mult [type=decimal] @@ -1205,14 +1205,14 @@ project │ │ └── filters [type=bool] │ │ └── eq [type=bool] │ │ ├── mult [type=int] - │ │ │ ├── variable: kv.w [type=int] + │ │ │ ├── variable: w [type=int] │ │ │ └── const: 2 [type=int] - │ │ └── variable: kv.k [type=int] + │ │ └── variable: k [type=int] │ └── aggregations │ ├── avg [type=decimal] - │ │ └── variable: kv.k [type=int] + │ │ └── variable: k [type=int] │ └── max [type=int] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] └── projections └── plus [type=decimal] ├── mult [type=decimal] @@ -1246,13 +1246,13 @@ scalar-group-by │ └── columns: a:1(string!null) b:2(float) c:3(bool) d:4(decimal) └── aggregations ├── min [type=string] - │ └── variable: abc.a [type=string] + │ └── variable: a [type=string] ├── min [type=float] - │ └── variable: abc.b [type=float] + │ └── variable: b [type=float] ├── min [type=bool] - │ └── variable: abc.c [type=bool] + │ └── variable: c [type=bool] └── min [type=decimal] - └── variable: abc.d [type=decimal] + └── variable: d [type=decimal] build SELECT max(a), max(b), max(c), max(d) FROM abc @@ -1263,13 +1263,13 @@ scalar-group-by │ └── columns: a:1(string!null) b:2(float) c:3(bool) d:4(decimal) └── aggregations ├── max [type=string] - │ └── variable: abc.a [type=string] + │ └── variable: a [type=string] ├── max [type=float] - │ └── variable: abc.b [type=float] + │ └── variable: b [type=float] ├── max [type=bool] - │ └── variable: abc.c [type=bool] + │ └── variable: c [type=bool] └── max [type=decimal] - └── variable: abc.d [type=decimal] + └── variable: d [type=decimal] build SELECT avg(b), sum(b), avg(d), sum(d) FROM abc @@ -1282,13 +1282,13 @@ scalar-group-by │ └── columns: a:1(string!null) b:2(float) c:3(bool) d:4(decimal) └── aggregations ├── avg [type=float] - │ └── variable: abc.b [type=float] + │ └── variable: b [type=float] ├── sum [type=float] - │ └── variable: abc.b [type=float] + │ └── variable: b [type=float] ├── avg [type=decimal] - │ └── variable: abc.d [type=decimal] + │ └── variable: d [type=decimal] └── sum [type=decimal] - └── variable: abc.d [type=decimal] + └── variable: d [type=decimal] # Verify summing of intervals exec-ddl @@ -1310,7 +1310,7 @@ scalar-group-by │ └── columns: a:1(interval!null) └── aggregations └── sum [type=interval] - └── variable: intervals.a [type=interval] + └── variable: a [type=interval] build SELECT avg(a) FROM abc @@ -1379,7 +1379,7 @@ scalar-group-by │ └── columns: x:1(int!null) y:2(int) z:3(float) └── aggregations └── min [type=int] - └── variable: xyz.x [type=int] + └── variable: x [type=int] build SELECT min(x) FROM xyz WHERE x in (0, 4, 7) @@ -1394,14 +1394,14 @@ scalar-group-by │ │ └── columns: x:1(int!null) y:2(int) z:3(float) │ └── filters [type=bool] │ └── in [type=bool] - │ ├── variable: xyz.x [type=int] + │ ├── variable: x [type=int] │ └── tuple [type=tuple{int, int, int}] │ ├── const: 0 [type=int] │ ├── const: 4 [type=int] │ └── const: 7 [type=int] └── aggregations └── min [type=int] - └── variable: xyz.x [type=int] + └── variable: x [type=int] build SELECT max(x) FROM xyz @@ -1414,7 +1414,7 @@ scalar-group-by │ └── columns: x:1(int!null) y:2(int) z:3(float) └── aggregations └── max [type=int] - └── variable: xyz.x [type=int] + └── variable: x [type=int] build SELECT max(y) FROM xyz WHERE x = 1 @@ -1429,11 +1429,11 @@ scalar-group-by │ │ └── columns: x:1(int!null) y:2(int) z:3(float) │ └── filters [type=bool] │ └── eq [type=bool] - │ ├── variable: xyz.x [type=int] + │ ├── variable: x [type=int] │ └── const: 1 [type=int] └── aggregations └── max [type=int] - └── variable: xyz.y [type=int] + └── variable: y [type=int] build SELECT min(y) FROM xyz WHERE x = 7 @@ -1448,11 +1448,11 @@ scalar-group-by │ │ └── columns: x:1(int!null) y:2(int) z:3(float) │ └── filters [type=bool] │ └── eq [type=bool] - │ ├── variable: xyz.x [type=int] + │ ├── variable: x [type=int] │ └── const: 7 [type=int] └── aggregations └── min [type=int] - └── variable: xyz.y [type=int] + └── variable: y [type=int] build SELECT min(x) FROM xyz WHERE (y, z) = (2, 3.0) @@ -1468,14 +1468,14 @@ scalar-group-by │ └── filters [type=bool] │ └── eq [type=bool] │ ├── tuple [type=tuple{int, float}] - │ │ ├── variable: xyz.y [type=int] - │ │ └── variable: xyz.z [type=float] + │ │ ├── variable: y [type=int] + │ │ └── variable: z [type=float] │ └── tuple [type=tuple{int, float}] │ ├── const: 2 [type=int] │ └── const: 3.0 [type=float] └── aggregations └── min [type=int] - └── variable: xyz.x [type=int] + └── variable: x [type=int] build SELECT max(x) FROM xyz WHERE (z, y) = (3.0, 2) @@ -1491,14 +1491,14 @@ scalar-group-by │ └── filters [type=bool] │ └── eq [type=bool] │ ├── tuple [type=tuple{float, int}] - │ │ ├── variable: xyz.z [type=float] - │ │ └── variable: xyz.y [type=int] + │ │ ├── variable: z [type=float] + │ │ └── variable: y [type=int] │ └── tuple [type=tuple{float, int}] │ ├── const: 3.0 [type=float] │ └── const: 2 [type=int] └── aggregations └── max [type=int] - └── variable: xyz.x [type=int] + └── variable: x [type=int] # VARIANCE/STDDEV @@ -1516,14 +1516,14 @@ project │ │ │ └── columns: x:1(int!null) y:2(int) z:3(float) │ │ └── projections │ │ └── cast: DECIMAL [type=decimal] - │ │ └── variable: xyz.y [type=int] + │ │ └── variable: y [type=int] │ └── aggregations │ ├── variance [type=decimal] - │ │ └── variable: xyz.x [type=int] + │ │ └── variable: x [type=int] │ ├── variance [type=decimal] │ │ └── variable: column5 [type=decimal] │ └── variance [type=float] - │ └── variable: xyz.z [type=float] + │ └── variable: z [type=float] └── projections └── function: round [type=float] ├── variable: column7 [type=float] @@ -1542,11 +1542,11 @@ scalar-group-by │ │ └── columns: x:1(int!null) y:2(int) z:3(float) │ └── filters [type=bool] │ └── eq [type=bool] - │ ├── variable: xyz.x [type=int] + │ ├── variable: x [type=int] │ └── const: 10 [type=int] └── aggregations └── variance [type=decimal] - └── variable: xyz.x [type=int] + └── variable: x [type=int] build SELECT stddev(x), stddev(y::decimal), round(stddev(z), 14) FROM xyz @@ -1561,14 +1561,14 @@ project │ │ │ └── columns: x:1(int!null) y:2(int) z:3(float) │ │ └── projections │ │ └── cast: DECIMAL [type=decimal] - │ │ └── variable: xyz.y [type=int] + │ │ └── variable: y [type=int] │ └── aggregations │ ├── std-dev [type=decimal] - │ │ └── variable: xyz.x [type=int] + │ │ └── variable: x [type=int] │ ├── std-dev [type=decimal] │ │ └── variable: column5 [type=decimal] │ └── std-dev [type=float] - │ └── variable: xyz.z [type=float] + │ └── variable: z [type=float] └── projections └── function: round [type=float] ├── variable: column7 [type=float] @@ -1587,11 +1587,11 @@ scalar-group-by │ │ └── columns: x:1(int!null) y:2(int) z:3(float) │ └── filters [type=bool] │ └── eq [type=bool] - │ ├── variable: xyz.x [type=int] + │ ├── variable: x [type=int] │ └── const: 1 [type=int] └── aggregations └── std-dev [type=decimal] - └── variable: xyz.x [type=int] + └── variable: x [type=int] build SELECT avg(1::int)::float, avg(2::float)::float, avg(3::decimal)::float @@ -1734,7 +1734,7 @@ limit │ │ └── columns: x:1(int!null) y:2(int) z:3(float) │ └── projections │ └── gt [type=bool] - │ ├── variable: xyz.x [type=int] + │ ├── variable: x [type=int] │ └── subquery [type=decimal] │ └── max1-row │ ├── columns: avg:5(decimal) @@ -1797,9 +1797,9 @@ scalar-group-by │ └── columns: b:1(bool) rowid:2(int!null) └── aggregations ├── bool-and [type=bool] - │ └── variable: bools.b [type=bool] + │ └── variable: b [type=bool] └── bool-or [type=bool] - └── variable: bools.b [type=bool] + └── variable: b [type=bool] # Tests with * inside GROUP BY. @@ -1840,9 +1840,9 @@ project │ │ └── columns: a:1(bytes) b:2(int) c:3(int) rowid:4(int!null) │ └── aggregations │ ├── xor-agg [type=bytes] - │ │ └── variable: xor_bytes.a [type=bytes] + │ │ └── variable: a [type=bytes] │ └── xor-agg [type=int] - │ └── variable: xor_bytes.c [type=int] + │ └── variable: c [type=int] └── projections └── function: to_hex [type=string] └── variable: column5 [type=bytes] @@ -1864,9 +1864,9 @@ sort │ │ └── columns: a:1(bytes) b:2(int) c:3(int) rowid:4(int!null) │ └── aggregations │ ├── xor-agg [type=bytes] - │ │ └── variable: xor_bytes.a [type=bytes] + │ │ └── variable: a [type=bytes] │ └── xor-agg [type=int] - │ └── variable: xor_bytes.c [type=int] + │ └── variable: c [type=int] └── projections └── function: to_hex [type=string] └── variable: column5 [type=bytes] @@ -1919,7 +1919,7 @@ scalar-group-by │ └── ordering: +1 └── aggregations └── concat-agg [type=string] - └── variable: kv.s [type=string] + └── variable: s [type=string] build SELECT json_agg(s) FROM (SELECT s FROM kv ORDER BY k) @@ -1935,7 +1935,7 @@ scalar-group-by │ └── ordering: +1 └── aggregations └── json-agg [type=jsonb] - └── variable: kv.s [type=string] + └── variable: s [type=string] build SELECT jsonb_agg(s) FROM (SELECT s FROM kv ORDER BY k) @@ -1951,7 +1951,7 @@ scalar-group-by │ └── ordering: +1 └── aggregations └── jsonb-agg [type=jsonb] - └── variable: kv.s [type=string] + └── variable: s [type=string] exec-ddl CREATE TABLE ab ( @@ -1990,8 +1990,8 @@ project │ └── columns: a:1(int!null) b:2(int) └── projections └── tuple [type=tuple{int, int}] - ├── variable: ab.b [type=int] - └── variable: ab.a [type=int] + ├── variable: b [type=int] + └── variable: a [type=int] build SELECT min(y), (b, a) AS r @@ -2013,11 +2013,11 @@ project │ │ └── true [type=bool] │ └── aggregations │ └── min [type=string] - │ └── variable: xy.y [type=string] + │ └── variable: y [type=string] └── projections └── tuple [type=tuple{int, int}] - ├── variable: ab.b [type=int] - └── variable: ab.a [type=int] + ├── variable: b [type=int] + └── variable: a [type=int] build SELECT v, count(k) FROM kv GROUP BY v ORDER BY count(k) @@ -2034,7 +2034,7 @@ sort │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) └── aggregations └── count [type=int] - └── variable: kv.k [type=int] + └── variable: k [type=int] build SELECT v, count(*) FROM kv GROUP BY v ORDER BY count(*) @@ -2085,11 +2085,11 @@ project │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── projections │ ├── plus [type=int] - │ │ ├── variable: kv.k [type=int] - │ │ └── variable: kv.v [type=int] + │ │ ├── variable: k [type=int] + │ │ └── variable: v [type=int] │ └── plus [type=int] - │ ├── variable: kv.v [type=int] - │ └── variable: kv.w [type=int] + │ ├── variable: v [type=int] + │ └── variable: w [type=int] └── projections └── div [type=decimal] ├── variable: column5 [type=int] @@ -2168,7 +2168,7 @@ project │ └── projections │ └── and [type=bool] │ ├── variable: bools.b [type=bool] - │ └── variable: abc.c [type=bool] + │ └── variable: c [type=bool] └── projections └── and [type=bool] ├── variable: column9 [type=bool] @@ -2204,7 +2204,7 @@ project │ └── projections │ └── or [type=bool] │ ├── variable: bools.b [type=bool] - │ └── variable: abc.c [type=bool] + │ └── variable: c [type=bool] └── projections └── or [type=bool] ├── variable: column9 [type=bool] @@ -2229,12 +2229,12 @@ project │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── projections │ └── mod [type=int] - │ ├── variable: kv.k [type=int] - │ └── variable: kv.w [type=int] + │ ├── variable: k [type=int] + │ └── variable: w [type=int] └── projections └── mod [type=int] ├── variable: column5 [type=int] - └── variable: kv.v [type=int] + └── variable: v [type=int] build SELECT concat(concat(s, a), a) FROM kv, abc GROUP BY concat(s, a), a @@ -2255,12 +2255,12 @@ project │ │ └── true [type=bool] │ └── projections │ └── function: concat [type=string] - │ ├── variable: kv.s [type=string] - │ └── variable: abc.a [type=string] + │ ├── variable: s [type=string] + │ └── variable: a [type=string] └── projections └── function: concat [type=string] ├── variable: column9 [type=string] - └── variable: abc.a [type=string] + └── variable: a [type=string] build SELECT concat(concat(s, a), s) FROM kv, abc GROUP BY concat(s, a), a @@ -2281,13 +2281,13 @@ project │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── projections │ └── lt [type=bool] - │ ├── variable: kv.k [type=int] - │ └── variable: kv.w [type=int] + │ ├── variable: k [type=int] + │ └── variable: w [type=int] └── projections └── and [type=bool] ├── variable: column5 [type=bool] └── ne [type=bool] - ├── variable: kv.v [type=int] + ├── variable: v [type=int] └── const: 5 [type=int] build @@ -2422,7 +2422,7 @@ group-by │ └── columns: b:1(bool) rowid:2(int!null) └── projections └── not [type=bool] - └── variable: bools.b [type=bool] + └── variable: b [type=bool] build SELECT b FROM bools GROUP BY NOT b @@ -2443,7 +2443,7 @@ project │ └── columns: b:1(bool) rowid:2(int!null) └── projections └── not [type=bool] - └── variable: bools.b [type=bool] + └── variable: b [type=bool] build SELECT +k * (-w) AS r FROM kv GROUP BY +k, -w @@ -2459,10 +2459,10 @@ project │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── projections │ └── unary-minus [type=int] - │ └── variable: kv.w [type=int] + │ └── variable: w [type=int] └── projections └── mult [type=int] - ├── variable: kv.k [type=int] + ├── variable: k [type=int] └── variable: column5 [type=int] build @@ -2479,10 +2479,10 @@ project │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── projections │ └── unary-minus [type=int] - │ └── variable: kv.w [type=int] + │ └── variable: w [type=int] └── projections └── mult [type=int] - ├── variable: kv.k [type=int] + ├── variable: k [type=int] └── variable: column5 [type=int] build @@ -2499,9 +2499,9 @@ project │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) └── projections └── mult [type=int] - ├── variable: kv.k [type=int] + ├── variable: k [type=int] └── unary-minus [type=int] - └── variable: kv.w [type=int] + └── variable: w [type=int] build SELECT 1 + min(v*2) AS r FROM kv GROUP BY k+3 @@ -2517,10 +2517,10 @@ project │ │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ │ └── projections │ │ ├── plus [type=int] - │ │ │ ├── variable: kv.k [type=int] + │ │ │ ├── variable: k [type=int] │ │ │ └── const: 3 [type=int] │ │ └── mult [type=int] - │ │ ├── variable: kv.v [type=int] + │ │ ├── variable: v [type=int] │ │ └── const: 2 [type=int] │ └── aggregations │ └── min [type=int] @@ -2559,7 +2559,7 @@ project │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── projections │ └── function: upper [type=string] - │ └── variable: kv.s [type=string] + │ └── variable: s [type=string] └── aggregations └── count [type=int] └── variable: column5 [type=string] @@ -2582,11 +2582,11 @@ project │ │ └── columns: a:5(string!null) b:6(float) c:7(bool) d:8(decimal) │ └── filters [type=bool] │ └── ge [type=bool] - │ ├── variable: kv.k [type=int] - │ └── variable: abc.d [type=decimal] + │ ├── variable: k [type=int] + │ └── variable: d [type=decimal] └── aggregations └── sum [type=decimal] - └── variable: abc.d [type=decimal] + └── variable: d [type=decimal] build SELECT sum(DISTINCT abc.d) FROM abc @@ -2600,7 +2600,7 @@ scalar-group-by └── aggregations └── sum [type=decimal] └── agg-distinct [type=decimal] - └── variable: abc.d [type=decimal] + └── variable: d [type=decimal] build SELECT sum(abc.d) FILTER (WHERE abc.d > 0) FROM abc @@ -2625,7 +2625,7 @@ sort │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) └── aggregations └── max [type=int] - └── variable: kv.k [type=int] + └── variable: k [type=int] build SELECT max(k) AS mk FROM kv GROUP BY v ORDER BY max(k) @@ -2644,7 +2644,7 @@ sort │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) └── aggregations └── max [type=int] - └── variable: kv.k [type=int] + └── variable: k [type=int] build SELECT max(k) AS mk1, max(k) AS mk2 FROM kv GROUP BY v ORDER BY mk1 @@ -2663,7 +2663,7 @@ sort │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) └── aggregations └── max [type=int] - └── variable: kv.k [type=int] + └── variable: k [type=int] build SELECT max(k) AS mk1, max(k) AS mk2 FROM kv GROUP BY v ORDER BY mk2 @@ -2682,7 +2682,7 @@ sort │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) └── aggregations └── max [type=int] - └── variable: kv.k [type=int] + └── variable: k [type=int] build SELECT max(k) AS mk1, max(k)/5 AS mk2 FROM kv GROUP BY v ORDER BY mk2 @@ -2701,7 +2701,7 @@ sort │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── aggregations │ └── max [type=int] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] └── projections └── div [type=decimal] ├── variable: mk1 [type=int] @@ -2724,18 +2724,18 @@ project │ │ │ └── columns: k:1(int!null) v:2(int) w:3(int) kv.s:4(string) │ │ └── projections │ │ ├── plus [type=int] - │ │ │ ├── variable: kv.k [type=int] - │ │ │ └── variable: kv.v [type=int] + │ │ │ ├── variable: k [type=int] + │ │ │ └── variable: v [type=int] │ │ ├── minus [type=int] - │ │ │ ├── variable: kv.k [type=int] - │ │ │ └── variable: kv.v [type=int] + │ │ │ ├── variable: k [type=int] + │ │ │ └── variable: v [type=int] │ │ └── div [type=decimal] │ │ ├── plus [type=int] - │ │ │ ├── variable: kv.k [type=int] - │ │ │ └── variable: kv.v [type=int] + │ │ │ ├── variable: k [type=int] + │ │ │ └── variable: v [type=int] │ │ └── minus [type=int] - │ │ ├── variable: kv.k [type=int] - │ │ └── variable: kv.v [type=int] + │ │ ├── variable: k [type=int] + │ │ └── variable: v [type=int] │ └── aggregations │ └── max [type=decimal] │ └── variable: column7 [type=decimal] @@ -2758,22 +2758,22 @@ project │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── projections │ ├── plus [type=int] - │ │ ├── variable: kv.k [type=int] - │ │ └── variable: kv.v [type=int] + │ │ ├── variable: k [type=int] + │ │ └── variable: v [type=int] │ ├── div [type=decimal] │ │ ├── plus [type=int] - │ │ │ ├── variable: kv.k [type=int] - │ │ │ └── variable: kv.v [type=int] + │ │ │ ├── variable: k [type=int] + │ │ │ └── variable: v [type=int] │ │ └── minus [type=int] - │ │ ├── variable: kv.k [type=int] - │ │ └── variable: kv.v [type=int] + │ │ ├── variable: k [type=int] + │ │ └── variable: v [type=int] │ └── mult [type=int] │ ├── plus [type=int] - │ │ ├── variable: kv.k [type=int] - │ │ └── variable: kv.v [type=int] + │ │ ├── variable: k [type=int] + │ │ └── variable: v [type=int] │ └── minus [type=int] - │ ├── variable: kv.k [type=int] - │ └── variable: kv.v [type=int] + │ ├── variable: k [type=int] + │ └── variable: v [type=int] └── aggregations └── max [type=decimal] └── variable: column6 [type=decimal] @@ -2795,7 +2795,7 @@ sort │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── aggregations │ └── max [type=int] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] └── projections └── const: 123 [type=int] @@ -2817,11 +2817,11 @@ scalar-group-by │ │ └── columns: x:1(int!null) y:2(int) z:3(float) │ └── projections │ └── plus [type=int] - │ ├── variable: xyz.x [type=int] - │ └── variable: xyz.y [type=int] + │ ├── variable: x [type=int] + │ └── variable: y [type=int] └── aggregations └── array-agg [type=int[]] - └── variable: xyz.y [type=int] + └── variable: y [type=int] build SELECT array_agg(y) FROM (SELECT * FROM xyz ORDER BY x DESC) @@ -2837,4 +2837,4 @@ scalar-group-by │ └── ordering: -1 └── aggregations └── array-agg [type=int[]] - └── variable: xyz.y [type=int] + └── variable: y [type=int] diff --git a/pkg/sql/opt/optbuilder/testdata/distinct b/pkg/sql/opt/optbuilder/testdata/distinct index 4cca25fe91ab..07752810cc2a 100644 --- a/pkg/sql/opt/optbuilder/testdata/distinct +++ b/pkg/sql/opt/optbuilder/testdata/distinct @@ -115,8 +115,8 @@ sort │ └── columns: x:1(int!null) y:2(int) z:3(float) └── projections └── plus [type=int] - ├── variable: xyz.y [type=int] - └── variable: xyz.x [type=int] + ├── variable: y [type=int] + └── variable: x [type=int] build SELECT DISTINCT y + x AS r FROM xyz ORDER BY y + x @@ -133,8 +133,8 @@ sort │ └── columns: x:1(int!null) y:2(int) z:3(float) └── projections └── plus [type=int] - ├── variable: xyz.y [type=int] - └── variable: xyz.x [type=int] + ├── variable: y [type=int] + └── variable: x [type=int] build SELECT DISTINCT y + z FROM xyz ORDER BY y + z @@ -176,8 +176,8 @@ distinct-on │ └── columns: x:1(int!null) y:2(int) z:3(float) └── projections └── tuple [type=tuple{int, float}] - ├── variable: xyz.y [type=int] - └── variable: xyz.z [type=float] + ├── variable: y [type=int] + └── variable: z [type=float] build SELECT count(*) FROM (SELECT DISTINCT y FROM xyz) @@ -209,7 +209,7 @@ distinct-on │ └── columns: x:1(int!null) y:2(int) z:3(float) └── filters [type=bool] └── gt [type=bool] - ├── variable: xyz.x [type=int] + ├── variable: x [type=int] └── const: 0 [type=int] build @@ -226,7 +226,7 @@ distinct-on │ └── columns: x:1(int!null) y:2(int) z:3(float) └── filters [type=bool] └── gt [type=bool] - ├── variable: xyz.x [type=int] + ├── variable: x [type=int] └── const: 0 [type=int] build @@ -246,7 +246,7 @@ distinct-on │ └── columns: x:1(int!null) y:2(int) z:3(float) └── aggregations └── max [type=int] - └── variable: xyz.x [type=int] + └── variable: x [type=int] build SELECT DISTINCT x+y AS r FROM xyz @@ -260,8 +260,8 @@ distinct-on │ └── columns: x:1(int!null) y:2(int) z:3(float) └── projections └── plus [type=int] - ├── variable: xyz.x [type=int] - └── variable: xyz.y [type=int] + ├── variable: x [type=int] + └── variable: y [type=int] build SELECT DISTINCT 3 r FROM xyz @@ -306,15 +306,15 @@ distinct-on │ │ │ └── columns: x:1(int!null) y:2(int) z:3(float) │ │ └── aggregations │ │ └── max [type=float] - │ │ └── variable: xyz.z [type=float] + │ │ └── variable: z [type=float] │ └── filters [type=bool] │ └── gt [type=bool] - │ ├── variable: xyz.y [type=int] + │ ├── variable: y [type=int] │ └── const: 4 [type=int] └── projections ├── plus [type=int] - │ ├── variable: xyz.x [type=int] - │ └── variable: xyz.y [type=int] + │ ├── variable: x [type=int] + │ └── variable: y [type=int] └── const: 3 [type=int] exec-ddl diff --git a/pkg/sql/opt/optbuilder/testdata/distinct_on b/pkg/sql/opt/optbuilder/testdata/distinct_on index 15c8205a7936..59277012b32e 100644 --- a/pkg/sql/opt/optbuilder/testdata/distinct_on +++ b/pkg/sql/opt/optbuilder/testdata/distinct_on @@ -155,7 +155,7 @@ distinct-on │ └── columns: a:1(string!null) b:2(string!null) c:3(string!null) └── aggregations └── first-agg [type=string] - └── variable: abc.b [type=string] + └── variable: b [type=string] build SELECT DISTINCT ON (c, a) b, c, a FROM abc @@ -167,7 +167,7 @@ distinct-on │ └── columns: a:1(string!null) b:2(string!null) c:3(string!null) └── aggregations └── first-agg [type=string] - └── variable: abc.b [type=string] + └── variable: b [type=string] ################# # With ORDER BY # @@ -202,7 +202,7 @@ sort │ └── columns: x:1(int) y:2(int) z:3(int) pk1:4(int!null) pk2:5(int!null) └── aggregations └── first-agg [type=int] - └── variable: xyz.y [type=int] + └── variable: y [type=int] build SELECT DISTINCT ON (x) y, z, x FROM xyz ORDER BY x ASC, z DESC, y DESC @@ -221,9 +221,9 @@ distinct-on │ └── columns: x:1(int) y:2(int) z:3(int) pk1:4(int!null) pk2:5(int!null) └── aggregations ├── first-agg [type=int] - │ └── variable: xyz.y [type=int] + │ └── variable: y [type=int] └── first-agg [type=int] - └── variable: xyz.z [type=int] + └── variable: z [type=int] ##################### # With aggregations # @@ -243,9 +243,9 @@ distinct-on │ │ └── columns: x:1(int) y:2(int) z:3(int) pk1:4(int!null) pk2:5(int!null) │ └── aggregations │ ├── max [type=int] - │ │ └── variable: xyz.x [type=int] + │ │ └── variable: x [type=int] │ └── max [type=int] - │ └── variable: xyz.y [type=int] + │ └── variable: y [type=int] └── aggregations └── first-agg [type=int] └── variable: max [type=int] @@ -262,13 +262,13 @@ distinct-on │ │ └── columns: a:1(string!null) b:2(string!null) c:3(string!null) │ └── aggregations │ ├── max [type=string] - │ │ └── variable: abc.a [type=string] + │ │ └── variable: a [type=string] │ ├── min [type=string] - │ │ └── variable: abc.a [type=string] + │ │ └── variable: a [type=string] │ ├── max [type=string] - │ │ └── variable: abc.b [type=string] + │ │ └── variable: b [type=string] │ └── min [type=string] - │ └── variable: abc.c [type=string] + │ └── variable: c [type=string] └── aggregations └── first-agg [type=string] └── variable: max [type=string] @@ -292,7 +292,7 @@ distinct-on │ │ └── columns: x:1(int) y:2(int) z:3(int) pk1:4(int!null) pk2:5(int!null) │ └── aggregations │ └── min [type=int] - │ └── variable: xyz.x [type=int] + │ └── variable: x [type=int] └── aggregations └── first-agg [type=int] └── variable: min [type=int] @@ -316,7 +316,7 @@ distinct-on │ │ └── columns: x:1(int) y:2(int) z:3(int) pk1:4(int!null) pk2:5(int!null) │ └── aggregations │ └── min [type=int] - │ └── variable: xyz.x [type=int] + │ └── variable: x [type=int] └── filters [type=bool] └── eq [type=bool] ├── variable: column6 [type=int] @@ -347,9 +347,9 @@ distinct-on │ └── columns: x:1(int) y:2(int) z:3(int) pk1:4(int!null) pk2:5(int!null) └── aggregations ├── first-agg [type=int] - │ └── variable: xyz.y [type=int] + │ └── variable: y [type=int] └── first-agg [type=int] - └── variable: xyz.z [type=int] + └── variable: z [type=int] build SELECT DISTINCT ON (1,2,3) a, b, c FROM abc @@ -377,7 +377,7 @@ distinct-on │ └── columns: x:1(int) y:2(int) z:3(int) pk1:4(int!null) pk2:5(int!null) └── aggregations └── first-agg [type=int] - └── variable: xyz.y [type=int] + └── variable: y [type=int] # Ignores the alias. build @@ -423,7 +423,7 @@ sort │ └── columns: x:1(int) y:2(int) z:3(int) pk1:4(int!null) pk2:5(int!null) └── aggregations └── first-agg [type=int] - └── variable: xyz.z [type=int] + └── variable: z [type=int] build SELECT DISTINCT ON (x, y, z) pk1 FROM xyz ORDER BY x @@ -440,4 +440,4 @@ sort │ └── columns: x:1(int) y:2(int) z:3(int) pk1:4(int!null) pk2:5(int!null) └── aggregations └── first-agg [type=int] - └── variable: xyz.pk1 [type=int] + └── variable: pk1 [type=int] diff --git a/pkg/sql/opt/optbuilder/testdata/explain b/pkg/sql/opt/optbuilder/testdata/explain index 1666647e1421..25fbcdca75fa 100644 --- a/pkg/sql/opt/optbuilder/testdata/explain +++ b/pkg/sql/opt/optbuilder/testdata/explain @@ -70,7 +70,7 @@ explain │ └── const: 4 [type=int] └── filters [type=bool] └── eq [type=bool] - ├── variable: xy.x [type=int] + ├── variable: x [type=int] └── variable: column1 [type=int] build diff --git a/pkg/sql/opt/optbuilder/testdata/having b/pkg/sql/opt/optbuilder/testdata/having index 8e44fe3d5e0d..d1192ac0a578 100644 --- a/pkg/sql/opt/optbuilder/testdata/having +++ b/pkg/sql/opt/optbuilder/testdata/having @@ -64,9 +64,9 @@ select │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── aggregations │ ├── min [type=int] - │ │ └── variable: kv.v [type=int] + │ │ └── variable: v [type=int] │ └── max [type=int] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] └── filters [type=bool] └── gt [type=bool] ├── variable: column5 [type=int] @@ -87,11 +87,11 @@ project │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── aggregations │ ├── max [type=int] - │ │ └── variable: kv.v [type=int] + │ │ └── variable: v [type=int] │ ├── max [type=int] - │ │ └── variable: kv.k [type=int] + │ │ └── variable: k [type=int] │ └── min [type=int] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] └── filters [type=bool] └── gt [type=bool] ├── variable: column5 [type=int] @@ -139,8 +139,8 @@ select │ │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ │ └── projections │ │ └── plus [type=int] - │ │ ├── variable: kv.k [type=int] - │ │ └── variable: kv.w [type=int] + │ │ ├── variable: k [type=int] + │ │ └── variable: w [type=int] │ └── aggregations │ └── count-rows [type=int] └── filters [type=bool] @@ -170,10 +170,10 @@ project │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── aggregations │ └── max [type=int] - │ └── variable: kv.v [type=int] + │ └── variable: v [type=int] └── filters [type=bool] └── gt [type=bool] - ├── variable: kv.v [type=int] + ├── variable: v [type=int] └── const: 5 [type=int] build @@ -192,10 +192,10 @@ project │ │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ │ └── projections │ │ └── function: lower [type=string] - │ │ └── variable: kv.s [type=string] + │ │ └── variable: s [type=string] │ └── aggregations │ └── sum [type=decimal] - │ └── variable: kv.w [type=int] + │ └── variable: w [type=int] └── filters [type=bool] └── like [type=bool] ├── variable: column5 [type=string] @@ -217,10 +217,10 @@ project │ │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ │ └── projections │ │ └── function: lower [type=string] - │ │ └── variable: kv.s [type=string] + │ │ └── variable: s [type=string] │ └── aggregations │ └── sum [type=decimal] - │ └── variable: kv.w [type=int] + │ └── variable: w [type=int] └── filters [type=bool] └── in [type=bool] ├── variable: column6 [type=decimal] @@ -302,7 +302,7 @@ sort │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── aggregations │ └── sum [type=decimal] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] └── filters [type=bool] └── eq [type=bool] ├── variable: column5 [type=decimal] @@ -327,9 +327,9 @@ sort │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── aggregations │ ├── max [type=int] - │ │ └── variable: kv.k [type=int] + │ │ └── variable: k [type=int] │ └── sum [type=decimal] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] └── filters [type=bool] └── gt [type=bool] ├── variable: column5 [type=int] @@ -354,10 +354,10 @@ sort │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── aggregations │ └── sum [type=decimal] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] └── filters [type=bool] └── gt [type=bool] - ├── variable: kv.v [type=int] + ├── variable: v [type=int] └── const: 10 [type=int] build @@ -379,7 +379,7 @@ sort │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── aggregations │ └── max [type=int] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] └── filters [type=bool] └── gt [type=bool] ├── variable: column5 [type=int] @@ -404,7 +404,7 @@ sort │ │ └── columns: k:1(int!null) v:2(int) w:3(int) s:4(string) │ └── aggregations │ └── max [type=int] - │ └── variable: kv.k [type=int] + │ └── variable: k [type=int] └── filters [type=bool] └── gt [type=bool] ├── variable: column5 [type=int] diff --git a/pkg/sql/opt/optbuilder/testdata/join b/pkg/sql/opt/optbuilder/testdata/join index 8cc28129fbb5..1aed12e0bdd3 100644 --- a/pkg/sql/opt/optbuilder/testdata/join +++ b/pkg/sql/opt/optbuilder/testdata/join @@ -365,7 +365,7 @@ limit │ │ └── const: 42 [type=int] │ └── filters [type=bool] │ └── eq [type=bool] - │ ├── variable: onecolumn.x [type=int] + │ ├── variable: x [type=int] │ └── variable: column1 [type=int] └── const: 1 [type=int] @@ -749,7 +749,7 @@ project └── filters [type=bool] └── eq [type=bool] ├── variable: onecolumn.x [type=int] - └── variable: twocolumn.y [type=int] + └── variable: y [type=int] build SELECT * FROM onecolumn JOIN twocolumn ON onecolumn.x = twocolumn.y @@ -765,7 +765,7 @@ project └── filters [type=bool] └── eq [type=bool] ├── variable: onecolumn.x [type=int] - └── variable: twocolumn.y [type=int] + └── variable: y [type=int] # Inner join with filter predicate build @@ -801,7 +801,7 @@ project │ ├── variable: onecolumn.x [type=int] │ └── variable: twocolumn.x [type=int] └── eq [type=bool] - ├── variable: twocolumn.y [type=int] + ├── variable: y [type=int] └── const: 53 [type=int] # Outer joins with filter predicate @@ -822,7 +822,7 @@ project │ ├── variable: onecolumn.x [type=int] │ └── variable: twocolumn.x [type=int] └── eq [type=bool] - ├── variable: twocolumn.y [type=int] + ├── variable: y [type=int] └── const: 53 [type=int] build @@ -1084,7 +1084,7 @@ project │ └── const: 43 [type=int] └── filters [type=bool] └── eq [type=bool] - ├── variable: onecolumn.x [type=int] + ├── variable: x [type=int] └── variable: column1 [type=int] build @@ -1400,8 +1400,8 @@ project │ └── true [type=bool] └── filters [type=bool] └── eq [type=bool] - ├── variable: pairs.b [type=int] - └── variable: square.n [type=int] + ├── variable: b [type=int] + └── variable: n [type=int] # The filter expression becomes an ON predicate. build @@ -1421,9 +1421,9 @@ project └── filters [type=bool] └── eq [type=bool] ├── plus [type=int] - │ ├── variable: pairs.a [type=int] - │ └── variable: pairs.b [type=int] - └── variable: square.sq [type=int] + │ ├── variable: a [type=int] + │ └── variable: b [type=int] + └── variable: sq [type=int] # Query similar to the one above, but the filter refers to a rendered # expression and can't "break through". See the comment for propagateFilters @@ -1446,12 +1446,12 @@ project │ │ └── true [type=bool] │ └── projections │ └── plus [type=int] - │ ├── variable: pairs.a [type=int] - │ └── variable: pairs.b [type=int] + │ ├── variable: a [type=int] + │ └── variable: b [type=int] └── filters [type=bool] └── eq [type=bool] ├── variable: sum [type=int] - └── variable: square.sq [type=int] + └── variable: sq [type=int] # The filter expression must stay on top of the outer join. build @@ -1468,9 +1468,9 @@ project └── filters [type=bool] └── eq [type=bool] ├── plus [type=int] - │ ├── variable: pairs.a [type=int] - │ └── variable: pairs.b [type=int] - └── variable: square.sq [type=int] + │ ├── variable: a [type=int] + │ └── variable: b [type=int] + └── variable: sq [type=int] build SELECT * FROM pairs FULL OUTER JOIN square ON pairs.a + pairs.b = square.sq WHERE pairs.b%2 <> square.sq%2 @@ -1488,16 +1488,16 @@ project │ └── filters [type=bool] │ └── eq [type=bool] │ ├── plus [type=int] - │ │ ├── variable: pairs.a [type=int] - │ │ └── variable: pairs.b [type=int] - │ └── variable: square.sq [type=int] + │ │ ├── variable: a [type=int] + │ │ └── variable: b [type=int] + │ └── variable: sq [type=int] └── filters [type=bool] └── ne [type=bool] ├── mod [type=int] - │ ├── variable: pairs.b [type=int] + │ ├── variable: b [type=int] │ └── const: 2 [type=int] └── mod [type=int] - ├── variable: square.sq [type=int] + ├── variable: sq [type=int] └── const: 2 [type=int] # Filter propagation through outer joins. @@ -1521,34 +1521,34 @@ select │ └── and [type=bool] │ ├── and [type=bool] │ │ ├── eq [type=bool] - │ │ │ ├── variable: pairs.b [type=int] - │ │ │ └── variable: square.sq [type=int] + │ │ │ ├── variable: b [type=int] + │ │ │ └── variable: sq [type=int] │ │ └── gt [type=bool] - │ │ ├── variable: pairs.a [type=int] + │ │ ├── variable: a [type=int] │ │ └── const: 1 [type=int] │ └── lt [type=bool] - │ ├── variable: square.n [type=int] + │ ├── variable: n [type=int] │ └── const: 6 [type=int] └── filters [type=bool] └── and [type=bool] ├── and [type=bool] │ ├── gt [type=bool] - │ │ ├── variable: pairs.b [type=int] + │ │ ├── variable: b [type=int] │ │ └── const: 1 [type=int] │ └── or [type=bool] │ ├── is [type=bool] - │ │ ├── variable: square.n [type=int] + │ │ ├── variable: n [type=int] │ │ └── null [type=unknown] │ └── gt [type=bool] - │ ├── variable: square.n [type=int] + │ ├── variable: n [type=int] │ └── const: 1 [type=int] └── or [type=bool] ├── is [type=bool] - │ ├── variable: square.n [type=int] + │ ├── variable: n [type=int] │ └── null [type=unknown] └── lt [type=bool] - ├── variable: pairs.a [type=int] - └── variable: square.sq [type=int] + ├── variable: a [type=int] + └── variable: sq [type=int] build SELECT * @@ -1569,34 +1569,34 @@ select │ └── and [type=bool] │ ├── and [type=bool] │ │ ├── eq [type=bool] - │ │ │ ├── variable: pairs.b [type=int] - │ │ │ └── variable: square.sq [type=int] + │ │ │ ├── variable: b [type=int] + │ │ │ └── variable: sq [type=int] │ │ └── gt [type=bool] - │ │ ├── variable: pairs.a [type=int] + │ │ ├── variable: a [type=int] │ │ └── const: 1 [type=int] │ └── lt [type=bool] - │ ├── variable: square.n [type=int] + │ ├── variable: n [type=int] │ └── const: 6 [type=int] └── filters [type=bool] └── and [type=bool] ├── and [type=bool] │ ├── or [type=bool] │ │ ├── is [type=bool] - │ │ │ ├── variable: pairs.a [type=int] + │ │ │ ├── variable: a [type=int] │ │ │ └── null [type=unknown] │ │ └── gt [type=bool] - │ │ ├── variable: pairs.a [type=int] + │ │ ├── variable: a [type=int] │ │ └── const: 2 [type=int] │ └── gt [type=bool] - │ ├── variable: square.n [type=int] + │ ├── variable: n [type=int] │ └── const: 1 [type=int] └── or [type=bool] ├── is [type=bool] - │ ├── variable: pairs.a [type=int] + │ ├── variable: a [type=int] │ └── null [type=unknown] └── lt [type=bool] - ├── variable: pairs.a [type=int] - └── variable: square.sq [type=int] + ├── variable: a [type=int] + └── variable: sq [type=int] # The simpler plan for an inner join, to compare. build @@ -1618,34 +1618,34 @@ select │ └── and [type=bool] │ ├── and [type=bool] │ │ ├── eq [type=bool] - │ │ │ ├── variable: pairs.b [type=int] - │ │ │ └── variable: square.sq [type=int] + │ │ │ ├── variable: b [type=int] + │ │ │ └── variable: sq [type=int] │ │ └── gt [type=bool] - │ │ ├── variable: pairs.a [type=int] + │ │ ├── variable: a [type=int] │ │ └── const: 1 [type=int] │ └── lt [type=bool] - │ ├── variable: square.n [type=int] + │ ├── variable: n [type=int] │ └── const: 6 [type=int] └── filters [type=bool] └── and [type=bool] ├── and [type=bool] │ ├── or [type=bool] │ │ ├── is [type=bool] - │ │ │ ├── variable: pairs.a [type=int] + │ │ │ ├── variable: a [type=int] │ │ │ └── null [type=unknown] │ │ └── gt [type=bool] - │ │ ├── variable: pairs.a [type=int] + │ │ ├── variable: a [type=int] │ │ └── const: 2 [type=int] │ └── gt [type=bool] - │ ├── variable: square.n [type=int] + │ ├── variable: n [type=int] │ └── const: 1 [type=int] └── or [type=bool] ├── is [type=bool] - │ ├── variable: pairs.a [type=int] + │ ├── variable: a [type=int] │ └── null [type=unknown] └── lt [type=bool] - ├── variable: pairs.a [type=int] - └── variable: square.sq [type=int] + ├── variable: a [type=int] + └── variable: sq [type=int] exec-ddl @@ -2606,7 +2606,7 @@ project ├── tuple [type=tuple{int, int, int}] │ ├── variable: xyu.x [type=int] │ ├── variable: xyu.y [type=int] - │ └── variable: xyu.u [type=int] + │ └── variable: u [type=int] └── tuple [type=tuple{int, int, int}] ├── const: 1 [type=int] ├── const: 2 [type=int] @@ -2796,20 +2796,20 @@ project │ │ ├── const: 1 [type=int] │ │ └── const: 2 [type=int] │ └── lt [type=bool] - │ ├── variable: abcdef.c [type=int] + │ ├── variable: c [type=int] │ └── const: 6 [type=int] └── and [type=bool] ├── eq [type=bool] │ ├── tuple [type=tuple{int, int, int}] │ │ ├── variable: abcdef.a [type=int] │ │ ├── variable: abcdef.b [type=int] - │ │ └── variable: abcdef.c [type=int] + │ │ └── variable: c [type=int] │ └── tuple [type=tuple{int, int, int}] │ ├── const: 1 [type=int] │ ├── const: 2 [type=int] │ └── const: 6 [type=int] └── gt [type=bool] - ├── variable: abcdef.d [type=int] + ├── variable: d [type=int] └── const: 8 [type=int] # Regression tests for mixed-type equality columns (#22514). diff --git a/pkg/sql/opt/optbuilder/testdata/limit b/pkg/sql/opt/optbuilder/testdata/limit index 244f4727dc82..5848961cf9d5 100644 --- a/pkg/sql/opt/optbuilder/testdata/limit +++ b/pkg/sql/opt/optbuilder/testdata/limit @@ -149,7 +149,7 @@ limit │ │ └── columns: k:1(int!null) v:2(int) w:3(int) │ └── aggregations │ └── sum [type=decimal] - │ └── variable: t.w [type=int] + │ └── variable: w [type=int] └── const: 10 [type=int] build diff --git a/pkg/sql/opt/optbuilder/testdata/orderby b/pkg/sql/opt/optbuilder/testdata/orderby index a3f27fc1e6b9..e6f2c7416abb 100644 --- a/pkg/sql/opt/optbuilder/testdata/orderby +++ b/pkg/sql/opt/optbuilder/testdata/orderby @@ -265,7 +265,7 @@ sort │ └── columns: a:1(int!null) b:2(int) c:3(bool) └── filters [type=bool] └── eq [type=bool] - ├── variable: t.b [type=int] + ├── variable: b [type=int] └── const: 7 [type=int] build @@ -293,12 +293,12 @@ sort │ │ └── columns: a:1(int!null) b:2(int) c:3(bool) │ └── filters [type=bool] │ └── eq [type=bool] - │ ├── variable: t.b [type=int] + │ ├── variable: b [type=int] │ └── const: 7 [type=int] └── projections └── plus [type=int] - ├── variable: t.a [type=int] - └── variable: t.b [type=int] + ├── variable: a [type=int] + └── variable: b [type=int] build SELECT a FROM t ORDER BY a+b DESC, a @@ -312,8 +312,8 @@ sort │ └── columns: a:1(int!null) b:2(int) c:3(bool) └── projections └── plus [type=int] - ├── variable: t.a [type=int] - └── variable: t.b [type=int] + ├── variable: a [type=int] + └── variable: b [type=int] build SELECT a FROM t ORDER BY (((a))) @@ -524,7 +524,7 @@ sort │ └── columns: a:1(int!null) b:2(int) c:3(bool) └── projections └── plus [type=int] - ├── variable: t.b [type=int] + ├── variable: b [type=int] └── const: 2 [type=int] # Check that the sort picks up a renamed render properly. @@ -540,7 +540,7 @@ sort │ └── columns: a:1(int!null) b:2(int) c:3(bool) └── projections └── plus [type=int] - ├── variable: t.b [type=int] + ├── variable: b [type=int] └── const: 2 [type=int] build @@ -555,7 +555,7 @@ sort │ └── columns: a:1(int!null) b:2(int) c:3(bool) └── projections └── plus [type=int] - ├── variable: t.b [type=int] + ├── variable: b [type=int] └── const: 2 [type=int] build @@ -569,7 +569,7 @@ sort ├── scan t │ └── columns: a:1(int!null) b:2(int) c:3(bool) └── projections - └── variable: t.b [type=int] + └── variable: b [type=int] build SELECT b, c FROM t ORDER BY @4 @@ -625,7 +625,7 @@ sort │ └── columns: a:1(int!null) b:2(int!null) c:3(int!null) d:4(string) └── projections └── function: lower [type=string] - └── variable: abc.d [type=string] + └── variable: d [type=string] build SELECT * FROM abc ORDER BY a @@ -721,7 +721,7 @@ sort │ └── columns: a:1(int!null) b:2(int!null) c:3(int!null) d:4(string) └── filters [type=bool] └── eq [type=bool] - ├── variable: abc.b [type=int] + ├── variable: b [type=int] └── const: 2 [type=int] build @@ -738,7 +738,7 @@ sort │ └── columns: a:1(int!null) b:2(int!null) c:3(int!null) d:4(string) └── filters [type=bool] └── eq [type=bool] - ├── variable: abc.b [type=int] + ├── variable: b [type=int] └── const: 2 [type=int] # Verify that the ordering of the primary index is still used for the outer sort. @@ -759,7 +759,7 @@ sort │ └── columns: a:1(int!null) b:2(int!null) c:3(int!null) d:4(string) └── filters [type=bool] └── eq [type=bool] - ├── variable: abc.a [type=int] + ├── variable: a [type=int] └── const: 1 [type=int] build @@ -843,8 +843,8 @@ project │ └── columns: a:1(int!null) b:2(int) c:3(int) d:4(int) └── projections └── plus [type=int] - ├── variable: abcd.a [type=int] - └── variable: abcd.b [type=int] + ├── variable: a [type=int] + └── variable: b [type=int] build SELECT b+d AS r FROM (SELECT * FROM abcd ORDER BY a,d) @@ -855,8 +855,8 @@ project │ └── columns: a:1(int!null) b:2(int) c:3(int) d:4(int) └── projections └── plus [type=int] - ├── variable: abcd.b [type=int] - └── variable: abcd.d [type=int] + ├── variable: b [type=int] + └── variable: d [type=int] build SELECT * FROM (VALUES ('a'), ('b'), ('c')) AS c(x) ORDER BY x diff --git a/pkg/sql/opt/optbuilder/testdata/project b/pkg/sql/opt/optbuilder/testdata/project index 3475f93c849b..e71be4e56095 100644 --- a/pkg/sql/opt/optbuilder/testdata/project +++ b/pkg/sql/opt/optbuilder/testdata/project @@ -72,7 +72,7 @@ project │ └── columns: x:1(int!null) y:2(float) └── projections ├── plus [type=int] - │ ├── variable: a.x [type=int] + │ ├── variable: x [type=int] │ └── const: 3 [type=int] └── false [type=bool] @@ -86,10 +86,10 @@ project └── projections └── or [type=bool] ├── lt [type=bool] - │ ├── variable: a.x [type=int] - │ └── variable: a.y [type=float] + │ ├── variable: x [type=int] + │ └── variable: y [type=float] └── gt [type=bool] - ├── variable: a.x [type=int] + ├── variable: x [type=int] └── const: 1000 [type=int] build @@ -113,10 +113,10 @@ project │ │ └── columns: x:1(int!null) y:2(float) │ └── projections │ ├── plus [type=int] - │ │ ├── variable: a.x [type=int] + │ │ ├── variable: x [type=int] │ │ └── const: 3 [type=int] │ └── plus [type=float] - │ ├── variable: a.y [type=float] + │ ├── variable: y [type=float] │ └── const: 1.0 [type=float] └── projections ├── plus [type=int] @@ -187,7 +187,7 @@ select │ └── columns: x:1(int) y:2(float) rowid:3(int!null) └── filters [type=bool] └── gt [type=bool] - ├── variable: c.rowid [type=int] + ├── variable: rowid [type=int] └── const: 0 [type=int] build @@ -276,6 +276,6 @@ project │ └── columns: k:1(int!null) v:2(int) └── projections └── tuple [type=tuple{int AS a, int AS b, int AS c}] - ├── variable: kv.v [type=int] - ├── variable: kv.v [type=int] - └── variable: kv.v [type=int] + ├── variable: v [type=int] + ├── variable: v [type=int] + └── variable: v [type=int] diff --git a/pkg/sql/opt/optbuilder/testdata/scalar b/pkg/sql/opt/optbuilder/testdata/scalar index 14e4d26e3a31..9d200d8f8b91 100644 --- a/pkg/sql/opt/optbuilder/testdata/scalar +++ b/pkg/sql/opt/optbuilder/testdata/scalar @@ -803,11 +803,11 @@ project │ │ │ └── columns: a:2(int!null) │ │ └── filters [type=bool] │ │ └── eq [type=bool] - │ │ ├── variable: x.a [type=int] - │ │ └── variable: y.b [type=int] + │ │ ├── variable: a [type=int] + │ │ └── variable: b [type=int] │ └── aggregations │ └── array-agg [type=int[]] - │ └── variable: x.a [type=int] + │ └── variable: a [type=int] └── array: [type=int[]] build @@ -828,7 +828,7 @@ project │ │ └── ordering: +2 │ └── aggregations │ └── array-agg [type=int[]] - │ └── variable: x.a [type=int] + │ └── variable: a [type=int] └── array: [type=int[]] build diff --git a/pkg/sql/opt/optbuilder/testdata/select b/pkg/sql/opt/optbuilder/testdata/select index bc604549d52c..5a693cdebb0a 100644 --- a/pkg/sql/opt/optbuilder/testdata/select +++ b/pkg/sql/opt/optbuilder/testdata/select @@ -153,9 +153,9 @@ project └── projections └── plus [type=int] ├── plus [type=int] - │ ├── variable: abc.a [type=int] - │ └── variable: abc.b [type=int] - └── variable: abc.c [type=int] + │ ├── variable: a [type=int] + │ └── variable: b [type=int] + └── variable: c [type=int] build allow-unsupported SELECT a,b FROM abc WHERE CASE WHEN a != 0 THEN b/a > 1.5 ELSE false END @@ -171,12 +171,12 @@ project ├── true [type=bool] ├── when [type=bool] │ ├── ne [type=bool] - │ │ ├── variable: abc.a [type=int] + │ │ ├── variable: a [type=int] │ │ └── const: 0 [type=int] │ └── gt [type=bool] │ ├── div [type=decimal] - │ │ ├── variable: abc.b [type=int] - │ │ └── variable: abc.a [type=int] + │ │ ├── variable: b [type=int] + │ │ └── variable: a [type=int] │ └── const: 1.5 [type=decimal] └── false [type=bool] @@ -212,7 +212,7 @@ project │ └── columns: k:1(string!null) v:2(string) └── projections └── concat [type=string] - ├── variable: kv.v [type=string] + ├── variable: v [type=string] └── const: 'foo' [type=string] build @@ -224,7 +224,7 @@ project │ └── columns: k:1(string!null) v:2(string) └── projections └── function: lower [type=string] - └── variable: kv.v [type=string] + └── variable: v [type=string] build SELECT k FROM kv @@ -255,8 +255,8 @@ project │ └── columns: k:1(string!null) v:2(string) └── projections └── tuple [type=tuple{string AS k, string AS v}] - ├── variable: kv.k [type=string] - └── variable: kv.v [type=string] + ├── variable: k [type=string] + └── variable: v [type=string] build SELECT foo.* FROM kv @@ -300,7 +300,7 @@ project │ └── columns: k:1(string!null) v:2(string) └── filters [type=bool] └── eq [type=bool] - ├── variable: kv.k [type=string] + ├── variable: k [type=string] └── const: 'a' [type=string] build @@ -314,7 +314,7 @@ project │ └── columns: k:1(string!null) v:2(string) └── filters [type=bool] └── eq [type=bool] - ├── variable: kv.k [type=string] + ├── variable: k [type=string] └── const: 'a' [type=string] exec-ddl @@ -429,8 +429,8 @@ project │ └── columns: x:1(int!null) y:2(int) z:3(int) w:4(int) └── projections └── tuple [type=tuple{int, int}] - ├── variable: xyzw.x [type=int] - └── variable: xyzw.y [type=int] + ├── variable: x [type=int] + └── variable: y [type=int] build SELECT * FROM xyzw LIMIT 0 @@ -606,13 +606,13 @@ project └── projections ├── mult [type=int] │ ├── const: 0 [type=int] - │ └── variable: abc.b [type=int] + │ └── variable: b [type=int] ├── mod [type=int] - │ ├── variable: abc.b [type=int] + │ ├── variable: b [type=int] │ └── const: 1 [type=int] └── mod [type=int] ├── const: 0 [type=int] - └── variable: abc.b [type=int] + └── variable: b [type=int] # Regression tests for #22670. build @@ -1002,7 +1002,7 @@ select │ └── columns: x:1(int!null) y:2(float) └── filters [type=bool] └── gt [type=bool] - ├── variable: a.x [type=int] + ├── variable: x [type=int] └── const: 10 [type=int] build @@ -1015,14 +1015,14 @@ select └── filters [type=bool] └── and [type=bool] ├── gt [type=bool] - │ ├── variable: a.x [type=int] + │ ├── variable: x [type=int] │ └── const: 10 [type=int] └── and [type=bool] ├── lt [type=bool] - │ ├── variable: a.x [type=int] + │ ├── variable: x [type=int] │ └── const: 20 [type=int] └── ne [type=bool] - ├── variable: a.x [type=int] + ├── variable: x [type=int] └── const: 13 [type=int] build @@ -1034,7 +1034,7 @@ select │ └── columns: x:1(int!null) y:2(float) └── filters [type=bool] └── in [type=bool] - ├── variable: a.x [type=int] + ├── variable: x [type=int] └── tuple [type=tuple{int, int, int}] ├── const: 1 [type=int] ├── const: 2 [type=int] @@ -1054,8 +1054,8 @@ project ├── scan a │ └── columns: x:1(int!null) y:2(float) └── projections - ├── variable: a.x [type=int] - └── variable: a.y [type=float] + ├── variable: x [type=int] + └── variable: y [type=float] build SELECT * FROM a WHERE (x > 10)::bool @@ -1067,7 +1067,7 @@ select └── filters [type=bool] └── cast: BOOL [type=bool] └── gt [type=bool] - ├── variable: a.x [type=int] + ├── variable: x [type=int] └── const: 10 [type=int] build @@ -1084,7 +1084,7 @@ select │ └── columns: x:1(int!null) y:2(float) └── filters [type=bool] └── eq [type=bool] - ├── variable: a.x [type=int] + ├── variable: x [type=int] └── placeholder: $1 [type=int] # This is slightly funky, because the AS OF SYSTEM TIME timestamp only gets diff --git a/pkg/sql/opt/optbuilder/testdata/srfs b/pkg/sql/opt/optbuilder/testdata/srfs index 8b7c55b189c1..935da00c7850 100644 --- a/pkg/sql/opt/optbuilder/testdata/srfs +++ b/pkg/sql/opt/optbuilder/testdata/srfs @@ -748,12 +748,12 @@ project │ │ │ └── columns: a:1(string) t.rowid:2(int!null) │ │ └── projections │ │ └── cast: INT [type=int] - │ │ └── variable: t.a [type=string] + │ │ └── variable: a [type=string] │ └── aggregations │ ├── max [type=int] │ │ └── variable: column6 [type=int] │ └── max [type=string] - │ └── variable: t.a [type=string] + │ └── variable: a [type=string] └── filters [type=bool] └── gt [type=bool] ├── variable: column7 [type=int] @@ -773,7 +773,7 @@ project │ │ └── function: generate_series [type=int] │ │ ├── const: 0 [type=int] │ │ └── cast: INT [type=int] - │ │ └── variable: u.b [type=string] + │ │ └── variable: b [type=string] │ └── true [type=bool] └── const: 1 [type=int] @@ -810,7 +810,7 @@ project │ │ │ ├── variable: t.a [type=string] │ │ │ └── concat [type=string] │ │ │ ├── variable: t.a [type=string] - │ │ │ └── variable: u.b [type=string] + │ │ │ └── variable: b [type=string] │ │ └── true [type=bool] │ └── const: 100 [type=int] └── true [type=bool] diff --git a/pkg/sql/opt/optbuilder/testdata/subquery b/pkg/sql/opt/optbuilder/testdata/subquery index 4a97d7214e1f..5e11b333c317 100644 --- a/pkg/sql/opt/optbuilder/testdata/subquery +++ b/pkg/sql/opt/optbuilder/testdata/subquery @@ -660,8 +660,8 @@ project │ │ └── columns: a:1(int!null) b:2(int) c:3(int) │ └── projections │ └── tuple [type=tuple{int, int}] - │ ├── variable: abc.a [type=int] - │ └── variable: abc.b [type=int] + │ ├── variable: a [type=int] + │ └── variable: b [type=int] └── tuple [type=tuple{int, int}] ├── const: 1 [type=int] └── const: 2 [type=int] @@ -687,8 +687,8 @@ project │ │ └── false [type=bool] │ └── projections │ └── tuple [type=tuple{int, int}] - │ ├── variable: abc.a [type=int] - │ └── variable: abc.b [type=int] + │ ├── variable: a [type=int] + │ └── variable: b [type=int] └── tuple [type=tuple{int, int}] ├── const: 1 [type=int] └── const: 2 [type=int] @@ -788,7 +788,7 @@ select │ └── columns: a:1(int!null) b:2(int) c:3(int) └── filters [type=bool] └── eq [type=bool] - ├── variable: abc.a [type=int] + ├── variable: a [type=int] └── const: 7 [type=int] exec-ddl @@ -927,7 +927,7 @@ project │ │ └── columns: k:1(int!null) v:2(string) │ └── filters [type=bool] │ └── eq [type=bool] - │ ├── variable: kv.k [type=int] + │ ├── variable: k [type=int] │ └── const: 1 [type=int] └── projections └── const: 1 [type=int] @@ -949,7 +949,7 @@ project │ │ └── columns: k:1(int!null) v:2(string) │ └── filters [type=bool] │ └── eq [type=bool] - │ ├── variable: kv.k [type=int] + │ ├── variable: k [type=int] │ └── const: 2 [type=int] └── projections └── const: 1 [type=int] @@ -1041,7 +1041,7 @@ select │ └── columns: x:1(int!null) y:2(int) z:3(int) └── filters [type=bool] └── lt [type=bool] - ├── variable: xyz.x [type=int] + ├── variable: x [type=int] └── const: 7 [type=int] build @@ -1053,7 +1053,7 @@ select │ └── columns: x:1(int!null) y:2(int) z:3(int) └── filters [type=bool] └── lt [type=bool] - ├── variable: xyz.x [type=int] + ├── variable: x [type=int] └── const: 7 [type=int] build @@ -1065,7 +1065,7 @@ select │ └── columns: x:1(int!null) y:2(int) z:3(int) └── filters [type=bool] └── lt [type=bool] - ├── variable: xyz.x [type=int] + ├── variable: x [type=int] └── const: 7 [type=int] build @@ -1077,7 +1077,7 @@ select │ └── columns: x:1(int!null) y:2(int) z:3(int) └── filters [type=bool] └── lt [type=bool] - ├── variable: xyz.x [type=int] + ├── variable: x [type=int] └── const: 7 [type=int] build @@ -1092,7 +1092,7 @@ sort │ └── columns: x:1(int!null) y:2(int) z:3(int) └── filters [type=bool] └── lt [type=bool] - ├── variable: xyz.x [type=int] + ├── variable: x [type=int] └── const: 7 [type=int] build @@ -1941,7 +1941,7 @@ select │ │ └── columns: a:1(string) t.rowid:2(int!null) │ └── aggregations │ └── max [type=string] - │ └── variable: t.a [type=string] + │ └── variable: a [type=string] └── filters [type=bool] └── any: lt [type=bool] ├── project @@ -1963,7 +1963,7 @@ project │ │ └── columns: a:1(string) t.rowid:2(int!null) │ └── aggregations │ └── min [type=string] - │ └── variable: t.a [type=string] + │ └── variable: a [type=string] └── projections └── any: eq [type=bool] ├── project diff --git a/pkg/sql/opt/optbuilder/testdata/view b/pkg/sql/opt/optbuilder/testdata/view index f37a067c16bc..70d333816145 100644 --- a/pkg/sql/opt/optbuilder/testdata/view +++ b/pkg/sql/opt/optbuilder/testdata/view @@ -79,7 +79,7 @@ project │ └── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb) └── filters [type=bool] └── eq [type=bool] - ├── variable: a.i [type=int] + ├── variable: i [type=int] └── const: 10 [type=int] # Sort used by group by because of presence of ARRAY_AGG. @@ -102,8 +102,8 @@ scalar-group-by │ │ └── columns: k:1(int!null) i:2(int) f:3(float) s:4(string) j:5(jsonb) │ └── filters [type=bool] │ └── eq [type=bool] - │ ├── variable: a.i [type=int] + │ ├── variable: i [type=int] │ └── const: 10 [type=int] └── aggregations └── array-agg [type=float[]] - └── variable: a.f [type=float] + └── variable: f [type=float] diff --git a/pkg/sql/opt/optbuilder/testdata/where b/pkg/sql/opt/optbuilder/testdata/where index c753ff7a37c4..39b113b23f3e 100644 --- a/pkg/sql/opt/optbuilder/testdata/where +++ b/pkg/sql/opt/optbuilder/testdata/where @@ -33,7 +33,7 @@ select │ └── columns: k:1(int!null) v:2(int) └── filters [type=bool] └── in [type=bool] - ├── variable: kv.k [type=int] + ├── variable: k [type=int] └── tuple [type=tuple{int, int}] ├── const: 1 [type=int] └── const: 3 [type=int] @@ -47,7 +47,7 @@ select │ └── columns: k:1(int!null) v:2(int) └── filters [type=bool] └── in [type=bool] - ├── variable: kv.v [type=int] + ├── variable: v [type=int] └── tuple [type=tuple{int}] └── const: 6 [type=int] @@ -106,12 +106,12 @@ project │ │ └── ordering: +1 │ └── filters [type=bool] │ └── like [type=bool] - │ ├── variable: kvstring.k [type=string] + │ ├── variable: k [type=string] │ └── const: 'like%' [type=string] └── projections └── like [type=bool] ├── const: 'hello' [type=string] - └── variable: kvstring.v [type=string] + └── variable: v [type=string] build SELECT 'hello' SIMILAR TO v AS r FROM kvString WHERE k SIMILAR TO 'like[1-2]' ORDER BY k @@ -127,12 +127,12 @@ project │ │ └── ordering: +1 │ └── filters [type=bool] │ └── similar-to [type=bool] - │ ├── variable: kvstring.k [type=string] + │ ├── variable: k [type=string] │ └── const: 'like[1-2]' [type=string] └── projections └── similar-to [type=bool] ├── const: 'hello' [type=string] - └── variable: kvstring.v [type=string] + └── variable: v [type=string] build SELECT 'hello' ~ replace(v, '%', '.*') AS r FROM kvString WHERE k ~ 'like[1-2]' ORDER BY k @@ -148,13 +148,13 @@ project │ │ └── ordering: +1 │ └── filters [type=bool] │ └── reg-match [type=bool] - │ ├── variable: kvstring.k [type=string] + │ ├── variable: k [type=string] │ └── const: 'like[1-2]' [type=string] └── projections └── reg-match [type=bool] ├── const: 'hello' [type=string] └── function: replace [type=string] - ├── variable: kvstring.v [type=string] + ├── variable: v [type=string] ├── const: '%' [type=string] └── const: '.*' [type=string] @@ -169,7 +169,7 @@ select │ └── columns: k:1(int!null) v:2(int) └── filters [type=bool] └── in [type=bool] - ├── variable: kv.k [type=int] + ├── variable: k [type=int] └── tuple [type=tuple{int, int, int}] ├── const: 1 [type=int] ├── const: 5 [type=int] @@ -197,7 +197,7 @@ project │ └── columns: a:1(int) b:2(int) rowid:3(int!null) └── filters [type=bool] └── in [type=bool] - ├── variable: ab.a [type=int] + ├── variable: a [type=int] └── tuple [type=tuple{int, int, int}] ├── const: 1 [type=int] ├── const: 3 [type=int] @@ -214,7 +214,7 @@ project │ └── columns: a:1(int) b:2(int) rowid:3(int!null) └── filters [type=bool] └── in [type=bool] - ├── variable: ab.a [type=int] + ├── variable: a [type=int] └── tuple [type=tuple{int, int, int, int}] ├── const: 1 [type=int] ├── const: 3 [type=int] @@ -233,8 +233,8 @@ project └── filters [type=bool] └── in [type=bool] ├── tuple [type=tuple{int, int}] - │ ├── variable: ab.a [type=int] - │ └── variable: ab.b [type=int] + │ ├── variable: a [type=int] + │ └── variable: b [type=int] └── tuple [type=tuple{tuple{int, int}, tuple{int, int}, tuple{int, int}}] ├── tuple [type=tuple{int, int}] │ ├── const: 1 [type=int] @@ -258,8 +258,8 @@ project └── filters [type=bool] └── in [type=bool] ├── tuple [type=tuple{int, int}] - │ ├── variable: ab.a [type=int] - │ └── variable: ab.b [type=int] + │ ├── variable: a [type=int] + │ └── variable: b [type=int] └── tuple [type=tuple{tuple{int, int}, tuple{int, int}, tuple{int, int}}] ├── tuple [type=tuple{int, int}] │ ├── const: 1 [type=int] diff --git a/pkg/sql/opt/testutils/format.go b/pkg/sql/opt/testutils/format.go index c21f0ee1b253..d0be484dcc8b 100644 --- a/pkg/sql/opt/testutils/format.go +++ b/pkg/sql/opt/testutils/format.go @@ -59,7 +59,7 @@ func fmtInterceptor(f *memo.ExprFmtCtx, tp treeprinter.Node, ev memo.ExprView) b fmtCtx := tree.MakeFmtCtx(f.Buffer, tree.FmtSimple) fmtCtx.WithIndexedVarFormat(func(ctx *tree.FmtCtx, idx int) { fullyQualify := !f.HasFlags(memo.ExprFmtHideQualifications) - label := md.QualifiedColumnLabel(opt.ColumnID(idx+1), fullyQualify, true /* useTable */) + label := md.QualifiedColumnLabel(opt.ColumnID(idx+1), fullyQualify) ctx.WriteString(label) }) expr.Format(&fmtCtx) diff --git a/pkg/sql/opt/xform/testdata/coster/groupby b/pkg/sql/opt/xform/testdata/coster/groupby index 5d04f03f8dbe..1f7ede35469f 100644 --- a/pkg/sql/opt/xform/testdata/coster/groupby +++ b/pkg/sql/opt/xform/testdata/coster/groupby @@ -27,6 +27,6 @@ group-by │ └── fd: (1)-->(2,3) └── aggregations [outer=(1)] ├── max [type=int, outer=(1)] - │ └── variable: a.k [type=int, outer=(1)] + │ └── variable: k [type=int, outer=(1)] └── min [type=int, outer=(1)] - └── variable: a.k [type=int, outer=(1)] + └── variable: k [type=int, outer=(1)] diff --git a/pkg/sql/opt/xform/testdata/coster/join b/pkg/sql/opt/xform/testdata/coster/join index 6aa5c582eb05..980ae4fbcf9e 100644 --- a/pkg/sql/opt/xform/testdata/coster/join +++ b/pkg/sql/opt/xform/testdata/coster/join @@ -49,9 +49,9 @@ project │ │ ├── key: (1) │ │ └── fd: (1)-->(4) │ └── filters [type=bool, outer=(4), constraints=(/4: [/1.0 - /1.0]; tight), fd=()-->(4)] - │ └── a.d = 1.0 [type=bool, outer=(4), constraints=(/4: [/1.0 - /1.0]; tight)] + │ └── d = 1.0 [type=bool, outer=(4), constraints=(/4: [/1.0 - /1.0]; tight)] └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - └── a.k = b.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── k = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] exec-ddl CREATE TABLE abc (a INT PRIMARY KEY, b INT, c INT, INDEX c_idx (c)) diff --git a/pkg/sql/opt/xform/testdata/coster/project b/pkg/sql/opt/xform/testdata/coster/project index 24b1dbf4d93d..fd99fc2905df 100644 --- a/pkg/sql/opt/xform/testdata/coster/project +++ b/pkg/sql/opt/xform/testdata/coster/project @@ -25,7 +25,7 @@ project │ ├── key: (1) │ └── fd: (1)-->(2,3) └── projections [outer=(1-3)] - └── a.s || 'foo' [type=string, outer=(3)] + └── s || 'foo' [type=string, outer=(3)] opt SELECT k, k+2, i*d FROM a @@ -43,5 +43,5 @@ project │ ├── key: (1) │ └── fd: (1)-->(2,4) └── projections [outer=(1,2,4)] - ├── a.k + 2 [type=int, outer=(1)] - └── a.i * a.d [type=decimal, outer=(2,4)] + ├── k + 2 [type=int, outer=(1)] + └── i * d [type=decimal, outer=(2,4)] diff --git a/pkg/sql/opt/xform/testdata/coster/select b/pkg/sql/opt/xform/testdata/coster/select index 038c448f9e98..e6e8686b1cf2 100644 --- a/pkg/sql/opt/xform/testdata/coster/select +++ b/pkg/sql/opt/xform/testdata/coster/select @@ -25,4 +25,4 @@ select │ ├── key: (1) │ └── fd: (1)-->(3) └── filters [type=bool, outer=(3), constraints=(/3: [/'foo' - ]; tight)] - └── a.s >= 'foo' [type=bool, outer=(3), constraints=(/3: [/'foo' - ]; tight)] + └── s >= 'foo' [type=bool, outer=(3), constraints=(/3: [/'foo' - ]; tight)] diff --git a/pkg/sql/opt/xform/testdata/coster/virtual-scan b/pkg/sql/opt/xform/testdata/coster/virtual-scan index 4c56810030f1..b25356634ced 100644 --- a/pkg/sql/opt/xform/testdata/coster/virtual-scan +++ b/pkg/sql/opt/xform/testdata/coster/virtual-scan @@ -25,4 +25,4 @@ select │ ├── stats: [rows=1000, distinct(2)=700] │ └── cost: 10 └── filters [type=bool, outer=(2), constraints=(/2: [/'public' - /'public']; tight), fd=()-->(2)] - └── schemata.schema_name = 'public' [type=bool, outer=(2), constraints=(/2: [/'public' - /'public']; tight)] + └── schema_name = 'public' [type=bool, outer=(2), constraints=(/2: [/'public' - /'public']; tight)] diff --git a/pkg/sql/opt/xform/testdata/external/activerecord b/pkg/sql/opt/xform/testdata/external/activerecord index 73b7a5763576..9b5caff02dc0 100644 --- a/pkg/sql/opt/xform/testdata/external/activerecord +++ b/pkg/sql/opt/xform/testdata/external/activerecord @@ -224,7 +224,7 @@ sort │ │ │ ├── key: (36) │ │ │ └── fd: (36)-->(63) │ │ └── filters [type=bool, outer=(29,63), constraints=(/29: (/NULL - ]; /63: (/NULL - ])] - │ │ └── pg_collation.oid != pg_type.typcollation [type=bool, outer=(29,63), constraints=(/29: (/NULL - ]; /63: (/NULL - ])] + │ │ └── pg_collation.oid != typcollation [type=bool, outer=(29,63), constraints=(/29: (/NULL - ]; /63: (/NULL - ])] │ ├── left-join (lookup pg_attrdef) │ │ ├── columns: attrelid:1(oid!null) attname:2(string!null) atttypid:3(oid!null) attnum:6(int!null) atttypmod:9(int!null) attnotnull:13(bool!null) attisdropped:15(bool!null) attcollation:18(oid!null) adrelid:23(oid) adnum:24(int) adbin:25(string) │ │ ├── key columns: [22] = [22] @@ -244,20 +244,20 @@ sort │ │ │ │ │ ├── key: (1,6) │ │ │ │ │ └── fd: (1,6)-->(2,3,9,13,15,18), (1,2)-->(3,6,9,13,15,18) │ │ │ │ └── filters [type=bool, outer=(1,6,15), constraints=(/1: (/NULL - ]; /6: [/1 - ]; /15: [/false - /false]), fd=()-->(15)] - │ │ │ │ ├── pg_attribute.attrelid = '"numbers"'::REGCLASS [type=bool, outer=(1), constraints=(/1: (/NULL - ])] - │ │ │ │ ├── pg_attribute.attnum > 0 [type=bool, outer=(6), constraints=(/6: [/1 - ]; tight)] - │ │ │ │ └── NOT pg_attribute.attisdropped [type=bool, outer=(15), constraints=(/15: [/false - /false]; tight)] + │ │ │ │ ├── attrelid = '"numbers"'::REGCLASS [type=bool, outer=(1), constraints=(/1: (/NULL - ])] + │ │ │ │ ├── attnum > 0 [type=bool, outer=(6), constraints=(/6: [/1 - ]; tight)] + │ │ │ │ └── NOT attisdropped [type=bool, outer=(15), constraints=(/15: [/false - /false]; tight)] │ │ │ └── filters [type=bool, outer=(1,6,23,24), constraints=(/1: (/NULL - ]; /6: (/NULL - ]; /23: (/NULL - ]; /24: [/1 - ]), fd=(1)==(23), (23)==(1), (6)==(24), (24)==(6)] - │ │ │ ├── pg_attribute.attrelid = pg_attrdef.adrelid [type=bool, outer=(1,23), constraints=(/1: (/NULL - ]; /23: (/NULL - ])] - │ │ │ ├── pg_attribute.attnum = pg_attrdef.adnum [type=bool, outer=(6,24), constraints=(/6: (/NULL - ]; /24: (/NULL - ])] - │ │ │ ├── pg_attrdef.adrelid = '"numbers"'::REGCLASS [type=bool, outer=(23), constraints=(/23: (/NULL - ])] - │ │ │ └── pg_attrdef.adnum > 0 [type=bool, outer=(24), constraints=(/24: [/1 - ]; tight)] + │ │ │ ├── attrelid = adrelid [type=bool, outer=(1,23), constraints=(/1: (/NULL - ]; /23: (/NULL - ])] + │ │ │ ├── attnum = adnum [type=bool, outer=(6,24), constraints=(/6: (/NULL - ]; /24: (/NULL - ])] + │ │ │ ├── adrelid = '"numbers"'::REGCLASS [type=bool, outer=(23), constraints=(/23: (/NULL - ])] + │ │ │ └── adnum > 0 [type=bool, outer=(24), constraints=(/24: [/1 - ]; tight)] │ │ └── true [type=bool] │ └── filters [type=bool, outer=(3,18,29,36), constraints=(/3: (/NULL - ]; /18: (/NULL - ]; /29: (/NULL - ]; /36: (/NULL - ]), fd=(18)==(29), (29)==(18), (3)==(36), (36)==(3)] - │ ├── pg_collation.oid = pg_attribute.attcollation [type=bool, outer=(18,29), constraints=(/18: (/NULL - ]; /29: (/NULL - ])] - │ └── pg_type.oid = pg_attribute.atttypid [type=bool, outer=(3,36), constraints=(/3: (/NULL - ]; /36: (/NULL - ])] + │ ├── pg_collation.oid = attcollation [type=bool, outer=(18,29), constraints=(/18: (/NULL - ]; /29: (/NULL - ])] + │ └── pg_type.oid = atttypid [type=bool, outer=(3,36), constraints=(/3: (/NULL - ]; /36: (/NULL - ])] └── projections [outer=(1-3,6,9,13,23,25,30)] - ├── format_type(pg_attribute.atttypid, pg_attribute.atttypmod) [type=string, outer=(3,9)] - ├── pg_get_expr(pg_attrdef.adbin, pg_attrdef.adrelid) [type=string, outer=(23,25)] + ├── format_type(atttypid, atttypmod) [type=string, outer=(3,9)] + ├── pg_get_expr(adbin, adrelid) [type=string, outer=(23,25)] ├── variable: pg_collation.collname [type=string, outer=(30)] - └── col_description(pg_attribute.attrelid, pg_attribute.attnum) [type=string, outer=(1,6)] + └── col_description(attrelid, attnum) [type=string, outer=(1,6)] diff --git a/pkg/sql/opt/xform/testdata/external/hibernate b/pkg/sql/opt/xform/testdata/external/hibernate index c97acc8e13b6..832d3deb207a 100644 --- a/pkg/sql/opt/xform/testdata/external/hibernate +++ b/pkg/sql/opt/xform/testdata/external/hibernate @@ -92,9 +92,9 @@ project │ │ │ ├── key: (2) │ │ │ └── fd: ()-->(1) │ │ └── filters [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ]), fd=(2)==(3), (3)==(2)] - │ │ └── phone_register.person_id = phone.id [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] + │ │ └── person_id = phone.id [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - │ └── phone.id = phone_register.person_id [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ └── phone.id = person_id [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] └── projections [outer=(1-6,9)] └── variable: phone.since [type=timestamp, outer=(9)] @@ -255,7 +255,7 @@ inner-join │ │ │ ├── key: (15) │ │ │ └── fd: (15)-->(18) │ │ └── filters [type=bool, outer=(1,18), constraints=(/1: (/NULL - ]; /18: (/NULL - ]), fd=(1)==(18), (18)==(1)] - │ │ └── phone.id = phone_call.phone_id [type=bool, outer=(1,18), constraints=(/1: (/NULL - ]; /18: (/NULL - ])] + │ │ └── phone.id = phone_id [type=bool, outer=(1,18), constraints=(/1: (/NULL - ]; /18: (/NULL - ])] │ ├── scan person │ │ ├── columns: person.id:6(int!null) address:7(string) createdon:8(timestamp) name:9(string) nickname:10(string) version:11(int!null) │ │ ├── key: (6) @@ -316,7 +316,7 @@ project │ │ │ ├── key: (15) │ │ │ └── fd: (15)-->(18) │ │ └── filters [type=bool, outer=(1,18), constraints=(/1: (/NULL - ]; /18: (/NULL - ]), fd=(1)==(18), (18)==(1)] - │ │ └── phone.id = phone_call.phone_id [type=bool, outer=(1,18), constraints=(/1: (/NULL - ]; /18: (/NULL - ])] + │ │ └── phone.id = phone_id [type=bool, outer=(1,18), constraints=(/1: (/NULL - ]; /18: (/NULL - ])] │ ├── scan person │ │ ├── columns: person.id:6(int!null) │ │ └── key: (6) @@ -376,13 +376,13 @@ inner-join │ │ │ ├── key: (1) │ │ │ └── fd: (1)-->(2-6) │ │ └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - │ │ └── person.address = $1 [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + │ │ └── address = $1 [type=bool, outer=(2), constraints=(/2: (/NULL - ])] │ ├── scan phone │ │ ├── columns: phone.id:10(int!null) person_id:13(int) │ │ ├── key: (10) │ │ └── fd: (10)-->(13) │ └── filters [type=bool, outer=(1,13), constraints=(/1: (/NULL - ]; /13: (/NULL - ]), fd=(1)==(13), (13)==(1)] - │ └── person.id = phone.person_id [type=bool, outer=(1,13), constraints=(/1: (/NULL - ]; /13: (/NULL - ])] + │ └── person.id = person_id [type=bool, outer=(1,13), constraints=(/1: (/NULL - ]; /13: (/NULL - ])] ├── select │ ├── columns: partner.id:7(int!null) partner.name:8(string!null) partner.version:9(int!null) │ ├── key: (7) @@ -800,18 +800,18 @@ distinct-on │ │ ├── key: (10) │ │ └── fd: (10)-->(11-15) │ └── filters [type=bool, outer=(4,10), constraints=(/4: (/NULL - ]; /10: (/NULL - ]), fd=(4)==(10), (10)==(4)] - │ └── phone.person_id = person.id [type=bool, outer=(4,10), constraints=(/4: (/NULL - ]; /10: (/NULL - ])] + │ └── person_id = person.id [type=bool, outer=(4,10), constraints=(/4: (/NULL - ]; /10: (/NULL - ])] └── aggregations [outer=(11-15)] ├── const-agg [type=string, outer=(11)] - │ └── variable: person.address [type=string, outer=(11)] + │ └── variable: address [type=string, outer=(11)] ├── const-agg [type=timestamp, outer=(12)] - │ └── variable: person.createdon [type=timestamp, outer=(12)] + │ └── variable: createdon [type=timestamp, outer=(12)] ├── const-agg [type=string, outer=(13)] - │ └── variable: person.name [type=string, outer=(13)] + │ └── variable: name [type=string, outer=(13)] ├── const-agg [type=string, outer=(14)] - │ └── variable: person.nickname [type=string, outer=(14)] + │ └── variable: nickname [type=string, outer=(14)] └── const-agg [type=int, outer=(15)] - └── variable: person.version [type=int, outer=(15)] + └── variable: version [type=int, outer=(15)] opt select @@ -857,16 +857,16 @@ project │ │ │ ├── key: (6) │ │ │ └── fd: (6)-->(9) │ │ └── filters [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ]), fd=(1)==(9), (9)==(1)] - │ │ └── phone.id = phone_call.phone_id [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ])] + │ │ └── phone.id = phone_id [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ])] │ └── aggregations [outer=(2-4,6)] │ ├── max [type=int, outer=(6)] │ │ └── variable: phone_call.id [type=int, outer=(6)] │ ├── const-agg [type=string, outer=(2)] - │ │ └── variable: phone.phone_number [type=string, outer=(2)] + │ │ └── variable: phone_number [type=string, outer=(2)] │ ├── const-agg [type=string, outer=(3)] - │ │ └── variable: phone.phone_type [type=string, outer=(3)] + │ │ └── variable: phone_type [type=string, outer=(3)] │ └── const-agg [type=int, outer=(4)] - │ └── variable: phone.person_id [type=int, outer=(4)] + │ └── variable: person_id [type=int, outer=(4)] └── filters [type=bool, outer=(10), constraints=(/10: (/NULL - ])] └── max = $1 [type=bool, outer=(10), constraints=(/10: (/NULL - ])] @@ -913,20 +913,20 @@ project │ │ ├── scan phone │ │ │ └── columns: person_id:10(int) │ │ └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - │ │ └── person.id = phone.person_id [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + │ │ └── person.id = person_id [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] │ └── aggregations [outer=(2-6,10)] │ ├── count [type=int, outer=(10)] - │ │ └── variable: phone.person_id [type=int, outer=(10)] + │ │ └── variable: person_id [type=int, outer=(10)] │ ├── const-agg [type=string, outer=(2)] - │ │ └── variable: person.address [type=string, outer=(2)] + │ │ └── variable: address [type=string, outer=(2)] │ ├── const-agg [type=timestamp, outer=(3)] - │ │ └── variable: person.createdon [type=timestamp, outer=(3)] + │ │ └── variable: createdon [type=timestamp, outer=(3)] │ ├── const-agg [type=string, outer=(4)] - │ │ └── variable: person.name [type=string, outer=(4)] + │ │ └── variable: name [type=string, outer=(4)] │ ├── const-agg [type=string, outer=(5)] - │ │ └── variable: person.nickname [type=string, outer=(5)] + │ │ └── variable: nickname [type=string, outer=(5)] │ └── const-agg [type=int, outer=(6)] - │ └── variable: person.version [type=int, outer=(6)] + │ └── variable: version [type=int, outer=(6)] └── filters [type=bool, outer=(12), constraints=(/12: [/2 - /2]; tight), fd=()-->(12)] └── count = 2 [type=bool, outer=(12), constraints=(/12: [/2 - /2]; tight)] @@ -974,16 +974,16 @@ project │ │ │ ├── key: (6) │ │ │ └── fd: (6)-->(9) │ │ └── filters [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ]), fd=(1)==(9), (9)==(1)] - │ │ └── phone.id = phone_call.phone_id [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ])] + │ │ └── phone.id = phone_id [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ])] │ └── aggregations [outer=(2-4,6)] │ ├── min [type=int, outer=(6)] │ │ └── variable: phone_call.id [type=int, outer=(6)] │ ├── const-agg [type=string, outer=(2)] - │ │ └── variable: phone.phone_number [type=string, outer=(2)] + │ │ └── variable: phone_number [type=string, outer=(2)] │ ├── const-agg [type=string, outer=(3)] - │ │ └── variable: phone.phone_type [type=string, outer=(3)] + │ │ └── variable: phone_type [type=string, outer=(3)] │ └── const-agg [type=int, outer=(4)] - │ └── variable: phone.person_id [type=int, outer=(4)] + │ └── variable: person_id [type=int, outer=(4)] └── filters [type=bool, outer=(10), constraints=(/10: (/NULL - ])] └── min = $1 [type=bool, outer=(10), constraints=(/10: (/NULL - ])] @@ -1032,22 +1032,22 @@ project │ │ │ ├── scan phone │ │ │ │ └── columns: person_id:10(int) order_id:11(int) │ │ │ └── filters [type=bool, outer=(11), constraints=(/11: (/NULL - ]; tight)] - │ │ │ └── phone.order_id IS NOT NULL [type=bool, outer=(11), constraints=(/11: (/NULL - ]; tight)] + │ │ │ └── order_id IS NOT NULL [type=bool, outer=(11), constraints=(/11: (/NULL - ]; tight)] │ │ └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - │ │ └── person.id = phone.person_id [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + │ │ └── person.id = person_id [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] │ └── aggregations [outer=(2-6,11)] │ ├── max [type=int, outer=(11)] - │ │ └── variable: phone.order_id [type=int, outer=(11)] + │ │ └── variable: order_id [type=int, outer=(11)] │ ├── const-agg [type=string, outer=(2)] - │ │ └── variable: person.address [type=string, outer=(2)] + │ │ └── variable: address [type=string, outer=(2)] │ ├── const-agg [type=timestamp, outer=(3)] - │ │ └── variable: person.createdon [type=timestamp, outer=(3)] + │ │ └── variable: createdon [type=timestamp, outer=(3)] │ ├── const-agg [type=string, outer=(4)] - │ │ └── variable: person.name [type=string, outer=(4)] + │ │ └── variable: name [type=string, outer=(4)] │ ├── const-agg [type=string, outer=(5)] - │ │ └── variable: person.nickname [type=string, outer=(5)] + │ │ └── variable: nickname [type=string, outer=(5)] │ └── const-agg [type=int, outer=(6)] - │ └── variable: person.version [type=int, outer=(6)] + │ └── variable: version [type=int, outer=(6)] └── filters [type=bool, outer=(12), constraints=(/12: [/0 - /0]; tight), fd=()-->(12)] └── max = 0 [type=bool, outer=(12), constraints=(/12: [/0 - /0]; tight)] @@ -1090,7 +1090,7 @@ semi-join │ └── filters [type=bool, outer=(7), constraints=(/7: (/NULL - ])] │ └── phone.id = $1::INT [type=bool, outer=(7), constraints=(/7: (/NULL - ])] └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - └── person.id = phone.person_id [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + └── person.id = person_id [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] opt select @@ -1131,7 +1131,7 @@ semi-join │ └── filters [type=bool, outer=(7), constraints=(/7: (/NULL - ])] │ └── phone.id = $1::INT [type=bool, outer=(7), constraints=(/7: (/NULL - ])] └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - └── person.id = phone.person_id [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + └── person.id = person_id [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] opt select @@ -1166,7 +1166,7 @@ semi-join │ ├── key: (7) │ └── fd: (7)-->(10) └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - └── person.id = phone.person_id [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + └── person.id = person_id [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] opt select @@ -1199,9 +1199,9 @@ anti-join │ ├── scan phone_repairtimestamps │ │ └── columns: phone_id:6(int!null) repairtimestamps:7(timestamp) │ └── filters [type=bool, outer=(7)] - │ └── (phone_repairtimestamps.repairtimestamps >= $1::DATE) IS NOT false [type=bool, outer=(7)] + │ └── (repairtimestamps >= $1::DATE) IS NOT false [type=bool, outer=(7)] └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - └── phone.id = phone_repairtimestamps.phone_id [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── id = phone_id [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] opt select @@ -1242,12 +1242,12 @@ semi-join (merge) │ ├── scan phone │ │ └── columns: person_id:10(int) order_id:11(int) │ └── filters [type=bool, outer=(11), constraints=(/11: [/1 - /1]; tight), fd=()-->(11)] - │ └── phone.order_id = 1 [type=bool, outer=(11), constraints=(/11: [/1 - /1]; tight)] + │ └── order_id = 1 [type=bool, outer=(11), constraints=(/11: [/1 - /1]; tight)] └── merge-on ├── left ordering: +1 ├── right ordering: +10 └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - └── person.id = phone.person_id [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + └── person.id = person_id [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] opt select @@ -1319,15 +1319,15 @@ project │ ├── const-agg [type=int, outer=(11)] │ │ └── variable: phone.order_id [type=int, outer=(11)] │ ├── const-agg [type=string, outer=(2)] - │ │ └── variable: person.address [type=string, outer=(2)] + │ │ └── variable: address [type=string, outer=(2)] │ ├── const-agg [type=timestamp, outer=(3)] - │ │ └── variable: person.createdon [type=timestamp, outer=(3)] + │ │ └── variable: createdon [type=timestamp, outer=(3)] │ ├── const-agg [type=string, outer=(4)] - │ │ └── variable: person.name [type=string, outer=(4)] + │ │ └── variable: name [type=string, outer=(4)] │ ├── const-agg [type=string, outer=(5)] - │ │ └── variable: person.nickname [type=string, outer=(5)] + │ │ └── variable: nickname [type=string, outer=(5)] │ ├── const-agg [type=int, outer=(6)] - │ │ └── variable: person.version [type=int, outer=(6)] + │ │ └── variable: version [type=int, outer=(6)] │ └── const-agg [type=int, outer=(1)] │ └── variable: person.id [type=int, outer=(1)] └── filters [type=bool, outer=(11,17), constraints=(/11: (/NULL - ]; /17: (/NULL - ]), fd=(11)==(17), (17)==(11)] @@ -1364,7 +1364,7 @@ anti-join │ ├── key: (7) │ └── fd: (7)-->(10) └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - └── person.id = phone.person_id [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + └── person.id = person_id [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] opt select @@ -1399,7 +1399,7 @@ semi-join │ ├── key: (7) │ └── fd: (7)-->(10) └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - └── person.id = phone.person_id [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + └── person.id = person_id [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] opt select @@ -1430,7 +1430,7 @@ anti-join │ ├── key: (6) │ └── fd: (6)-->(9) └── filters [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ]), fd=(1)==(9), (9)==(1)] - └── phone.id = phone_call.phone_id [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ])] + └── phone.id = phone_id [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ])] opt select @@ -1469,12 +1469,12 @@ semi-join (merge) │ │ ├── columns: person_id:7(int!null) addresses:8(string) │ │ └── ordering: +7 opt(8) │ └── filters [type=bool, outer=(8), constraints=(/8: [/'Home address' - /'Home address']; tight), fd=()-->(8)] - │ └── person_addresses.addresses = 'Home address' [type=bool, outer=(8), constraints=(/8: [/'Home address' - /'Home address']; tight)] + │ └── addresses = 'Home address' [type=bool, outer=(8), constraints=(/8: [/'Home address' - /'Home address']; tight)] └── merge-on ├── left ordering: +1 ├── right ordering: +7 └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - └── person.id = person_addresses.person_id [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + └── id = person_id [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] opt select @@ -1512,12 +1512,12 @@ anti-join (merge) │ │ ├── columns: person_id:7(int!null) addresses:8(string) │ │ └── ordering: +7 │ └── filters [type=bool, outer=(8)] - │ └── (person_addresses.addresses = 'Home address') IS NOT false [type=bool, outer=(8)] + │ └── (addresses = 'Home address') IS NOT false [type=bool, outer=(8)] └── merge-on ├── left ordering: +1 ├── right ordering: +7 └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - └── person.id = person_addresses.person_id [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + └── id = person_id [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] exec-ddl drop table Phone, phone_call, Person, Phone_repairTimestamps, Person_addresses; @@ -1594,14 +1594,14 @@ project │ │ ├── scan employee_phones │ │ │ └── columns: employee_id:4(int!null) │ │ └── filters [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ]), fd=(1)==(4), (4)==(1)] - │ │ └── employee.id = employee_phones.employee_id [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ])] + │ │ └── id = employee_id [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ])] │ └── aggregations [outer=(2-4)] │ ├── count [type=int, outer=(4)] - │ │ └── variable: employee_phones.employee_id [type=int, outer=(4)] + │ │ └── variable: employee_id [type=int, outer=(4)] │ ├── const-agg [type=string, outer=(2)] - │ │ └── variable: employee.email [type=string, outer=(2)] + │ │ └── variable: email [type=string, outer=(2)] │ └── const-agg [type=int, outer=(3)] - │ └── variable: employee.currentproject_id [type=int, outer=(3)] + │ └── variable: currentproject_id [type=int, outer=(3)] └── filters [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight), fd=()-->(7)] └── count = 1 [type=bool, outer=(7), constraints=(/7: [/1 - /1]; tight)] @@ -1749,15 +1749,15 @@ left-join │ │ │ ├── columns: company_id:6(int!null) employees_id:7(int!null) │ │ │ └── key: (6,7) │ │ └── filters [type=bool, outer=(7,12), constraints=(/7: (/NULL - ]; /12: (/NULL - ]), fd=(7)==(12), (12)==(7)] - │ │ └── company_employee.employees_id = id [type=bool, outer=(7,12), constraints=(/7: (/NULL - ]; /12: (/NULL - ])] + │ │ └── employees_id = id [type=bool, outer=(7,12), constraints=(/7: (/NULL - ]; /12: (/NULL - ])] │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ └── company.id = company_employee.company_id [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ └── company.id = company_id [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] ├── scan location │ ├── columns: location.id:3(int!null) address:4(string) zip:5(int!null) │ ├── key: (3) │ └── fd: (3)-->(4,5) └── filters [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ]), fd=(2)==(3), (3)==(2)] - └── company.location_id = location.id [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] + └── location_id = location.id [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] exec-ddl drop table Company, Company_Employee, Employee, Manager, Location; @@ -1850,9 +1850,9 @@ project │ │ │ ├── key: (2) │ │ │ └── fd: ()-->(1) │ │ └── filters [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ]), fd=(2)==(3), (3)==(2)] - │ │ └── newspaper_news.news_news_id = news.news_id [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] + │ │ └── news_news_id = news.news_id [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] │ └── filters [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ]), fd=(2)==(6), (6)==(2)] - │ └── news.news_id = newspaper_news.news_news_id [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + │ └── news.news_id = news_news_id [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] └── projections [outer=(1-5,8)] └── variable: news.title [type=string, outer=(8)] @@ -1960,13 +1960,13 @@ project │ │ │ │ │ ├── key: (2) │ │ │ │ │ └── fd: ()-->(1) │ │ │ │ └── filters [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ]), fd=(2)==(3), (3)==(2)] - │ │ │ │ └── generationuser_generationgroup.ref_id = generationgroup.id [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] + │ │ │ │ └── ref_id = generationgroup.id [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] │ │ │ └── filters [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ]), fd=(2)==(7), (7)==(2)] - │ │ │ └── generationgroup.id = generationuser_generationgroup.ref_id [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] + │ │ │ └── generationgroup.id = ref_id [type=bool, outer=(2,7), constraints=(/2: (/NULL - ]; /7: (/NULL - ])] │ │ └── filters [type=bool, outer=(2,12), constraints=(/2: (/NULL - ]; /12: (/NULL - ]), fd=(2)==(12), (12)==(2)] - │ │ └── generationgroup.id = generationuser_generationgroup.ref_id [type=bool, outer=(2,12), constraints=(/2: (/NULL - ]; /12: (/NULL - ])] + │ │ └── generationgroup.id = ref_id [type=bool, outer=(2,12), constraints=(/2: (/NULL - ]; /12: (/NULL - ])] │ └── filters [type=bool, outer=(2,17), constraints=(/2: (/NULL - ]; /17: (/NULL - ]), fd=(2)==(17), (17)==(2)] - │ └── generationgroup.id = generationuser_generationgroup.ref_id [type=bool, outer=(2,17), constraints=(/2: (/NULL - ]; /17: (/NULL - ])] + │ └── generationgroup.id = ref_id [type=bool, outer=(2,17), constraints=(/2: (/NULL - ]; /17: (/NULL - ])] └── projections [outer=(1-6,8,14,20)] ├── variable: generationgroup.age [type=string, outer=(8)] ├── variable: generationgroup.culture [type=string, outer=(14)] @@ -2061,18 +2061,18 @@ project │ │ │ │ ├── key: (1) │ │ │ │ └── fd: (1)-->(2-4) │ │ │ └── filters [type=bool, outer=(4), constraints=(/4: (/NULL - ])] - │ │ │ └── tbid2.auctionid = $1 [type=bool, outer=(4), constraints=(/4: (/NULL - ])] + │ │ │ └── auctionid = $1 [type=bool, outer=(4), constraints=(/4: (/NULL - ])] │ │ └── filters [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)] - │ │ └── tauction2.successfulbid = tbid2.id [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ])] + │ │ └── successfulbid = tbid2.id [type=bool, outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ])] │ └── aggregations [outer=(2-4,10)] │ ├── const-not-null-agg [type=bool, outer=(10)] │ │ └── variable: true [type=bool, outer=(10)] │ ├── const-agg [type=decimal, outer=(2)] - │ │ └── variable: tbid2.amount [type=decimal, outer=(2)] + │ │ └── variable: amount [type=decimal, outer=(2)] │ ├── const-agg [type=timestamp, outer=(3)] - │ │ └── variable: tbid2.createddatetime [type=timestamp, outer=(3)] + │ │ └── variable: createddatetime [type=timestamp, outer=(3)] │ └── const-agg [type=int, outer=(4)] - │ └── variable: tbid2.auctionid [type=int, outer=(4)] + │ └── variable: auctionid [type=int, outer=(4)] └── projections [outer=(1-4,11)] └── true_agg IS NOT NULL [type=bool, outer=(11)] @@ -2212,7 +2212,7 @@ project │ │ │ │ └── filters [type=bool, outer=(10,12), constraints=(/10: (/NULL - ]; /12: (/NULL - ]), fd=(10)==(12), (12)==(10)] │ │ │ │ └── lineitem.productid = product.productid [type=bool, outer=(10,12), constraints=(/10: (/NULL - ]; /12: (/NULL - ])] │ │ │ └── projections [outer=(8,9,11,14)] - │ │ │ └── lineitem.quantity * product.cost [type=decimal, outer=(11,14)] + │ │ │ └── lineitem.quantity * cost [type=decimal, outer=(11,14)] │ │ ├── left-join (merge) │ │ │ ├── columns: customerorder.customerid:1(string!null) customerorder.ordernumber:2(int!null) orderdate:3(date!null) lineitem.customerid:4(string) lineitem.ordernumber:5(int) lineitem.productid:6(string) lineitem.quantity:7(int) │ │ │ ├── key: (6) @@ -2245,7 +2245,7 @@ project │ ├── const-agg [type=int, outer=(2)] │ │ └── variable: customerorder.ordernumber [type=int, outer=(2)] │ ├── const-agg [type=date, outer=(3)] - │ │ └── variable: customerorder.orderdate [type=date, outer=(3)] + │ │ └── variable: orderdate [type=date, outer=(3)] │ ├── const-agg [type=string, outer=(4)] │ │ └── variable: lineitem.customerid [type=string, outer=(4)] │ ├── const-agg [type=int, outer=(5)] @@ -2392,11 +2392,11 @@ project │ │ │ ├── sum [type=decimal, outer=(23)] │ │ │ │ └── variable: column23 [type=decimal, outer=(23)] │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ └── variable: customer.name [type=string, outer=(2)] + │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ ├── const-agg [type=string, outer=(3)] - │ │ │ │ └── variable: customer.address [type=string, outer=(3)] + │ │ │ │ └── variable: address [type=string, outer=(3)] │ │ │ ├── const-agg [type=date, outer=(6)] - │ │ │ │ └── variable: customerorder.orderdate [type=date, outer=(6)] + │ │ │ │ └── variable: orderdate [type=date, outer=(6)] │ │ │ ├── const-agg [type=int, outer=(10)] │ │ │ │ └── variable: lineitem.quantity [type=int, outer=(10)] │ │ │ ├── const-agg [type=string, outer=(12)] @@ -2413,11 +2413,11 @@ project │ ├── sum [type=decimal, outer=(29)] │ │ └── variable: lineitem.quantity [type=int, outer=(29)] │ ├── const-agg [type=string, outer=(2)] - │ │ └── variable: customer.name [type=string, outer=(2)] + │ │ └── variable: name [type=string, outer=(2)] │ ├── const-agg [type=string, outer=(3)] - │ │ └── variable: customer.address [type=string, outer=(3)] + │ │ └── variable: address [type=string, outer=(3)] │ ├── const-agg [type=date, outer=(6)] - │ │ └── variable: customerorder.orderdate [type=date, outer=(6)] + │ │ └── variable: orderdate [type=date, outer=(6)] │ ├── const-agg [type=int, outer=(10)] │ │ └── variable: lineitem.quantity [type=int, outer=(10)] │ ├── const-agg [type=string, outer=(12)] @@ -2493,7 +2493,7 @@ project │ │ │ │ └── filters [type=bool, outer=(10,12), constraints=(/10: (/NULL - ]; /12: (/NULL - ]), fd=(10)==(12), (12)==(10)] │ │ │ │ └── lineitem.productid = product.productid [type=bool, outer=(10,12), constraints=(/10: (/NULL - ]; /12: (/NULL - ])] │ │ │ └── projections [outer=(8,9,11,14)] - │ │ │ └── lineitem.quantity * product.cost [type=decimal, outer=(11,14)] + │ │ │ └── lineitem.quantity * cost [type=decimal, outer=(11,14)] │ │ ├── left-join (merge) │ │ │ ├── columns: customerorder.customerid:1(string!null) customerorder.ordernumber:2(int!null) orderdate:3(date!null) lineitem.customerid:4(string) lineitem.ordernumber:5(int) lineitem.productid:6(string) lineitem.quantity:7(int) │ │ │ ├── key: (6) @@ -2526,7 +2526,7 @@ project │ ├── const-agg [type=int, outer=(2)] │ │ └── variable: customerorder.ordernumber [type=int, outer=(2)] │ ├── const-agg [type=date, outer=(3)] - │ │ └── variable: customerorder.orderdate [type=date, outer=(3)] + │ │ └── variable: orderdate [type=date, outer=(3)] │ ├── const-agg [type=string, outer=(4)] │ │ └── variable: lineitem.customerid [type=string, outer=(4)] │ ├── const-agg [type=int, outer=(5)] @@ -2588,7 +2588,7 @@ project │ │ │ │ └── filters [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ]), fd=(6)==(8), (8)==(6)] │ │ │ │ └── lineitem.productid = product.productid [type=bool, outer=(6,8), constraints=(/6: (/NULL - ]; /8: (/NULL - ])] │ │ │ └── projections [outer=(4,5,7,10)] - │ │ │ └── lineitem.quantity * product.cost [type=decimal, outer=(7,10)] + │ │ │ └── quantity * cost [type=decimal, outer=(7,10)] │ │ └── filters [type=bool, outer=(1,2,4,5), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /4: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(4), (4)==(1), (2)==(5), (5)==(2)] │ │ ├── lineitem.customerid = customerorder.customerid [type=bool, outer=(1,4), constraints=(/1: (/NULL - ]; /4: (/NULL - ])] │ │ └── lineitem.ordernumber = customerorder.ordernumber [type=bool, outer=(2,5), constraints=(/2: (/NULL - ]; /5: (/NULL - ])] @@ -2596,7 +2596,7 @@ project │ ├── sum [type=decimal, outer=(12)] │ │ └── variable: column12 [type=decimal, outer=(12)] │ └── const-agg [type=date, outer=(3)] - │ └── variable: customerorder.orderdate [type=date, outer=(3)] + │ └── variable: orderdate [type=date, outer=(3)] └── projections [outer=(1-3,13)] └── variable: sum [type=decimal, outer=(13)] @@ -2704,31 +2704,31 @@ group-by │ │ │ │ ├── key: (1) │ │ │ │ └── fd: (1)-->(2-5) │ │ │ └── filters [type=bool, outer=(5,11), constraints=(/5: (/NULL - ]; /11: (/NULL - ]), fd=(5)==(11), (11)==(5)] - │ │ │ └── student.preferredcoursecode = enrolment.coursecode [type=bool, outer=(5,11), constraints=(/5: (/NULL - ]; /11: (/NULL - ])] + │ │ │ └── preferredcoursecode = enrolment.coursecode [type=bool, outer=(5,11), constraints=(/5: (/NULL - ]; /11: (/NULL - ])] │ │ └── aggregations [outer=(2-5,9,13)] │ │ ├── max [type=int, outer=(13)] │ │ │ └── variable: enrolment.year [type=int, outer=(13)] │ │ ├── const-agg [type=int, outer=(9)] │ │ │ └── variable: enrolment.year [type=int, outer=(9)] │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ └── variable: student.name [type=string, outer=(2)] + │ │ │ └── variable: name [type=string, outer=(2)] │ │ ├── const-agg [type=string, outer=(3)] - │ │ │ └── variable: student.address_city [type=string, outer=(3)] + │ │ │ └── variable: address_city [type=string, outer=(3)] │ │ ├── const-agg [type=string, outer=(4)] - │ │ │ └── variable: student.address_state [type=string, outer=(4)] + │ │ │ └── variable: address_state [type=string, outer=(4)] │ │ └── const-agg [type=string, outer=(5)] - │ │ └── variable: student.preferredcoursecode [type=string, outer=(5)] + │ │ └── variable: preferredcoursecode [type=string, outer=(5)] │ └── filters [type=bool, outer=(9,14), constraints=(/9: (/NULL - ]; /14: (/NULL - ]), fd=(9)==(14), (14)==(9)] │ └── enrolment.year = y0_ [type=bool, outer=(9,14), constraints=(/9: (/NULL - ]; /14: (/NULL - ])] └── aggregations [outer=(2-5)] ├── const-agg [type=string, outer=(2)] - │ └── variable: student.name [type=string, outer=(2)] + │ └── variable: name [type=string, outer=(2)] ├── const-agg [type=string, outer=(3)] - │ └── variable: student.address_city [type=string, outer=(3)] + │ └── variable: address_city [type=string, outer=(3)] ├── const-agg [type=string, outer=(4)] - │ └── variable: student.address_state [type=string, outer=(4)] + │ └── variable: address_state [type=string, outer=(4)] └── const-agg [type=string, outer=(5)] - └── variable: student.preferredcoursecode [type=string, outer=(5)] + └── variable: preferredcoursecode [type=string, outer=(5)] exec-ddl drop table student, enrolment diff --git a/pkg/sql/opt/xform/testdata/external/liquibase b/pkg/sql/opt/xform/testdata/external/liquibase index 12f0eb2a20f6..775299212c7d 100644 --- a/pkg/sql/opt/xform/testdata/external/liquibase +++ b/pkg/sql/opt/xform/testdata/external/liquibase @@ -316,7 +316,7 @@ project │ │ │ │ │ │ │ │ ├── key: (72) │ │ │ │ │ │ │ │ └── fd: (72)-->(73,79) │ │ │ │ │ │ │ └── filters [type=bool, outer=(79), constraints=(/79: [/true - /true]; tight), fd=()-->(79)] - │ │ │ │ │ │ │ └── pg_index.indisclustered = true [type=bool, outer=(79), constraints=(/79: [/true - /true]; tight)] + │ │ │ │ │ │ │ └── indisclustered = true [type=bool, outer=(79), constraints=(/79: [/true - /true]; tight)] │ │ │ │ │ │ ├── right-join │ │ │ │ │ │ │ ├── columns: pg_class.oid:1(oid!null) pg_class.relname:2(string!null) pg_class.relnamespace:3(oid!null) pg_class.relowner:5(oid!null) pg_class.reltablespace:8(oid!null) pg_class.reltuples:10(float!null) pg_class.relhasindex:13(bool!null) pg_class.relpersistence:15(string!null) pg_class.relkind:17(string!null) pg_class.relhasoids:20(bool!null) pg_class.relhasrules:22(bool!null) pg_class.relhastriggers:23(bool!null) pg_class.relacl:26(string[]) pg_class.reloptions:27(string[]) pg_namespace.oid:28(oid!null) pg_namespace.nspname:29(string!null) pg_tablespace.oid:32(oid) spcname:33(string) pg_inherits.inhrelid:38(oid) pg_inherits.inhparent:39(oid) pg_class.oid:41(oid) pg_class.relname:42(string) pg_class.relnamespace:43(oid) pg_namespace.oid:68(oid) pg_namespace.nspname:69(string) │ │ │ │ │ │ │ ├── fd: ()-->(3,28,29), (1)-->(2,5,8,10,13,15,17,20,22,23,26,27), (2)-->(1,5,8,10,13,15,17,20,22,23,26,27), (3)==(28), (28)==(3), (32)-->(33), (33)-->(32), (41)-->(42,43), (42,43)-->(41), (39)==(41), (41)==(39), (68)~~>(69), (69)~~>(68) @@ -372,13 +372,13 @@ project │ │ │ │ │ │ │ └── filters [type=bool, outer=(1,38), constraints=(/1: (/NULL - ]; /38: (/NULL - ]), fd=(1)==(38), (38)==(1)] │ │ │ │ │ │ │ └── pg_inherits.inhrelid = pg_class.oid [type=bool, outer=(1,38), constraints=(/1: (/NULL - ]; /38: (/NULL - ])] │ │ │ │ │ │ └── filters [type=bool, outer=(1,73), constraints=(/1: (/NULL - ]; /73: (/NULL - ]), fd=(1)==(73), (73)==(1)] - │ │ │ │ │ │ └── pg_index.indrelid = pg_class.oid [type=bool, outer=(1,73), constraints=(/1: (/NULL - ]; /73: (/NULL - ])] + │ │ │ │ │ │ └── indrelid = pg_class.oid [type=bool, outer=(1,73), constraints=(/1: (/NULL - ]; /73: (/NULL - ])] │ │ │ │ │ └── filters [type=bool, outer=(72,91), constraints=(/72: (/NULL - ]; /91: (/NULL - ]), fd=(72)==(91), (91)==(72)] - │ │ │ │ │ └── pg_class.oid = pg_index.indexrelid [type=bool, outer=(72,91), constraints=(/72: (/NULL - ]; /91: (/NULL - ])] + │ │ │ │ │ └── pg_class.oid = indexrelid [type=bool, outer=(72,91), constraints=(/72: (/NULL - ]; /91: (/NULL - ])] │ │ │ │ └── filters [type=bool, outer=(1,118), constraints=(/1: (/NULL - ]; /118: (/NULL - ]), fd=(1)==(118), (118)==(1)] - │ │ │ │ └── pg_foreign_table.ftrelid = pg_class.oid [type=bool, outer=(1,118), constraints=(/1: (/NULL - ]; /118: (/NULL - ])] + │ │ │ │ └── ftrelid = pg_class.oid [type=bool, outer=(1,118), constraints=(/1: (/NULL - ]; /118: (/NULL - ])] │ │ │ └── filters [type=bool, outer=(119,121), constraints=(/119: (/NULL - ]; /121: (/NULL - ]), fd=(119)==(121), (121)==(119)] - │ │ │ └── pg_foreign_table.ftserver = pg_foreign_server.oid [type=bool, outer=(119,121), constraints=(/119: (/NULL - ]; /121: (/NULL - ])] + │ │ │ └── ftserver = pg_foreign_server.oid [type=bool, outer=(119,121), constraints=(/119: (/NULL - ]; /121: (/NULL - ])] │ │ └── filters [type=bool, outer=(1,132), constraints=(/1: (/NULL - ]; /132: (/NULL - ]), fd=(1)==(132), (132)==(1)] │ │ └── pg_inherits.inhparent = pg_class.oid [type=bool, outer=(1,132), constraints=(/1: (/NULL - ]; /132: (/NULL - ])] │ └── aggregations [outer=(1,2,5,10,13,15,17,20,22,23,26,27,29,33,42,69,92,120,122,132)] @@ -411,7 +411,7 @@ project │ ├── const-agg [type=string, outer=(29)] │ │ └── variable: pg_namespace.nspname [type=string, outer=(29)] │ ├── const-agg [type=string, outer=(33)] - │ │ └── variable: pg_tablespace.spcname [type=string, outer=(33)] + │ │ └── variable: spcname [type=string, outer=(33)] │ ├── const-agg [type=string, outer=(42)] │ │ └── variable: pg_class.relname [type=string, outer=(42)] │ ├── const-agg [type=string, outer=(69)] @@ -419,9 +419,9 @@ project │ ├── const-agg [type=string, outer=(92)] │ │ └── variable: pg_class.relname [type=string, outer=(92)] │ ├── const-agg [type=string[], outer=(120)] - │ │ └── variable: pg_foreign_table.ftoptions [type=string[], outer=(120)] + │ │ └── variable: ftoptions [type=string[], outer=(120)] │ └── const-agg [type=string, outer=(122)] - │ └── variable: pg_foreign_server.srvname [type=string, outer=(122)] + │ └── variable: srvname [type=string, outer=(122)] └── projections [outer=(1,2,5,10,13,15,17,20,22,23,26,27,29,33,42,69,92,120,122,134)] ├── pg_get_userbyid(pg_class.relowner) [type=string, outer=(5)] ├── obj_description(pg_class.oid) [type=string, outer=(1)] diff --git a/pkg/sql/opt/xform/testdata/external/navicat b/pkg/sql/opt/xform/testdata/external/navicat index b7b6f4c7c529..a1c97ff03b6e 100644 --- a/pkg/sql/opt/xform/testdata/external/navicat +++ b/pkg/sql/opt/xform/testdata/external/navicat @@ -319,7 +319,7 @@ sort │ │ │ │ │ │ │ │ ├── key: (72) │ │ │ │ │ │ │ │ └── fd: (72)-->(73,79) │ │ │ │ │ │ │ └── filters [type=bool, outer=(79), constraints=(/79: [/true - /true]; tight), fd=()-->(79)] - │ │ │ │ │ │ │ └── pg_index.indisclustered = true [type=bool, outer=(79), constraints=(/79: [/true - /true]; tight)] + │ │ │ │ │ │ │ └── indisclustered = true [type=bool, outer=(79), constraints=(/79: [/true - /true]; tight)] │ │ │ │ │ │ ├── right-join │ │ │ │ │ │ │ ├── columns: pg_class.oid:1(oid!null) pg_class.relname:2(string!null) pg_class.relnamespace:3(oid!null) pg_class.relowner:5(oid!null) pg_class.reltablespace:8(oid!null) pg_class.reltuples:10(float!null) pg_class.relhasindex:13(bool!null) pg_class.relpersistence:15(string!null) pg_class.relkind:17(string!null) pg_class.relhasoids:20(bool!null) pg_class.relhasrules:22(bool!null) pg_class.relhastriggers:23(bool!null) pg_class.relacl:26(string[]) pg_class.reloptions:27(string[]) pg_namespace.oid:28(oid!null) pg_namespace.nspname:29(string!null) pg_tablespace.oid:32(oid) spcname:33(string) pg_inherits.inhrelid:38(oid) pg_inherits.inhparent:39(oid) pg_class.oid:41(oid) pg_class.relname:42(string) pg_class.relnamespace:43(oid) pg_namespace.oid:68(oid) pg_namespace.nspname:69(string) │ │ │ │ │ │ │ ├── fd: ()-->(3,28,29), (1)-->(2,5,8,10,13,15,17,20,22,23,26,27), (2)-->(1,5,8,10,13,15,17,20,22,23,26,27), (3)==(28), (28)==(3), (32)-->(33), (33)-->(32), (41)-->(42,43), (42,43)-->(41), (39)==(41), (41)==(39), (68)~~>(69), (69)~~>(68) @@ -375,13 +375,13 @@ sort │ │ │ │ │ │ │ └── filters [type=bool, outer=(1,38), constraints=(/1: (/NULL - ]; /38: (/NULL - ]), fd=(1)==(38), (38)==(1)] │ │ │ │ │ │ │ └── pg_inherits.inhrelid = pg_class.oid [type=bool, outer=(1,38), constraints=(/1: (/NULL - ]; /38: (/NULL - ])] │ │ │ │ │ │ └── filters [type=bool, outer=(1,73), constraints=(/1: (/NULL - ]; /73: (/NULL - ]), fd=(1)==(73), (73)==(1)] - │ │ │ │ │ │ └── pg_index.indrelid = pg_class.oid [type=bool, outer=(1,73), constraints=(/1: (/NULL - ]; /73: (/NULL - ])] + │ │ │ │ │ │ └── indrelid = pg_class.oid [type=bool, outer=(1,73), constraints=(/1: (/NULL - ]; /73: (/NULL - ])] │ │ │ │ │ └── filters [type=bool, outer=(72,91), constraints=(/72: (/NULL - ]; /91: (/NULL - ]), fd=(72)==(91), (91)==(72)] - │ │ │ │ │ └── pg_class.oid = pg_index.indexrelid [type=bool, outer=(72,91), constraints=(/72: (/NULL - ]; /91: (/NULL - ])] + │ │ │ │ │ └── pg_class.oid = indexrelid [type=bool, outer=(72,91), constraints=(/72: (/NULL - ]; /91: (/NULL - ])] │ │ │ │ └── filters [type=bool, outer=(1,118), constraints=(/1: (/NULL - ]; /118: (/NULL - ]), fd=(1)==(118), (118)==(1)] - │ │ │ │ └── pg_foreign_table.ftrelid = pg_class.oid [type=bool, outer=(1,118), constraints=(/1: (/NULL - ]; /118: (/NULL - ])] + │ │ │ │ └── ftrelid = pg_class.oid [type=bool, outer=(1,118), constraints=(/1: (/NULL - ]; /118: (/NULL - ])] │ │ │ └── filters [type=bool, outer=(119,121), constraints=(/119: (/NULL - ]; /121: (/NULL - ]), fd=(119)==(121), (121)==(119)] - │ │ │ └── pg_foreign_table.ftserver = pg_foreign_server.oid [type=bool, outer=(119,121), constraints=(/119: (/NULL - ]; /121: (/NULL - ])] + │ │ │ └── ftserver = pg_foreign_server.oid [type=bool, outer=(119,121), constraints=(/119: (/NULL - ]; /121: (/NULL - ])] │ │ └── filters [type=bool, outer=(1,132), constraints=(/1: (/NULL - ]; /132: (/NULL - ]), fd=(1)==(132), (132)==(1)] │ │ └── pg_inherits.inhparent = pg_class.oid [type=bool, outer=(1,132), constraints=(/1: (/NULL - ]; /132: (/NULL - ])] │ └── aggregations [outer=(1,2,5,10,13,15,17,20,22,23,26,27,29,33,42,69,92,120,122,132)] @@ -414,7 +414,7 @@ sort │ ├── const-agg [type=string, outer=(29)] │ │ └── variable: pg_namespace.nspname [type=string, outer=(29)] │ ├── const-agg [type=string, outer=(33)] - │ │ └── variable: pg_tablespace.spcname [type=string, outer=(33)] + │ │ └── variable: spcname [type=string, outer=(33)] │ ├── const-agg [type=string, outer=(42)] │ │ └── variable: pg_class.relname [type=string, outer=(42)] │ ├── const-agg [type=string, outer=(69)] @@ -422,9 +422,9 @@ sort │ ├── const-agg [type=string, outer=(92)] │ │ └── variable: pg_class.relname [type=string, outer=(92)] │ ├── const-agg [type=string[], outer=(120)] - │ │ └── variable: pg_foreign_table.ftoptions [type=string[], outer=(120)] + │ │ └── variable: ftoptions [type=string[], outer=(120)] │ └── const-agg [type=string, outer=(122)] - │ └── variable: pg_foreign_server.srvname [type=string, outer=(122)] + │ └── variable: srvname [type=string, outer=(122)] └── projections [outer=(1,2,5,10,13,15,17,20,22,23,26,27,29,33,42,69,92,120,122,134)] ├── pg_get_userbyid(pg_class.relowner) [type=string, outer=(5)] ├── obj_description(pg_class.oid) [type=string, outer=(1)] diff --git a/pkg/sql/opt/xform/testdata/external/nova b/pkg/sql/opt/xform/testdata/external/nova index 24df2b51631e..3cca08ca55be 100644 --- a/pkg/sql/opt/xform/testdata/external/nova +++ b/pkg/sql/opt/xform/testdata/external/nova @@ -324,7 +324,7 @@ sort │ │ │ │ │ │ │ ├── fd: (1)-->(2-12,14,15), (7)-->(1-6,8-12,14,15), (2)-->(1,3-12,14,15) │ │ │ │ │ │ │ └── ordering: +1 │ │ │ │ │ │ └── filters [type=bool, outer=(7), constraints=(/7: (/NULL - ])] - │ │ │ │ │ │ └── flavors.flavorid = $2 [type=bool, outer=(7), constraints=(/7: (/NULL - ])] + │ │ │ │ │ │ └── flavorid = $2 [type=bool, outer=(7), constraints=(/7: (/NULL - ])] │ │ │ │ │ ├── project │ │ │ │ │ │ ├── columns: true:22(bool!null) flavor_projects.flavor_id:17(int!null) │ │ │ │ │ │ ├── fd: ()-->(22) @@ -338,7 +338,7 @@ sort │ │ │ │ │ │ │ │ ├── key: (17,18) │ │ │ │ │ │ │ │ └── ordering: +17 │ │ │ │ │ │ │ └── filters [type=bool, outer=(18), constraints=(/18: (/NULL - ])] - │ │ │ │ │ │ │ └── flavor_projects.project_id = $1 [type=bool, outer=(18), constraints=(/18: (/NULL - ])] + │ │ │ │ │ │ │ └── project_id = $1 [type=bool, outer=(18), constraints=(/18: (/NULL - ])] │ │ │ │ │ │ └── projections [outer=(17)] │ │ │ │ │ │ └── true [type=bool] │ │ │ │ │ └── merge-on @@ -350,33 +350,33 @@ sort │ │ │ │ ├── const-not-null-agg [type=bool, outer=(22)] │ │ │ │ │ └── variable: true [type=bool, outer=(22)] │ │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ │ └── variable: flavors.name [type=string, outer=(2)] + │ │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ │ └── variable: flavors.memory_mb [type=int, outer=(3)] + │ │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ │ └── variable: flavors.vcpus [type=int, outer=(4)] + │ │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ │ └── variable: flavors.root_gb [type=int, outer=(5)] + │ │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ │ └── variable: flavors.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ │ └── variable: flavors.flavorid [type=string, outer=(7)] + │ │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ │ └── variable: flavors.swap [type=int, outer=(8)] + │ │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ │ └── variable: flavors.rxtx_factor [type=float, outer=(9)] + │ │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ │ └── variable: flavors.vcpu_weight [type=int, outer=(10)] + │ │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ │ └── variable: flavors.disabled [type=bool, outer=(11)] + │ │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ │ └── variable: flavors.is_public [type=bool, outer=(12)] + │ │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ │ ├── const-agg [type=timestamp, outer=(14)] │ │ │ │ │ └── variable: flavors.created_at [type=timestamp, outer=(14)] │ │ │ │ └── const-agg [type=timestamp, outer=(15)] │ │ │ │ └── variable: flavors.updated_at [type=timestamp, outer=(15)] │ │ │ └── filters [type=bool, outer=(12,23)] - │ │ │ └── (flavors.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,23)] + │ │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,23)] │ │ └── placeholder: $3 [type=int] │ └── placeholder: $4 [type=int] └── filters [type=bool, outer=(1,28), constraints=(/1: (/NULL - ]; /28: (/NULL - ]), fd=(1)==(28), (28)==(1)] @@ -523,7 +523,7 @@ left-join (lookup flavor_extra_specs) │ │ │ │ │ │ │ │ │ │ │ ├── fd: (1)-->(2-12,14,15), (7)-->(1-6,8-12,14,15), (2)-->(1,3-12,14,15) │ │ │ │ │ │ │ │ │ │ │ └── ordering: +1 opt(11) │ │ │ │ │ │ │ │ │ │ └── filters [type=bool, outer=(11), constraints=(/11: [/false - /false]; tight), fd=()-->(11)] - │ │ │ │ │ │ │ │ │ │ └── flavors.disabled = false [type=bool, outer=(11), constraints=(/11: [/false - /false]; tight)] + │ │ │ │ │ │ │ │ │ │ └── disabled = false [type=bool, outer=(11), constraints=(/11: [/false - /false]; tight)] │ │ │ │ │ │ │ │ │ ├── project │ │ │ │ │ │ │ │ │ │ ├── columns: true:28(bool!null) flavor_projects.flavor_id:17(int!null) │ │ │ │ │ │ │ │ │ │ ├── fd: ()-->(28) @@ -549,66 +549,66 @@ left-join (lookup flavor_extra_specs) │ │ │ │ │ │ │ │ ├── const-not-null-agg [type=bool, outer=(28)] │ │ │ │ │ │ │ │ │ └── variable: true [type=bool, outer=(28)] │ │ │ │ │ │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ │ │ │ │ │ └── variable: flavors.name [type=string, outer=(2)] + │ │ │ │ │ │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ │ │ │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ │ │ │ │ │ └── variable: flavors.memory_mb [type=int, outer=(3)] + │ │ │ │ │ │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ │ │ │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ │ │ │ │ │ └── variable: flavors.vcpus [type=int, outer=(4)] + │ │ │ │ │ │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ │ │ │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ │ │ │ │ │ └── variable: flavors.root_gb [type=int, outer=(5)] + │ │ │ │ │ │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ │ │ │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ │ │ │ │ │ └── variable: flavors.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ │ │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ │ │ │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ │ │ │ │ │ └── variable: flavors.flavorid [type=string, outer=(7)] + │ │ │ │ │ │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ │ │ │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ │ │ │ │ │ └── variable: flavors.swap [type=int, outer=(8)] + │ │ │ │ │ │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ │ │ │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ │ │ │ │ │ └── variable: flavors.rxtx_factor [type=float, outer=(9)] + │ │ │ │ │ │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ │ │ │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ │ │ │ │ │ └── variable: flavors.vcpu_weight [type=int, outer=(10)] + │ │ │ │ │ │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ │ │ │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ │ │ │ │ │ └── variable: flavors.disabled [type=bool, outer=(11)] + │ │ │ │ │ │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ │ │ │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ │ │ │ │ │ └── variable: flavors.is_public [type=bool, outer=(12)] + │ │ │ │ │ │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ │ │ │ │ │ ├── const-agg [type=timestamp, outer=(14)] │ │ │ │ │ │ │ │ │ └── variable: flavors.created_at [type=timestamp, outer=(14)] │ │ │ │ │ │ │ │ └── const-agg [type=timestamp, outer=(15)] │ │ │ │ │ │ │ │ └── variable: flavors.updated_at [type=timestamp, outer=(15)] │ │ │ │ │ │ │ └── filters [type=bool, outer=(12,29)] - │ │ │ │ │ │ │ └── (flavors.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,29)] + │ │ │ │ │ │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,29)] │ │ │ │ │ │ └── filters [type=bool, outer=(1,23), constraints=(/1: (/NULL - ]; /23: (/NULL - ]), fd=(1)==(23), (23)==(1)] │ │ │ │ │ │ └── flavor_projects.flavor_id = flavors.id [type=bool, outer=(1,23), constraints=(/1: (/NULL - ]; /23: (/NULL - ])] │ │ │ │ │ └── aggregations [outer=(2-12,14,15,31)] │ │ │ │ │ ├── const-not-null-agg [type=bool, outer=(31)] │ │ │ │ │ │ └── variable: true [type=bool, outer=(31)] │ │ │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ │ │ └── variable: flavors.name [type=string, outer=(2)] + │ │ │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ │ │ └── variable: flavors.memory_mb [type=int, outer=(3)] + │ │ │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ │ │ └── variable: flavors.vcpus [type=int, outer=(4)] + │ │ │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ │ │ └── variable: flavors.root_gb [type=int, outer=(5)] + │ │ │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ │ │ └── variable: flavors.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ │ │ └── variable: flavors.flavorid [type=string, outer=(7)] + │ │ │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ │ │ └── variable: flavors.swap [type=int, outer=(8)] + │ │ │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ │ │ └── variable: flavors.rxtx_factor [type=float, outer=(9)] + │ │ │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ │ │ └── variable: flavors.vcpu_weight [type=int, outer=(10)] + │ │ │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ │ │ └── variable: flavors.disabled [type=bool, outer=(11)] + │ │ │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ │ │ └── variable: flavors.is_public [type=bool, outer=(12)] + │ │ │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ │ │ ├── const-agg [type=timestamp, outer=(14)] │ │ │ │ │ │ └── variable: flavors.created_at [type=timestamp, outer=(14)] │ │ │ │ │ └── const-agg [type=timestamp, outer=(15)] │ │ │ │ │ └── variable: flavors.updated_at [type=timestamp, outer=(15)] │ │ │ │ └── filters [type=bool, outer=(12,32)] - │ │ │ │ └── (flavors.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,32)] + │ │ │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,32)] │ │ │ └── placeholder: $3 [type=int] │ │ └── placeholder: $4 [type=int] │ └── filters [type=bool, outer=(1,37), constraints=(/1: (/NULL - ]; /37: (/NULL - ]), fd=(1)==(37), (37)==(1)] @@ -746,7 +746,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ │ │ │ └── filters [type=bool, outer=(19,20), constraints=(/19: (/NULL - ]; /20: (/NULL - ])] │ │ │ │ │ │ │ │ ├── instance_type_projects.deleted = $2 [type=bool, outer=(20), constraints=(/20: (/NULL - ])] │ │ │ │ │ │ │ │ ├── instance_type_projects.deleted = $3 [type=bool, outer=(20), constraints=(/20: (/NULL - ])] - │ │ │ │ │ │ │ │ └── instance_type_projects.project_id = $4 [type=bool, outer=(19), constraints=(/19: (/NULL - ])] + │ │ │ │ │ │ │ │ └── project_id = $4 [type=bool, outer=(19), constraints=(/19: (/NULL - ])] │ │ │ │ │ │ │ └── projections [outer=(18)] │ │ │ │ │ │ │ └── true [type=bool] │ │ │ │ │ │ └── merge-on @@ -758,27 +758,27 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ ├── const-not-null-agg [type=bool, outer=(25)] │ │ │ │ │ │ └── variable: true [type=bool, outer=(25)] │ │ │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ │ │ └── variable: instance_types.name [type=string, outer=(2)] + │ │ │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ │ │ └── variable: instance_types.memory_mb [type=int, outer=(3)] + │ │ │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ │ │ └── variable: instance_types.vcpus [type=int, outer=(4)] + │ │ │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ │ │ └── variable: instance_types.root_gb [type=int, outer=(5)] + │ │ │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ │ │ └── variable: instance_types.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ │ │ └── variable: instance_types.flavorid [type=string, outer=(7)] + │ │ │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ │ │ └── variable: instance_types.swap [type=int, outer=(8)] + │ │ │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ │ │ └── variable: instance_types.rxtx_factor [type=float, outer=(9)] + │ │ │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ │ │ └── variable: instance_types.vcpu_weight [type=int, outer=(10)] + │ │ │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ │ │ └── variable: instance_types.disabled [type=bool, outer=(11)] + │ │ │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ │ │ └── variable: instance_types.is_public [type=bool, outer=(12)] + │ │ │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ │ │ ├── const-agg [type=bool, outer=(13)] │ │ │ │ │ │ └── variable: instance_types.deleted [type=bool, outer=(13)] │ │ │ │ │ ├── const-agg [type=timestamp, outer=(14)] @@ -788,7 +788,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ └── const-agg [type=timestamp, outer=(16)] │ │ │ │ │ └── variable: instance_types.updated_at [type=timestamp, outer=(16)] │ │ │ │ └── filters [type=bool, outer=(12,26)] - │ │ │ │ └── (instance_types.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,26)] + │ │ │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,26)] │ │ │ └── placeholder: $5 [type=int] │ │ └── placeholder: $6 [type=int] │ └── filters [type=bool, outer=(1,31,32), constraints=(/1: (/NULL - ]; /31: (/NULL - ]; /32: (/NULL - ]), fd=(1)==(31), (31)==(1)] @@ -893,7 +893,7 @@ sort │ │ │ │ │ │ └── ordering: +26 │ │ │ │ │ └── filters [type=bool, outer=(27,28), constraints=(/27: (/NULL - ]; /28: (/NULL - ])] │ │ │ │ │ ├── instance_type_projects.deleted = $3 [type=bool, outer=(28), constraints=(/28: (/NULL - ])] - │ │ │ │ │ └── instance_type_projects.project_id = $4 [type=bool, outer=(27), constraints=(/27: (/NULL - ])] + │ │ │ │ │ └── project_id = $4 [type=bool, outer=(27), constraints=(/27: (/NULL - ])] │ │ │ │ └── projections [outer=(26)] │ │ │ │ └── true [type=bool] │ │ │ └── merge-on @@ -905,27 +905,27 @@ sort │ │ ├── const-not-null-agg [type=bool, outer=(33)] │ │ │ └── variable: true [type=bool, outer=(33)] │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ └── variable: instance_types.name [type=string, outer=(2)] + │ │ │ └── variable: name [type=string, outer=(2)] │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ └── variable: instance_types.memory_mb [type=int, outer=(3)] + │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ └── variable: instance_types.vcpus [type=int, outer=(4)] + │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ └── variable: instance_types.root_gb [type=int, outer=(5)] + │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ └── variable: instance_types.ephemeral_gb [type=int, outer=(6)] + │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ └── variable: instance_types.flavorid [type=string, outer=(7)] + │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ └── variable: instance_types.swap [type=int, outer=(8)] + │ │ │ └── variable: swap [type=int, outer=(8)] │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ └── variable: instance_types.rxtx_factor [type=float, outer=(9)] + │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ └── variable: instance_types.vcpu_weight [type=int, outer=(10)] + │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ └── variable: instance_types.disabled [type=bool, outer=(11)] + │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ └── variable: instance_types.is_public [type=bool, outer=(12)] + │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ ├── const-agg [type=bool, outer=(13)] │ │ │ └── variable: instance_types.deleted [type=bool, outer=(13)] │ │ ├── const-agg [type=timestamp, outer=(14)] @@ -935,7 +935,7 @@ sort │ │ └── const-agg [type=timestamp, outer=(16)] │ │ └── variable: instance_types.updated_at [type=timestamp, outer=(16)] │ └── filters [type=bool, outer=(12,34)] - │ └── (instance_types.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,34)] + │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,34)] └── filters [type=bool, outer=(1,20), constraints=(/1: (/NULL - ]; /20: (/NULL - ]), fd=(1)==(20), (20)==(1)] └── instance_type_extra_specs.instance_type_id = instance_types.id [type=bool, outer=(1,20), constraints=(/1: (/NULL - ]; /20: (/NULL - ])] @@ -1045,7 +1045,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ │ │ │ └── fd: (1)-->(2,13), (2,13)~~>(1) │ │ │ │ │ │ │ └── filters [type=bool, outer=(2,13), constraints=(/2: (/NULL - ]; /13: (/NULL - ])] │ │ │ │ │ │ │ ├── instance_types.deleted = $1 [type=bool, outer=(13), constraints=(/13: (/NULL - ])] - │ │ │ │ │ │ │ └── instance_types.name = $4 [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + │ │ │ │ │ │ │ └── name = $4 [type=bool, outer=(2), constraints=(/2: (/NULL - ])] │ │ │ │ │ │ ├── project │ │ │ │ │ │ │ ├── columns: true:25(bool!null) instance_type_projects.instance_type_id:18(int!null) │ │ │ │ │ │ │ ├── fd: ()-->(25) @@ -1055,7 +1055,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ │ │ │ │ └── columns: instance_type_projects.instance_type_id:18(int!null) project_id:19(string) instance_type_projects.deleted:20(bool) │ │ │ │ │ │ │ │ └── filters [type=bool, outer=(19,20), constraints=(/19: (/NULL - ]; /20: (/NULL - ])] │ │ │ │ │ │ │ │ ├── instance_type_projects.deleted = $2 [type=bool, outer=(20), constraints=(/20: (/NULL - ])] - │ │ │ │ │ │ │ │ └── instance_type_projects.project_id = $3 [type=bool, outer=(19), constraints=(/19: (/NULL - ])] + │ │ │ │ │ │ │ │ └── project_id = $3 [type=bool, outer=(19), constraints=(/19: (/NULL - ])] │ │ │ │ │ │ │ └── projections [outer=(18)] │ │ │ │ │ │ │ └── true [type=bool] │ │ │ │ │ │ └── filters [type=bool, outer=(1,18), constraints=(/1: (/NULL - ]; /18: (/NULL - ]), fd=(1)==(18), (18)==(1)] @@ -1064,27 +1064,27 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ ├── const-not-null-agg [type=bool, outer=(25)] │ │ │ │ │ │ └── variable: true [type=bool, outer=(25)] │ │ │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ │ │ └── variable: instance_types.name [type=string, outer=(2)] + │ │ │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ │ │ └── variable: instance_types.memory_mb [type=int, outer=(3)] + │ │ │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ │ │ └── variable: instance_types.vcpus [type=int, outer=(4)] + │ │ │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ │ │ └── variable: instance_types.root_gb [type=int, outer=(5)] + │ │ │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ │ │ └── variable: instance_types.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ │ │ └── variable: instance_types.flavorid [type=string, outer=(7)] + │ │ │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ │ │ └── variable: instance_types.swap [type=int, outer=(8)] + │ │ │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ │ │ └── variable: instance_types.rxtx_factor [type=float, outer=(9)] + │ │ │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ │ │ └── variable: instance_types.vcpu_weight [type=int, outer=(10)] + │ │ │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ │ │ └── variable: instance_types.disabled [type=bool, outer=(11)] + │ │ │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ │ │ └── variable: instance_types.is_public [type=bool, outer=(12)] + │ │ │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ │ │ ├── const-agg [type=bool, outer=(13)] │ │ │ │ │ │ └── variable: instance_types.deleted [type=bool, outer=(13)] │ │ │ │ │ ├── const-agg [type=timestamp, outer=(14)] @@ -1094,7 +1094,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ └── const-agg [type=timestamp, outer=(16)] │ │ │ │ │ └── variable: instance_types.updated_at [type=timestamp, outer=(16)] │ │ │ │ └── filters [type=bool, outer=(12,26)] - │ │ │ │ └── (instance_types.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,26)] + │ │ │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,26)] │ │ │ └── placeholder: $5 [type=int] │ │ └── placeholder: $6 [type=int] │ └── filters [type=bool, outer=(1,31,32), constraints=(/1: (/NULL - ]; /31: (/NULL - ]; /32: (/NULL - ]), fd=(1)==(31), (31)==(1)] @@ -1218,7 +1218,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ │ │ │ │ └── ordering: +18 │ │ │ │ │ │ │ │ └── filters [type=bool, outer=(18-20), constraints=(/18: (/NULL - ]; /19: (/NULL - ]; /20: (/NULL - ])] │ │ │ │ │ │ │ │ ├── instance_type_projects.deleted = $2 [type=bool, outer=(20), constraints=(/20: (/NULL - ])] - │ │ │ │ │ │ │ │ ├── instance_type_projects.project_id = $3 [type=bool, outer=(19), constraints=(/19: (/NULL - ])] + │ │ │ │ │ │ │ │ ├── project_id = $3 [type=bool, outer=(19), constraints=(/19: (/NULL - ])] │ │ │ │ │ │ │ │ └── instance_type_projects.instance_type_id = $4 [type=bool, outer=(18), constraints=(/18: (/NULL - ])] │ │ │ │ │ │ │ └── projections [outer=(18)] │ │ │ │ │ │ │ └── true [type=bool] @@ -1231,27 +1231,27 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ ├── const-not-null-agg [type=bool, outer=(25)] │ │ │ │ │ │ └── variable: true [type=bool, outer=(25)] │ │ │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ │ │ └── variable: instance_types.name [type=string, outer=(2)] + │ │ │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ │ │ └── variable: instance_types.memory_mb [type=int, outer=(3)] + │ │ │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ │ │ └── variable: instance_types.vcpus [type=int, outer=(4)] + │ │ │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ │ │ └── variable: instance_types.root_gb [type=int, outer=(5)] + │ │ │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ │ │ └── variable: instance_types.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ │ │ └── variable: instance_types.flavorid [type=string, outer=(7)] + │ │ │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ │ │ └── variable: instance_types.swap [type=int, outer=(8)] + │ │ │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ │ │ └── variable: instance_types.rxtx_factor [type=float, outer=(9)] + │ │ │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ │ │ └── variable: instance_types.vcpu_weight [type=int, outer=(10)] + │ │ │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ │ │ └── variable: instance_types.disabled [type=bool, outer=(11)] + │ │ │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ │ │ └── variable: instance_types.is_public [type=bool, outer=(12)] + │ │ │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ │ │ ├── const-agg [type=bool, outer=(13)] │ │ │ │ │ │ └── variable: instance_types.deleted [type=bool, outer=(13)] │ │ │ │ │ ├── const-agg [type=timestamp, outer=(14)] @@ -1261,7 +1261,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ └── const-agg [type=timestamp, outer=(16)] │ │ │ │ │ └── variable: instance_types.updated_at [type=timestamp, outer=(16)] │ │ │ │ └── filters [type=bool, outer=(12,26)] - │ │ │ │ └── (instance_types.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,26)] + │ │ │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,26)] │ │ │ └── placeholder: $5 [type=int] │ │ └── placeholder: $6 [type=int] │ └── filters [type=bool, outer=(1,31,32), constraints=(/1: (/NULL - ]; /31: (/NULL - ]; /32: (/NULL - ]), fd=(1)==(31), (31)==(1)] @@ -1360,7 +1360,7 @@ right-join │ │ │ │ │ │ │ ├── fd: (1)-->(2-12,14,15), (7)-->(1-6,8-12,14,15), (2)-->(1,3-12,14,15) │ │ │ │ │ │ │ └── ordering: +1 │ │ │ │ │ │ └── filters [type=bool, outer=(2), constraints=(/2: (/NULL - ])] - │ │ │ │ │ │ └── flavors.name = $2 [type=bool, outer=(2), constraints=(/2: (/NULL - ])] + │ │ │ │ │ │ └── name = $2 [type=bool, outer=(2), constraints=(/2: (/NULL - ])] │ │ │ │ │ ├── project │ │ │ │ │ │ ├── columns: true:22(bool!null) flavor_projects.flavor_id:17(int!null) │ │ │ │ │ │ ├── fd: ()-->(22) @@ -1374,7 +1374,7 @@ right-join │ │ │ │ │ │ │ │ ├── key: (17,18) │ │ │ │ │ │ │ │ └── ordering: +17 │ │ │ │ │ │ │ └── filters [type=bool, outer=(18), constraints=(/18: (/NULL - ])] - │ │ │ │ │ │ │ └── flavor_projects.project_id = $1 [type=bool, outer=(18), constraints=(/18: (/NULL - ])] + │ │ │ │ │ │ │ └── project_id = $1 [type=bool, outer=(18), constraints=(/18: (/NULL - ])] │ │ │ │ │ │ └── projections [outer=(17)] │ │ │ │ │ │ └── true [type=bool] │ │ │ │ │ └── merge-on @@ -1386,33 +1386,33 @@ right-join │ │ │ │ ├── const-not-null-agg [type=bool, outer=(22)] │ │ │ │ │ └── variable: true [type=bool, outer=(22)] │ │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ │ └── variable: flavors.name [type=string, outer=(2)] + │ │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ │ └── variable: flavors.memory_mb [type=int, outer=(3)] + │ │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ │ └── variable: flavors.vcpus [type=int, outer=(4)] + │ │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ │ └── variable: flavors.root_gb [type=int, outer=(5)] + │ │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ │ └── variable: flavors.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ │ └── variable: flavors.flavorid [type=string, outer=(7)] + │ │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ │ └── variable: flavors.swap [type=int, outer=(8)] + │ │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ │ └── variable: flavors.rxtx_factor [type=float, outer=(9)] + │ │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ │ └── variable: flavors.vcpu_weight [type=int, outer=(10)] + │ │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ │ └── variable: flavors.disabled [type=bool, outer=(11)] + │ │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ │ └── variable: flavors.is_public [type=bool, outer=(12)] + │ │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ │ ├── const-agg [type=timestamp, outer=(14)] │ │ │ │ │ └── variable: flavors.created_at [type=timestamp, outer=(14)] │ │ │ │ └── const-agg [type=timestamp, outer=(15)] │ │ │ │ └── variable: flavors.updated_at [type=timestamp, outer=(15)] │ │ │ └── filters [type=bool, outer=(12,23)] - │ │ │ └── (flavors.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,23)] + │ │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,23)] │ │ └── placeholder: $3 [type=int] │ └── placeholder: $4 [type=int] └── filters [type=bool, outer=(1,28), constraints=(/1: (/NULL - ]; /28: (/NULL - ]), fd=(1)==(28), (28)==(1)] @@ -1509,7 +1509,7 @@ right-join │ │ │ │ │ │ │ ├── fd: (1)-->(2-12,14,15), (7)-->(1-6,8-12,14,15), (2)-->(1,3-12,14,15) │ │ │ │ │ │ │ └── ordering: +1 │ │ │ │ │ │ └── filters [type=bool, outer=(7), constraints=(/7: (/NULL - ])] - │ │ │ │ │ │ └── flavors.flavorid = $2 [type=bool, outer=(7), constraints=(/7: (/NULL - ])] + │ │ │ │ │ │ └── flavorid = $2 [type=bool, outer=(7), constraints=(/7: (/NULL - ])] │ │ │ │ │ ├── project │ │ │ │ │ │ ├── columns: true:22(bool!null) flavor_projects.flavor_id:17(int!null) │ │ │ │ │ │ ├── fd: ()-->(22) @@ -1523,7 +1523,7 @@ right-join │ │ │ │ │ │ │ │ ├── key: (17,18) │ │ │ │ │ │ │ │ └── ordering: +17 │ │ │ │ │ │ │ └── filters [type=bool, outer=(18), constraints=(/18: (/NULL - ])] - │ │ │ │ │ │ │ └── flavor_projects.project_id = $1 [type=bool, outer=(18), constraints=(/18: (/NULL - ])] + │ │ │ │ │ │ │ └── project_id = $1 [type=bool, outer=(18), constraints=(/18: (/NULL - ])] │ │ │ │ │ │ └── projections [outer=(17)] │ │ │ │ │ │ └── true [type=bool] │ │ │ │ │ └── merge-on @@ -1535,33 +1535,33 @@ right-join │ │ │ │ ├── const-not-null-agg [type=bool, outer=(22)] │ │ │ │ │ └── variable: true [type=bool, outer=(22)] │ │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ │ └── variable: flavors.name [type=string, outer=(2)] + │ │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ │ └── variable: flavors.memory_mb [type=int, outer=(3)] + │ │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ │ └── variable: flavors.vcpus [type=int, outer=(4)] + │ │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ │ └── variable: flavors.root_gb [type=int, outer=(5)] + │ │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ │ └── variable: flavors.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ │ └── variable: flavors.flavorid [type=string, outer=(7)] + │ │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ │ └── variable: flavors.swap [type=int, outer=(8)] + │ │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ │ └── variable: flavors.rxtx_factor [type=float, outer=(9)] + │ │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ │ └── variable: flavors.vcpu_weight [type=int, outer=(10)] + │ │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ │ └── variable: flavors.disabled [type=bool, outer=(11)] + │ │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ │ └── variable: flavors.is_public [type=bool, outer=(12)] + │ │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ │ ├── const-agg [type=timestamp, outer=(14)] │ │ │ │ │ └── variable: flavors.created_at [type=timestamp, outer=(14)] │ │ │ │ └── const-agg [type=timestamp, outer=(15)] │ │ │ │ └── variable: flavors.updated_at [type=timestamp, outer=(15)] │ │ │ └── filters [type=bool, outer=(12,23)] - │ │ │ └── (flavors.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,23)] + │ │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,23)] │ │ └── placeholder: $3 [type=int] │ └── placeholder: $4 [type=int] └── filters [type=bool, outer=(1,28), constraints=(/1: (/NULL - ]; /28: (/NULL - ]), fd=(1)==(28), (28)==(1)] @@ -1675,7 +1675,7 @@ sort │ │ │ │ │ │ │ ├── fd: (1)-->(2-12,14,15), (7)-->(1-6,8-12,14,15), (2)-->(1,3-12,14,15) │ │ │ │ │ │ │ └── ordering: +1 │ │ │ │ │ │ └── filters [type=bool, outer=(1,7)] - │ │ │ │ │ │ └── (flavors.flavorid > $2) OR ((flavors.flavorid = $3) AND (flavors.id > $4)) [type=bool, outer=(1,7)] + │ │ │ │ │ │ └── (flavorid > $2) OR ((flavorid = $3) AND (flavors.id > $4)) [type=bool, outer=(1,7)] │ │ │ │ │ ├── project │ │ │ │ │ │ ├── columns: true:22(bool!null) flavor_projects.flavor_id:17(int!null) │ │ │ │ │ │ ├── fd: ()-->(22) @@ -1689,7 +1689,7 @@ sort │ │ │ │ │ │ │ │ ├── key: (17,18) │ │ │ │ │ │ │ │ └── ordering: +17 │ │ │ │ │ │ │ └── filters [type=bool, outer=(18), constraints=(/18: (/NULL - ])] - │ │ │ │ │ │ │ └── flavor_projects.project_id = $1 [type=bool, outer=(18), constraints=(/18: (/NULL - ])] + │ │ │ │ │ │ │ └── project_id = $1 [type=bool, outer=(18), constraints=(/18: (/NULL - ])] │ │ │ │ │ │ └── projections [outer=(17)] │ │ │ │ │ │ └── true [type=bool] │ │ │ │ │ └── merge-on @@ -1701,33 +1701,33 @@ sort │ │ │ │ ├── const-not-null-agg [type=bool, outer=(22)] │ │ │ │ │ └── variable: true [type=bool, outer=(22)] │ │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ │ └── variable: flavors.name [type=string, outer=(2)] + │ │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ │ └── variable: flavors.memory_mb [type=int, outer=(3)] + │ │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ │ └── variable: flavors.vcpus [type=int, outer=(4)] + │ │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ │ └── variable: flavors.root_gb [type=int, outer=(5)] + │ │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ │ └── variable: flavors.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ │ └── variable: flavors.flavorid [type=string, outer=(7)] + │ │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ │ └── variable: flavors.swap [type=int, outer=(8)] + │ │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ │ └── variable: flavors.rxtx_factor [type=float, outer=(9)] + │ │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ │ └── variable: flavors.vcpu_weight [type=int, outer=(10)] + │ │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ │ └── variable: flavors.disabled [type=bool, outer=(11)] + │ │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ │ └── variable: flavors.is_public [type=bool, outer=(12)] + │ │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ │ ├── const-agg [type=timestamp, outer=(14)] │ │ │ │ │ └── variable: flavors.created_at [type=timestamp, outer=(14)] │ │ │ │ └── const-agg [type=timestamp, outer=(15)] │ │ │ │ └── variable: flavors.updated_at [type=timestamp, outer=(15)] │ │ │ └── filters [type=bool, outer=(12,23)] - │ │ │ └── (flavors.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,23)] + │ │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,23)] │ │ └── placeholder: $5 [type=int] │ └── placeholder: $6 [type=int] └── filters [type=bool, outer=(1,28), constraints=(/1: (/NULL - ]; /28: (/NULL - ]), fd=(1)==(28), (28)==(1)] @@ -1862,7 +1862,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ │ │ │ │ └── ordering: +18 │ │ │ │ │ │ │ │ └── filters [type=bool, outer=(19,20), constraints=(/19: (/NULL - ]; /20: (/NULL - ])] │ │ │ │ │ │ │ │ ├── instance_type_projects.deleted = $2 [type=bool, outer=(20), constraints=(/20: (/NULL - ])] - │ │ │ │ │ │ │ │ └── instance_type_projects.project_id = $3 [type=bool, outer=(19), constraints=(/19: (/NULL - ])] + │ │ │ │ │ │ │ │ └── project_id = $3 [type=bool, outer=(19), constraints=(/19: (/NULL - ])] │ │ │ │ │ │ │ └── projections [outer=(18)] │ │ │ │ │ │ │ └── true [type=bool] │ │ │ │ │ │ └── merge-on @@ -1874,27 +1874,27 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ ├── const-not-null-agg [type=bool, outer=(25)] │ │ │ │ │ │ └── variable: true [type=bool, outer=(25)] │ │ │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ │ │ └── variable: instance_types.name [type=string, outer=(2)] + │ │ │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ │ │ └── variable: instance_types.memory_mb [type=int, outer=(3)] + │ │ │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ │ │ └── variable: instance_types.vcpus [type=int, outer=(4)] + │ │ │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ │ │ └── variable: instance_types.root_gb [type=int, outer=(5)] + │ │ │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ │ │ └── variable: instance_types.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ │ │ └── variable: instance_types.flavorid [type=string, outer=(7)] + │ │ │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ │ │ └── variable: instance_types.swap [type=int, outer=(8)] + │ │ │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ │ │ └── variable: instance_types.rxtx_factor [type=float, outer=(9)] + │ │ │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ │ │ └── variable: instance_types.vcpu_weight [type=int, outer=(10)] + │ │ │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ │ │ └── variable: instance_types.disabled [type=bool, outer=(11)] + │ │ │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ │ │ └── variable: instance_types.is_public [type=bool, outer=(12)] + │ │ │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ │ │ ├── const-agg [type=bool, outer=(13)] │ │ │ │ │ │ └── variable: instance_types.deleted [type=bool, outer=(13)] │ │ │ │ │ ├── const-agg [type=timestamp, outer=(14)] @@ -1904,7 +1904,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ └── const-agg [type=timestamp, outer=(16)] │ │ │ │ │ └── variable: instance_types.updated_at [type=timestamp, outer=(16)] │ │ │ │ └── filters [type=bool, outer=(12,26)] - │ │ │ │ └── (instance_types.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,26)] + │ │ │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,26)] │ │ │ └── placeholder: $4 [type=int] │ │ └── placeholder: $5 [type=int] │ └── filters [type=bool, outer=(1,31,32), constraints=(/1: (/NULL - ]; /31: (/NULL - ]; /32: (/NULL - ]), fd=(1)==(31), (31)==(1)] @@ -2018,7 +2018,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ │ │ │ └── fd: (1)-->(7,13), (7,13)~~>(1) │ │ │ │ │ │ │ └── filters [type=bool, outer=(7,13), constraints=(/7: (/NULL - ]; /13: (/NULL - ])] │ │ │ │ │ │ │ ├── instance_types.deleted = $1 [type=bool, outer=(13), constraints=(/13: (/NULL - ])] - │ │ │ │ │ │ │ └── instance_types.flavorid = $4 [type=bool, outer=(7), constraints=(/7: (/NULL - ])] + │ │ │ │ │ │ │ └── flavorid = $4 [type=bool, outer=(7), constraints=(/7: (/NULL - ])] │ │ │ │ │ │ ├── project │ │ │ │ │ │ │ ├── columns: true:25(bool!null) instance_type_projects.instance_type_id:18(int!null) │ │ │ │ │ │ │ ├── fd: ()-->(25) @@ -2028,7 +2028,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ │ │ │ │ └── columns: instance_type_projects.instance_type_id:18(int!null) project_id:19(string) instance_type_projects.deleted:20(bool) │ │ │ │ │ │ │ │ └── filters [type=bool, outer=(19,20), constraints=(/19: (/NULL - ]; /20: (/NULL - ])] │ │ │ │ │ │ │ │ ├── instance_type_projects.deleted = $2 [type=bool, outer=(20), constraints=(/20: (/NULL - ])] - │ │ │ │ │ │ │ │ └── instance_type_projects.project_id = $3 [type=bool, outer=(19), constraints=(/19: (/NULL - ])] + │ │ │ │ │ │ │ │ └── project_id = $3 [type=bool, outer=(19), constraints=(/19: (/NULL - ])] │ │ │ │ │ │ │ └── projections [outer=(18)] │ │ │ │ │ │ │ └── true [type=bool] │ │ │ │ │ │ └── filters [type=bool, outer=(1,18), constraints=(/1: (/NULL - ]; /18: (/NULL - ]), fd=(1)==(18), (18)==(1)] @@ -2037,27 +2037,27 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ ├── const-not-null-agg [type=bool, outer=(25)] │ │ │ │ │ │ └── variable: true [type=bool, outer=(25)] │ │ │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ │ │ └── variable: instance_types.name [type=string, outer=(2)] + │ │ │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ │ │ └── variable: instance_types.memory_mb [type=int, outer=(3)] + │ │ │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ │ │ └── variable: instance_types.vcpus [type=int, outer=(4)] + │ │ │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ │ │ └── variable: instance_types.root_gb [type=int, outer=(5)] + │ │ │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ │ │ └── variable: instance_types.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ │ │ └── variable: instance_types.flavorid [type=string, outer=(7)] + │ │ │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ │ │ └── variable: instance_types.swap [type=int, outer=(8)] + │ │ │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ │ │ └── variable: instance_types.rxtx_factor [type=float, outer=(9)] + │ │ │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ │ │ └── variable: instance_types.vcpu_weight [type=int, outer=(10)] + │ │ │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ │ │ └── variable: instance_types.disabled [type=bool, outer=(11)] + │ │ │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ │ │ └── variable: instance_types.is_public [type=bool, outer=(12)] + │ │ │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ │ │ ├── const-agg [type=bool, outer=(13)] │ │ │ │ │ │ └── variable: instance_types.deleted [type=bool, outer=(13)] │ │ │ │ │ ├── const-agg [type=timestamp, outer=(14)] @@ -2067,7 +2067,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ └── const-agg [type=timestamp, outer=(16)] │ │ │ │ │ └── variable: instance_types.updated_at [type=timestamp, outer=(16)] │ │ │ │ └── filters [type=bool, outer=(12,26)] - │ │ │ │ └── (instance_types.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,26)] + │ │ │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,26)] │ │ │ └── placeholder: $5 [type=int] │ │ └── placeholder: $6 [type=int] │ └── filters [type=bool, outer=(1,31,32), constraints=(/1: (/NULL - ]; /31: (/NULL - ]; /32: (/NULL - ]), fd=(1)==(31), (31)==(1)] @@ -2153,7 +2153,7 @@ sort │ │ │ │ │ │ ├── key: (23,24) │ │ │ │ │ │ └── ordering: +23 │ │ │ │ │ └── filters [type=bool, outer=(24), constraints=(/24: (/NULL - ])] - │ │ │ │ │ └── flavor_projects.project_id = $1 [type=bool, outer=(24), constraints=(/24: (/NULL - ])] + │ │ │ │ │ └── project_id = $1 [type=bool, outer=(24), constraints=(/24: (/NULL - ])] │ │ │ │ └── projections [outer=(23)] │ │ │ │ └── true [type=bool] │ │ │ └── merge-on @@ -2165,33 +2165,33 @@ sort │ │ ├── const-not-null-agg [type=bool, outer=(28)] │ │ │ └── variable: true [type=bool, outer=(28)] │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ └── variable: flavors.name [type=string, outer=(2)] + │ │ │ └── variable: name [type=string, outer=(2)] │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ └── variable: flavors.memory_mb [type=int, outer=(3)] + │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ └── variable: flavors.vcpus [type=int, outer=(4)] + │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ └── variable: flavors.root_gb [type=int, outer=(5)] + │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ └── variable: flavors.ephemeral_gb [type=int, outer=(6)] + │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ └── variable: flavors.flavorid [type=string, outer=(7)] + │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ └── variable: flavors.swap [type=int, outer=(8)] + │ │ │ └── variable: swap [type=int, outer=(8)] │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ └── variable: flavors.rxtx_factor [type=float, outer=(9)] + │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ └── variable: flavors.vcpu_weight [type=int, outer=(10)] + │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ └── variable: flavors.disabled [type=bool, outer=(11)] + │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ └── variable: flavors.is_public [type=bool, outer=(12)] + │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ ├── const-agg [type=timestamp, outer=(14)] │ │ │ └── variable: flavors.created_at [type=timestamp, outer=(14)] │ │ └── const-agg [type=timestamp, outer=(15)] │ │ └── variable: flavors.updated_at [type=timestamp, outer=(15)] │ └── filters [type=bool, outer=(12,29)] - │ └── (flavors.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,29)] + │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,29)] └── filters [type=bool, outer=(1,19), constraints=(/1: (/NULL - ]; /19: (/NULL - ]), fd=(1)==(19), (19)==(1)] └── flavor_extra_specs.flavor_id = flavors.id [type=bool, outer=(1,19), constraints=(/1: (/NULL - ]; /19: (/NULL - ])] @@ -2318,7 +2318,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ │ │ │ └── fd: (1)-->(7,13), (7,13)~~>(1) │ │ │ │ │ │ │ └── filters [type=bool, outer=(1,7,13), constraints=(/13: (/NULL - ])] │ │ │ │ │ │ │ ├── instance_types.deleted = $1 [type=bool, outer=(13), constraints=(/13: (/NULL - ])] - │ │ │ │ │ │ │ └── (instance_types.flavorid > $4) OR ((instance_types.flavorid = $5) AND (instance_types.id > $6)) [type=bool, outer=(1,7)] + │ │ │ │ │ │ │ └── (flavorid > $4) OR ((flavorid = $5) AND (instance_types.id > $6)) [type=bool, outer=(1,7)] │ │ │ │ │ │ ├── project │ │ │ │ │ │ │ ├── columns: true:25(bool!null) instance_type_projects.instance_type_id:18(int!null) │ │ │ │ │ │ │ ├── fd: ()-->(25) @@ -2328,7 +2328,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ │ │ │ │ └── columns: instance_type_projects.instance_type_id:18(int!null) project_id:19(string) instance_type_projects.deleted:20(bool) │ │ │ │ │ │ │ │ └── filters [type=bool, outer=(19,20), constraints=(/19: (/NULL - ]; /20: (/NULL - ])] │ │ │ │ │ │ │ │ ├── instance_type_projects.deleted = $2 [type=bool, outer=(20), constraints=(/20: (/NULL - ])] - │ │ │ │ │ │ │ │ └── instance_type_projects.project_id = $3 [type=bool, outer=(19), constraints=(/19: (/NULL - ])] + │ │ │ │ │ │ │ │ └── project_id = $3 [type=bool, outer=(19), constraints=(/19: (/NULL - ])] │ │ │ │ │ │ │ └── projections [outer=(18)] │ │ │ │ │ │ │ └── true [type=bool] │ │ │ │ │ │ └── filters [type=bool, outer=(1,18), constraints=(/1: (/NULL - ]; /18: (/NULL - ]), fd=(1)==(18), (18)==(1)] @@ -2337,27 +2337,27 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ ├── const-not-null-agg [type=bool, outer=(25)] │ │ │ │ │ │ └── variable: true [type=bool, outer=(25)] │ │ │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ │ │ └── variable: instance_types.name [type=string, outer=(2)] + │ │ │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ │ │ └── variable: instance_types.memory_mb [type=int, outer=(3)] + │ │ │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ │ │ └── variable: instance_types.vcpus [type=int, outer=(4)] + │ │ │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ │ │ └── variable: instance_types.root_gb [type=int, outer=(5)] + │ │ │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ │ │ └── variable: instance_types.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ │ │ └── variable: instance_types.flavorid [type=string, outer=(7)] + │ │ │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ │ │ └── variable: instance_types.swap [type=int, outer=(8)] + │ │ │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ │ │ └── variable: instance_types.rxtx_factor [type=float, outer=(9)] + │ │ │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ │ │ └── variable: instance_types.vcpu_weight [type=int, outer=(10)] + │ │ │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ │ │ └── variable: instance_types.disabled [type=bool, outer=(11)] + │ │ │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ │ │ └── variable: instance_types.is_public [type=bool, outer=(12)] + │ │ │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ │ │ ├── const-agg [type=bool, outer=(13)] │ │ │ │ │ │ └── variable: instance_types.deleted [type=bool, outer=(13)] │ │ │ │ │ ├── const-agg [type=timestamp, outer=(14)] @@ -2367,7 +2367,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ └── const-agg [type=timestamp, outer=(16)] │ │ │ │ │ └── variable: instance_types.updated_at [type=timestamp, outer=(16)] │ │ │ │ └── filters [type=bool, outer=(12,26)] - │ │ │ │ └── (instance_types.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,26)] + │ │ │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,26)] │ │ │ └── placeholder: $7 [type=int] │ │ └── placeholder: $8 [type=int] │ └── filters [type=bool, outer=(1,31,32), constraints=(/1: (/NULL - ]; /31: (/NULL - ]; /32: (/NULL - ]), fd=(1)==(31), (31)==(1)] @@ -2487,7 +2487,7 @@ sort │ │ │ │ │ │ │ │ ├── key: (17,18) │ │ │ │ │ │ │ │ └── ordering: +17 │ │ │ │ │ │ │ └── filters [type=bool, outer=(18), constraints=(/18: (/NULL - ])] - │ │ │ │ │ │ │ └── flavor_projects.project_id = $1 [type=bool, outer=(18), constraints=(/18: (/NULL - ])] + │ │ │ │ │ │ │ └── project_id = $1 [type=bool, outer=(18), constraints=(/18: (/NULL - ])] │ │ │ │ │ │ └── projections [outer=(17)] │ │ │ │ │ │ └── true [type=bool] │ │ │ │ │ └── merge-on @@ -2499,33 +2499,33 @@ sort │ │ │ │ ├── const-not-null-agg [type=bool, outer=(22)] │ │ │ │ │ └── variable: true [type=bool, outer=(22)] │ │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ │ └── variable: flavors.name [type=string, outer=(2)] + │ │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ │ └── variable: flavors.memory_mb [type=int, outer=(3)] + │ │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ │ └── variable: flavors.vcpus [type=int, outer=(4)] + │ │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ │ └── variable: flavors.root_gb [type=int, outer=(5)] + │ │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ │ └── variable: flavors.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ │ └── variable: flavors.flavorid [type=string, outer=(7)] + │ │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ │ └── variable: flavors.swap [type=int, outer=(8)] + │ │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ │ └── variable: flavors.rxtx_factor [type=float, outer=(9)] + │ │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ │ └── variable: flavors.vcpu_weight [type=int, outer=(10)] + │ │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ │ └── variable: flavors.disabled [type=bool, outer=(11)] + │ │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ │ └── variable: flavors.is_public [type=bool, outer=(12)] + │ │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ │ ├── const-agg [type=timestamp, outer=(14)] │ │ │ │ │ └── variable: flavors.created_at [type=timestamp, outer=(14)] │ │ │ │ └── const-agg [type=timestamp, outer=(15)] │ │ │ │ └── variable: flavors.updated_at [type=timestamp, outer=(15)] │ │ │ └── filters [type=bool, outer=(12,23)] - │ │ │ └── (flavors.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,23)] + │ │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,23)] │ │ └── placeholder: $2 [type=int] │ └── placeholder: $3 [type=int] └── filters [type=bool, outer=(1,28), constraints=(/1: (/NULL - ]; /28: (/NULL - ]), fd=(1)==(28), (28)==(1)] @@ -2672,7 +2672,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ │ │ │ │ │ │ └── ordering: +1 opt(11) │ │ │ │ │ │ │ │ │ │ └── filters [type=bool, outer=(11,13), constraints=(/11: [/false - /false]; /13: (/NULL - ]), fd=()-->(11)] │ │ │ │ │ │ │ │ │ │ ├── instance_types.deleted = $1 [type=bool, outer=(13), constraints=(/13: (/NULL - ])] - │ │ │ │ │ │ │ │ │ │ └── instance_types.disabled = false [type=bool, outer=(11), constraints=(/11: [/false - /false]; tight)] + │ │ │ │ │ │ │ │ │ │ └── disabled = false [type=bool, outer=(11), constraints=(/11: [/false - /false]; tight)] │ │ │ │ │ │ │ │ │ ├── project │ │ │ │ │ │ │ │ │ │ ├── columns: true:33(bool!null) instance_type_projects.instance_type_id:18(int!null) │ │ │ │ │ │ │ │ │ │ ├── fd: ()-->(33) @@ -2697,27 +2697,27 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ │ │ │ ├── const-not-null-agg [type=bool, outer=(33)] │ │ │ │ │ │ │ │ │ └── variable: true [type=bool, outer=(33)] │ │ │ │ │ │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ │ │ │ │ │ └── variable: instance_types.name [type=string, outer=(2)] + │ │ │ │ │ │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ │ │ │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ │ │ │ │ │ └── variable: instance_types.memory_mb [type=int, outer=(3)] + │ │ │ │ │ │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ │ │ │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ │ │ │ │ │ └── variable: instance_types.vcpus [type=int, outer=(4)] + │ │ │ │ │ │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ │ │ │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ │ │ │ │ │ └── variable: instance_types.root_gb [type=int, outer=(5)] + │ │ │ │ │ │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ │ │ │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ │ │ │ │ │ └── variable: instance_types.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ │ │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ │ │ │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ │ │ │ │ │ └── variable: instance_types.flavorid [type=string, outer=(7)] + │ │ │ │ │ │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ │ │ │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ │ │ │ │ │ └── variable: instance_types.swap [type=int, outer=(8)] + │ │ │ │ │ │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ │ │ │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ │ │ │ │ │ └── variable: instance_types.rxtx_factor [type=float, outer=(9)] + │ │ │ │ │ │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ │ │ │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ │ │ │ │ │ └── variable: instance_types.vcpu_weight [type=int, outer=(10)] + │ │ │ │ │ │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ │ │ │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ │ │ │ │ │ └── variable: instance_types.disabled [type=bool, outer=(11)] + │ │ │ │ │ │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ │ │ │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ │ │ │ │ │ └── variable: instance_types.is_public [type=bool, outer=(12)] + │ │ │ │ │ │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ │ │ │ │ │ ├── const-agg [type=bool, outer=(13)] │ │ │ │ │ │ │ │ │ └── variable: instance_types.deleted [type=bool, outer=(13)] │ │ │ │ │ │ │ │ ├── const-agg [type=timestamp, outer=(14)] @@ -2727,7 +2727,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ │ │ │ └── const-agg [type=timestamp, outer=(16)] │ │ │ │ │ │ │ │ └── variable: instance_types.updated_at [type=timestamp, outer=(16)] │ │ │ │ │ │ │ └── filters [type=bool, outer=(12,34)] - │ │ │ │ │ │ │ └── (instance_types.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,34)] + │ │ │ │ │ │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,34)] │ │ │ │ │ │ ├── project │ │ │ │ │ │ │ ├── columns: true:36(bool!null) instance_type_projects.instance_type_id:26(int!null) │ │ │ │ │ │ │ ├── fd: ()-->(36) @@ -2747,27 +2747,27 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ ├── const-not-null-agg [type=bool, outer=(36)] │ │ │ │ │ │ └── variable: true [type=bool, outer=(36)] │ │ │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ │ │ └── variable: instance_types.name [type=string, outer=(2)] + │ │ │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ │ │ └── variable: instance_types.memory_mb [type=int, outer=(3)] + │ │ │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ │ │ └── variable: instance_types.vcpus [type=int, outer=(4)] + │ │ │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ │ │ └── variable: instance_types.root_gb [type=int, outer=(5)] + │ │ │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ │ │ └── variable: instance_types.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ │ │ └── variable: instance_types.flavorid [type=string, outer=(7)] + │ │ │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ │ │ └── variable: instance_types.swap [type=int, outer=(8)] + │ │ │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ │ │ └── variable: instance_types.rxtx_factor [type=float, outer=(9)] + │ │ │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ │ │ └── variable: instance_types.vcpu_weight [type=int, outer=(10)] + │ │ │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ │ │ └── variable: instance_types.disabled [type=bool, outer=(11)] + │ │ │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ │ │ └── variable: instance_types.is_public [type=bool, outer=(12)] + │ │ │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ │ │ ├── const-agg [type=bool, outer=(13)] │ │ │ │ │ │ └── variable: instance_types.deleted [type=bool, outer=(13)] │ │ │ │ │ ├── const-agg [type=timestamp, outer=(14)] @@ -2777,7 +2777,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ └── const-agg [type=timestamp, outer=(16)] │ │ │ │ │ └── variable: instance_types.updated_at [type=timestamp, outer=(16)] │ │ │ │ └── filters [type=bool, outer=(12,37)] - │ │ │ │ └── (instance_types.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,37)] + │ │ │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,37)] │ │ │ └── placeholder: $7 [type=int] │ │ └── placeholder: $8 [type=int] │ └── filters [type=bool, outer=(1,42,43), constraints=(/1: (/NULL - ]; /42: (/NULL - ]; /43: (/NULL - ]), fd=(1)==(42), (42)==(1)] @@ -2906,7 +2906,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ │ │ │ └── fd: (1)-->(7,13), (7,13)~~>(1) │ │ │ │ │ │ │ └── filters [type=bool, outer=(7,13), constraints=(/7: (/NULL - ]; /13: (/NULL - ])] │ │ │ │ │ │ │ ├── instance_types.deleted = $1 [type=bool, outer=(13), constraints=(/13: (/NULL - ])] - │ │ │ │ │ │ │ └── instance_types.flavorid = $4 [type=bool, outer=(7), constraints=(/7: (/NULL - ])] + │ │ │ │ │ │ │ └── flavorid = $4 [type=bool, outer=(7), constraints=(/7: (/NULL - ])] │ │ │ │ │ │ ├── project │ │ │ │ │ │ │ ├── columns: true:25(bool!null) instance_type_projects.instance_type_id:18(int!null) │ │ │ │ │ │ │ ├── fd: ()-->(25) @@ -2916,7 +2916,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ │ │ │ │ └── columns: instance_type_projects.instance_type_id:18(int!null) project_id:19(string) instance_type_projects.deleted:20(bool) │ │ │ │ │ │ │ │ └── filters [type=bool, outer=(19,20), constraints=(/19: (/NULL - ]; /20: (/NULL - ])] │ │ │ │ │ │ │ │ ├── instance_type_projects.deleted = $2 [type=bool, outer=(20), constraints=(/20: (/NULL - ])] - │ │ │ │ │ │ │ │ └── instance_type_projects.project_id = $3 [type=bool, outer=(19), constraints=(/19: (/NULL - ])] + │ │ │ │ │ │ │ │ └── project_id = $3 [type=bool, outer=(19), constraints=(/19: (/NULL - ])] │ │ │ │ │ │ │ └── projections [outer=(18)] │ │ │ │ │ │ │ └── true [type=bool] │ │ │ │ │ │ └── filters [type=bool, outer=(1,18), constraints=(/1: (/NULL - ]; /18: (/NULL - ]), fd=(1)==(18), (18)==(1)] @@ -2925,27 +2925,27 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ ├── const-not-null-agg [type=bool, outer=(25)] │ │ │ │ │ │ └── variable: true [type=bool, outer=(25)] │ │ │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ │ │ └── variable: instance_types.name [type=string, outer=(2)] + │ │ │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ │ │ └── variable: instance_types.memory_mb [type=int, outer=(3)] + │ │ │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ │ │ └── variable: instance_types.vcpus [type=int, outer=(4)] + │ │ │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ │ │ └── variable: instance_types.root_gb [type=int, outer=(5)] + │ │ │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ │ │ └── variable: instance_types.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ │ │ └── variable: instance_types.flavorid [type=string, outer=(7)] + │ │ │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ │ │ └── variable: instance_types.swap [type=int, outer=(8)] + │ │ │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ │ │ └── variable: instance_types.rxtx_factor [type=float, outer=(9)] + │ │ │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ │ │ └── variable: instance_types.vcpu_weight [type=int, outer=(10)] + │ │ │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ │ │ └── variable: instance_types.disabled [type=bool, outer=(11)] + │ │ │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ │ │ └── variable: instance_types.is_public [type=bool, outer=(12)] + │ │ │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ │ │ ├── const-agg [type=bool, outer=(13)] │ │ │ │ │ │ └── variable: instance_types.deleted [type=bool, outer=(13)] │ │ │ │ │ ├── const-agg [type=timestamp, outer=(14)] @@ -2955,7 +2955,7 @@ left-join (lookup instance_type_extra_specs) │ │ │ │ │ └── const-agg [type=timestamp, outer=(16)] │ │ │ │ │ └── variable: instance_types.updated_at [type=timestamp, outer=(16)] │ │ │ │ └── filters [type=bool, outer=(12,26)] - │ │ │ │ └── (instance_types.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,26)] + │ │ │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,26)] │ │ │ └── placeholder: $5 [type=int] │ │ └── placeholder: $6 [type=int] │ └── filters [type=bool, outer=(1,31,32), constraints=(/1: (/NULL - ]; /31: (/NULL - ]; /32: (/NULL - ]), fd=(1)==(31), (31)==(1)] @@ -3068,7 +3068,7 @@ right-join │ │ │ │ │ │ │ │ ├── key: (17,18) │ │ │ │ │ │ │ │ └── ordering: +17 │ │ │ │ │ │ │ └── filters [type=bool, outer=(17,18), constraints=(/17: (/NULL - ]; /18: (/NULL - ])] - │ │ │ │ │ │ │ ├── flavor_projects.project_id = $1 [type=bool, outer=(18), constraints=(/18: (/NULL - ])] + │ │ │ │ │ │ │ ├── project_id = $1 [type=bool, outer=(18), constraints=(/18: (/NULL - ])] │ │ │ │ │ │ │ └── flavor_projects.flavor_id = $2 [type=bool, outer=(17), constraints=(/17: (/NULL - ])] │ │ │ │ │ │ └── projections [outer=(17)] │ │ │ │ │ │ └── true [type=bool] @@ -3081,33 +3081,33 @@ right-join │ │ │ │ ├── const-not-null-agg [type=bool, outer=(22)] │ │ │ │ │ └── variable: true [type=bool, outer=(22)] │ │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ │ └── variable: flavors.name [type=string, outer=(2)] + │ │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ │ └── variable: flavors.memory_mb [type=int, outer=(3)] + │ │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ │ └── variable: flavors.vcpus [type=int, outer=(4)] + │ │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ │ └── variable: flavors.root_gb [type=int, outer=(5)] + │ │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ │ └── variable: flavors.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ │ └── variable: flavors.flavorid [type=string, outer=(7)] + │ │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ │ └── variable: flavors.swap [type=int, outer=(8)] + │ │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ │ └── variable: flavors.rxtx_factor [type=float, outer=(9)] + │ │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ │ └── variable: flavors.vcpu_weight [type=int, outer=(10)] + │ │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ │ └── variable: flavors.disabled [type=bool, outer=(11)] + │ │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ │ └── variable: flavors.is_public [type=bool, outer=(12)] + │ │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ │ ├── const-agg [type=timestamp, outer=(14)] │ │ │ │ │ └── variable: flavors.created_at [type=timestamp, outer=(14)] │ │ │ │ └── const-agg [type=timestamp, outer=(15)] │ │ │ │ └── variable: flavors.updated_at [type=timestamp, outer=(15)] │ │ │ └── filters [type=bool, outer=(12,23)] - │ │ │ └── (flavors.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,23)] + │ │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,23)] │ │ └── placeholder: $3 [type=int] │ └── placeholder: $4 [type=int] └── filters [type=bool, outer=(1,28), constraints=(/1: (/NULL - ]; /28: (/NULL - ]), fd=(1)==(28), (28)==(1)] @@ -3220,7 +3220,7 @@ sort │ │ │ │ │ │ │ ├── key: (17,18) │ │ │ │ │ │ │ └── ordering: +17 │ │ │ │ │ │ └── filters [type=bool, outer=(18), constraints=(/18: (/NULL - ])] - │ │ │ │ │ │ └── flavor_projects.project_id = $1 [type=bool, outer=(18), constraints=(/18: (/NULL - ])] + │ │ │ │ │ │ └── project_id = $1 [type=bool, outer=(18), constraints=(/18: (/NULL - ])] │ │ │ │ │ └── projections [outer=(17)] │ │ │ │ │ └── true [type=bool] │ │ │ │ └── merge-on @@ -3232,35 +3232,35 @@ sort │ │ │ ├── const-not-null-agg [type=bool, outer=(22)] │ │ │ │ └── variable: true [type=bool, outer=(22)] │ │ │ ├── const-agg [type=string, outer=(2)] - │ │ │ │ └── variable: flavors.name [type=string, outer=(2)] + │ │ │ │ └── variable: name [type=string, outer=(2)] │ │ │ ├── const-agg [type=int, outer=(3)] - │ │ │ │ └── variable: flavors.memory_mb [type=int, outer=(3)] + │ │ │ │ └── variable: memory_mb [type=int, outer=(3)] │ │ │ ├── const-agg [type=int, outer=(4)] - │ │ │ │ └── variable: flavors.vcpus [type=int, outer=(4)] + │ │ │ │ └── variable: vcpus [type=int, outer=(4)] │ │ │ ├── const-agg [type=int, outer=(5)] - │ │ │ │ └── variable: flavors.root_gb [type=int, outer=(5)] + │ │ │ │ └── variable: root_gb [type=int, outer=(5)] │ │ │ ├── const-agg [type=int, outer=(6)] - │ │ │ │ └── variable: flavors.ephemeral_gb [type=int, outer=(6)] + │ │ │ │ └── variable: ephemeral_gb [type=int, outer=(6)] │ │ │ ├── const-agg [type=string, outer=(7)] - │ │ │ │ └── variable: flavors.flavorid [type=string, outer=(7)] + │ │ │ │ └── variable: flavorid [type=string, outer=(7)] │ │ │ ├── const-agg [type=int, outer=(8)] - │ │ │ │ └── variable: flavors.swap [type=int, outer=(8)] + │ │ │ │ └── variable: swap [type=int, outer=(8)] │ │ │ ├── const-agg [type=float, outer=(9)] - │ │ │ │ └── variable: flavors.rxtx_factor [type=float, outer=(9)] + │ │ │ │ └── variable: rxtx_factor [type=float, outer=(9)] │ │ │ ├── const-agg [type=int, outer=(10)] - │ │ │ │ └── variable: flavors.vcpu_weight [type=int, outer=(10)] + │ │ │ │ └── variable: vcpu_weight [type=int, outer=(10)] │ │ │ ├── const-agg [type=bool, outer=(11)] - │ │ │ │ └── variable: flavors.disabled [type=bool, outer=(11)] + │ │ │ │ └── variable: disabled [type=bool, outer=(11)] │ │ │ ├── const-agg [type=bool, outer=(12)] - │ │ │ │ └── variable: flavors.is_public [type=bool, outer=(12)] + │ │ │ │ └── variable: is_public [type=bool, outer=(12)] │ │ │ ├── const-agg [type=string, outer=(13)] - │ │ │ │ └── variable: flavors.description [type=string, outer=(13)] + │ │ │ │ └── variable: description [type=string, outer=(13)] │ │ │ ├── const-agg [type=timestamp, outer=(14)] │ │ │ │ └── variable: flavors.created_at [type=timestamp, outer=(14)] │ │ │ └── const-agg [type=timestamp, outer=(15)] │ │ │ └── variable: flavors.updated_at [type=timestamp, outer=(15)] │ │ └── filters [type=bool, outer=(12,23)] - │ │ └── (flavors.is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,23)] + │ │ └── (is_public = true) OR (true_agg IS NOT NULL) [type=bool, outer=(12,23)] │ └── placeholder: $2 [type=int] └── filters [type=bool, outer=(1,28), constraints=(/1: (/NULL - ]; /28: (/NULL - ]), fd=(1)==(28), (28)==(1)] └── flavor_extra_specs.flavor_id = flavors.id [type=bool, outer=(1,28), constraints=(/1: (/NULL - ]; /28: (/NULL - ])] diff --git a/pkg/sql/opt/xform/testdata/external/pgadmin b/pkg/sql/opt/xform/testdata/external/pgadmin index 46436f28252c..75156f3c2c9b 100644 --- a/pkg/sql/opt/xform/testdata/external/pgadmin +++ b/pkg/sql/opt/xform/testdata/external/pgadmin @@ -146,11 +146,11 @@ project │ │ │ │ ├── scan pg_roles │ │ │ │ │ └── columns: oid:21(oid) rolname:22(name) rolsuper:23(bool) │ │ │ │ └── filters [type=bool, outer=(22), constraints=(/22: (/NULL - ])] - │ │ │ │ └── pg_roles.rolname = current_user() [type=bool, outer=(22), constraints=(/22: (/NULL - ])] + │ │ │ │ └── rolname = current_user() [type=bool, outer=(22), constraints=(/22: (/NULL - ])] │ │ │ └── projections [outer=(4,21,23)] - │ │ │ └── pg_roles.rolsuper OR (pg_roles.oid = pg_stat_activity.usesysid) [type=bool, outer=(4,21,23)] + │ │ │ └── rolsuper OR (oid = usesysid) [type=bool, outer=(4,21,23)] │ │ └── filters [type=bool, outer=(36), constraints=(/36: [/true - /true]; tight), fd=()-->(36)] │ │ └── variable: ?column? [type=bool, outer=(36), constraints=(/36: [/true - /true]; tight)] │ └── true [type=bool] └── projections [outer=(2,3,5-12,19)] - └── CASE WHEN (pg_stat_activity.client_hostname IS NOT NULL) AND (pg_stat_activity.client_hostname != '') THEN (pg_stat_activity.client_hostname || ':') || pg_stat_activity.client_port::STRING WHEN (pg_stat_activity.client_addr IS NOT NULL) AND (pg_stat_activity.client_addr::STRING != '') THEN (pg_stat_activity.client_addr::STRING || ':') || pg_stat_activity.client_port::STRING WHEN pg_stat_activity.client_port = -1 THEN 'local pipe' ELSE 'localhost:' || pg_stat_activity.client_port::STRING END [type=string, outer=(7-9)] + └── CASE WHEN (client_hostname IS NOT NULL) AND (client_hostname != '') THEN (client_hostname || ':') || client_port::STRING WHEN (client_addr IS NOT NULL) AND (client_addr::STRING != '') THEN (client_addr::STRING || ':') || client_port::STRING WHEN client_port = -1 THEN 'local pipe' ELSE 'localhost:' || client_port::STRING END [type=string, outer=(7-9)] diff --git a/pkg/sql/opt/xform/testdata/external/pgjdbc b/pkg/sql/opt/xform/testdata/external/pgjdbc index f6c13bf992ff..26d0a95117a4 100644 --- a/pkg/sql/opt/xform/testdata/external/pgjdbc +++ b/pkg/sql/opt/xform/testdata/external/pgjdbc @@ -139,7 +139,7 @@ project │ │ │ ├── scan pg_namespace │ │ │ │ └── columns: pg_namespace.oid:33(oid) nspname:34(name!null) │ │ │ └── filters [type=bool, outer=(34), constraints=(/34: (/NULL - /'pg_catalog') [/e'pg_catalog\x00' - ]; tight)] - │ │ │ └── pg_namespace.nspname != 'pg_catalog' [type=bool, outer=(34), constraints=(/34: (/NULL - /'pg_catalog') [/e'pg_catalog\x00' - ]; tight)] + │ │ │ └── nspname != 'pg_catalog' [type=bool, outer=(34), constraints=(/34: (/NULL - /'pg_catalog') [/e'pg_catalog\x00' - ]; tight)] │ │ └── filters [type=bool, outer=(3,33), constraints=(/3: (/NULL - ]; /33: (/NULL - ]), fd=(3)==(33), (33)==(3)] │ │ └── pg_type.typnamespace = pg_namespace.oid [type=bool, outer=(3,33), constraints=(/3: (/NULL - ]; /33: (/NULL - ])] │ ├── max1-row diff --git a/pkg/sql/opt/xform/testdata/external/tpcc b/pkg/sql/opt/xform/testdata/external/tpcc index 4c64ebbb51fe..aa3ce88a246f 100644 --- a/pkg/sql/opt/xform/testdata/external/tpcc +++ b/pkg/sql/opt/xform/testdata/external/tpcc @@ -847,7 +847,7 @@ scalar-group-by │ └── interesting orderings: (+3,+2,-1) └── aggregations [outer=(9)] └── sum [type=decimal, outer=(9)] - └── variable: order_line.ol_amount [type=decimal, outer=(9)] + └── variable: ol_amount [type=decimal, outer=(9)] # -------------------------------------------------- # 2.8 The Stock-Level Transaction @@ -916,21 +916,21 @@ scalar-group-by │ │ └── interesting orderings: (+3,+2,-1) │ └── filters [type=bool, outer=(3,5,11-13), constraints=(/3: (/NULL - ]; /5: (/NULL - ]; /11: (/NULL - ]; /12: [/10 - /10]; /13: (/NULL - /14]), fd=()-->(3,12), (5)==(11), (11)==(5), (3)==(12), (12)==(3)] │ ├── eq [type=bool, outer=(5,11), constraints=(/5: (/NULL - ]; /11: (/NULL - ])] - │ │ ├── variable: stock.s_i_id [type=int, outer=(11)] - │ │ └── variable: order_line.ol_i_id [type=int, outer=(5)] + │ │ ├── variable: s_i_id [type=int, outer=(11)] + │ │ └── variable: ol_i_id [type=int, outer=(5)] │ ├── eq [type=bool, outer=(3,12), constraints=(/3: (/NULL - ]; /12: (/NULL - ])] - │ │ ├── variable: stock.s_w_id [type=int, outer=(12)] - │ │ └── variable: order_line.ol_w_id [type=int, outer=(3)] + │ │ ├── variable: s_w_id [type=int, outer=(12)] + │ │ └── variable: ol_w_id [type=int, outer=(3)] │ ├── eq [type=bool, outer=(12), constraints=(/12: [/10 - /10]; tight)] - │ │ ├── variable: stock.s_w_id [type=int, outer=(12)] + │ │ ├── variable: s_w_id [type=int, outer=(12)] │ │ └── const: 10 [type=int] │ └── lt [type=bool, outer=(13), constraints=(/13: (/NULL - /14]; tight)] - │ ├── variable: stock.s_quantity [type=int, outer=(13)] + │ ├── variable: s_quantity [type=int, outer=(13)] │ └── const: 15 [type=int] └── aggregations [outer=(11)] └── count [type=int, outer=(11)] └── agg-distinct [type=int, outer=(11)] - └── variable: stock.s_i_id [type=int, outer=(11)] + └── variable: s_i_id [type=int, outer=(11)] # -------------------------------------------------- # Consistency Queries @@ -990,13 +990,13 @@ scalar-group-by │ │ │ └── interesting orderings: (+11) │ │ └── aggregations [outer=(19)] │ │ └── sum [type=decimal, outer=(19)] - │ │ └── variable: district.d_ytd [type=decimal, outer=(19)] + │ │ └── variable: d_ytd [type=decimal, outer=(19)] │ └── filters [type=bool, outer=(1,9,11,21), constraints=(/1: (/NULL - ]; /9: (/NULL - ]; /11: (/NULL - ]; /21: (/NULL - ]), fd=(1)==(11), (11)==(1)] │ ├── eq [type=bool, outer=(1,11), constraints=(/1: (/NULL - ]; /11: (/NULL - ])] - │ │ ├── variable: warehouse.w_id [type=int, outer=(1)] - │ │ └── variable: district.d_w_id [type=int, outer=(11)] + │ │ ├── variable: w_id [type=int, outer=(1)] + │ │ └── variable: d_w_id [type=int, outer=(11)] │ └── ne [type=bool, outer=(9,21), constraints=(/9: (/NULL - ]; /21: (/NULL - ])] - │ ├── variable: warehouse.w_ytd [type=decimal, outer=(9)] + │ ├── variable: w_ytd [type=decimal, outer=(9)] │ └── variable: sum_d_ytd [type=decimal, outer=(21)] └── aggregations └── count-rows [type=int] @@ -1047,7 +1047,7 @@ sort │ └── interesting orderings: (+3,+2,-1) └── aggregations [outer=(1)] └── max [type=int, outer=(1)] - └── variable: new_order.no_o_id [type=int, outer=(1)] + └── variable: no_o_id [type=int, outer=(1)] opt format=hide-qual SELECT max(o_id) @@ -1080,7 +1080,7 @@ sort │ └── interesting orderings: (+3,+2,-1) └── aggregations [outer=(1)] └── max [type=int, outer=(1)] - └── variable: order.o_id [type=int, outer=(1)] + └── variable: o_id [type=int, outer=(1)] opt format=hide-qual SELECT count(*) @@ -1125,9 +1125,9 @@ scalar-group-by │ │ │ └── interesting orderings: (+3,+2,-1) │ │ └── aggregations [outer=(1)] │ │ ├── max [type=int, outer=(1)] - │ │ │ └── variable: new_order.no_o_id [type=int, outer=(1)] + │ │ │ └── variable: no_o_id [type=int, outer=(1)] │ │ ├── min [type=int, outer=(1)] - │ │ │ └── variable: new_order.no_o_id [type=int, outer=(1)] + │ │ │ └── variable: no_o_id [type=int, outer=(1)] │ │ └── count-rows [type=int] │ └── filters [type=bool, outer=(4-6)] │ └── ne [type=bool, outer=(4-6)] @@ -1170,7 +1170,7 @@ sort │ └── interesting orderings: (+3,+2) └── aggregations [outer=(7)] └── sum [type=decimal, outer=(7)] - └── variable: order.o_ol_cnt [type=int, outer=(7)] + └── variable: o_ol_cnt [type=int, outer=(7)] opt format=hide-qual SELECT count(*) @@ -1246,7 +1246,7 @@ except-all │ └── interesting orderings: (+6,+5,-4) (+6,+5,+9,+4) └── filters [type=bool, outer=(9), constraints=(/9: [/NULL - /NULL]; tight), fd=()-->(9)] └── is [type=bool, outer=(9), constraints=(/9: [/NULL - /NULL]; tight)] - ├── variable: order.o_carrier_id [type=int, outer=(9)] + ├── variable: o_carrier_id [type=int, outer=(9)] └── null [type=unknown] opt format=hide-qual @@ -1285,7 +1285,7 @@ except-all │ │ └── interesting orderings: (+3,+2,-1) (+3,+2,+6,+1) │ └── filters [type=bool, outer=(6), constraints=(/6: [/NULL - /NULL]; tight), fd=()-->(6)] │ └── is [type=bool, outer=(6), constraints=(/6: [/NULL - /NULL]; tight)] - │ ├── variable: order.o_carrier_id [type=int, outer=(6)] + │ ├── variable: o_carrier_id [type=int, outer=(6)] │ └── null [type=unknown] └── scan new_order ├── columns: no_o_id:9(int!null) no_d_id:10(int!null) no_w_id:11(int!null) @@ -1448,7 +1448,7 @@ scalar-group-by │ │ │ │ └── interesting orderings: (+3,+2,-1) (+3,+2,+6,+1) │ │ │ └── filters [type=bool, outer=(6), constraints=(/6: [/NULL - /NULL]; tight), fd=()-->(6)] │ │ │ └── is [type=bool, outer=(6), constraints=(/6: [/NULL - /NULL]; tight)] - │ │ │ ├── variable: order.o_carrier_id [type=int, outer=(6)] + │ │ │ ├── variable: o_carrier_id [type=int, outer=(6)] │ │ │ └── null [type=unknown] │ │ ├── project │ │ │ ├── columns: ol_o_id:9(int!null) ol_d_id:10(int!null) ol_w_id:11(int!null) @@ -1471,25 +1471,25 @@ scalar-group-by │ │ │ │ └── interesting orderings: (+11,+10,-9) │ │ │ └── filters [type=bool, outer=(15), constraints=(/15: [/NULL - /NULL]; tight), fd=()-->(15)] │ │ │ └── is [type=bool, outer=(15), constraints=(/15: [/NULL - /NULL]; tight)] - │ │ │ ├── variable: order_line.ol_delivery_d [type=timestamp, outer=(15)] + │ │ │ ├── variable: ol_delivery_d [type=timestamp, outer=(15)] │ │ │ └── null [type=unknown] │ │ └── filters [type=bool, outer=(1-3,9-11), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /3: (/NULL - ]; /9: (/NULL - ]; /10: (/NULL - ]; /11: (/NULL - ]), fd=(3)==(11), (11)==(3), (2)==(10), (10)==(2), (1)==(9), (9)==(1)] │ │ ├── eq [type=bool, outer=(3,11), constraints=(/3: (/NULL - ]; /11: (/NULL - ])] - │ │ │ ├── variable: order_line.ol_w_id [type=int, outer=(11)] - │ │ │ └── variable: order.o_w_id [type=int, outer=(3)] + │ │ │ ├── variable: ol_w_id [type=int, outer=(11)] + │ │ │ └── variable: o_w_id [type=int, outer=(3)] │ │ ├── eq [type=bool, outer=(2,10), constraints=(/2: (/NULL - ]; /10: (/NULL - ])] - │ │ │ ├── variable: order_line.ol_d_id [type=int, outer=(10)] - │ │ │ └── variable: order.o_d_id [type=int, outer=(2)] + │ │ │ ├── variable: ol_d_id [type=int, outer=(10)] + │ │ │ └── variable: o_d_id [type=int, outer=(2)] │ │ └── eq [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ])] - │ │ ├── variable: order_line.ol_o_id [type=int, outer=(9)] - │ │ └── variable: order.o_id [type=int, outer=(1)] + │ │ ├── variable: ol_o_id [type=int, outer=(9)] + │ │ └── variable: o_id [type=int, outer=(1)] │ └── filters [type=bool, outer=(1,9)] │ └── or [type=bool, outer=(1,9)] │ ├── is [type=bool, outer=(9)] - │ │ ├── variable: order_line.ol_o_id [type=int, outer=(9)] + │ │ ├── variable: ol_o_id [type=int, outer=(9)] │ │ └── null [type=unknown] │ └── is [type=bool, outer=(1)] - │ ├── variable: order.o_id [type=int, outer=(1)] + │ ├── variable: o_id [type=int, outer=(1)] │ └── null [type=unknown] └── aggregations └── count-rows [type=int] diff --git a/pkg/sql/opt/xform/testdata/external/tpcc-no-stats b/pkg/sql/opt/xform/testdata/external/tpcc-no-stats index cdc11412f902..890bcb9bc0b2 100644 --- a/pkg/sql/opt/xform/testdata/external/tpcc-no-stats +++ b/pkg/sql/opt/xform/testdata/external/tpcc-no-stats @@ -652,7 +652,7 @@ scalar-group-by │ └── interesting orderings: (+3,+2,-1) └── aggregations [outer=(9)] └── sum [type=decimal, outer=(9)] - └── variable: order_line.ol_amount [type=decimal, outer=(9)] + └── variable: ol_amount [type=decimal, outer=(9)] # -------------------------------------------------- # 2.8 The Stock-Level Transaction @@ -721,21 +721,21 @@ scalar-group-by │ │ └── interesting orderings: (+3,+2,-1) │ └── filters [type=bool, outer=(3,5,11-13), constraints=(/3: (/NULL - ]; /5: (/NULL - ]; /11: (/NULL - ]; /12: [/10 - /10]; /13: (/NULL - /14]), fd=()-->(3,12), (5)==(11), (11)==(5), (3)==(12), (12)==(3)] │ ├── eq [type=bool, outer=(5,11), constraints=(/5: (/NULL - ]; /11: (/NULL - ])] - │ │ ├── variable: stock.s_i_id [type=int, outer=(11)] - │ │ └── variable: order_line.ol_i_id [type=int, outer=(5)] + │ │ ├── variable: s_i_id [type=int, outer=(11)] + │ │ └── variable: ol_i_id [type=int, outer=(5)] │ ├── eq [type=bool, outer=(3,12), constraints=(/3: (/NULL - ]; /12: (/NULL - ])] - │ │ ├── variable: stock.s_w_id [type=int, outer=(12)] - │ │ └── variable: order_line.ol_w_id [type=int, outer=(3)] + │ │ ├── variable: s_w_id [type=int, outer=(12)] + │ │ └── variable: ol_w_id [type=int, outer=(3)] │ ├── eq [type=bool, outer=(12), constraints=(/12: [/10 - /10]; tight)] - │ │ ├── variable: stock.s_w_id [type=int, outer=(12)] + │ │ ├── variable: s_w_id [type=int, outer=(12)] │ │ └── const: 10 [type=int] │ └── lt [type=bool, outer=(13), constraints=(/13: (/NULL - /14]; tight)] - │ ├── variable: stock.s_quantity [type=int, outer=(13)] + │ ├── variable: s_quantity [type=int, outer=(13)] │ └── const: 15 [type=int] └── aggregations [outer=(11)] └── count [type=int, outer=(11)] └── agg-distinct [type=int, outer=(11)] - └── variable: stock.s_i_id [type=int, outer=(11)] + └── variable: s_i_id [type=int, outer=(11)] # -------------------------------------------------- # Consistency Queries @@ -795,13 +795,13 @@ scalar-group-by │ │ │ └── interesting orderings: (+11) │ │ └── aggregations [outer=(19)] │ │ └── sum [type=decimal, outer=(19)] - │ │ └── variable: district.d_ytd [type=decimal, outer=(19)] + │ │ └── variable: d_ytd [type=decimal, outer=(19)] │ └── filters [type=bool, outer=(1,9,11,21), constraints=(/1: (/NULL - ]; /9: (/NULL - ]; /11: (/NULL - ]; /21: (/NULL - ]), fd=(1)==(11), (11)==(1)] │ ├── eq [type=bool, outer=(1,11), constraints=(/1: (/NULL - ]; /11: (/NULL - ])] - │ │ ├── variable: warehouse.w_id [type=int, outer=(1)] - │ │ └── variable: district.d_w_id [type=int, outer=(11)] + │ │ ├── variable: w_id [type=int, outer=(1)] + │ │ └── variable: d_w_id [type=int, outer=(11)] │ └── ne [type=bool, outer=(9,21), constraints=(/9: (/NULL - ]; /21: (/NULL - ])] - │ ├── variable: warehouse.w_ytd [type=decimal, outer=(9)] + │ ├── variable: w_ytd [type=decimal, outer=(9)] │ └── variable: sum_d_ytd [type=decimal, outer=(21)] └── aggregations └── count-rows [type=int] @@ -852,7 +852,7 @@ sort │ └── interesting orderings: (+3,+2,-1) └── aggregations [outer=(1)] └── max [type=int, outer=(1)] - └── variable: new_order.no_o_id [type=int, outer=(1)] + └── variable: no_o_id [type=int, outer=(1)] opt format=hide-qual SELECT max(o_id) @@ -885,7 +885,7 @@ sort │ └── interesting orderings: (+3,+2,-1) └── aggregations [outer=(1)] └── max [type=int, outer=(1)] - └── variable: order.o_id [type=int, outer=(1)] + └── variable: o_id [type=int, outer=(1)] opt format=hide-qual SELECT count(*) @@ -930,9 +930,9 @@ scalar-group-by │ │ │ └── interesting orderings: (+3,+2,-1) │ │ └── aggregations [outer=(1)] │ │ ├── max [type=int, outer=(1)] - │ │ │ └── variable: new_order.no_o_id [type=int, outer=(1)] + │ │ │ └── variable: no_o_id [type=int, outer=(1)] │ │ ├── min [type=int, outer=(1)] - │ │ │ └── variable: new_order.no_o_id [type=int, outer=(1)] + │ │ │ └── variable: no_o_id [type=int, outer=(1)] │ │ └── count-rows [type=int] │ └── filters [type=bool, outer=(4-6)] │ └── ne [type=bool, outer=(4-6)] @@ -975,7 +975,7 @@ sort │ └── interesting orderings: (+3,+2) └── aggregations [outer=(7)] └── sum [type=decimal, outer=(7)] - └── variable: order.o_ol_cnt [type=int, outer=(7)] + └── variable: o_ol_cnt [type=int, outer=(7)] opt format=hide-qual SELECT count(*) @@ -1051,7 +1051,7 @@ except-all │ └── interesting orderings: (+6,+5,-4) (+6,+5,+9,+4) └── filters [type=bool, outer=(9), constraints=(/9: [/NULL - /NULL]; tight), fd=()-->(9)] └── is [type=bool, outer=(9), constraints=(/9: [/NULL - /NULL]; tight)] - ├── variable: order.o_carrier_id [type=int, outer=(9)] + ├── variable: o_carrier_id [type=int, outer=(9)] └── null [type=unknown] opt format=hide-qual @@ -1090,7 +1090,7 @@ except-all │ │ └── interesting orderings: (+3,+2,-1) (+3,+2,+6,+1) │ └── filters [type=bool, outer=(6), constraints=(/6: [/NULL - /NULL]; tight), fd=()-->(6)] │ └── is [type=bool, outer=(6), constraints=(/6: [/NULL - /NULL]; tight)] - │ ├── variable: order.o_carrier_id [type=int, outer=(6)] + │ ├── variable: o_carrier_id [type=int, outer=(6)] │ └── null [type=unknown] └── scan new_order ├── columns: no_o_id:9(int!null) no_d_id:10(int!null) no_w_id:11(int!null) @@ -1253,7 +1253,7 @@ scalar-group-by │ │ │ │ └── interesting orderings: (+3,+2,-1) (+3,+2,+6,+1) │ │ │ └── filters [type=bool, outer=(6), constraints=(/6: [/NULL - /NULL]; tight), fd=()-->(6)] │ │ │ └── is [type=bool, outer=(6), constraints=(/6: [/NULL - /NULL]; tight)] - │ │ │ ├── variable: order.o_carrier_id [type=int, outer=(6)] + │ │ │ ├── variable: o_carrier_id [type=int, outer=(6)] │ │ │ └── null [type=unknown] │ │ ├── project │ │ │ ├── columns: ol_o_id:9(int!null) ol_d_id:10(int!null) ol_w_id:11(int!null) @@ -1276,25 +1276,25 @@ scalar-group-by │ │ │ │ └── interesting orderings: (+11,+10,-9) │ │ │ └── filters [type=bool, outer=(15), constraints=(/15: [/NULL - /NULL]; tight), fd=()-->(15)] │ │ │ └── is [type=bool, outer=(15), constraints=(/15: [/NULL - /NULL]; tight)] - │ │ │ ├── variable: order_line.ol_delivery_d [type=timestamp, outer=(15)] + │ │ │ ├── variable: ol_delivery_d [type=timestamp, outer=(15)] │ │ │ └── null [type=unknown] │ │ └── filters [type=bool, outer=(1-3,9-11), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /3: (/NULL - ]; /9: (/NULL - ]; /10: (/NULL - ]; /11: (/NULL - ]), fd=(3)==(11), (11)==(3), (2)==(10), (10)==(2), (1)==(9), (9)==(1)] │ │ ├── eq [type=bool, outer=(3,11), constraints=(/3: (/NULL - ]; /11: (/NULL - ])] - │ │ │ ├── variable: order_line.ol_w_id [type=int, outer=(11)] - │ │ │ └── variable: order.o_w_id [type=int, outer=(3)] + │ │ │ ├── variable: ol_w_id [type=int, outer=(11)] + │ │ │ └── variable: o_w_id [type=int, outer=(3)] │ │ ├── eq [type=bool, outer=(2,10), constraints=(/2: (/NULL - ]; /10: (/NULL - ])] - │ │ │ ├── variable: order_line.ol_d_id [type=int, outer=(10)] - │ │ │ └── variable: order.o_d_id [type=int, outer=(2)] + │ │ │ ├── variable: ol_d_id [type=int, outer=(10)] + │ │ │ └── variable: o_d_id [type=int, outer=(2)] │ │ └── eq [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ])] - │ │ ├── variable: order_line.ol_o_id [type=int, outer=(9)] - │ │ └── variable: order.o_id [type=int, outer=(1)] + │ │ ├── variable: ol_o_id [type=int, outer=(9)] + │ │ └── variable: o_id [type=int, outer=(1)] │ └── filters [type=bool, outer=(1,9)] │ └── or [type=bool, outer=(1,9)] │ ├── is [type=bool, outer=(9)] - │ │ ├── variable: order_line.ol_o_id [type=int, outer=(9)] + │ │ ├── variable: ol_o_id [type=int, outer=(9)] │ │ └── null [type=unknown] │ └── is [type=bool, outer=(1)] - │ ├── variable: order.o_id [type=int, outer=(1)] + │ ├── variable: o_id [type=int, outer=(1)] │ └── null [type=unknown] └── aggregations └── count-rows [type=int] diff --git a/pkg/sql/opt/xform/testdata/external/tpch b/pkg/sql/opt/xform/testdata/external/tpch index c6ee55d74c1e..d0a03e6da293 100644 --- a/pkg/sql/opt/xform/testdata/external/tpch +++ b/pkg/sql/opt/xform/testdata/external/tpch @@ -259,25 +259,25 @@ sort │ │ ├── scan lineitem │ │ │ └── columns: l_quantity:5(float) l_extendedprice:6(float) l_discount:7(float) l_tax:8(float) l_returnflag:9(string) l_linestatus:10(string) l_shipdate:11(date) │ │ └── filters [type=bool, outer=(11), constraints=(/11: (/NULL - ])] - │ │ └── lineitem.l_shipdate <= ('1998-12-01' - '90d') [type=bool, outer=(11), constraints=(/11: (/NULL - ])] + │ │ └── l_shipdate <= ('1998-12-01' - '90d') [type=bool, outer=(11), constraints=(/11: (/NULL - ])] │ └── projections [outer=(5-10)] - │ ├── lineitem.l_extendedprice * (1.0 - lineitem.l_discount) [type=float, outer=(6,7)] - │ └── (lineitem.l_extendedprice * (1.0 - lineitem.l_discount)) * (lineitem.l_tax + 1.0) [type=float, outer=(6-8)] + │ ├── l_extendedprice * (1.0 - l_discount) [type=float, outer=(6,7)] + │ └── (l_extendedprice * (1.0 - l_discount)) * (l_tax + 1.0) [type=float, outer=(6-8)] └── aggregations [outer=(5-7,19,21)] ├── sum [type=float, outer=(5)] - │ └── variable: lineitem.l_quantity [type=float, outer=(5)] + │ └── variable: l_quantity [type=float, outer=(5)] ├── sum [type=float, outer=(6)] - │ └── variable: lineitem.l_extendedprice [type=float, outer=(6)] + │ └── variable: l_extendedprice [type=float, outer=(6)] ├── sum [type=float, outer=(19)] │ └── variable: column19 [type=float, outer=(19)] ├── sum [type=float, outer=(21)] │ └── variable: column21 [type=float, outer=(21)] ├── avg [type=float, outer=(5)] - │ └── variable: lineitem.l_quantity [type=float, outer=(5)] + │ └── variable: l_quantity [type=float, outer=(5)] ├── avg [type=float, outer=(6)] - │ └── variable: lineitem.l_extendedprice [type=float, outer=(6)] + │ └── variable: l_extendedprice [type=float, outer=(6)] ├── avg [type=float, outer=(7)] - │ └── variable: lineitem.l_discount [type=float, outer=(7)] + │ └── variable: l_discount [type=float, outer=(7)] └── count-rows [type=int] # -------------------------------------------------- @@ -456,21 +456,21 @@ project │ │ │ │ │ │ │ │ │ ├── key: (1) │ │ │ │ │ │ │ │ │ └── fd: (1)-->(3,5,6) │ │ │ │ │ │ │ │ └── filters [type=bool, outer=(5,6), constraints=(/6: [/15 - /15]), fd=()-->(6)] - │ │ │ │ │ │ │ │ ├── part.p_size = 15 [type=bool, outer=(6), constraints=(/6: [/15 - /15]; tight)] - │ │ │ │ │ │ │ │ └── part.p_type LIKE '%BRASS' [type=bool, outer=(5)] + │ │ │ │ │ │ │ │ ├── p_size = 15 [type=bool, outer=(6), constraints=(/6: [/15 - /15]; tight)] + │ │ │ │ │ │ │ │ └── p_type LIKE '%BRASS' [type=bool, outer=(5)] │ │ │ │ │ │ │ └── true [type=bool] │ │ │ │ │ │ └── filters [type=bool, outer=(1,10,17,18), constraints=(/1: (/NULL - ]; /10: (/NULL - ]; /17: (/NULL - ]; /18: (/NULL - ]), fd=(1)==(17), (17)==(1), (10)==(18), (18)==(10)] - │ │ │ │ │ │ ├── part.p_partkey = partsupp.ps_partkey [type=bool, outer=(1,17), constraints=(/1: (/NULL - ]; /17: (/NULL - ])] + │ │ │ │ │ │ ├── p_partkey = partsupp.ps_partkey [type=bool, outer=(1,17), constraints=(/1: (/NULL - ]; /17: (/NULL - ])] │ │ │ │ │ │ └── supplier.s_suppkey = partsupp.ps_suppkey [type=bool, outer=(10,18), constraints=(/10: (/NULL - ]; /18: (/NULL - ])] │ │ │ │ │ └── filters [type=bool, outer=(1,29), constraints=(/1: (/NULL - ]; /29: (/NULL - ]), fd=(1)==(29), (29)==(1)] - │ │ │ │ │ └── part.p_partkey = partsupp.ps_partkey [type=bool, outer=(1,29), constraints=(/1: (/NULL - ]; /29: (/NULL - ])] + │ │ │ │ │ └── p_partkey = partsupp.ps_partkey [type=bool, outer=(1,29), constraints=(/1: (/NULL - ]; /29: (/NULL - ])] │ │ │ │ └── aggregations [outer=(1,3,11-16,20,32)] │ │ │ │ ├── min [type=float, outer=(32)] │ │ │ │ │ └── variable: partsupp.ps_supplycost [type=float, outer=(32)] │ │ │ │ ├── const-agg [type=float, outer=(20)] │ │ │ │ │ └── variable: partsupp.ps_supplycost [type=float, outer=(20)] │ │ │ │ ├── const-agg [type=string, outer=(3)] - │ │ │ │ │ └── variable: part.p_mfgr [type=string, outer=(3)] + │ │ │ │ │ └── variable: p_mfgr [type=string, outer=(3)] │ │ │ │ ├── const-agg [type=string, outer=(11)] │ │ │ │ │ └── variable: supplier.s_name [type=string, outer=(11)] │ │ │ │ ├── const-agg [type=string, outer=(12)] @@ -484,7 +484,7 @@ project │ │ │ │ ├── const-agg [type=string, outer=(16)] │ │ │ │ │ └── variable: supplier.s_comment [type=string, outer=(16)] │ │ │ │ └── const-agg [type=int, outer=(1)] - │ │ │ │ └── variable: part.p_partkey [type=int, outer=(1)] + │ │ │ │ └── variable: p_partkey [type=int, outer=(1)] │ │ │ └── filters [type=bool, outer=(20,48), constraints=(/20: (/NULL - ]; /48: (/NULL - ]), fd=(20)==(48), (48)==(20)] │ │ │ └── partsupp.ps_supplycost = min [type=bool, outer=(20,48), constraints=(/20: (/NULL - ]; /48: (/NULL - ])] │ │ └── filters [type=bool, outer=(13,22), constraints=(/13: (/NULL - ]; /22: (/NULL - ]), fd=(13)==(22), (22)==(13)] @@ -567,7 +567,7 @@ limit │ │ │ │ │ │ ├── key: (9) │ │ │ │ │ │ └── fd: (9)-->(10,13,16) │ │ │ │ │ └── filters [type=bool, outer=(13), constraints=(/13: (/NULL - /'1995-03-14']; tight)] - │ │ │ │ │ └── orders.o_orderdate < '1995-03-15' [type=bool, outer=(13), constraints=(/13: (/NULL - /'1995-03-14']; tight)] + │ │ │ │ │ └── o_orderdate < '1995-03-15' [type=bool, outer=(13), constraints=(/13: (/NULL - /'1995-03-14']; tight)] │ │ │ │ ├── select │ │ │ │ │ ├── columns: c_custkey:1(int!null) c_mktsegment:7(string!null) │ │ │ │ │ ├── key: (1) @@ -577,21 +577,21 @@ limit │ │ │ │ │ │ ├── key: (1) │ │ │ │ │ │ └── fd: (1)-->(7) │ │ │ │ │ └── filters [type=bool, outer=(7), constraints=(/7: [/'BUILDING' - /'BUILDING']; tight), fd=()-->(7)] - │ │ │ │ │ └── customer.c_mktsegment = 'BUILDING' [type=bool, outer=(7), constraints=(/7: [/'BUILDING' - /'BUILDING']; tight)] + │ │ │ │ │ └── c_mktsegment = 'BUILDING' [type=bool, outer=(7), constraints=(/7: [/'BUILDING' - /'BUILDING']; tight)] │ │ │ │ └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - │ │ │ │ └── customer.c_custkey = orders.o_custkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + │ │ │ │ └── c_custkey = o_custkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] │ │ │ └── filters [type=bool, outer=(9,18,28), constraints=(/9: (/NULL - ]; /18: (/NULL - ]; /28: [/'1995-03-16' - ]), fd=(9)==(18), (18)==(9)] - │ │ │ ├── lineitem.l_orderkey = orders.o_orderkey [type=bool, outer=(9,18), constraints=(/9: (/NULL - ]; /18: (/NULL - ])] - │ │ │ └── lineitem.l_shipdate > '1995-03-15' [type=bool, outer=(28), constraints=(/28: [/'1995-03-16' - ]; tight)] + │ │ │ ├── l_orderkey = o_orderkey [type=bool, outer=(9,18), constraints=(/9: (/NULL - ]; /18: (/NULL - ])] + │ │ │ └── l_shipdate > '1995-03-15' [type=bool, outer=(28), constraints=(/28: [/'1995-03-16' - ]; tight)] │ │ └── projections [outer=(13,16,18,23,24)] - │ │ └── lineitem.l_extendedprice * (1.0 - lineitem.l_discount) [type=float, outer=(23,24)] + │ │ └── l_extendedprice * (1.0 - l_discount) [type=float, outer=(23,24)] │ └── aggregations [outer=(13,16,34)] │ ├── sum [type=float, outer=(34)] │ │ └── variable: column34 [type=float, outer=(34)] │ ├── const-agg [type=date, outer=(13)] - │ │ └── variable: orders.o_orderdate [type=date, outer=(13)] + │ │ └── variable: o_orderdate [type=date, outer=(13)] │ └── const-agg [type=int, outer=(16)] - │ └── variable: orders.o_shippriority [type=int, outer=(16)] + │ └── variable: o_shippriority [type=int, outer=(16)] └── const: 10 [type=int] # -------------------------------------------------- @@ -653,8 +653,8 @@ sort │ │ │ ├── fd: (1)-->(5,6) │ │ │ └── ordering: +1 │ │ └── filters [type=bool, outer=(5), constraints=(/5: [/'1993-07-01' - ])] - │ │ ├── orders.o_orderdate >= '1993-07-01' [type=bool, outer=(5), constraints=(/5: [/'1993-07-01' - ]; tight)] - │ │ └── orders.o_orderdate < ('1993-07-01' + '3mon') [type=bool, outer=(5), constraints=(/5: (/NULL - ])] + │ │ ├── o_orderdate >= '1993-07-01' [type=bool, outer=(5), constraints=(/5: [/'1993-07-01' - ]; tight)] + │ │ └── o_orderdate < ('1993-07-01' + '3mon') [type=bool, outer=(5), constraints=(/5: (/NULL - ])] │ ├── select │ │ ├── columns: l_orderkey:10(int!null) l_commitdate:21(date!null) l_receiptdate:22(date!null) │ │ ├── ordering: +10 @@ -662,12 +662,12 @@ sort │ │ │ ├── columns: l_orderkey:10(int!null) l_commitdate:21(date) l_receiptdate:22(date) │ │ │ └── ordering: +10 │ │ └── filters [type=bool, outer=(21,22), constraints=(/21: (/NULL - ]; /22: (/NULL - ])] - │ │ └── lineitem.l_commitdate < lineitem.l_receiptdate [type=bool, outer=(21,22), constraints=(/21: (/NULL - ]; /22: (/NULL - ])] + │ │ └── l_commitdate < l_receiptdate [type=bool, outer=(21,22), constraints=(/21: (/NULL - ]; /22: (/NULL - ])] │ └── merge-on │ ├── left ordering: +1 │ ├── right ordering: +10 │ └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - │ └── lineitem.l_orderkey = orders.o_orderkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + │ └── l_orderkey = o_orderkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] └── aggregations └── count-rows [type=int] @@ -756,22 +756,22 @@ sort │ │ │ │ │ │ │ │ ├── key: (9) │ │ │ │ │ │ │ │ └── fd: (9)-->(10,13) │ │ │ │ │ │ │ └── filters [type=bool, outer=(13), constraints=(/13: [/'1994-01-01' - ])] - │ │ │ │ │ │ │ ├── orders.o_orderdate >= '1994-01-01' [type=bool, outer=(13), constraints=(/13: [/'1994-01-01' - ]; tight)] - │ │ │ │ │ │ │ └── orders.o_orderdate < ('1994-01-01' + '1y') [type=bool, outer=(13), constraints=(/13: (/NULL - ])] + │ │ │ │ │ │ │ ├── o_orderdate >= '1994-01-01' [type=bool, outer=(13), constraints=(/13: [/'1994-01-01' - ]; tight)] + │ │ │ │ │ │ │ └── o_orderdate < ('1994-01-01' + '1y') [type=bool, outer=(13), constraints=(/13: (/NULL - ])] │ │ │ │ │ │ └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - │ │ │ │ │ │ └── customer.c_custkey = orders.o_custkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + │ │ │ │ │ │ └── c_custkey = o_custkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] │ │ │ │ │ └── filters [type=bool, outer=(9,18), constraints=(/9: (/NULL - ]; /18: (/NULL - ]), fd=(9)==(18), (18)==(9)] - │ │ │ │ │ └── lineitem.l_orderkey = orders.o_orderkey [type=bool, outer=(9,18), constraints=(/9: (/NULL - ]; /18: (/NULL - ])] + │ │ │ │ │ └── l_orderkey = o_orderkey [type=bool, outer=(9,18), constraints=(/9: (/NULL - ]; /18: (/NULL - ])] │ │ │ │ └── filters [type=bool, outer=(4,20,34,37), constraints=(/4: (/NULL - ]; /20: (/NULL - ]; /34: (/NULL - ]; /37: (/NULL - ]), fd=(20)==(34), (34)==(20), (4)==(37), (37)==(4)] - │ │ │ │ ├── lineitem.l_suppkey = supplier.s_suppkey [type=bool, outer=(20,34), constraints=(/20: (/NULL - ]; /34: (/NULL - ])] - │ │ │ │ └── customer.c_nationkey = supplier.s_nationkey [type=bool, outer=(4,37), constraints=(/4: (/NULL - ]; /37: (/NULL - ])] + │ │ │ │ ├── l_suppkey = s_suppkey [type=bool, outer=(20,34), constraints=(/20: (/NULL - ]; /34: (/NULL - ])] + │ │ │ │ └── c_nationkey = s_nationkey [type=bool, outer=(4,37), constraints=(/4: (/NULL - ]; /37: (/NULL - ])] │ │ │ └── filters [type=bool, outer=(37,41), constraints=(/37: (/NULL - ]; /41: (/NULL - ]), fd=(37)==(41), (41)==(37)] - │ │ │ └── supplier.s_nationkey = nation.n_nationkey [type=bool, outer=(37,41), constraints=(/37: (/NULL - ]; /41: (/NULL - ])] + │ │ │ └── s_nationkey = n_nationkey [type=bool, outer=(37,41), constraints=(/37: (/NULL - ]; /41: (/NULL - ])] │ │ └── filters [type=bool, outer=(43,45,46), constraints=(/43: (/NULL - ]; /45: (/NULL - ]; /46: [/'ASIA' - /'ASIA']), fd=()-->(46), (43)==(45), (45)==(43)] - │ │ ├── nation.n_regionkey = region.r_regionkey [type=bool, outer=(43,45), constraints=(/43: (/NULL - ]; /45: (/NULL - ])] - │ │ └── region.r_name = 'ASIA' [type=bool, outer=(46), constraints=(/46: [/'ASIA' - /'ASIA']; tight)] + │ │ ├── n_regionkey = r_regionkey [type=bool, outer=(43,45), constraints=(/43: (/NULL - ]; /45: (/NULL - ])] + │ │ └── r_name = 'ASIA' [type=bool, outer=(46), constraints=(/46: [/'ASIA' - /'ASIA']; tight)] │ └── projections [outer=(23,24,42)] - │ └── lineitem.l_extendedprice * (1.0 - lineitem.l_discount) [type=float, outer=(23,24)] + │ └── l_extendedprice * (1.0 - l_discount) [type=float, outer=(23,24)] └── aggregations [outer=(48)] └── sum [type=float, outer=(48)] └── variable: column48 [type=float, outer=(48)] @@ -814,13 +814,13 @@ scalar-group-by │ │ ├── scan lineitem │ │ │ └── columns: l_quantity:5(float) l_extendedprice:6(float) l_discount:7(float) l_shipdate:11(date) │ │ └── filters [type=bool, outer=(5,7,11), constraints=(/5: (/NULL - /23.999999999999996]; /7: [/0.05 - /0.07]; /11: [/'1994-01-01' - ])] - │ │ ├── lineitem.l_shipdate >= '1994-01-01' [type=bool, outer=(11), constraints=(/11: [/'1994-01-01' - ]; tight)] - │ │ ├── lineitem.l_shipdate < ('1994-01-01' + '1y') [type=bool, outer=(11), constraints=(/11: (/NULL - ])] - │ │ ├── lineitem.l_discount >= 0.05 [type=bool, outer=(7), constraints=(/7: [/0.05 - ]; tight)] - │ │ ├── lineitem.l_discount <= 0.07 [type=bool, outer=(7), constraints=(/7: (/NULL - /0.07]; tight)] - │ │ └── lineitem.l_quantity < 24.0 [type=bool, outer=(5), constraints=(/5: (/NULL - /23.999999999999996]; tight)] + │ │ ├── l_shipdate >= '1994-01-01' [type=bool, outer=(11), constraints=(/11: [/'1994-01-01' - ]; tight)] + │ │ ├── l_shipdate < ('1994-01-01' + '1y') [type=bool, outer=(11), constraints=(/11: (/NULL - ])] + │ │ ├── l_discount >= 0.05 [type=bool, outer=(7), constraints=(/7: [/0.05 - ]; tight)] + │ │ ├── l_discount <= 0.07 [type=bool, outer=(7), constraints=(/7: (/NULL - /0.07]; tight)] + │ │ └── l_quantity < 24.0 [type=bool, outer=(5), constraints=(/5: (/NULL - /23.999999999999996]; tight)] │ └── projections [outer=(6,7)] - │ └── lineitem.l_extendedprice * lineitem.l_discount [type=float, outer=(6,7)] + │ └── l_extendedprice * l_discount [type=float, outer=(6,7)] └── aggregations [outer=(17)] └── sum [type=float, outer=(17)] └── variable: column17 [type=float, outer=(17)] @@ -932,22 +932,22 @@ sort │ │ │ │ │ │ │ ├── scan lineitem │ │ │ │ │ │ │ │ └── columns: l_orderkey:8(int!null) l_suppkey:10(int!null) l_extendedprice:13(float) l_discount:14(float) l_shipdate:18(date) │ │ │ │ │ │ │ └── filters [type=bool, outer=(18), constraints=(/18: [/'1995-01-01' - /'1996-12-31']; tight)] - │ │ │ │ │ │ │ ├── lineitem.l_shipdate >= '1995-01-01' [type=bool, outer=(18), constraints=(/18: [/'1995-01-01' - ]; tight)] - │ │ │ │ │ │ │ └── lineitem.l_shipdate <= '1996-12-31' [type=bool, outer=(18), constraints=(/18: (/NULL - /'1996-12-31']; tight)] + │ │ │ │ │ │ │ ├── l_shipdate >= '1995-01-01' [type=bool, outer=(18), constraints=(/18: [/'1995-01-01' - ]; tight)] + │ │ │ │ │ │ │ └── l_shipdate <= '1996-12-31' [type=bool, outer=(18), constraints=(/18: (/NULL - /'1996-12-31']; tight)] │ │ │ │ │ │ └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - │ │ │ │ │ │ └── supplier.s_suppkey = lineitem.l_suppkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + │ │ │ │ │ │ └── s_suppkey = l_suppkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] │ │ │ │ │ └── filters [type=bool, outer=(8,24), constraints=(/8: (/NULL - ]; /24: (/NULL - ]), fd=(8)==(24), (24)==(8)] - │ │ │ │ │ └── orders.o_orderkey = lineitem.l_orderkey [type=bool, outer=(8,24), constraints=(/8: (/NULL - ]; /24: (/NULL - ])] + │ │ │ │ │ └── o_orderkey = l_orderkey [type=bool, outer=(8,24), constraints=(/8: (/NULL - ]; /24: (/NULL - ])] │ │ │ │ └── filters [type=bool, outer=(25,33), constraints=(/25: (/NULL - ]; /33: (/NULL - ]), fd=(25)==(33), (33)==(25)] - │ │ │ │ └── customer.c_custkey = orders.o_custkey [type=bool, outer=(25,33), constraints=(/25: (/NULL - ]; /33: (/NULL - ])] + │ │ │ │ └── c_custkey = o_custkey [type=bool, outer=(25,33), constraints=(/25: (/NULL - ]; /33: (/NULL - ])] │ │ │ └── filters [type=bool, outer=(4,41), constraints=(/4: (/NULL - ]; /41: (/NULL - ]), fd=(4)==(41), (41)==(4)] - │ │ │ └── supplier.s_nationkey = nation.n_nationkey [type=bool, outer=(4,41), constraints=(/4: (/NULL - ]; /41: (/NULL - ])] + │ │ │ └── s_nationkey = nation.n_nationkey [type=bool, outer=(4,41), constraints=(/4: (/NULL - ]; /41: (/NULL - ])] │ │ └── filters [type=bool, outer=(36,42,45,46), constraints=(/36: (/NULL - ]; /45: (/NULL - ]), fd=(36)==(45), (45)==(36)] - │ │ ├── customer.c_nationkey = nation.n_nationkey [type=bool, outer=(36,45), constraints=(/36: (/NULL - ]; /45: (/NULL - ])] + │ │ ├── c_nationkey = nation.n_nationkey [type=bool, outer=(36,45), constraints=(/36: (/NULL - ]; /45: (/NULL - ])] │ │ └── ((nation.n_name = 'FRANCE') AND (nation.n_name = 'GERMANY')) OR ((nation.n_name = 'GERMANY') AND (nation.n_name = 'FRANACE')) [type=bool, outer=(42,46)] │ └── projections [outer=(13,14,18,42,46)] - │ ├── extract('year', lineitem.l_shipdate) [type=int, outer=(18)] - │ └── lineitem.l_extendedprice * (1.0 - lineitem.l_discount) [type=float, outer=(13,14)] + │ ├── extract('year', l_shipdate) [type=int, outer=(18)] + │ └── l_extendedprice * (1.0 - l_discount) [type=float, outer=(13,14)] └── aggregations [outer=(50)] └── sum [type=float, outer=(50)] └── variable: volume [type=float, outer=(50)] @@ -1067,29 +1067,29 @@ sort │ │ │ │ │ │ │ │ │ │ │ │ ├── key: (1) │ │ │ │ │ │ │ │ │ │ │ │ └── fd: (1)-->(5) │ │ │ │ │ │ │ │ │ │ │ └── filters [type=bool, outer=(5), constraints=(/5: [/'ECONOMY ANODIZED STEEL' - /'ECONOMY ANODIZED STEEL']; tight), fd=()-->(5)] - │ │ │ │ │ │ │ │ │ │ │ └── part.p_type = 'ECONOMY ANODIZED STEEL' [type=bool, outer=(5), constraints=(/5: [/'ECONOMY ANODIZED STEEL' - /'ECONOMY ANODIZED STEEL']; tight)] + │ │ │ │ │ │ │ │ │ │ │ └── p_type = 'ECONOMY ANODIZED STEEL' [type=bool, outer=(5), constraints=(/5: [/'ECONOMY ANODIZED STEEL' - /'ECONOMY ANODIZED STEEL']; tight)] │ │ │ │ │ │ │ │ │ │ └── true [type=bool] │ │ │ │ │ │ │ │ │ ├── scan lineitem │ │ │ │ │ │ │ │ │ │ └── columns: l_orderkey:17(int!null) l_partkey:18(int!null) l_suppkey:19(int!null) l_extendedprice:22(float) l_discount:23(float) │ │ │ │ │ │ │ │ │ └── filters [type=bool, outer=(1,10,18,19), constraints=(/1: (/NULL - ]; /10: (/NULL - ]; /18: (/NULL - ]; /19: (/NULL - ]), fd=(1)==(18), (18)==(1), (10)==(19), (19)==(10)] - │ │ │ │ │ │ │ │ │ ├── part.p_partkey = lineitem.l_partkey [type=bool, outer=(1,18), constraints=(/1: (/NULL - ]; /18: (/NULL - ])] - │ │ │ │ │ │ │ │ │ └── supplier.s_suppkey = lineitem.l_suppkey [type=bool, outer=(10,19), constraints=(/10: (/NULL - ]; /19: (/NULL - ])] + │ │ │ │ │ │ │ │ │ ├── p_partkey = l_partkey [type=bool, outer=(1,18), constraints=(/1: (/NULL - ]; /18: (/NULL - ])] + │ │ │ │ │ │ │ │ │ └── s_suppkey = l_suppkey [type=bool, outer=(10,19), constraints=(/10: (/NULL - ]; /19: (/NULL - ])] │ │ │ │ │ │ │ │ └── filters [type=bool, outer=(17,33,37), constraints=(/17: (/NULL - ]; /33: (/NULL - ]; /37: [/'1995-01-01' - /'1996-12-31']), fd=(17)==(33), (33)==(17)] - │ │ │ │ │ │ │ │ ├── lineitem.l_orderkey = orders.o_orderkey [type=bool, outer=(17,33), constraints=(/17: (/NULL - ]; /33: (/NULL - ])] - │ │ │ │ │ │ │ │ ├── orders.o_orderdate >= '1995-01-01' [type=bool, outer=(37), constraints=(/37: [/'1995-01-01' - ]; tight)] - │ │ │ │ │ │ │ │ └── orders.o_orderdate <= '1996-12-31' [type=bool, outer=(37), constraints=(/37: (/NULL - /'1996-12-31']; tight)] + │ │ │ │ │ │ │ │ ├── l_orderkey = o_orderkey [type=bool, outer=(17,33), constraints=(/17: (/NULL - ]; /33: (/NULL - ])] + │ │ │ │ │ │ │ │ ├── o_orderdate >= '1995-01-01' [type=bool, outer=(37), constraints=(/37: [/'1995-01-01' - ]; tight)] + │ │ │ │ │ │ │ │ └── o_orderdate <= '1996-12-31' [type=bool, outer=(37), constraints=(/37: (/NULL - /'1996-12-31']; tight)] │ │ │ │ │ │ │ └── filters [type=bool, outer=(34,42), constraints=(/34: (/NULL - ]; /42: (/NULL - ]), fd=(34)==(42), (42)==(34)] - │ │ │ │ │ │ │ └── orders.o_custkey = customer.c_custkey [type=bool, outer=(34,42), constraints=(/34: (/NULL - ]; /42: (/NULL - ])] + │ │ │ │ │ │ │ └── o_custkey = c_custkey [type=bool, outer=(34,42), constraints=(/34: (/NULL - ]; /42: (/NULL - ])] │ │ │ │ │ │ └── filters [type=bool, outer=(45,50), constraints=(/45: (/NULL - ]; /50: (/NULL - ]), fd=(45)==(50), (50)==(45)] - │ │ │ │ │ │ └── customer.c_nationkey = nation.n_nationkey [type=bool, outer=(45,50), constraints=(/45: (/NULL - ]; /50: (/NULL - ])] + │ │ │ │ │ │ └── c_nationkey = nation.n_nationkey [type=bool, outer=(45,50), constraints=(/45: (/NULL - ]; /50: (/NULL - ])] │ │ │ │ │ └── filters [type=bool, outer=(13,54), constraints=(/13: (/NULL - ]; /54: (/NULL - ]), fd=(13)==(54), (54)==(13)] - │ │ │ │ │ └── supplier.s_nationkey = nation.n_nationkey [type=bool, outer=(13,54), constraints=(/13: (/NULL - ]; /54: (/NULL - ])] + │ │ │ │ │ └── s_nationkey = nation.n_nationkey [type=bool, outer=(13,54), constraints=(/13: (/NULL - ]; /54: (/NULL - ])] │ │ │ │ └── filters [type=bool, outer=(52,58,59), constraints=(/52: (/NULL - ]; /58: (/NULL - ]; /59: [/'AMERICA' - /'AMERICA']), fd=()-->(59), (52)==(58), (58)==(52)] - │ │ │ │ ├── nation.n_regionkey = region.r_regionkey [type=bool, outer=(52,58), constraints=(/52: (/NULL - ]; /58: (/NULL - ])] - │ │ │ │ └── region.r_name = 'AMERICA' [type=bool, outer=(59), constraints=(/59: [/'AMERICA' - /'AMERICA']; tight)] + │ │ │ │ ├── nation.n_regionkey = r_regionkey [type=bool, outer=(52,58), constraints=(/52: (/NULL - ]; /58: (/NULL - ])] + │ │ │ │ └── r_name = 'AMERICA' [type=bool, outer=(59), constraints=(/59: [/'AMERICA' - /'AMERICA']; tight)] │ │ │ └── projections [outer=(22,23,37,55)] - │ │ │ ├── extract('year', orders.o_orderdate) [type=int, outer=(37)] - │ │ │ └── lineitem.l_extendedprice * (1.0 - lineitem.l_discount) [type=float, outer=(22,23)] + │ │ │ ├── extract('year', o_orderdate) [type=int, outer=(37)] + │ │ │ └── l_extendedprice * (1.0 - l_discount) [type=float, outer=(22,23)] │ │ └── projections [outer=(55,61,62)] │ │ └── CASE WHEN nation.n_name = 'BRAZIL' THEN volume ELSE 0.0 END [type=float, outer=(55,62)] │ └── aggregations [outer=(62,63)] @@ -1200,23 +1200,23 @@ sort │ │ │ │ │ │ │ │ ├── key: (1) │ │ │ │ │ │ │ │ └── fd: (1)-->(2) │ │ │ │ │ │ │ └── filters [type=bool, outer=(2)] - │ │ │ │ │ │ │ └── part.p_name LIKE '%green%' [type=bool, outer=(2)] + │ │ │ │ │ │ │ └── p_name LIKE '%green%' [type=bool, outer=(2)] │ │ │ │ │ │ └── true [type=bool] │ │ │ │ │ ├── scan lineitem │ │ │ │ │ │ └── columns: l_orderkey:17(int!null) l_partkey:18(int!null) l_suppkey:19(int!null) l_quantity:21(float) l_extendedprice:22(float) l_discount:23(float) │ │ │ │ │ └── filters [type=bool, outer=(1,10,18,19), constraints=(/1: (/NULL - ]; /10: (/NULL - ]; /18: (/NULL - ]; /19: (/NULL - ]), fd=(10)==(19), (19)==(10), (1)==(18), (18)==(1)] - │ │ │ │ │ ├── supplier.s_suppkey = lineitem.l_suppkey [type=bool, outer=(10,19), constraints=(/10: (/NULL - ]; /19: (/NULL - ])] - │ │ │ │ │ └── part.p_partkey = lineitem.l_partkey [type=bool, outer=(1,18), constraints=(/1: (/NULL - ]; /18: (/NULL - ])] + │ │ │ │ │ ├── s_suppkey = l_suppkey [type=bool, outer=(10,19), constraints=(/10: (/NULL - ]; /19: (/NULL - ])] + │ │ │ │ │ └── p_partkey = l_partkey [type=bool, outer=(1,18), constraints=(/1: (/NULL - ]; /18: (/NULL - ])] │ │ │ │ └── filters [type=bool, outer=(18,19,33,34), constraints=(/18: (/NULL - ]; /19: (/NULL - ]; /33: (/NULL - ]; /34: (/NULL - ]), fd=(19)==(34), (34)==(19), (18)==(33), (33)==(18)] - │ │ │ │ ├── partsupp.ps_suppkey = lineitem.l_suppkey [type=bool, outer=(19,34), constraints=(/19: (/NULL - ]; /34: (/NULL - ])] - │ │ │ │ └── partsupp.ps_partkey = lineitem.l_partkey [type=bool, outer=(18,33), constraints=(/18: (/NULL - ]; /33: (/NULL - ])] + │ │ │ │ ├── ps_suppkey = l_suppkey [type=bool, outer=(19,34), constraints=(/19: (/NULL - ]; /34: (/NULL - ])] + │ │ │ │ └── ps_partkey = l_partkey [type=bool, outer=(18,33), constraints=(/18: (/NULL - ]; /33: (/NULL - ])] │ │ │ └── filters [type=bool, outer=(17,38), constraints=(/17: (/NULL - ]; /38: (/NULL - ]), fd=(17)==(38), (38)==(17)] - │ │ │ └── orders.o_orderkey = lineitem.l_orderkey [type=bool, outer=(17,38), constraints=(/17: (/NULL - ]; /38: (/NULL - ])] + │ │ │ └── o_orderkey = l_orderkey [type=bool, outer=(17,38), constraints=(/17: (/NULL - ]; /38: (/NULL - ])] │ │ └── filters [type=bool, outer=(13,47), constraints=(/13: (/NULL - ]; /47: (/NULL - ]), fd=(13)==(47), (47)==(13)] - │ │ └── supplier.s_nationkey = nation.n_nationkey [type=bool, outer=(13,47), constraints=(/13: (/NULL - ]; /47: (/NULL - ])] + │ │ └── s_nationkey = n_nationkey [type=bool, outer=(13,47), constraints=(/13: (/NULL - ]; /47: (/NULL - ])] │ └── projections [outer=(21-23,36,42,48)] - │ ├── extract('year', orders.o_orderdate) [type=int, outer=(42)] - │ └── (lineitem.l_extendedprice * (1.0 - lineitem.l_discount)) - (partsupp.ps_supplycost * lineitem.l_quantity) [type=float, outer=(21-23,36)] + │ ├── extract('year', o_orderdate) [type=int, outer=(42)] + │ └── (l_extendedprice * (1.0 - l_discount)) - (ps_supplycost * l_quantity) [type=float, outer=(21-23,36)] └── aggregations [outer=(52)] └── sum [type=float, outer=(52)] └── variable: amount [type=float, outer=(52)] @@ -1311,32 +1311,32 @@ limit │ │ │ │ │ │ │ ├── key: (9) │ │ │ │ │ │ │ └── fd: (9)-->(10,13) │ │ │ │ │ │ └── filters [type=bool, outer=(13), constraints=(/13: [/'1993-10-01' - ])] - │ │ │ │ │ │ ├── orders.o_orderdate >= '1993-10-01' [type=bool, outer=(13), constraints=(/13: [/'1993-10-01' - ]; tight)] - │ │ │ │ │ │ └── orders.o_orderdate < ('1993-10-01' + '3mon') [type=bool, outer=(13), constraints=(/13: (/NULL - ])] + │ │ │ │ │ │ ├── o_orderdate >= '1993-10-01' [type=bool, outer=(13), constraints=(/13: [/'1993-10-01' - ]; tight)] + │ │ │ │ │ │ └── o_orderdate < ('1993-10-01' + '3mon') [type=bool, outer=(13), constraints=(/13: (/NULL - ])] │ │ │ │ │ └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - │ │ │ │ │ └── customer.c_custkey = orders.o_custkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + │ │ │ │ │ └── c_custkey = o_custkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] │ │ │ │ └── filters [type=bool, outer=(9,18,26), constraints=(/9: (/NULL - ]; /18: (/NULL - ]; /26: [/'R' - /'R']), fd=()-->(26), (9)==(18), (18)==(9)] - │ │ │ │ ├── lineitem.l_orderkey = orders.o_orderkey [type=bool, outer=(9,18), constraints=(/9: (/NULL - ]; /18: (/NULL - ])] - │ │ │ │ └── lineitem.l_returnflag = 'R' [type=bool, outer=(26), constraints=(/26: [/'R' - /'R']; tight)] + │ │ │ │ ├── l_orderkey = o_orderkey [type=bool, outer=(9,18), constraints=(/9: (/NULL - ]; /18: (/NULL - ])] + │ │ │ │ └── l_returnflag = 'R' [type=bool, outer=(26), constraints=(/26: [/'R' - /'R']; tight)] │ │ │ └── filters [type=bool, outer=(4,34), constraints=(/4: (/NULL - ]; /34: (/NULL - ]), fd=(4)==(34), (34)==(4)] - │ │ │ └── customer.c_nationkey = nation.n_nationkey [type=bool, outer=(4,34), constraints=(/4: (/NULL - ]; /34: (/NULL - ])] + │ │ │ └── c_nationkey = n_nationkey [type=bool, outer=(4,34), constraints=(/4: (/NULL - ]; /34: (/NULL - ])] │ │ └── projections [outer=(1-3,5,6,8,23,24,35)] - │ │ └── lineitem.l_extendedprice * (1.0 - lineitem.l_discount) [type=float, outer=(23,24)] + │ │ └── l_extendedprice * (1.0 - l_discount) [type=float, outer=(23,24)] │ └── aggregations [outer=(2,3,5,6,8,35,38)] │ ├── sum [type=float, outer=(38)] │ │ └── variable: column38 [type=float, outer=(38)] │ ├── const-agg [type=string, outer=(2)] - │ │ └── variable: customer.c_name [type=string, outer=(2)] + │ │ └── variable: c_name [type=string, outer=(2)] │ ├── const-agg [type=string, outer=(3)] - │ │ └── variable: customer.c_address [type=string, outer=(3)] + │ │ └── variable: c_address [type=string, outer=(3)] │ ├── const-agg [type=string, outer=(5)] - │ │ └── variable: customer.c_phone [type=string, outer=(5)] + │ │ └── variable: c_phone [type=string, outer=(5)] │ ├── const-agg [type=float, outer=(6)] - │ │ └── variable: customer.c_acctbal [type=float, outer=(6)] + │ │ └── variable: c_acctbal [type=float, outer=(6)] │ ├── const-agg [type=string, outer=(8)] - │ │ └── variable: customer.c_comment [type=string, outer=(8)] + │ │ └── variable: c_comment [type=string, outer=(8)] │ └── const-agg [type=string, outer=(35)] - │ └── variable: nation.n_name [type=string, outer=(35)] + │ └── variable: n_name [type=string, outer=(35)] └── const: 20 [type=int] # -------------------------------------------------- @@ -1544,16 +1544,16 @@ sort │ │ │ ├── scan lineitem │ │ │ │ └── columns: l_orderkey:10(int!null) l_shipdate:20(date) l_commitdate:21(date) l_receiptdate:22(date) l_shipmode:24(string) │ │ │ └── filters [type=bool, outer=(20-22,24), constraints=(/20: (/NULL - ]; /21: (/NULL - ]; /22: [/'1994-01-01' - ]; /24: [/'MAIL' - /'MAIL'] [/'SHIP' - /'SHIP'])] - │ │ │ ├── lineitem.l_shipmode IN ('MAIL', 'SHIP') [type=bool, outer=(24), constraints=(/24: [/'MAIL' - /'MAIL'] [/'SHIP' - /'SHIP']; tight)] - │ │ │ ├── lineitem.l_commitdate < lineitem.l_receiptdate [type=bool, outer=(21,22), constraints=(/21: (/NULL - ]; /22: (/NULL - ])] - │ │ │ ├── lineitem.l_shipdate < lineitem.l_commitdate [type=bool, outer=(20,21), constraints=(/20: (/NULL - ]; /21: (/NULL - ])] - │ │ │ ├── lineitem.l_receiptdate >= '1994-01-01' [type=bool, outer=(22), constraints=(/22: [/'1994-01-01' - ]; tight)] - │ │ │ └── lineitem.l_receiptdate < ('1994-01-01' + '1y') [type=bool, outer=(22), constraints=(/22: (/NULL - ])] + │ │ │ ├── l_shipmode IN ('MAIL', 'SHIP') [type=bool, outer=(24), constraints=(/24: [/'MAIL' - /'MAIL'] [/'SHIP' - /'SHIP']; tight)] + │ │ │ ├── l_commitdate < l_receiptdate [type=bool, outer=(21,22), constraints=(/21: (/NULL - ]; /22: (/NULL - ])] + │ │ │ ├── l_shipdate < l_commitdate [type=bool, outer=(20,21), constraints=(/20: (/NULL - ]; /21: (/NULL - ])] + │ │ │ ├── l_receiptdate >= '1994-01-01' [type=bool, outer=(22), constraints=(/22: [/'1994-01-01' - ]; tight)] + │ │ │ └── l_receiptdate < ('1994-01-01' + '1y') [type=bool, outer=(22), constraints=(/22: (/NULL - ])] │ │ └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - │ │ └── orders.o_orderkey = lineitem.l_orderkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + │ │ └── o_orderkey = l_orderkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] │ └── projections [outer=(6,24)] - │ ├── CASE WHEN (orders.o_orderpriority = '1-URGENT') OR (orders.o_orderpriority = '2-HIGH') THEN 1 ELSE 0 END [type=int, outer=(6)] - │ └── CASE WHEN (orders.o_orderpriority != '1-URGENT') AND (orders.o_orderpriority != '2-HIGH') THEN 1 ELSE 0 END [type=int, outer=(6)] + │ ├── CASE WHEN (o_orderpriority = '1-URGENT') OR (o_orderpriority = '2-HIGH') THEN 1 ELSE 0 END [type=int, outer=(6)] + │ └── CASE WHEN (o_orderpriority != '1-URGENT') AND (o_orderpriority != '2-HIGH') THEN 1 ELSE 0 END [type=int, outer=(6)] └── aggregations [outer=(26,28)] ├── sum [type=decimal, outer=(26)] │ └── variable: column26 [type=int, outer=(26)] @@ -1623,12 +1623,12 @@ sort │ │ │ │ ├── key: (9) │ │ │ │ └── fd: (9)-->(10,17) │ │ │ └── filters [type=bool, outer=(17)] - │ │ │ └── orders.o_comment NOT LIKE '%special%requests%' [type=bool, outer=(17)] + │ │ │ └── o_comment NOT LIKE '%special%requests%' [type=bool, outer=(17)] │ │ └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - │ │ └── customer.c_custkey = orders.o_custkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + │ │ └── c_custkey = o_custkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] │ └── aggregations [outer=(9)] │ └── count [type=int, outer=(9)] - │ └── variable: orders.o_orderkey [type=int, outer=(9)] + │ └── variable: o_orderkey [type=int, outer=(9)] └── aggregations └── count-rows [type=int] @@ -1680,13 +1680,13 @@ project │ │ │ │ ├── scan lineitem │ │ │ │ │ └── columns: l_partkey:2(int!null) l_extendedprice:6(float) l_discount:7(float) l_shipdate:11(date) │ │ │ │ └── filters [type=bool, outer=(11), constraints=(/11: [/'1995-09-01' - ])] - │ │ │ │ ├── lineitem.l_shipdate >= '1995-09-01' [type=bool, outer=(11), constraints=(/11: [/'1995-09-01' - ]; tight)] - │ │ │ │ └── lineitem.l_shipdate < ('1995-09-01' + '1mon') [type=bool, outer=(11), constraints=(/11: (/NULL - ])] + │ │ │ │ ├── l_shipdate >= '1995-09-01' [type=bool, outer=(11), constraints=(/11: [/'1995-09-01' - ]; tight)] + │ │ │ │ └── l_shipdate < ('1995-09-01' + '1mon') [type=bool, outer=(11), constraints=(/11: (/NULL - ])] │ │ │ └── filters [type=bool, outer=(2,17), constraints=(/2: (/NULL - ]; /17: (/NULL - ]), fd=(2)==(17), (17)==(2)] - │ │ │ └── lineitem.l_partkey = part.p_partkey [type=bool, outer=(2,17), constraints=(/2: (/NULL - ]; /17: (/NULL - ])] + │ │ │ └── l_partkey = p_partkey [type=bool, outer=(2,17), constraints=(/2: (/NULL - ]; /17: (/NULL - ])] │ │ └── projections [outer=(6,7,21)] - │ │ ├── CASE WHEN part.p_type LIKE 'PROMO%' THEN lineitem.l_extendedprice * (1.0 - lineitem.l_discount) ELSE 0.0 END [type=float, outer=(6,7,21)] - │ │ └── lineitem.l_extendedprice * (1.0 - lineitem.l_discount) [type=float, outer=(6,7)] + │ │ ├── CASE WHEN p_type LIKE 'PROMO%' THEN l_extendedprice * (1.0 - l_discount) ELSE 0.0 END [type=float, outer=(6,7,21)] + │ │ └── l_extendedprice * (1.0 - l_discount) [type=float, outer=(6,7)] │ └── aggregations [outer=(26,28)] │ ├── sum [type=float, outer=(26)] │ │ └── variable: column26 [type=float, outer=(26)] @@ -1812,7 +1812,7 @@ sort │ └── max [type=float, outer=(43)] │ └── variable: sum [type=float, outer=(43)] └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - └── supplier.s_suppkey = lineitem.l_suppkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + └── s_suppkey = lineitem.l_suppkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] # -------------------------------------------------- # Q16 @@ -1889,9 +1889,9 @@ sort │ │ │ │ ├── key: (15) │ │ │ │ └── fd: (15)-->(21) │ │ │ └── filters [type=bool, outer=(21)] - │ │ │ └── supplier.s_comment LIKE '%Customer%Complaints%' [type=bool, outer=(21)] + │ │ │ └── s_comment LIKE '%Customer%Complaints%' [type=bool, outer=(21)] │ │ └── filters [type=bool, outer=(2,15)] - │ │ └── (partsupp.ps_suppkey = supplier.s_suppkey) IS NOT false [type=bool, outer=(2,15)] + │ │ └── (ps_suppkey = s_suppkey) IS NOT false [type=bool, outer=(2,15)] │ ├── select │ │ ├── columns: p_partkey:6(int!null) p_brand:9(string!null) p_type:10(string) p_size:11(int!null) │ │ ├── key: (6) @@ -1901,15 +1901,15 @@ sort │ │ │ ├── key: (6) │ │ │ └── fd: (6)-->(9-11) │ │ └── filters [type=bool, outer=(9-11), constraints=(/9: (/NULL - /'Brand#45') [/e'Brand#45\x00' - ]; /11: [/3 - /3] [/9 - /9] [/14 - /14] [/19 - /19] [/23 - /23] [/36 - /36] [/45 - /45] [/49 - /49])] - │ │ ├── part.p_brand != 'Brand#45' [type=bool, outer=(9), constraints=(/9: (/NULL - /'Brand#45') [/e'Brand#45\x00' - ]; tight)] - │ │ ├── part.p_type NOT LIKE 'MEDIUM POLISHED %' [type=bool, outer=(10)] - │ │ └── part.p_size IN (3, 9, 14, 19, 23, 36, 45, 49) [type=bool, outer=(11), constraints=(/11: [/3 - /3] [/9 - /9] [/14 - /14] [/19 - /19] [/23 - /23] [/36 - /36] [/45 - /45] [/49 - /49]; tight)] + │ │ ├── p_brand != 'Brand#45' [type=bool, outer=(9), constraints=(/9: (/NULL - /'Brand#45') [/e'Brand#45\x00' - ]; tight)] + │ │ ├── p_type NOT LIKE 'MEDIUM POLISHED %' [type=bool, outer=(10)] + │ │ └── p_size IN (3, 9, 14, 19, 23, 36, 45, 49) [type=bool, outer=(11), constraints=(/11: [/3 - /3] [/9 - /9] [/14 - /14] [/19 - /19] [/23 - /23] [/36 - /36] [/45 - /45] [/49 - /49]; tight)] │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ └── part.p_partkey = partsupp.ps_partkey [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ └── p_partkey = ps_partkey [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] └── aggregations [outer=(2)] └── count [type=int, outer=(2)] └── agg-distinct [type=int, outer=(2)] - └── variable: partsupp.ps_suppkey [type=int, outer=(2)] + └── variable: ps_suppkey [type=int, outer=(2)] # -------------------------------------------------- # Q17 @@ -1985,17 +1985,17 @@ project │ │ │ │ │ │ │ ├── key: (17) │ │ │ │ │ │ │ └── fd: (17)-->(20,23) │ │ │ │ │ │ └── filters [type=bool, outer=(20,23), constraints=(/20: [/'Brand#23' - /'Brand#23']; /23: [/'MED BOX' - /'MED BOX']; tight), fd=()-->(20,23)] - │ │ │ │ │ │ ├── part.p_brand = 'Brand#23' [type=bool, outer=(20), constraints=(/20: [/'Brand#23' - /'Brand#23']; tight)] - │ │ │ │ │ │ └── part.p_container = 'MED BOX' [type=bool, outer=(23), constraints=(/23: [/'MED BOX' - /'MED BOX']; tight)] + │ │ │ │ │ │ ├── p_brand = 'Brand#23' [type=bool, outer=(20), constraints=(/20: [/'Brand#23' - /'Brand#23']; tight)] + │ │ │ │ │ │ └── p_container = 'MED BOX' [type=bool, outer=(23), constraints=(/23: [/'MED BOX' - /'MED BOX']; tight)] │ │ │ │ │ └── filters [type=bool, outer=(17,27), constraints=(/17: (/NULL - ]; /27: (/NULL - ]), fd=(17)==(27), (27)==(17)] - │ │ │ │ │ └── lineitem.l_partkey = part.p_partkey [type=bool, outer=(17,27), constraints=(/17: (/NULL - ]; /27: (/NULL - ])] + │ │ │ │ │ └── lineitem.l_partkey = p_partkey [type=bool, outer=(17,27), constraints=(/17: (/NULL - ]; /27: (/NULL - ])] │ │ │ │ └── aggregations [outer=(30)] │ │ │ │ └── avg [type=float, outer=(30)] │ │ │ │ └── variable: lineitem.l_quantity [type=float, outer=(30)] │ │ │ └── projections [outer=(17,42)] │ │ │ └── column42 * 0.2 [type=float, outer=(42)] │ │ └── filters [type=bool, outer=(2,5,17,43), constraints=(/2: (/NULL - ]; /5: (/NULL - ]; /17: (/NULL - ]; /43: (/NULL - ]), fd=(2)==(17), (17)==(2)] - │ │ ├── part.p_partkey = lineitem.l_partkey [type=bool, outer=(2,17), constraints=(/2: (/NULL - ]; /17: (/NULL - ])] + │ │ ├── p_partkey = lineitem.l_partkey [type=bool, outer=(2,17), constraints=(/2: (/NULL - ]; /17: (/NULL - ])] │ │ └── lineitem.l_quantity < ?column? [type=bool, outer=(5,43), constraints=(/5: (/NULL - ]; /43: (/NULL - ])] │ └── aggregations [outer=(6)] │ └── sum [type=float, outer=(6)] @@ -2102,24 +2102,24 @@ limit │ │ │ │ │ └── filters [type=bool, outer=(50), constraints=(/50: [/300.00000000000006 - ]; tight)] │ │ │ │ │ └── column50 > 300.0 [type=bool, outer=(50), constraints=(/50: [/300.00000000000006 - ]; tight)] │ │ │ │ └── filters [type=bool, outer=(9,34), constraints=(/9: (/NULL - ]; /34: (/NULL - ]), fd=(9)==(34), (34)==(9)] - │ │ │ │ └── orders.o_orderkey = lineitem.l_orderkey [type=bool, outer=(9,34), constraints=(/9: (/NULL - ]; /34: (/NULL - ])] + │ │ │ │ └── o_orderkey = lineitem.l_orderkey [type=bool, outer=(9,34), constraints=(/9: (/NULL - ]; /34: (/NULL - ])] │ │ │ └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - │ │ │ └── customer.c_custkey = orders.o_custkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + │ │ │ └── c_custkey = o_custkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] │ │ ├── scan lineitem │ │ │ └── columns: lineitem.l_orderkey:18(int!null) lineitem.l_quantity:22(float) │ │ └── filters [type=bool, outer=(9,18), constraints=(/9: (/NULL - ]; /18: (/NULL - ]), fd=(9)==(18), (18)==(9)] - │ │ └── orders.o_orderkey = lineitem.l_orderkey [type=bool, outer=(9,18), constraints=(/9: (/NULL - ]; /18: (/NULL - ])] + │ │ └── o_orderkey = lineitem.l_orderkey [type=bool, outer=(9,18), constraints=(/9: (/NULL - ]; /18: (/NULL - ])] │ └── aggregations [outer=(1,2,12,13,22)] │ ├── sum [type=float, outer=(22)] │ │ └── variable: lineitem.l_quantity [type=float, outer=(22)] │ ├── const-agg [type=int, outer=(1)] - │ │ └── variable: customer.c_custkey [type=int, outer=(1)] + │ │ └── variable: c_custkey [type=int, outer=(1)] │ ├── const-agg [type=string, outer=(2)] - │ │ └── variable: customer.c_name [type=string, outer=(2)] + │ │ └── variable: c_name [type=string, outer=(2)] │ ├── const-agg [type=float, outer=(12)] - │ │ └── variable: orders.o_totalprice [type=float, outer=(12)] + │ │ └── variable: o_totalprice [type=float, outer=(12)] │ └── const-agg [type=date, outer=(13)] - │ └── variable: orders.o_orderdate [type=date, outer=(13)] + │ └── variable: o_orderdate [type=date, outer=(13)] └── const: 100 [type=int] # -------------------------------------------------- @@ -2188,14 +2188,14 @@ scalar-group-by │ │ │ ├── scan lineitem │ │ │ │ └── columns: l_partkey:2(int!null) l_quantity:5(float) l_extendedprice:6(float) l_discount:7(float) l_shipinstruct:14(string) l_shipmode:15(string) │ │ │ └── filters [type=bool, outer=(14,15), constraints=(/14: [/'DELIVER IN PERSON' - /'DELIVER IN PERSON']; /15: [/'AIR' - /'AIR'] [/'AIR REG' - /'AIR REG']; tight), fd=()-->(14)] - │ │ │ ├── lineitem.l_shipmode IN ('AIR', 'AIR REG') [type=bool, outer=(15), constraints=(/15: [/'AIR' - /'AIR'] [/'AIR REG' - /'AIR REG']; tight)] - │ │ │ └── lineitem.l_shipinstruct = 'DELIVER IN PERSON' [type=bool, outer=(14), constraints=(/14: [/'DELIVER IN PERSON' - /'DELIVER IN PERSON']; tight)] + │ │ │ ├── l_shipmode IN ('AIR', 'AIR REG') [type=bool, outer=(15), constraints=(/15: [/'AIR' - /'AIR'] [/'AIR REG' - /'AIR REG']; tight)] + │ │ │ └── l_shipinstruct = 'DELIVER IN PERSON' [type=bool, outer=(14), constraints=(/14: [/'DELIVER IN PERSON' - /'DELIVER IN PERSON']; tight)] │ │ └── filters [type=bool, outer=(2,5,17,20,22,23), constraints=(/2: (/NULL - ]; /17: (/NULL - ]; /22: [/1 - ]), fd=(2)==(17), (17)==(2)] - │ │ ├── part.p_partkey = lineitem.l_partkey [type=bool, outer=(2,17), constraints=(/2: (/NULL - ]; /17: (/NULL - ])] - │ │ ├── ((((((part.p_brand = 'Brand#12') AND (part.p_container IN ('SM BOX', 'SM CASE', 'SM PACK', 'SM PKG'))) AND (lineitem.l_quantity >= 1.0)) AND (lineitem.l_quantity <= 11.0)) AND (part.p_size <= 5)) OR (((((part.p_brand = 'Brand#23') AND (part.p_container IN ('MED BAG', 'MED BOX', 'MED PACK', 'MED PKG'))) AND (lineitem.l_quantity >= 10.0)) AND (lineitem.l_quantity <= 20.0)) AND (part.p_size <= 10))) OR (((((part.p_brand = 'Brand#34') AND (part.p_container IN ('LG BOX', 'LG CASE', 'LG PACK', 'LG PKG'))) AND (lineitem.l_quantity >= 20.0)) AND (lineitem.l_quantity <= 30.0)) AND (part.p_size <= 15)) [type=bool, outer=(5,20,22,23)] - │ │ └── part.p_size >= 1 [type=bool, outer=(22), constraints=(/22: [/1 - ]; tight)] + │ │ ├── p_partkey = l_partkey [type=bool, outer=(2,17), constraints=(/2: (/NULL - ]; /17: (/NULL - ])] + │ │ ├── ((((((p_brand = 'Brand#12') AND (p_container IN ('SM BOX', 'SM CASE', 'SM PACK', 'SM PKG'))) AND (l_quantity >= 1.0)) AND (l_quantity <= 11.0)) AND (p_size <= 5)) OR (((((p_brand = 'Brand#23') AND (p_container IN ('MED BAG', 'MED BOX', 'MED PACK', 'MED PKG'))) AND (l_quantity >= 10.0)) AND (l_quantity <= 20.0)) AND (p_size <= 10))) OR (((((p_brand = 'Brand#34') AND (p_container IN ('LG BOX', 'LG CASE', 'LG PACK', 'LG PKG'))) AND (l_quantity >= 20.0)) AND (l_quantity <= 30.0)) AND (p_size <= 15)) [type=bool, outer=(5,20,22,23)] + │ │ └── p_size >= 1 [type=bool, outer=(22), constraints=(/22: [/1 - ]; tight)] │ └── projections [outer=(6,7)] - │ └── lineitem.l_extendedprice * (1.0 - lineitem.l_discount) [type=float, outer=(6,7)] + │ └── l_extendedprice * (1.0 - l_discount) [type=float, outer=(6,7)] └── aggregations [outer=(26)] └── sum [type=float, outer=(26)] └── variable: column26 [type=float, outer=(26)] @@ -2297,18 +2297,18 @@ sort │ │ │ │ │ │ ├── scan lineitem │ │ │ │ │ │ │ └── columns: l_partkey:27(int!null) l_suppkey:28(int!null) l_quantity:30(float) l_shipdate:36(date) │ │ │ │ │ │ └── filters [type=bool, outer=(36), constraints=(/36: [/'1994-01-01' - ])] - │ │ │ │ │ │ ├── lineitem.l_shipdate >= '1994-01-01' [type=bool, outer=(36), constraints=(/36: [/'1994-01-01' - ]; tight)] - │ │ │ │ │ │ └── lineitem.l_shipdate < ('1994-01-01' + '1y') [type=bool, outer=(36), constraints=(/36: (/NULL - ])] + │ │ │ │ │ │ ├── l_shipdate >= '1994-01-01' [type=bool, outer=(36), constraints=(/36: [/'1994-01-01' - ]; tight)] + │ │ │ │ │ │ └── l_shipdate < ('1994-01-01' + '1y') [type=bool, outer=(36), constraints=(/36: (/NULL - ])] │ │ │ │ │ └── filters [type=bool, outer=(12,13,27,28), constraints=(/12: (/NULL - ]; /13: (/NULL - ]; /27: (/NULL - ]; /28: (/NULL - ]), fd=(12)==(27), (27)==(12), (13)==(28), (28)==(13)] - │ │ │ │ │ ├── lineitem.l_partkey = partsupp.ps_partkey [type=bool, outer=(12,27), constraints=(/12: (/NULL - ]; /27: (/NULL - ])] - │ │ │ │ │ └── lineitem.l_suppkey = partsupp.ps_suppkey [type=bool, outer=(13,28), constraints=(/13: (/NULL - ]; /28: (/NULL - ])] + │ │ │ │ │ ├── l_partkey = ps_partkey [type=bool, outer=(12,27), constraints=(/12: (/NULL - ]; /27: (/NULL - ])] + │ │ │ │ │ └── l_suppkey = ps_suppkey [type=bool, outer=(13,28), constraints=(/13: (/NULL - ]; /28: (/NULL - ])] │ │ │ │ └── aggregations [outer=(14,30)] │ │ │ │ ├── sum [type=float, outer=(30)] - │ │ │ │ │ └── variable: lineitem.l_quantity [type=float, outer=(30)] + │ │ │ │ │ └── variable: l_quantity [type=float, outer=(30)] │ │ │ │ └── const-agg [type=int, outer=(14)] - │ │ │ │ └── variable: partsupp.ps_availqty [type=int, outer=(14)] + │ │ │ │ └── variable: ps_availqty [type=int, outer=(14)] │ │ │ └── filters [type=bool, outer=(14,42), constraints=(/14: (/NULL - ])] - │ │ │ └── partsupp.ps_availqty > (column42 * 0.5) [type=bool, outer=(14,42), constraints=(/14: (/NULL - ])] + │ │ │ └── ps_availqty > (column42 * 0.5) [type=bool, outer=(14,42), constraints=(/14: (/NULL - ])] │ │ ├── select │ │ │ ├── columns: p_partkey:17(int!null) p_name:18(string) │ │ │ ├── key: (17) @@ -2318,11 +2318,11 @@ sort │ │ │ │ ├── key: (17) │ │ │ │ └── fd: (17)-->(18) │ │ │ └── filters [type=bool, outer=(18)] - │ │ │ └── part.p_name LIKE 'forest%' [type=bool, outer=(18)] + │ │ │ └── p_name LIKE 'forest%' [type=bool, outer=(18)] │ │ └── filters [type=bool, outer=(12,17), constraints=(/12: (/NULL - ]; /17: (/NULL - ]), fd=(12)==(17), (17)==(12)] - │ │ └── partsupp.ps_partkey = part.p_partkey [type=bool, outer=(12,17), constraints=(/12: (/NULL - ]; /17: (/NULL - ])] + │ │ └── ps_partkey = p_partkey [type=bool, outer=(12,17), constraints=(/12: (/NULL - ]; /17: (/NULL - ])] │ └── filters [type=bool, outer=(1,13), constraints=(/1: (/NULL - ]; /13: (/NULL - ]), fd=(1)==(13), (13)==(1)] - │ └── supplier.s_suppkey = partsupp.ps_suppkey [type=bool, outer=(1,13), constraints=(/1: (/NULL - ]; /13: (/NULL - ])] + │ └── s_suppkey = ps_suppkey [type=bool, outer=(1,13), constraints=(/1: (/NULL - ]; /13: (/NULL - ])] ├── select │ ├── columns: n_nationkey:8(int!null) n_name:9(string!null) │ ├── key: (8) @@ -2332,9 +2332,9 @@ sort │ │ ├── key: (8) │ │ └── fd: (8)-->(9) │ └── filters [type=bool, outer=(9), constraints=(/9: [/'CANADA' - /'CANADA']; tight), fd=()-->(9)] - │ └── nation.n_name = 'CANADA' [type=bool, outer=(9), constraints=(/9: [/'CANADA' - /'CANADA']; tight)] + │ └── n_name = 'CANADA' [type=bool, outer=(9), constraints=(/9: [/'CANADA' - /'CANADA']; tight)] └── filters [type=bool, outer=(4,8), constraints=(/4: (/NULL - ]; /8: (/NULL - ]), fd=(4)==(8), (8)==(4)] - └── supplier.s_nationkey = nation.n_nationkey [type=bool, outer=(4,8), constraints=(/4: (/NULL - ]; /8: (/NULL - ])] + └── s_nationkey = n_nationkey [type=bool, outer=(4,8), constraints=(/4: (/NULL - ]; /8: (/NULL - ])] # -------------------------------------------------- # Q21 @@ -2460,13 +2460,13 @@ limit │ │ │ │ │ ├── lineitem.l_orderkey = lineitem.l_orderkey [type=bool, outer=(8,37), constraints=(/8: (/NULL - ]; /37: (/NULL - ])] │ │ │ │ │ └── lineitem.l_suppkey != lineitem.l_suppkey [type=bool, outer=(10,39), constraints=(/10: (/NULL - ]; /39: (/NULL - ])] │ │ │ │ └── filters [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ]), fd=(1)==(10), (10)==(1)] - │ │ │ │ └── supplier.s_suppkey = lineitem.l_suppkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] + │ │ │ │ └── s_suppkey = lineitem.l_suppkey [type=bool, outer=(1,10), constraints=(/1: (/NULL - ]; /10: (/NULL - ])] │ │ │ └── filters [type=bool, outer=(8,24,26), constraints=(/8: (/NULL - ]; /24: (/NULL - ]; /26: [/'F' - /'F']), fd=()-->(26), (8)==(24), (24)==(8)] - │ │ │ ├── orders.o_orderkey = lineitem.l_orderkey [type=bool, outer=(8,24), constraints=(/8: (/NULL - ]; /24: (/NULL - ])] - │ │ │ └── orders.o_orderstatus = 'F' [type=bool, outer=(26), constraints=(/26: [/'F' - /'F']; tight)] + │ │ │ ├── o_orderkey = lineitem.l_orderkey [type=bool, outer=(8,24), constraints=(/8: (/NULL - ]; /24: (/NULL - ])] + │ │ │ └── o_orderstatus = 'F' [type=bool, outer=(26), constraints=(/26: [/'F' - /'F']; tight)] │ │ └── filters [type=bool, outer=(4,33,34), constraints=(/4: (/NULL - ]; /33: (/NULL - ]; /34: [/'SAUDI ARABIA' - /'SAUDI ARABIA']), fd=()-->(34), (4)==(33), (33)==(4)] - │ │ ├── supplier.s_nationkey = nation.n_nationkey [type=bool, outer=(4,33), constraints=(/4: (/NULL - ]; /33: (/NULL - ])] - │ │ └── nation.n_name = 'SAUDI ARABIA' [type=bool, outer=(34), constraints=(/34: [/'SAUDI ARABIA' - /'SAUDI ARABIA']; tight)] + │ │ ├── s_nationkey = n_nationkey [type=bool, outer=(4,33), constraints=(/4: (/NULL - ]; /33: (/NULL - ])] + │ │ └── n_name = 'SAUDI ARABIA' [type=bool, outer=(34), constraints=(/34: [/'SAUDI ARABIA' - /'SAUDI ARABIA']; tight)] │ └── aggregations │ └── count-rows [type=int] └── const: 100 [type=int] @@ -2567,7 +2567,7 @@ sort │ │ ├── scan orders │ │ │ └── columns: o_custkey:19(int!null) │ │ └── filters [type=bool, outer=(1,19), constraints=(/1: (/NULL - ]; /19: (/NULL - ]), fd=(1)==(19), (19)==(1)] - │ │ └── orders.o_custkey = customer.c_custkey [type=bool, outer=(1,19), constraints=(/1: (/NULL - ]; /19: (/NULL - ])] + │ │ └── o_custkey = customer.c_custkey [type=bool, outer=(1,19), constraints=(/1: (/NULL - ]; /19: (/NULL - ])] │ └── projections [outer=(5,6)] │ └── substring(customer.c_phone, 1, 2) [type=string, outer=(5)] └── aggregations [outer=(6)] diff --git a/pkg/sql/opt/xform/testdata/physprops/ordering b/pkg/sql/opt/xform/testdata/physprops/ordering index 195af0cf7827..a06c5b890296 100644 --- a/pkg/sql/opt/xform/testdata/physprops/ordering +++ b/pkg/sql/opt/xform/testdata/physprops/ordering @@ -80,7 +80,7 @@ select │ ├── columns: x:1(int!null) y:2(float!null) z:3(decimal) s:4(string!null) │ └── ordering: +1,-2 └── filters [type=bool] - └── a.x > a.y [type=bool] + └── x > y [type=bool] # Pass through ordering to scan operator that can't support it. opt @@ -94,7 +94,7 @@ sort ├── scan a │ └── columns: x:1(int!null) y:2(float!null) z:3(decimal) s:4(string!null) └── filters [type=bool] - └── a.x > a.y [type=bool] + └── x > y [type=bool] # -------------------------------------------------- # Project operator (pass through). @@ -111,7 +111,7 @@ project │ ├── columns: x:1(int!null) y:2(float!null) │ └── ordering: +1,-2 └── projections - └── a.x + 1 [type=int] + └── x + 1 [type=int] # Pass through ordering to scan operator that can't support it. opt @@ -125,7 +125,7 @@ sort ├── scan a │ └── columns: x:1(int!null) y:2(float!null) z:3(decimal) └── projections - └── a.z + 1 [type=decimal] + └── z + 1 [type=decimal] # Ordering cannot be passed through because it includes computed column. opt @@ -139,7 +139,7 @@ sort ├── scan a │ └── columns: x:1(int!null) y:2(float!null) └── projections - └── a.y + 1.0 [type=float] + └── y + 1.0 [type=float] # -------------------------------------------------- # Select + Project operators (pass through both). @@ -159,9 +159,9 @@ project │ │ ├── columns: x:1(int!null) y:2(float!null) │ │ └── ordering: +1,-2 │ └── filters [type=bool] - │ └── a.x > a.y [type=bool] + │ └── x > y [type=bool] └── projections - └── a.x - 1 [type=int] + └── x - 1 [type=int] memo SELECT y, x-1 AS z FROM a WHERE x>y ORDER BY x, y DESC @@ -193,8 +193,8 @@ memo (optimized) ├── G6: (minus G9 G8) ├── G7: (gt G9 G10) ├── G8: (const 1) - ├── G9: (variable a.x) - └── G10: (variable a.y) + ├── G9: (variable x) + └── G10: (variable y) # Pass through ordering to scan operator that can't support it. opt @@ -210,7 +210,7 @@ sort ├── scan a │ └── columns: x:1(int!null) y:2(float!null) z:3(decimal) └── filters [type=bool] - └── a.x > a.y [type=bool] + └── x > y [type=bool] memo SELECT y, z FROM a WHERE x>y ORDER BY y @@ -240,8 +240,8 @@ memo (optimized) │ └── cost: 1279.32 ├── G5: (filters G6) ├── G6: (gt G7 G8) - ├── G7: (variable a.x) - └── G8: (variable a.y) + ├── G7: (variable x) + └── G8: (variable y) # -------------------------------------------------- # GroupBy operator. @@ -259,7 +259,7 @@ scalar-group-by │ └── columns: y:2(float!null) z:3(decimal) └── aggregations └── array-agg [type=decimal[]] - └── variable: a.z [type=decimal] + └── variable: z [type=decimal] opt SELECT array_agg(x) FROM (SELECT * FROM a ORDER BY x, y DESC) @@ -272,7 +272,7 @@ scalar-group-by │ └── ordering: +1,-2 └── aggregations └── array-agg [type=int[]] - └── variable: a.x [type=int] + └── variable: x [type=int] # -------------------------------------------------- # Explain operator. @@ -461,7 +461,7 @@ inner-join (merge) ├── left ordering: +1 ├── right ordering: +4 └── filters [type=bool] - └── abc.a = xyz.x [type=bool] + └── a = x [type=bool] opt SELECT * FROM abc JOIN xyz ON a=x ORDER BY x @@ -479,7 +479,7 @@ inner-join (merge) ├── left ordering: +1 ├── right ordering: +4 └── filters [type=bool] - └── abc.a = xyz.x [type=bool] + └── a = x [type=bool] # A left join guarantees an ordering on the left side. opt @@ -498,7 +498,7 @@ left-join (merge) ├── left ordering: +1 ├── right ordering: +4 └── filters [type=bool] - └── abc.a = xyz.x [type=bool] + └── a = x [type=bool] # A left join doesn't guarantee an ordering on x (some rows will have NULLs). opt @@ -519,7 +519,7 @@ sort ├── left ordering: +1 ├── right ordering: +4 └── filters [type=bool] - └── abc.a = xyz.x [type=bool] + └── a = x [type=bool] # A right join doesn't guarantee an ordering on a (some rows will have NULLs). opt @@ -540,7 +540,7 @@ sort ├── left ordering: +1 ├── right ordering: +4 └── filters [type=bool] - └── abc.a = xyz.x [type=bool] + └── a = x [type=bool] opt SELECT * FROM abc RIGHT JOIN xyz ON a=x ORDER BY x @@ -558,7 +558,7 @@ right-join (merge) ├── left ordering: +1 ├── right ordering: +4 └── filters [type=bool] - └── abc.a = xyz.x [type=bool] + └── a = x [type=bool] opt SELECT * FROM abc FULL OUTER JOIN xyz ON a=x ORDER BY a @@ -578,7 +578,7 @@ sort ├── left ordering: +1 ├── right ordering: +4 └── filters [type=bool] - └── abc.a = xyz.x [type=bool] + └── a = x [type=bool] opt SELECT * FROM abc JOIN xyz ON a=x AND b=y ORDER BY a @@ -596,8 +596,8 @@ inner-join (merge) ├── left ordering: +1,+2 ├── right ordering: +4,+5 └── filters [type=bool] - ├── abc.a = xyz.x [type=bool] - └── abc.b = xyz.y [type=bool] + ├── a = x [type=bool] + └── b = y [type=bool] opt SELECT * FROM abc JOIN xyz ON a=x AND b=y ORDER BY a, b @@ -615,8 +615,8 @@ inner-join (merge) ├── left ordering: +1,+2 ├── right ordering: +4,+5 └── filters [type=bool] - ├── abc.a = xyz.x [type=bool] - └── abc.b = xyz.y [type=bool] + ├── a = x [type=bool] + └── b = y [type=bool] opt SELECT * FROM abc JOIN xyz ON a=x AND b=y ORDER BY a, y @@ -634,8 +634,8 @@ inner-join (merge) ├── left ordering: +1,+2 ├── right ordering: +4,+5 └── filters [type=bool] - ├── abc.a = xyz.x [type=bool] - └── abc.b = xyz.y [type=bool] + ├── a = x [type=bool] + └── b = y [type=bool] # -------------------------------------------------- # Limit / Offset @@ -666,7 +666,7 @@ limit │ │ ├── columns: a:1(int!null) b:2(int!null) c:3(int!null) │ │ └── ordering: +1,+2 │ └── filters [type=bool] - │ └── abc.c < (abc.a + abc.b) [type=bool] + │ └── c < (a + b) [type=bool] └── const: 10 [type=int] opt @@ -711,7 +711,7 @@ sort │ │ ├── columns: a:1(int!null) b:2(int!null) c:3(int!null) │ │ └── ordering: +1,+2 │ └── filters [type=bool] - │ └── abc.c < (abc.a + abc.b) [type=bool] + │ └── c < (a + b) [type=bool] └── const: 10 [type=int] opt @@ -754,7 +754,7 @@ limit │ │ ├── columns: a:1(int!null) b:2(int!null) c:3(int!null) │ │ └── ordering: +1,+2 │ └── filters [type=bool] - │ └── abc.c < (abc.a + abc.b) [type=bool] + │ └── c < (a + b) [type=bool] └── const: 10 [type=int] opt @@ -794,7 +794,7 @@ limit │ │ ├── columns: a:1(int!null) b:2(int!null) c:3(int!null) │ │ └── ordering: +1,+2,+3 │ └── filters [type=bool] - │ └── abc.c < (abc.a + abc.b) [type=bool] + │ └── c < (a + b) [type=bool] └── const: 10 [type=int] opt @@ -851,7 +851,7 @@ sort │ └── columns: a:1(int!null) b:2(int!null) c:3(int!null) └── aggregations └── first-agg [type=int] - └── variable: abc.a [type=int] + └── variable: a [type=int] opt SELECT DISTINCT ON (b, c) a, b, c FROM abc ORDER BY b, c, a @@ -868,7 +868,7 @@ sort │ └── ordering: +1 opt(2,3) └── aggregations └── first-agg [type=int] - └── variable: abc.a [type=int] + └── variable: a [type=int] opt SELECT DISTINCT ON (a) a, c FROM abc ORDER BY a, c DESC, b @@ -885,7 +885,7 @@ distinct-on │ └── columns: a:1(int!null) b:2(int!null) c:3(int!null) └── aggregations └── first-agg [type=int] - └── variable: abc.c [type=int] + └── variable: c [type=int] # Pass through the ordering from above. opt @@ -900,7 +900,7 @@ distinct-on │ └── ordering: +1 └── aggregations └── first-agg [type=int] - └── variable: abc.c [type=int] + └── variable: c [type=int] # Internal orderings that refer just to ON columns can be ignored. opt @@ -915,7 +915,7 @@ distinct-on │ └── ordering: +1,+2 └── aggregations └── first-agg [type=int] - └── variable: abc.c [type=int] + └── variable: c [type=int] opt SELECT * FROM (SELECT DISTINCT ON (a, b) a, b, c FROM abc ORDER BY a, b) ORDER BY a @@ -929,7 +929,7 @@ distinct-on │ └── ordering: +1 └── aggregations └── first-agg [type=int] - └── variable: abc.c [type=int] + └── variable: c [type=int] # The c,b part of the inner ordering can be ignored. opt @@ -945,7 +945,7 @@ distinct-on │ └── ordering: +1 └── aggregations └── first-agg [type=int] - └── variable: abc.a [type=int] + └── variable: a [type=int] # There is no ordering that satisfies both the intra-group ordering of c+ and the # inter-group ordering of a+; we have to sort twice. @@ -966,9 +966,9 @@ sort │ └── columns: a:1(int!null) b:2(int!null) c:3(int!null) └── aggregations ├── first-agg [type=int] - │ └── variable: abc.a [type=int] + │ └── variable: a [type=int] └── first-agg [type=int] - └── variable: abc.c [type=int] + └── variable: c [type=int] # Same as above, except we can use the index ordering for the distinct input. opt @@ -986,6 +986,6 @@ sort │ └── ordering: +2 opt(1) └── aggregations ├── first-agg [type=int] - │ └── variable: abc.b [type=int] + │ └── variable: b [type=int] └── first-agg [type=int] - └── variable: abc.c [type=int] + └── variable: c [type=int] diff --git a/pkg/sql/opt/xform/testdata/physprops/presentation b/pkg/sql/opt/xform/testdata/physprops/presentation index 61552362d7b3..22111a9481fd 100644 --- a/pkg/sql/opt/xform/testdata/physprops/presentation +++ b/pkg/sql/opt/xform/testdata/physprops/presentation @@ -33,7 +33,7 @@ select ├── scan a │ └── columns: x:1(int!null) y:2(int) └── filters [type=bool] - └── a.y = 1 [type=bool] + └── y = 1 [type=bool] # Project operator. opt @@ -44,7 +44,7 @@ project ├── scan a │ └── columns: x:1(int!null) y:2(int) └── projections - └── a.y + 1 [type=int] + └── y + 1 [type=int] # Join operator. opt @@ -69,6 +69,6 @@ group-by │ └── columns: x:1(int!null) y:2(int) └── aggregations ├── max [type=int] - │ └── variable: a.y [type=int] + │ └── variable: y [type=int] └── const-agg [type=int] - └── variable: a.y [type=int] + └── variable: y [type=int] diff --git a/pkg/sql/opt/xform/testdata/ruleprops/orderings b/pkg/sql/opt/xform/testdata/ruleprops/orderings index cc6d20e47eb3..381644fb6563 100644 --- a/pkg/sql/opt/xform/testdata/ruleprops/orderings +++ b/pkg/sql/opt/xform/testdata/ruleprops/orderings @@ -95,7 +95,7 @@ group-by │ └── interesting orderings: (+1,+2) └── aggregations [outer=(2)] └── min [type=int, outer=(2)] - └── variable: abc.b [type=int, outer=(2)] + └── variable: b [type=int, outer=(2)] opt SELECT min(b), c FROM abc GROUP BY c @@ -114,7 +114,7 @@ group-by │ └── interesting orderings: (+3) └── aggregations [outer=(2)] └── min [type=int, outer=(2)] - └── variable: abc.b [type=int, outer=(2)] + └── variable: b [type=int, outer=(2)] # GroupBy with required ordering. opt @@ -138,7 +138,7 @@ group-by │ └── prune: (1-3) └── aggregations [outer=(1)] └── array-agg [type=int[], outer=(1)] - └── variable: abc.a [type=int, outer=(1)] + └── variable: a [type=int, outer=(1)] # Scalar GroupBy case. opt @@ -157,11 +157,11 @@ scalar-group-by │ └── interesting orderings: (+1,+2) (+3) └── aggregations [outer=(1-3)] ├── max [type=int, outer=(1)] - │ └── variable: abc.a [type=int, outer=(1)] + │ └── variable: a [type=int, outer=(1)] ├── min [type=int, outer=(2)] - │ └── variable: abc.b [type=int, outer=(2)] + │ └── variable: b [type=int, outer=(2)] └── sum [type=decimal, outer=(3)] - └── variable: abc.c [type=int, outer=(3)] + └── variable: c [type=int, outer=(3)] # LookupJoin operator. opt @@ -281,4 +281,4 @@ inner-join │ ├── prune: (5-7) │ └── interesting orderings: (+7) (+5,+6) └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - └── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] diff --git a/pkg/sql/opt/xform/testdata/rules/combo b/pkg/sql/opt/xform/testdata/rules/combo index 60d145862adc..a56e987a20a1 100644 --- a/pkg/sql/opt/xform/testdata/rules/combo +++ b/pkg/sql/opt/xform/testdata/rules/combo @@ -61,8 +61,8 @@ Source expression: ├── scan xyz │ └── columns: x:5(int) y:6(int) z:7(int) └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] New expression 1 of 1: inner-join @@ -73,8 +73,8 @@ New expression 1 of 1: ├── scan xyz │ └── columns: x:5(int) y:6(int) z:7(int) └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] ================================================================================ GenerateIndexScans @@ -88,8 +88,8 @@ Source expression: ├── scan xyz │ └── columns: x:5(int) y:6(int) z:7(int) └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] New expression 1 of 1: inner-join @@ -100,8 +100,8 @@ New expression 1 of 1: ├── scan xyz@xy │ └── columns: x:5(int) y:6(int) z:7(int) └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] ================================================================================ CommuteJoin @@ -115,8 +115,8 @@ Source expression: ├── scan xyz │ └── columns: x:5(int) y:6(int) z:7(int) └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] New expression 1 of 1: inner-join @@ -127,8 +127,8 @@ New expression 1 of 1: ├── scan abc │ └── columns: a:1(int) b:2(int) c:3(int) └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] ================================================================================ GenerateMergeJoins @@ -142,8 +142,8 @@ Source expression: ├── scan xyz │ └── columns: x:5(int) y:6(int) z:7(int) └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] New expression 1 of 1: inner-join (merge) @@ -159,8 +159,8 @@ New expression 1 of 1: ├── left ordering: +1,+2 ├── right ordering: +5,+6 └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] ================================================================================ GenerateLookupJoin @@ -174,8 +174,8 @@ Source expression: ├── scan xyz │ └── columns: x:5(int) y:6(int) z:7(int) └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] New expression 1 of 1: inner-join (lookup xyz@xy) @@ -185,8 +185,8 @@ New expression 1 of 1: ├── scan abc │ └── columns: a:1(int) b:2(int) c:3(int) └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] ================================================================================ CommuteJoin @@ -200,8 +200,8 @@ Source expression: ├── scan abc │ └── columns: a:1(int) b:2(int) c:3(int) └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] No new expressions. @@ -217,8 +217,8 @@ Source expression: ├── scan abc │ └── columns: a:1(int) b:2(int) c:3(int) └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] New expression 1 of 1: inner-join (merge) @@ -234,8 +234,8 @@ New expression 1 of 1: ├── left ordering: +5,+6 ├── right ordering: +1,+2 └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] ================================================================================ GenerateLookupJoin @@ -249,8 +249,8 @@ Source expression: ├── scan abc │ └── columns: a:1(int) b:2(int) c:3(int) └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] New expression 1 of 1: inner-join (lookup abc@ab) @@ -260,7 +260,7 @@ New expression 1 of 1: ├── scan xyz │ └── columns: x:5(int) y:6(int) z:7(int) └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] ---- ---- diff --git a/pkg/sql/opt/xform/testdata/rules/groupby b/pkg/sql/opt/xform/testdata/rules/groupby index a5d8edf71115..689224b57400 100644 --- a/pkg/sql/opt/xform/testdata/rules/groupby +++ b/pkg/sql/opt/xform/testdata/rules/groupby @@ -33,7 +33,7 @@ scalar-group-by │ └── fd: ()-->(1) └── aggregations [outer=(1)] └── const-agg [type=string, outer=(1)] - └── variable: abc.a [type=string, outer=(1)] + └── variable: a [type=string, outer=(1)] # Verify the rule still fires even if DISTINCT is used. opt @@ -51,7 +51,7 @@ scalar-group-by │ └── fd: ()-->(1) └── aggregations [outer=(1)] └── const-agg [type=string, outer=(1)] - └── variable: abc.a [type=string, outer=(1)] + └── variable: a [type=string, outer=(1)] opt SELECT min(b) FROM abc @@ -65,7 +65,7 @@ scalar-group-by │ └── columns: b:2(float) └── aggregations [outer=(2)] └── min [type=float, outer=(2)] - └── variable: abc.b [type=float, outer=(2)] + └── variable: b [type=float, outer=(2)] exec-ddl CREATE TABLE xyz ( @@ -113,7 +113,7 @@ scalar-group-by │ └── fd: ()-->(2,3) └── aggregations [outer=(2)] └── const-agg [type=int, outer=(2)] - └── variable: xyz.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # ReplaceMaxWithLimit has the same behavior with max() as # the previous min() query because z is the prefix of a unique key @@ -133,7 +133,7 @@ scalar-group-by │ └── fd: ()-->(2,3) └── aggregations [outer=(2)] └── const-agg [type=int, outer=(2)] - └── variable: xyz.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # We expect ReplaceMinWithLimit not to be preferred here. # This is because we know nothing about the ordering of y @@ -153,7 +153,7 @@ scalar-group-by │ └── fd: (1)-->(2) └── aggregations [outer=(2)] └── min [type=int, outer=(2)] - └── variable: xyz.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # We expect ReplaceMaxWithLimit not to be preferred here. # This is because we know nothing about the ordering of y @@ -173,7 +173,7 @@ scalar-group-by │ └── fd: (1)-->(2) └── aggregations [outer=(2)] └── max [type=int, outer=(2)] - └── variable: xyz.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] opt SELECT max(x) FROM xyz @@ -190,7 +190,7 @@ scalar-group-by │ └── fd: ()-->(1) └── aggregations [outer=(1)] └── const-agg [type=int, outer=(1)] - └── variable: xyz.x [type=int, outer=(1)] + └── variable: x [type=int, outer=(1)] opt SELECT min(x) FROM xyz @@ -207,7 +207,7 @@ scalar-group-by │ └── fd: ()-->(1) └── aggregations [outer=(1)] └── const-agg [type=int, outer=(1)] - └── variable: xyz.x [type=int, outer=(1)] + └── variable: x [type=int, outer=(1)] opt SELECT min(x) FROM xyz WHERE x in (0, 4, 7) @@ -225,7 +225,7 @@ scalar-group-by │ └── fd: ()-->(1) └── aggregations [outer=(1)] └── const-agg [type=int, outer=(1)] - └── variable: xyz.x [type=int, outer=(1)] + └── variable: x [type=int, outer=(1)] opt SELECT max(x) FROM xyz WHERE x in (0, 4, 7) @@ -243,7 +243,7 @@ scalar-group-by │ └── fd: ()-->(1) └── aggregations [outer=(1)] └── const-agg [type=int, outer=(1)] - └── variable: xyz.x [type=int, outer=(1)] + └── variable: x [type=int, outer=(1)] opt SELECT min(y) FROM xyz @@ -261,7 +261,7 @@ scalar-group-by │ └── fd: ()-->(2) └── aggregations [outer=(2)] └── const-agg [type=int, outer=(2)] - └── variable: xyz.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] opt SELECT min(y), min(y) FROM xyz @@ -279,7 +279,7 @@ scalar-group-by │ └── fd: ()-->(2) └── aggregations [outer=(2)] └── const-agg [type=int, outer=(2)] - └── variable: xyz.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # ReplaceMinWithLimit does not apply when there is # a grouping column @@ -297,7 +297,7 @@ project │ └── columns: y:2(int) └── aggregations [outer=(2)] └── min [type=int, outer=(2)] - └── variable: xyz.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # ReplaceMaxWithLimit does not apply when there is # a grouping column @@ -315,7 +315,7 @@ project │ └── columns: y:2(int) └── aggregations [outer=(2)] └── max [type=int, outer=(2)] - └── variable: xyz.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # ReplaceMinWithLimit does not apply when there is # a grouping column @@ -335,7 +335,7 @@ project │ └── fd: (1)-->(2) └── aggregations [outer=(2)] └── min [type=int, outer=(2)] - └── variable: xyz.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # ReplaceMinWithLimit does not apply on multiple aggregations # on different columns @@ -353,9 +353,9 @@ scalar-group-by │ └── fd: (1)-->(2) └── aggregations [outer=(1,2)] ├── min [type=int, outer=(2)] - │ └── variable: xyz.y [type=int, outer=(2)] + │ └── variable: y [type=int, outer=(2)] └── min [type=int, outer=(1)] - └── variable: xyz.x [type=int, outer=(1)] + └── variable: x [type=int, outer=(1)] # ReplaceMaxWithLimit does not apply on multiple aggregations @@ -374,9 +374,9 @@ scalar-group-by │ └── fd: (1)-->(2) └── aggregations [outer=(1,2)] ├── max [type=int, outer=(2)] - │ └── variable: xyz.y [type=int, outer=(2)] + │ └── variable: y [type=int, outer=(2)] └── max [type=int, outer=(1)] - └── variable: xyz.x [type=int, outer=(1)] + └── variable: x [type=int, outer=(1)] # ReplaceMinWithLimit does not apply with # multiple grouping columns @@ -394,7 +394,7 @@ group-by │ └── fd: (1)-->(2) └── aggregations [outer=(2)] └── min [type=int, outer=(2)] - └── variable: xyz.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # ReplaceMaxWithLimit does not apply with # multiple grouping columns @@ -412,7 +412,7 @@ group-by │ └── fd: (1)-->(2) └── aggregations [outer=(2)] └── max [type=int, outer=(2)] - └── variable: xyz.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # ReplaceMinWithLimit does not apply to non-scalar # aggregates @@ -432,9 +432,9 @@ project │ └── fd: (1)-->(2) └── aggregations [outer=(1,2)] ├── min [type=int, outer=(1)] - │ └── variable: xyz.x [type=int, outer=(1)] + │ └── variable: x [type=int, outer=(1)] └── count [type=int, outer=(2)] - └── variable: xyz.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] # ReplaceMaxWithLimit does not apply to non-scalar # aggregates @@ -454,9 +454,9 @@ project │ └── fd: (1)-->(2) └── aggregations [outer=(1,2)] ├── max [type=int, outer=(1)] - │ └── variable: xyz.x [type=int, outer=(1)] + │ └── variable: x [type=int, outer=(1)] └── count [type=int, outer=(2)] - └── variable: xyz.y [type=int, outer=(2)] + └── variable: y [type=int, outer=(2)] memo SELECT min(a) FROM abc @@ -482,7 +482,7 @@ memo (optimized) │ └── cost: 1050.00 ├── G7: (const 1) ├── G8: (const-agg G9) - └── G9: (variable abc.a) + └── G9: (variable a) memo SELECT min(b) FROM abc @@ -517,7 +517,7 @@ memo (optimized) │ └── cost: 1259.32 ├── G10: (filters G11) ├── G11: (is-not G12 G13) - ├── G12: (variable abc.b) + ├── G12: (variable b) └── G13: (null) memo @@ -544,7 +544,7 @@ memo (optimized) │ └── cost: 1149.66 ├── G7: (const 1) ├── G8: (const-agg G9) - └── G9: (variable abc.a) + └── G9: (variable a) memo SELECT max(b) FROM abc @@ -579,7 +579,7 @@ memo (optimized) │ └── cost: 1259.32 ├── G10: (filters G11) ├── G11: (is-not G12 G13) - ├── G12: (variable abc.b) + ├── G12: (variable b) └── G13: (null) # -------------------------------------------------- @@ -601,7 +601,7 @@ scalar-group-by │ └── fd: ()-->(1) └── aggregations [outer=(1)] └── const-agg [type=string, outer=(1)] - └── variable: abc.a [type=string, outer=(1)] + └── variable: a [type=string, outer=(1)] # Verify the rule still fires even if DISTINCT is used. opt @@ -619,7 +619,7 @@ scalar-group-by │ └── fd: ()-->(1) └── aggregations [outer=(1)] └── const-agg [type=string, outer=(1)] - └── variable: abc.a [type=string, outer=(1)] + └── variable: a [type=string, outer=(1)] opt select max(b) FROM abc @@ -633,7 +633,7 @@ scalar-group-by │ └── columns: b:2(float) └── aggregations [outer=(2)] └── max [type=float, outer=(2)] - └── variable: abc.b [type=float, outer=(2)] + └── variable: b [type=float, outer=(2)] memo select max(b) from abc @@ -668,5 +668,5 @@ memo (optimized) │ └── cost: 1259.32 ├── G10: (filters G11) ├── G11: (is-not G12 G13) - ├── G12: (variable abc.b) + ├── G12: (variable b) └── G13: (null) diff --git a/pkg/sql/opt/xform/testdata/rules/join b/pkg/sql/opt/xform/testdata/rules/join index cbda961ebf8d..da2791fc4b6c 100644 --- a/pkg/sql/opt/xform/testdata/rules/join +++ b/pkg/sql/opt/xform/testdata/rules/join @@ -108,8 +108,8 @@ memo (optimized) │ └── cost: 1279.32 ├── G5: (filters G6) ├── G6: (eq G7 G8) - ├── G7: (variable abc.a) - └── G8: (variable xyz.z) + ├── G7: (variable a) + └── G8: (variable z) memo SELECT * FROM abc FULL OUTER JOIN xyz ON a=z @@ -136,8 +136,8 @@ memo (optimized) ├── G4: (merge-on G5 full-join,+1,+7) ├── G5: (filters G6) ├── G6: (eq G7 G8) - ├── G7: (variable abc.a) - └── G8: (variable xyz.z) + ├── G7: (variable a) + └── G8: (variable z) # Verify that we swap to get the smaller side on the right. opt @@ -156,7 +156,7 @@ inner-join │ │ ├── constraint: /2/3/4: (/1/NULL - /1] │ │ └── fd: ()-->(2) │ └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] - │ └── abc.a = abc.c [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + │ └── a = c [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] └── true [type=bool] opt @@ -172,7 +172,7 @@ full-join │ ├── constraint: /2/3/4: [/1 - /1] │ └── fd: ()-->(2) └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - └── abc.a = xyz.z [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + └── a = z [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] # -------------------------------------------------- # CommuteLeftJoin @@ -203,8 +203,8 @@ memo (optimized) ├── G4: (merge-on G5 left-join,+1,+7) ├── G5: (filters G6) ├── G6: (eq G7 G8) - ├── G7: (variable abc.a) - └── G8: (variable xyz.z) + ├── G7: (variable a) + └── G8: (variable z) opt SELECT * FROM abc LEFT OUTER JOIN xyz ON a=z WHERE b=1 @@ -219,7 +219,7 @@ right-join │ ├── constraint: /2/3/4: [/1 - /1] │ └── fd: ()-->(2) └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - └── abc.a = xyz.z [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + └── a = z [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] # -------------------------------------------------- # CommuteRightJoin @@ -250,8 +250,8 @@ memo (optimized) │ └── cost: 1279.32 ├── G5: (filters G6) ├── G6: (eq G7 G8) - ├── G7: (variable abc.a) - └── G8: (variable xyz.z) + ├── G7: (variable a) + └── G8: (variable z) opt SELECT * FROM (SELECT * FROM abc WHERE b=1) RIGHT OUTER JOIN xyz ON a=z @@ -266,7 +266,7 @@ left-join │ ├── constraint: /2/3/4: [/1 - /1] │ └── fd: ()-->(2) └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - └── abc.a = xyz.z [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + └── a = z [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] # -------------------------------------------------- # GenerateMergeJoins @@ -288,7 +288,7 @@ inner-join (merge) ├── left ordering: +1 ├── right ordering: +5 └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - └── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] memo SELECT * FROM abc JOIN xyz ON a=x @@ -316,8 +316,8 @@ memo (optimized) │ └── cost: 1070.00 ├── G6: (filters G7) ├── G7: (eq G8 G9) - ├── G8: (variable abc.a) - └── G9: (variable xyz.x) + ├── G8: (variable a) + └── G9: (variable x) opt SELECT * FROM abc JOIN xyz ON x=a @@ -335,7 +335,7 @@ inner-join (merge) ├── left ordering: +1 ├── right ordering: +5 └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - └── xyz.x = abc.a [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── x = a [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] opt SELECT * FROM abc JOIN xyz ON a=x AND a=x AND x=a @@ -353,9 +353,9 @@ inner-join (merge) ├── left ordering: +1 ├── right ordering: +5 └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── xyz.x = abc.a [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── x = a [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] # Use constraints to force the choice of an index which doesn't help, and # verify that we don't prefer a merge-join that has to sort both of its inputs. @@ -374,8 +374,8 @@ inner-join │ ├── constraint: /6/7/8: [/1 - /1] │ └── fd: ()-->(6) └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] # Verify case where we generate multiple merge-joins. memo @@ -580,9 +580,9 @@ left-join (merge) ├── left ordering: +1,+2,+3 ├── right ordering: +6,+5,+4 └── filters [type=bool, outer=(1-6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /3: (/NULL - ]; /4: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1), (2)==(5), (5)==(2), (3)==(4), (4)==(3)] - ├── abc.c = stu.s [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - ├── abc.b = stu.t [type=bool, outer=(2,5), constraints=(/2: (/NULL - ]; /5: (/NULL - ])] - └── abc.a = stu.u [type=bool, outer=(3,4), constraints=(/3: (/NULL - ]; /4: (/NULL - ])] + ├── c = s [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── b = t [type=bool, outer=(2,5), constraints=(/2: (/NULL - ]; /5: (/NULL - ])] + └── a = u [type=bool, outer=(3,4), constraints=(/3: (/NULL - ]; /4: (/NULL - ])] # The ordering is coming from the right side. opt @@ -603,9 +603,9 @@ left-join (merge) ├── left ordering: +5,+6,+7 ├── right ordering: +3,+2,+1 └── filters [type=bool, outer=(1-3,5-7), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /3: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]; /7: (/NULL - ]), fd=(3)==(5), (5)==(3), (2)==(6), (6)==(2), (1)==(7), (7)==(1)] - ├── abc.c = stu.s [type=bool, outer=(3,5), constraints=(/3: (/NULL - ]; /5: (/NULL - ])] - ├── abc.b = stu.t [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] - └── abc.a = stu.u [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + ├── c = s [type=bool, outer=(3,5), constraints=(/3: (/NULL - ]; /5: (/NULL - ])] + ├── b = t [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + └── a = u [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] # In these cases, we shouldn't pick up equivalencies. memo @@ -639,8 +639,8 @@ memo (optimized) │ └── cost: 356.67 ├── G8: (filters G9) ├── G9: (eq G10 G11) - ├── G10: (variable abc.a) - └── G11: (variable abc.b) + ├── G10: (variable a) + └── G11: (variable b) exec-ddl CREATE TABLE kfloat (k FLOAT PRIMARY KEY) @@ -668,8 +668,8 @@ memo (optimized) │ └── cost: 1070.00 ├── G4: (filters G5) ├── G5: (eq G6 G7) - ├── G6: (variable abc.a) - └── G7: (variable kfloat.k) + ├── G6: (variable a) + └── G7: (variable k) # We should only pick up one equivalency. opt @@ -688,8 +688,8 @@ inner-join (merge) ├── left ordering: +1 ├── right ordering: +5 └── filters [type=bool, outer=(1,5,6), constraints=(/1: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5,6), (5)==(1,6), (6)==(1,5)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.a = xyz.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── a = y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] # Verify that the required orderings are simplified: the equality columns are # (u,t)=(x,z) but we are able to utilize indexes on s,t,u and y,z. @@ -709,7 +709,7 @@ full-join (merge) │ │ ├── key: (1-3) │ │ └── ordering: +(1|3),+2 │ └── filters [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ]), fd=(1)==(3), (3)==(1)] - │ └── stu.s = stu.u [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] + │ └── s = u [type=bool, outer=(1,3), constraints=(/1: (/NULL - ]; /3: (/NULL - ])] ├── select │ ├── columns: x:4(int!null) y:5(int!null) z:6(int) │ ├── fd: (4)==(5), (5)==(4) @@ -719,13 +719,13 @@ full-join (merge) │ │ ├── constraint: /5/6/7: (/NULL - ] │ │ └── ordering: +(4|5),+6 │ └── filters [type=bool, outer=(4,5), constraints=(/4: (/NULL - ]; /5: (/NULL - ]), fd=(4)==(5), (5)==(4)] - │ └── xyz.x = xyz.y [type=bool, outer=(4,5), constraints=(/4: (/NULL - ]; /5: (/NULL - ])] + │ └── x = y [type=bool, outer=(4,5), constraints=(/4: (/NULL - ]; /5: (/NULL - ])] └── merge-on ├── left ordering: +3,+2 ├── right ordering: +4,+6 └── filters [type=bool, outer=(2-4,6), constraints=(/2: (/NULL - ]; /3: (/NULL - ]; /4: (/NULL - ]; /6: (/NULL - ]), fd=(3)==(4), (4)==(3), (2)==(6), (6)==(2)] - ├── stu.u = xyz.x [type=bool, outer=(3,4), constraints=(/3: (/NULL - ]; /4: (/NULL - ])] - └── stu.t = xyz.z [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + ├── u = x [type=bool, outer=(3,4), constraints=(/3: (/NULL - ]; /4: (/NULL - ])] + └── t = z [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] # Verify multiple merge-joins can be chained. opt @@ -748,8 +748,8 @@ right-join (merge) │ ├── left ordering: +1,+2 │ ├── right ordering: +5,+6 │ └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - │ ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - │ └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + │ ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + │ └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] ├── scan stu │ ├── columns: s:9(int!null) t:10(int!null) u:11(int!null) │ ├── key: (9-11) @@ -758,7 +758,7 @@ right-join (merge) ├── left ordering: +1 ├── right ordering: +9 └── filters [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ]), fd=(1)==(9), (9)==(1)] - └── abc.a = stu.s [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ])] + └── a = s [type=bool, outer=(1,9), constraints=(/1: (/NULL - ]; /9: (/NULL - ])] opt SELECT * FROM abc JOIN xyz ON a=x AND b=y RIGHT OUTER JOIN stu ON a=u AND y=t @@ -784,14 +784,14 @@ left-join (merge) │ ├── left ordering: +1,+2 │ ├── right ordering: +5,+6 │ └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /2: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5), (5)==(1), (2)==(6), (6)==(2)] - │ ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - │ └── abc.b = xyz.y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] + │ ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + │ └── b = y [type=bool, outer=(2,6), constraints=(/2: (/NULL - ]; /6: (/NULL - ])] └── merge-on ├── left ordering: +11,+10 ├── right ordering: +1,+6 └── filters [type=bool, outer=(1,6,10,11), constraints=(/1: (/NULL - ]; /6: (/NULL - ]; /10: (/NULL - ]; /11: (/NULL - ]), fd=(1)==(11), (11)==(1), (6)==(10), (10)==(6)] - ├── abc.a = stu.u [type=bool, outer=(1,11), constraints=(/1: (/NULL - ]; /11: (/NULL - ])] - └── xyz.y = stu.t [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ])] + ├── a = u [type=bool, outer=(1,11), constraints=(/1: (/NULL - ]; /11: (/NULL - ])] + └── y = t [type=bool, outer=(6,10), constraints=(/6: (/NULL - ]; /10: (/NULL - ])] # -------------------------------------------------- # GenerateLookupJoin @@ -814,8 +814,8 @@ Source expression: ├── scan xyz │ └── columns: x:5(int) y:6(int) z:7(int) └── filters [type=bool, outer=(1,5,6), constraints=(/1: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5,6), (5)==(1,6), (6)==(1,5)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.a = xyz.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── a = y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] New expression 1 of 1: inner-join (lookup xyz@xy) @@ -825,8 +825,8 @@ New expression 1 of 1: ├── scan abc │ └── columns: a:1(int) b:2(int) c:3(int) └── filters [type=bool, outer=(1,5,6), constraints=(/1: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5,6), (5)==(1,6), (6)==(1,5)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.a = xyz.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── a = y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] ================================================================================ GenerateLookupJoin @@ -840,8 +840,8 @@ Source expression: ├── scan abc │ └── columns: a:1(int) b:2(int) c:3(int) └── filters [type=bool, outer=(1,5,6), constraints=(/1: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5,6), (5)==(1,6), (6)==(1,5)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.a = xyz.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── a = y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] New expression 1 of 1: inner-join (lookup abc@ab) @@ -851,8 +851,8 @@ New expression 1 of 1: ├── scan xyz │ └── columns: x:5(int) y:6(int) z:7(int) └── filters [type=bool, outer=(1,5,6), constraints=(/1: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5,6), (5)==(1,6), (6)==(1,5)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.a = xyz.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── a = y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] ---- ---- @@ -873,7 +873,7 @@ Source expression: ├── scan abc │ └── columns: a:1(int) b:2(int) c:3(int) └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - └── abc.a = xyz.z [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + └── a = z [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] New expression 1 of 1: inner-join (lookup abc@ab) @@ -883,7 +883,7 @@ New expression 1 of 1: ├── scan xyz │ └── columns: x:5(int) y:6(int) z:7(int) └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - └── abc.a = xyz.z [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + └── a = z [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] ---- ---- @@ -902,7 +902,7 @@ Source expression: ├── scan abc │ └── columns: a:1(int) b:2(int) c:3(int) └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - └── abc.a = xyz.z [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + └── a = z [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] New expression 1 of 1: left-join (lookup abc@ab) @@ -911,7 +911,7 @@ New expression 1 of 1: ├── scan xyz │ └── columns: x:5(int) y:6(int) z:7(int) └── filters [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ]), fd=(1)==(7), (7)==(1)] - └── abc.a = xyz.z [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] + └── a = z [type=bool, outer=(1,7), constraints=(/1: (/NULL - ]; /7: (/NULL - ])] ---- ---- @@ -938,7 +938,7 @@ Source expression: ├── scan xyz │ └── columns: x:5(int) y:6(int) z:7(int) └── filters [type=bool, outer=(3,5), constraints=(/3: (/NULL - ]; /5: (/NULL - ]), fd=(3)==(5), (5)==(3)] - └── abc.c = xyz.x [type=bool, outer=(3,5), constraints=(/3: (/NULL - ]; /5: (/NULL - ])] + └── c = x [type=bool, outer=(3,5), constraints=(/3: (/NULL - ]; /5: (/NULL - ])] New expression 1 of 1: inner-join (lookup xyz@xy) @@ -948,7 +948,7 @@ New expression 1 of 1: ├── scan abc │ └── columns: a:1(int) b:2(int) c:3(int) └── filters [type=bool, outer=(3,5), constraints=(/3: (/NULL - ]; /5: (/NULL - ]), fd=(3)==(5), (5)==(3)] - └── abc.c = xyz.x [type=bool, outer=(3,5), constraints=(/3: (/NULL - ]; /5: (/NULL - ])] + └── c = x [type=bool, outer=(3,5), constraints=(/3: (/NULL - ]; /5: (/NULL - ])] ---- ---- @@ -967,7 +967,7 @@ Source expression: ├── scan xyz │ └── columns: x:5(int) y:6(int) z:7(int) └── filters [type=bool, outer=(3,5), constraints=(/3: (/NULL - ]; /5: (/NULL - ]), fd=(3)==(5), (5)==(3)] - └── abc.c = xyz.x [type=bool, outer=(3,5), constraints=(/3: (/NULL - ]; /5: (/NULL - ])] + └── c = x [type=bool, outer=(3,5), constraints=(/3: (/NULL - ]; /5: (/NULL - ])] New expression 1 of 1: left-join (lookup xyz@xy) @@ -976,7 +976,7 @@ New expression 1 of 1: ├── scan abc │ └── columns: a:1(int) b:2(int) c:3(int) └── filters [type=bool, outer=(3,5), constraints=(/3: (/NULL - ]; /5: (/NULL - ]), fd=(3)==(5), (5)==(3)] - └── abc.c = xyz.x [type=bool, outer=(3,5), constraints=(/3: (/NULL - ]; /5: (/NULL - ])] + └── c = x [type=bool, outer=(3,5), constraints=(/3: (/NULL - ]; /5: (/NULL - ])] ---- ---- @@ -1008,8 +1008,8 @@ Source expression: │ ├── columns: x:5(int!null) y:6(int) z:7(int) │ └── constraint: /5/6/8: [/2 - ] └── filters [type=bool, outer=(1,5,6), constraints=(/1: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5,6), (5)==(1,6), (6)==(1,5)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.a = xyz.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── a = y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] New expression 1 of 1: inner-join (lookup xyz@xy) @@ -1020,9 +1020,9 @@ New expression 1 of 1: │ ├── columns: a:1(int!null) b:2(int) c:3(int) │ └── constraint: /1/2/4: [/2 - ] └── filters [type=bool, outer=(1,5,6), constraints=(/1: (/NULL - ]; /5: [/2 - ]; /6: (/NULL - ]), fd=(1)==(5,6), (5)==(1,6), (6)==(1,5)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - ├── abc.a = xyz.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── xyz.x > 1 [type=bool, outer=(5), constraints=(/5: [/2 - ]; tight)] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + ├── a = y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x > 1 [type=bool, outer=(5), constraints=(/5: [/2 - ]; tight)] ================================================================================ GenerateLookupJoinWithFilter @@ -1038,8 +1038,8 @@ Source expression: │ ├── columns: a:1(int!null) b:2(int) c:3(int) │ └── constraint: /1/2/4: [/2 - ] └── filters [type=bool, outer=(1,5,6), constraints=(/1: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5,6), (5)==(1,6), (6)==(1,5)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.a = xyz.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── a = y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] New expression 1 of 1: inner-join (lookup abc@ab) @@ -1050,9 +1050,9 @@ New expression 1 of 1: │ ├── columns: x:5(int!null) y:6(int) z:7(int) │ └── constraint: /5/6/8: [/2 - ] └── filters [type=bool, outer=(1,5,6), constraints=(/1: [/2 - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5,6), (5)==(1,6), (6)==(1,5)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - ├── abc.a = xyz.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── abc.a > 1 [type=bool, outer=(1), constraints=(/1: [/2 - ]; tight)] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + ├── a = y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── a > 1 [type=bool, outer=(1), constraints=(/1: [/2 - ]; tight)] ---- ---- @@ -1075,8 +1075,8 @@ Source expression: │ ├── columns: x:5(int!null) y:6(int) z:7(int) │ └── constraint: /5/6/8: [/2 - ] └── filters [type=bool, outer=(1,5,6), constraints=(/1: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5,6), (5)==(1,6), (6)==(1,5)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.a = xyz.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── a = y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] New expression 1 of 1: inner-join (lookup xyz@xy) @@ -1087,9 +1087,9 @@ New expression 1 of 1: │ ├── columns: a:1(int!null) b:2(int) c:3(int) │ └── constraint: /1/2/4: [/2 - ] └── filters [type=bool, outer=(1,5,6), constraints=(/1: (/NULL - ]; /5: [/2 - ]; /6: (/NULL - ]), fd=(1)==(5,6), (5)==(1,6), (6)==(1,5)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - ├── abc.a = xyz.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── xyz.x > 1 [type=bool, outer=(5), constraints=(/5: [/2 - ]; tight)] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + ├── a = y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x > 1 [type=bool, outer=(5), constraints=(/5: [/2 - ]; tight)] ================================================================================ GenerateLookupJoinWithFilter @@ -1105,8 +1105,8 @@ Source expression: │ ├── columns: a:1(int!null) b:2(int) c:3(int) │ └── constraint: /1/2/4: [/2 - ] └── filters [type=bool, outer=(1,5,6), constraints=(/1: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5,6), (5)==(1,6), (6)==(1,5)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.a = xyz.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── a = y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] New expression 1 of 1: inner-join (lookup abc@ab) @@ -1117,9 +1117,9 @@ New expression 1 of 1: │ ├── columns: x:5(int!null) y:6(int) z:7(int) │ └── constraint: /5/6/8: [/2 - ] └── filters [type=bool, outer=(1,5,6), constraints=(/1: [/2 - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5,6), (5)==(1,6), (6)==(1,5)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - ├── abc.a = xyz.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── abc.a > 1 [type=bool, outer=(1), constraints=(/1: [/2 - ]; tight)] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + ├── a = y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── a > 1 [type=bool, outer=(1), constraints=(/1: [/2 - ]; tight)] ---- ---- @@ -1140,8 +1140,8 @@ Source expression: │ ├── columns: x:5(int!null) y:6(int) z:7(int) │ └── constraint: /5/6/8: [/2 - ] └── filters [type=bool, outer=(1,5,6), constraints=(/1: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5,6), (5)==(1,6), (6)==(1,5)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.a = xyz.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── a = y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] New expression 1 of 1: left-join (lookup xyz@xy) @@ -1150,9 +1150,9 @@ New expression 1 of 1: ├── scan abc │ └── columns: a:1(int) b:2(int) c:3(int) └── filters [type=bool, outer=(1,5,6), constraints=(/1: (/NULL - ]; /5: [/2 - ]; /6: (/NULL - ]), fd=(1)==(5,6), (5)==(1,6), (6)==(1,5)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - ├── abc.a = xyz.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── xyz.x > 1 [type=bool, outer=(5), constraints=(/5: [/2 - ]; tight)] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + ├── a = y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── x > 1 [type=bool, outer=(5), constraints=(/5: [/2 - ]; tight)] ---- ---- @@ -1172,8 +1172,8 @@ Source expression: │ ├── columns: a:1(int!null) b:2(int) c:3(int) │ └── constraint: /1/2/4: [/2 - ] └── filters [type=bool, outer=(1,5,6), constraints=(/1: (/NULL - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5,6), (5)==(1,6), (6)==(1,5)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - └── abc.a = xyz.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── a = y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] New expression 1 of 1: left-join (lookup abc@ab) @@ -1182,9 +1182,9 @@ New expression 1 of 1: ├── scan xyz │ └── columns: x:5(int) y:6(int) z:7(int) └── filters [type=bool, outer=(1,5,6), constraints=(/1: [/2 - ]; /5: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(5,6), (5)==(1,6), (6)==(1,5)] - ├── abc.a = xyz.x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] - ├── abc.a = xyz.y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - └── abc.a > 1 [type=bool, outer=(1), constraints=(/1: [/2 - ]; tight)] + ├── a = x [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + ├── a = y [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + └── a > 1 [type=bool, outer=(1), constraints=(/1: [/2 - ]; tight)] ---- ---- @@ -1229,7 +1229,7 @@ Source expression: │ ├── key: (5) │ └── fd: (5)-->(6,7) └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - └── abc.a = uvw.u [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + └── a = u [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] New expression 1 of 1: inner-join (lookup uvw) @@ -1246,7 +1246,7 @@ New expression 1 of 1: │ │ ├── key: (5) │ │ └── fd: (5)-->(6) │ └── filters [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ]), fd=(1)==(5), (5)==(1)] - │ └── abc.a = uvw.u [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] + │ └── a = u [type=bool, outer=(1,5), constraints=(/1: (/NULL - ]; /5: (/NULL - ])] └── true [type=bool] ---- ---- @@ -1287,7 +1287,7 @@ inner-join (lookup uvw) │ ├── scan abc │ │ └── columns: a:1(int) b:2(int) c:3(int) │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ └── abc.a = uvw.v [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ └── a = v [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] └── true [type=bool] opt @@ -1304,8 +1304,8 @@ inner-join (lookup uvw) │ ├── scan abc │ │ └── columns: a:1(int) b:2(int) c:3(int) │ └── filters [type=bool, outer=(1,2,5,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ ├── abc.a = uvw.v [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] - │ └── (abc.b + uvw.u) > 1 [type=bool, outer=(2,5)] + │ ├── a = v [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ └── (b + u) > 1 [type=bool, outer=(2,5)] └── true [type=bool] opt @@ -1322,6 +1322,6 @@ inner-join (lookup uvw) │ ├── scan abc │ │ └── columns: a:1(int) b:2(int) c:3(int) │ └── filters [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ]), fd=(1)==(6), (6)==(1)] - │ └── abc.a = uvw.v [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] + │ └── a = v [type=bool, outer=(1,6), constraints=(/1: (/NULL - ]; /6: (/NULL - ])] └── filters [type=bool, outer=(2,7)] - └── (abc.b + uvw.w) > 1 [type=bool, outer=(2,7)] + └── (b + w) > 1 [type=bool, outer=(2,7)] diff --git a/pkg/sql/opt/xform/testdata/rules/limit b/pkg/sql/opt/xform/testdata/rules/limit index 4103c2e59ae2..834ae08f111e 100644 --- a/pkg/sql/opt/xform/testdata/rules/limit +++ b/pkg/sql/opt/xform/testdata/rules/limit @@ -133,7 +133,7 @@ memo (optimized) │ └── cost: 1050.00 ├── G5: (filters G6) ├── G6: (eq G7 G8) - ├── G7: (variable a.s) + ├── G7: (variable s) └── G8: (const 'foo') # -------------------------------------------------- diff --git a/pkg/sql/opt/xform/testdata/rules/scan b/pkg/sql/opt/xform/testdata/rules/scan index 88601c146dce..ea5087f2b583 100644 --- a/pkg/sql/opt/xform/testdata/rules/scan +++ b/pkg/sql/opt/xform/testdata/rules/scan @@ -352,7 +352,7 @@ memo (optimized) │ ├── best: (scan abc@ba,cols=(1-3)) │ └── cost: 1060.00 ├── G6: (function G7 lower) - └── G7: (variable abc.d) + └── G7: (variable d) memo SELECT j FROM a WHERE s = 'foo' @@ -385,7 +385,7 @@ memo (optimized) │ └── cost: 1060.00 ├── G8: (filters G9) ├── G9: (eq G10 G11) - ├── G10: (variable a.s) + ├── G10: (variable s) └── G11: (const 'foo') # Scan of primary index is lowest cost. @@ -489,5 +489,5 @@ memo (optimized) │ └── cost: 1070.00 ├── G5: (filters G6) ├── G6: (ge G7 G8) - ├── G7: (variable a.s) + ├── G7: (variable s) └── G8: (const 'foo') diff --git a/pkg/sql/opt/xform/testdata/rules/select b/pkg/sql/opt/xform/testdata/rules/select index c3644eb31e20..246ccf9c5bea 100644 --- a/pkg/sql/opt/xform/testdata/rules/select +++ b/pkg/sql/opt/xform/testdata/rules/select @@ -80,7 +80,7 @@ memo (optimized) │ └── cost: 1040.00 ├── G3: (filters G4) ├── G4: (eq G5 G6) - ├── G5: (variable a.k) + ├── G5: (variable k) └── G6: (const 1) opt @@ -114,7 +114,7 @@ memo (optimized) │ └── cost: 1050.00 ├── G5: (filters G6) ├── G6: (gt G7 G8) - ├── G7: (variable a.v) + ├── G7: (variable v) └── G8: (const 1) opt @@ -157,9 +157,9 @@ memo (optimized) ├── G7: (filters G9) ├── G8: (eq G10 G11) ├── G9: (eq G12 G13) - ├── G10: (variable a.k) + ├── G10: (variable k) ├── G11: (const 5) - ├── G12: (variable a.u) + ├── G12: (variable u) └── G13: (const 1) # Constraint + remaining filter. @@ -179,7 +179,7 @@ project │ ├── key: (1) │ └── fd: ()-->(2) └── filters [type=bool, outer=(1,2)] - └── (a.k + a.u) = 1 [type=bool, outer=(1,2)] + └── (k + u) = 1 [type=bool, outer=(1,2)] memo SELECT k FROM a WHERE u = 1 AND k+u = 1 @@ -208,8 +208,8 @@ memo (optimized) ├── G9: (eq G10 G11) ├── G10: (plus G12 G13) ├── G11: (const 1) - ├── G12: (variable a.k) - └── G13: (variable a.u) + ├── G12: (variable k) + └── G13: (variable u) opt SELECT k FROM a WHERE u = 1 AND v = 5 @@ -231,7 +231,7 @@ project │ ├── key: () │ └── fd: ()-->(1-3) └── filters [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight), fd=()-->(2)] - └── a.u = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] + └── u = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] memo SELECT k FROM a WHERE u = 1 AND v = 5 @@ -263,9 +263,9 @@ memo (optimized) ├── G9: (filters G11) ├── G10: (eq G12 G13) ├── G11: (eq G14 G15) - ├── G12: (variable a.v) + ├── G12: (variable v) ├── G13: (const 5) - ├── G14: (variable a.u) + ├── G14: (variable u) └── G15: (const 1) # Only not-null constraint is pushed down. @@ -285,7 +285,7 @@ project │ ├── key: (1) │ └── fd: (1)-->(2,3), (3)~~>(1,2) └── filters [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ]), fd=(2)==(3), (3)==(2)] - └── a.u = a.v [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] + └── u = v [type=bool, outer=(2,3), constraints=(/2: (/NULL - ]; /3: (/NULL - ])] # Don't push constraint into already limited scan. opt @@ -307,7 +307,7 @@ project │ ├── key: () │ └── fd: ()-->(1,2) └── filters [type=bool, outer=(1), constraints=(/1: [/1 - /1]; tight), fd=()-->(1)] - └── a.k = 1 [type=bool, outer=(1), constraints=(/1: [/1 - /1]; tight)] + └── k = 1 [type=bool, outer=(1), constraints=(/1: [/1 - /1]; tight)] # -------------------------------------------------- # PushFilterIntoLookupJoinNoRemainder @@ -358,7 +358,7 @@ memo (optimized) ├── G8: (ge G11 G10) ├── G9: (le G11 G12) ├── G10: (const 1) - ├── G11: (variable b.v) + ├── G11: (variable v) └── G12: (const 10) # Don't choose lookup join if it's not beneficial. @@ -374,7 +374,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(2-4), (3)~~>(1,2,4) └── filters [type=bool, outer=(3), constraints=(/3: [/2 - ]; tight)] - └── b.v > 1 [type=bool, outer=(3), constraints=(/3: [/2 - ]; tight)] + └── v > 1 [type=bool, outer=(3), constraints=(/3: [/2 - ]; tight)] opt SELECT * FROM b WHERE v >= 1 AND v <= 10 AND k > 5 @@ -393,7 +393,7 @@ index-join b │ ├── key: (1) │ └── fd: (1)-->(3), (3)-->(1) └── filters [type=bool, outer=(1), constraints=(/1: [/6 - ]; tight)] - └── b.k > 5 [type=bool, outer=(1), constraints=(/1: [/6 - ]; tight)] + └── k > 5 [type=bool, outer=(1), constraints=(/1: [/6 - ]; tight)] memo SELECT * FROM b WHERE v >= 1 AND v <= 10 AND k > 5 @@ -453,10 +453,10 @@ memo (optimized) │ └── cost: 1040.00 ├── G17: (filters G21) ├── G18: (const 1) - ├── G19: (variable b.v) + ├── G19: (variable v) ├── G20: (const 10) ├── G21: (gt G22 G23) - ├── G22: (variable b.k) + ├── G22: (variable k) └── G23: (const 5) # Ensure the rule doesn't match at all when the first column of the index is @@ -481,7 +481,7 @@ Source expression: │ ├── key: (1) │ └── fd: (1)-->(2) └── filters [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight), fd=()-->(2)] - └── a.u = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] + └── u = 1 [type=bool, outer=(2), constraints=(/2: [/1 - /1]; tight)] New expression 1 of 1: project @@ -517,7 +517,7 @@ select │ ├── key: (1) │ └── fd: (1)-->(3), (3)-->(1) └── filters [type=bool, outer=(1,2)] - └── (b.k + b.u) = 1 [type=bool, outer=(1,2)] + └── (k + u) = 1 [type=bool, outer=(1,2)] memo SELECT * FROM b WHERE v >= 1 AND v <= 10 AND k+u = 1 @@ -571,10 +571,10 @@ memo (optimized) ├── G16: (le G19 G20) ├── G17: (plus G21 G22) ├── G18: (const 1) - ├── G19: (variable b.v) + ├── G19: (variable v) ├── G20: (const 10) - ├── G21: (variable b.k) - └── G22: (variable b.u) + ├── G21: (variable k) + └── G22: (variable u) opt SELECT * FROM b WHERE v >= 1 AND v <= 10 AND k+u = 1 AND k > 5 @@ -597,9 +597,9 @@ select │ │ ├── key: (1) │ │ └── fd: (1)-->(3), (3)-->(1) │ └── filters [type=bool, outer=(1), constraints=(/1: [/6 - ]; tight)] - │ └── b.k > 5 [type=bool, outer=(1), constraints=(/1: [/6 - ]; tight)] + │ └── k > 5 [type=bool, outer=(1), constraints=(/1: [/6 - ]; tight)] └── filters [type=bool, outer=(1,2)] - └── (b.k + b.u) = 1 [type=bool, outer=(1,2)] + └── (k + u) = 1 [type=bool, outer=(1,2)] memo SELECT * FROM b WHERE v >= 1 AND v <= 10 AND k+u = 1 AND k > 5 @@ -674,11 +674,11 @@ memo (optimized) ├── G25: (gt G31 G30) ├── G26: (plus G31 G32) ├── G27: (const 1) - ├── G28: (variable b.v) + ├── G28: (variable v) ├── G29: (const 10) ├── G30: (const 5) - ├── G31: (variable b.k) - └── G32: (variable b.u) + ├── G31: (variable k) + └── G32: (variable u) # -------------------------------------------------- # ConstrainLookupJoinIndexScan @@ -701,8 +701,8 @@ select │ ├── key: (1) │ └── fd: (1)-->(2) └── filters [type=bool, outer=(1-3), constraints=(/2/1/3: [/1/2/4 - /8/9/9]; tight)] - ├── (b.u, b.k, b.v) > (1, 2, 3) [type=bool, outer=(1-3), constraints=(/2/1/3: [/1/2/4 - ]; tight)] - └── (b.u, b.k, b.v) < (8, 9, 10) [type=bool, outer=(1-3), constraints=(/2/1/3: (/NULL - /8/9/9]; tight)] + ├── (u, k, v) > (1, 2, 3) [type=bool, outer=(1-3), constraints=(/2/1/3: [/1/2/4 - ]; tight)] + └── (u, k, v) < (8, 9, 10) [type=bool, outer=(1-3), constraints=(/2/1/3: (/NULL - /8/9/9]; tight)] memo SELECT * FROM b WHERE (u, k, v) > (1, 2, 3) AND (u, k, v) < (8, 9, 10) @@ -741,9 +741,9 @@ memo (optimized) ├── G13: (const 1) ├── G14: (const 2) ├── G15: (const 3) - ├── G16: (variable b.u) - ├── G17: (variable b.k) - ├── G18: (variable b.v) + ├── G16: (variable u) + ├── G17: (variable k) + ├── G18: (variable v) ├── G19: (const 8) ├── G20: (const 9) └── G21: (const 10) @@ -788,7 +788,7 @@ project │ ├── constraint: /4/1: [/'{"a": "b"}' - /'{"a": "b"}'] │ └── key: (1) └── filters [type=bool, outer=(4)] - └── b.j @> '{"a": "b", "c": "d"}' [type=bool, outer=(4)] + └── j @> '{"a": "b", "c": "d"}' [type=bool, outer=(4)] # Query requiring an index join with no remaining filter. opt @@ -849,7 +849,7 @@ select │ ├── constraint: /4/1: [/'{"a": "b"}' - /'{"a": "b"}'] │ └── key: (1) └── filters [type=bool, outer=(4)] - └── b.j @> '{"a": "b", "c": "d"}' [type=bool, outer=(4)] + └── j @> '{"a": "b", "c": "d"}' [type=bool, outer=(4)] opt SELECT * FROM b WHERE j @> '{"a": {"b": "c", "d": "e"}, "f": "g"}' @@ -867,4 +867,4 @@ select │ ├── constraint: /4/1: [/'{"a": {"b": "c"}}' - /'{"a": {"b": "c"}}'] │ └── key: (1) └── filters [type=bool, outer=(4)] - └── b.j @> '{"a": {"b": "c", "d": "e"}, "f": "g"}' [type=bool, outer=(4)] + └── j @> '{"a": {"b": "c", "d": "e"}, "f": "g"}' [type=bool, outer=(4)]