github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/opt/optgen/cmd/optfmt/testdata/test (about) 1 pretty 2 # 3 # Generate code for interesting rule. 4 # 5 [Relational] 6 define Select { 7 # Input comment. 8 Input RelExpr 9 Filters FiltersExpr 10 } 11 12 [Relational, Join, JoinNonApply] 13 define InnerJoin { 14 Left RelExpr 15 Right RelExpr 16 On FiltersExpr 17 } 18 19 [Scalar, Bool, List] 20 define Filters { 21 } 22 23 [Scalar, Bool, ListItem, ScalarProps] 24 define FiltersItem { 25 Condition ScalarExpr 26 } 27 28 # --- 29 # Unattached comment. 30 # --- 31 32 [PushSelectIntoJoinLeft, Normalize] 33 (Select | Other 34 $input:(InnerJoin | InnerJoinApply | SomethingElse | Many | Things | LooooooooongLine | Much | More | Than | EightyChars 35 $left:3 36 $right:* 37 $on:* 38 ) 39 $filters:[ 40 ... 41 $item:* & (IsBoundBy $item $leftCols:(OutputCols $left)) 42 ... 43 ] 44 ) 45 => 46 (Select 47 ((OpName $input) 48 (Select 49 $left 50 (ExtractBoundConditions $filters $leftCols) 51 ) 52 $right 53 $on 54 ) 55 (ExtractUnboundConditions $filters $leftCols) 56 ) 57 58 [TestSingleLine] 59 (Select $input:(InnerJoin | InnerJoinApply $left:* $right:* $on:*)) 60 => 61 (False) 62 63 [TestNestedAnd] 64 (Select 65 $right:* & 66 (HasOuterCols $right) & 67 ^(GroupBy | DistinctOn $input:* $aggregations:* $groupingPrivate:*) & 68 (IsUnorderedGrouping $groupingPrivate) 69 70 $left: * & (Blah) 71 ) 72 => 73 (False) 74 ---- 75 ---- 76 # 77 # Generate code for interesting rule. 78 # 79 [Relational] 80 define Select { 81 # Input comment. 82 Input RelExpr 83 Filters FiltersExpr 84 } 85 86 [Relational, Join, JoinNonApply] 87 define InnerJoin { 88 Left RelExpr 89 Right RelExpr 90 On FiltersExpr 91 } 92 93 [Scalar, Bool, List] 94 define Filters { 95 } 96 97 [Scalar, Bool, ListItem, ScalarProps] 98 define FiltersItem { 99 Condition ScalarExpr 100 } 101 102 # --- 103 # Unattached comment. 104 # --- 105 106 [PushSelectIntoJoinLeft, Normalize] 107 (Select | Other 108 $input:(InnerJoin | InnerJoinApply | SomethingElse | Many 109 | Things | LooooooooongLine | Much | More | Than 110 | EightyChars 111 $left:3 112 $right:* 113 $on:* 114 ) 115 $filters:[ 116 ... 117 $item:* & (IsBoundBy $item $leftCols:(OutputCols $left)) 118 ... 119 ] 120 ) 121 => 122 (Select 123 ((OpName $input) 124 (Select 125 $left 126 (ExtractBoundConditions $filters $leftCols) 127 ) 128 $right 129 $on 130 ) 131 (ExtractUnboundConditions $filters $leftCols) 132 ) 133 134 [TestSingleLine] 135 (Select 136 $input:(InnerJoin | InnerJoinApply $left:* $right:* $on:*) 137 ) 138 => 139 (False) 140 141 [TestNestedAnd] 142 (Select 143 $right:* & 144 (HasOuterCols $right) & 145 ^(GroupBy | DistinctOn 146 $input:* 147 $aggregations:* 148 $groupingPrivate:* 149 ) & 150 (IsUnorderedGrouping $groupingPrivate) 151 $left:* & (Blah) 152 ) 153 => 154 (False) 155 ---- 156 ---- 157 158 pretty 159 [Short] 160 (R) => (O) 161 ---- 162 [Short] 163 (R) 164 => 165 (O)