github.com/dolthub/go-mysql-server@v0.18.0/enginetest/queries/query_plans.go (about) 1 // Code generated by plangen. 2 3 // Copyright 2024 Dolthub, Inc. 4 // 5 // Licensed under the Apache License, Version 2.0 (the "License"); 6 // you may not use this file except in compliance with the License. 7 // You may obtain a copy of the License at 8 // 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 11 // Unless required by applicable law or agreed to in writing, software 12 // distributed under the License is distributed on an "AS IS" BASIS, 13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 // See the License for the specific language governing permissions and 15 // limitations under the License. 16 17 package queries 18 19 var PlanTests = []QueryPlanTest{ 20 { 21 Query: `select x from xy where y in (select xy.x from xy join (select t2.y from xy t2 where exists (select t3.y from xy t3 where t3.y = xy.x)) t1);`, 22 ExpectedPlan: "Project\n" + 23 " ├─ columns: [xy.x:0!null]\n" + 24 " └─ Filter\n" + 25 " ├─ InSubquery\n" + 26 " │ ├─ left: xy.y:1\n" + 27 " │ └─ right: Subquery\n" + 28 " │ ├─ cacheable: false\n" + 29 " │ ├─ alias-string: select xy.x from xy join (select t2.y from xy as t2 where exists (select t3.y from xy as t3 where t3.y = xy.x)) as t1\n" + 30 " │ └─ Project\n" + 31 " │ ├─ columns: [xy.x:2!null]\n" + 32 " │ └─ CrossHashJoin\n" + 33 " │ ├─ Table\n" + 34 " │ │ ├─ name: xy\n" + 35 " │ │ ├─ columns: [x]\n" + 36 " │ │ ├─ colSet: (3,4)\n" + 37 " │ │ └─ tableId: 2\n" + 38 " │ └─ HashLookup\n" + 39 " │ ├─ left-key: TUPLE()\n" + 40 " │ ├─ right-key: TUPLE()\n" + 41 " │ └─ SubqueryAlias\n" + 42 " │ ├─ name: t1\n" + 43 " │ ├─ outerVisibility: true\n" + 44 " │ ├─ isLateral: false\n" + 45 " │ ├─ cacheable: false\n" + 46 " │ ├─ colSet: (9)\n" + 47 " │ ├─ tableId: 5\n" + 48 " │ └─ Project\n" + 49 " │ ├─ columns: [t2.y:3]\n" + 50 " │ └─ Filter\n" + 51 " │ ├─ EXISTS Subquery\n" + 52 " │ │ ├─ cacheable: false\n" + 53 " │ │ ├─ alias-string: select t3.y from xy as t3 where t3.y = xy.x\n" + 54 " │ │ └─ Project\n" + 55 " │ │ ├─ columns: [t3.y:5]\n" + 56 " │ │ └─ Filter\n" + 57 " │ │ ├─ Eq\n" + 58 " │ │ │ ├─ t3.y:5\n" + 59 " │ │ │ └─ xy.x:0!null\n" + 60 " │ │ └─ TableAlias(t3)\n" + 61 " │ │ └─ IndexedTableAccess(xy)\n" + 62 " │ │ ├─ index: [xy.y]\n" + 63 " │ │ ├─ keys: [xy.x:0!null]\n" + 64 " │ │ ├─ colSet: (7,8)\n" + 65 " │ │ ├─ tableId: 4\n" + 66 " │ │ └─ Table\n" + 67 " │ │ ├─ name: xy\n" + 68 " │ │ └─ columns: [x y]\n" + 69 " │ └─ TableAlias(t2)\n" + 70 " │ └─ Table\n" + 71 " │ ├─ name: xy\n" + 72 " │ ├─ columns: [x y]\n" + 73 " │ ├─ colSet: (5,6)\n" + 74 " │ └─ tableId: 3\n" + 75 " └─ ProcessTable\n" + 76 " └─ Table\n" + 77 " ├─ name: xy\n" + 78 " └─ columns: [x y]\n" + 79 "", 80 ExpectedEstimates: "Project\n" + 81 " ├─ columns: [xy.x]\n" + 82 " └─ Filter\n" + 83 " ├─ InSubquery\n" + 84 " │ ├─ left: xy.y\n" + 85 " │ └─ right: Subquery\n" + 86 " │ ├─ cacheable: false\n" + 87 " │ └─ Project\n" + 88 " │ ├─ columns: [xy.x]\n" + 89 " │ └─ CrossHashJoin\n" + 90 " │ ├─ Table\n" + 91 " │ │ ├─ name: xy\n" + 92 " │ │ └─ columns: [x]\n" + 93 " │ └─ HashLookup\n" + 94 " │ ├─ left-key: ()\n" + 95 " │ ├─ right-key: ()\n" + 96 " │ └─ SubqueryAlias\n" + 97 " │ ├─ name: t1\n" + 98 " │ ├─ outerVisibility: true\n" + 99 " │ ├─ isLateral: false\n" + 100 " │ ├─ cacheable: false\n" + 101 " │ └─ Project\n" + 102 " │ ├─ columns: [t2.y]\n" + 103 " │ └─ Filter\n" + 104 " │ ├─ EXISTS Subquery\n" + 105 " │ │ ├─ cacheable: false\n" + 106 " │ │ └─ Project\n" + 107 " │ │ ├─ columns: [t3.y]\n" + 108 " │ │ └─ Filter\n" + 109 " │ │ ├─ (t3.y = xy.x)\n" + 110 " │ │ └─ TableAlias(t3)\n" + 111 " │ │ └─ IndexedTableAccess(xy)\n" + 112 " │ │ ├─ index: [xy.y]\n" + 113 " │ │ ├─ columns: [x y]\n" + 114 " │ │ └─ keys: xy.x\n" + 115 " │ └─ TableAlias(t2)\n" + 116 " │ └─ Table\n" + 117 " │ └─ name: xy\n" + 118 " └─ Table\n" + 119 " └─ name: xy\n" + 120 "", 121 ExpectedAnalysis: "Project\n" + 122 " ├─ columns: [xy.x]\n" + 123 " └─ Filter\n" + 124 " ├─ InSubquery\n" + 125 " │ ├─ left: xy.y\n" + 126 " │ └─ right: Subquery\n" + 127 " │ ├─ cacheable: false\n" + 128 " │ └─ Project\n" + 129 " │ ├─ columns: [xy.x]\n" + 130 " │ └─ CrossHashJoin\n" + 131 " │ ├─ Table\n" + 132 " │ │ ├─ name: xy\n" + 133 " │ │ └─ columns: [x]\n" + 134 " │ └─ HashLookup\n" + 135 " │ ├─ left-key: ()\n" + 136 " │ ├─ right-key: ()\n" + 137 " │ └─ SubqueryAlias\n" + 138 " │ ├─ name: t1\n" + 139 " │ ├─ outerVisibility: true\n" + 140 " │ ├─ isLateral: false\n" + 141 " │ ├─ cacheable: false\n" + 142 " │ └─ Project\n" + 143 " │ ├─ columns: [t2.y]\n" + 144 " │ └─ Filter\n" + 145 " │ ├─ EXISTS Subquery\n" + 146 " │ │ ├─ cacheable: false\n" + 147 " │ │ └─ Project\n" + 148 " │ │ ├─ columns: [t3.y]\n" + 149 " │ │ └─ Filter\n" + 150 " │ │ ├─ (t3.y = xy.x)\n" + 151 " │ │ └─ TableAlias(t3)\n" + 152 " │ │ └─ IndexedTableAccess(xy)\n" + 153 " │ │ ├─ index: [xy.y]\n" + 154 " │ │ ├─ columns: [x y]\n" + 155 " │ │ └─ keys: xy.x\n" + 156 " │ └─ TableAlias(t2)\n" + 157 " │ └─ Table\n" + 158 " │ └─ name: xy\n" + 159 " └─ Table\n" + 160 " └─ name: xy\n" + 161 "", 162 }, 163 { 164 Query: `select x from xy where y in (select x from xy where x in (select y from xy));`, 165 ExpectedPlan: "Project\n" + 166 " ├─ columns: [xy.x:1!null]\n" + 167 " └─ LookupJoin\n" + 168 " ├─ Eq\n" + 169 " │ ├─ xy.y:2\n" + 170 " │ └─ xy_1.x:0!null\n" + 171 " ├─ Distinct\n" + 172 " │ └─ Project\n" + 173 " │ ├─ columns: [xy_1.x:0!null]\n" + 174 " │ └─ Project\n" + 175 " │ ├─ columns: [xy_1.x:0!null, xy_1.y:1]\n" + 176 " │ └─ MergeJoin\n" + 177 " │ ├─ cmp: Eq\n" + 178 " │ │ ├─ xy_1.x:0!null\n" + 179 " │ │ └─ xy_2.y:2\n" + 180 " │ ├─ TableAlias(xy_1)\n" + 181 " │ │ └─ IndexedTableAccess(xy)\n" + 182 " │ │ ├─ index: [xy.x]\n" + 183 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 184 " │ │ ├─ colSet: (3,4)\n" + 185 " │ │ ├─ tableId: 2\n" + 186 " │ │ └─ Table\n" + 187 " │ │ ├─ name: xy\n" + 188 " │ │ └─ columns: [x y]\n" + 189 " │ └─ Project\n" + 190 " │ ├─ columns: [xy_2.y:1]\n" + 191 " │ └─ TableAlias(xy_2)\n" + 192 " │ └─ IndexedTableAccess(xy)\n" + 193 " │ ├─ index: [xy.y]\n" + 194 " │ ├─ static: [{[NULL, ∞)}]\n" + 195 " │ ├─ colSet: (5,6)\n" + 196 " │ ├─ tableId: 3\n" + 197 " │ └─ Table\n" + 198 " │ ├─ name: xy\n" + 199 " │ └─ columns: [x y]\n" + 200 " └─ IndexedTableAccess(xy)\n" + 201 " ├─ index: [xy.y]\n" + 202 " ├─ keys: [xy_1.x:0!null]\n" + 203 " ├─ colSet: (1,2)\n" + 204 " ├─ tableId: 1\n" + 205 " └─ Table\n" + 206 " ├─ name: xy\n" + 207 " └─ columns: [x y]\n" + 208 "", 209 ExpectedEstimates: "Project\n" + 210 " ├─ columns: [xy.x]\n" + 211 " └─ LookupJoin (estimated cost=3300.000 rows=1000)\n" + 212 " ├─ (xy.y = xy_1.x)\n" + 213 " ├─ Distinct\n" + 214 " │ └─ Project\n" + 215 " │ ├─ columns: [xy_1.x]\n" + 216 " │ └─ Project\n" + 217 " │ ├─ columns: [xy_1.x, xy_1.y]\n" + 218 " │ └─ MergeJoin (estimated cost=2030.000 rows=1000)\n" + 219 " │ ├─ cmp: (xy_1.x = xy_2.y)\n" + 220 " │ ├─ TableAlias(xy_1)\n" + 221 " │ │ └─ IndexedTableAccess(xy)\n" + 222 " │ │ ├─ index: [xy.x]\n" + 223 " │ │ └─ filters: [{[NULL, ∞)}]\n" + 224 " │ └─ Project\n" + 225 " │ ├─ columns: [xy_2.y]\n" + 226 " │ └─ TableAlias(xy_2)\n" + 227 " │ └─ IndexedTableAccess(xy)\n" + 228 " │ ├─ index: [xy.y]\n" + 229 " │ └─ filters: [{[NULL, ∞)}]\n" + 230 " └─ IndexedTableAccess(xy)\n" + 231 " ├─ index: [xy.y]\n" + 232 " └─ keys: xy_1.x\n" + 233 "", 234 ExpectedAnalysis: "Project\n" + 235 " ├─ columns: [xy.x]\n" + 236 " └─ LookupJoin (estimated cost=3300.000 rows=1000) (actual rows=4 loops=1)\n" + 237 " ├─ (xy.y = xy_1.x)\n" + 238 " ├─ Distinct\n" + 239 " │ └─ Project\n" + 240 " │ ├─ columns: [xy_1.x]\n" + 241 " │ └─ Project\n" + 242 " │ ├─ columns: [xy_1.x, xy_1.y]\n" + 243 " │ └─ MergeJoin (estimated cost=2030.000 rows=1000) (actual rows=4 loops=1)\n" + 244 " │ ├─ cmp: (xy_1.x = xy_2.y)\n" + 245 " │ ├─ TableAlias(xy_1)\n" + 246 " │ │ └─ IndexedTableAccess(xy)\n" + 247 " │ │ ├─ index: [xy.x]\n" + 248 " │ │ └─ filters: [{[NULL, ∞)}]\n" + 249 " │ └─ Project\n" + 250 " │ ├─ columns: [xy_2.y]\n" + 251 " │ └─ TableAlias(xy_2)\n" + 252 " │ └─ IndexedTableAccess(xy)\n" + 253 " │ ├─ index: [xy.y]\n" + 254 " │ └─ filters: [{[NULL, ∞)}]\n" + 255 " └─ IndexedTableAccess(xy)\n" + 256 " ├─ index: [xy.y]\n" + 257 " └─ keys: xy_1.x\n" + 258 "", 259 }, 260 { 261 Query: `select * from xy join uv on (x = u and u > 0) where u < 2`, 262 ExpectedPlan: "Project\n" + 263 " ├─ columns: [xy.x:2!null, xy.y:3, uv.u:0!null, uv.v:1]\n" + 264 " └─ LookupJoin\n" + 265 " ├─ IndexedTableAccess(uv)\n" + 266 " │ ├─ index: [uv.u]\n" + 267 " │ ├─ static: [{(0, 2)}]\n" + 268 " │ ├─ colSet: (3,4)\n" + 269 " │ ├─ tableId: 2\n" + 270 " │ └─ Table\n" + 271 " │ ├─ name: uv\n" + 272 " │ └─ columns: [u v]\n" + 273 " └─ IndexedTableAccess(xy)\n" + 274 " ├─ index: [xy.x]\n" + 275 " ├─ keys: [uv.u:0!null]\n" + 276 " ├─ colSet: (1,2)\n" + 277 " ├─ tableId: 1\n" + 278 " └─ Table\n" + 279 " ├─ name: xy\n" + 280 " └─ columns: [x y]\n" + 281 "", 282 ExpectedEstimates: "Project\n" + 283 " ├─ columns: [xy.x, xy.y, uv.u, uv.v]\n" + 284 " └─ LookupJoin (estimated cost=6.600 rows=2)\n" + 285 " ├─ IndexedTableAccess(uv)\n" + 286 " │ ├─ index: [uv.u]\n" + 287 " │ ├─ filters: [{(0, 2)}]\n" + 288 " │ └─ columns: [u v]\n" + 289 " └─ IndexedTableAccess(xy)\n" + 290 " ├─ index: [xy.x]\n" + 291 " ├─ columns: [x y]\n" + 292 " └─ keys: uv.u\n" + 293 "", 294 ExpectedAnalysis: "Project\n" + 295 " ├─ columns: [xy.x, xy.y, uv.u, uv.v]\n" + 296 " └─ LookupJoin (estimated cost=6.600 rows=2) (actual rows=1 loops=1)\n" + 297 " ├─ IndexedTableAccess(uv)\n" + 298 " │ ├─ index: [uv.u]\n" + 299 " │ ├─ filters: [{(0, 2)}]\n" + 300 " │ └─ columns: [u v]\n" + 301 " └─ IndexedTableAccess(xy)\n" + 302 " ├─ index: [xy.x]\n" + 303 " ├─ columns: [x y]\n" + 304 " └─ keys: uv.u\n" + 305 "", 306 }, 307 { 308 Query: ` 309 select 310 case when x is null then 0 311 when x in (select x from xy where not x in (select u from uv)) then 1 312 else 2 313 end as s 314 From xy;`, 315 ExpectedPlan: "Project\n" + 316 " ├─ columns: [CASE WHEN xy.x:0!null IS NULL THEN 0 (tinyint) WHEN InSubquery\n" + 317 " │ ├─ left: xy.x:0!null\n" + 318 " │ └─ right: Subquery\n" + 319 " │ ├─ cacheable: true\n" + 320 " │ ├─ alias-string: select x from xy where not x in (select u from uv)\n" + 321 " │ └─ Project\n" + 322 " │ ├─ columns: [xy.x:3!null]\n" + 323 " │ └─ Project\n" + 324 " │ ├─ columns: [xy.x:3!null, xy.y:4]\n" + 325 " │ └─ Filter\n" + 326 " │ ├─ uv.u:5!null IS NULL\n" + 327 " │ └─ LeftOuterMergeJoin\n" + 328 " │ ├─ cmp: Eq\n" + 329 " │ │ ├─ xy.x:3!null\n" + 330 " │ │ └─ uv.u:5!null\n" + 331 " │ ├─ IndexedTableAccess(xy)\n" + 332 " │ │ ├─ index: [xy.x]\n" + 333 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 334 " │ │ ├─ colSet: (3,4)\n" + 335 " │ │ ├─ tableId: 2\n" + 336 " │ │ └─ Table\n" + 337 " │ │ ├─ name: xy\n" + 338 " │ │ └─ columns: [x y]\n" + 339 " │ └─ IndexedTableAccess(uv)\n" + 340 " │ ├─ index: [uv.u]\n" + 341 " │ ├─ static: [{[NULL, ∞)}]\n" + 342 " │ ├─ colSet: (5,6)\n" + 343 " │ ├─ tableId: 3\n" + 344 " │ └─ Table\n" + 345 " │ ├─ name: uv\n" + 346 " │ └─ columns: [u]\n" + 347 " │ THEN 1 (tinyint) ELSE 2 (tinyint) END as s]\n" + 348 " └─ Project\n" + 349 " ├─ columns: [xy.x:0!null, xy.y:1, CASE WHEN xy.x:0!null IS NULL THEN 0 (tinyint) WHEN InSubquery\n" + 350 " │ ├─ left: xy.x:0!null\n" + 351 " │ └─ right: Subquery\n" + 352 " │ ├─ cacheable: true\n" + 353 " │ ├─ alias-string: select x from xy where not x in (select u from uv)\n" + 354 " │ └─ Project\n" + 355 " │ ├─ columns: [xy.x:2!null]\n" + 356 " │ └─ Project\n" + 357 " │ ├─ columns: [xy.x:2!null, xy.y:3]\n" + 358 " │ └─ Filter\n" + 359 " │ ├─ uv.u:4!null IS NULL\n" + 360 " │ └─ LeftOuterMergeJoin\n" + 361 " │ ├─ cmp: Eq\n" + 362 " │ │ ├─ xy.x:2!null\n" + 363 " │ │ └─ uv.u:4!null\n" + 364 " │ ├─ IndexedTableAccess(xy)\n" + 365 " │ │ ├─ index: [xy.x]\n" + 366 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 367 " │ │ ├─ colSet: (3,4)\n" + 368 " │ │ ├─ tableId: 2\n" + 369 " │ │ └─ Table\n" + 370 " │ │ ├─ name: xy\n" + 371 " │ │ └─ columns: [x y]\n" + 372 " │ └─ IndexedTableAccess(uv)\n" + 373 " │ ├─ index: [uv.u]\n" + 374 " │ ├─ static: [{[NULL, ∞)}]\n" + 375 " │ ├─ colSet: (5,6)\n" + 376 " │ ├─ tableId: 3\n" + 377 " │ └─ Table\n" + 378 " │ ├─ name: uv\n" + 379 " │ └─ columns: [u]\n" + 380 " │ THEN 1 (tinyint) ELSE 2 (tinyint) END as s]\n" + 381 " └─ ProcessTable\n" + 382 " └─ Table\n" + 383 " ├─ name: xy\n" + 384 " └─ columns: [x y]\n" + 385 "", 386 ExpectedEstimates: "Project\n" + 387 " ├─ columns: [CASE WHEN xy.x IS NULL THEN 0 WHEN InSubquery\n" + 388 " │ ├─ left: xy.x\n" + 389 " │ └─ right: Subquery\n" + 390 " │ ├─ cacheable: true\n" + 391 " │ └─ Project\n" + 392 " │ ├─ columns: [xy.x]\n" + 393 " │ └─ Project\n" + 394 " │ ├─ columns: [xy.x, xy.y]\n" + 395 " │ └─ Filter\n" + 396 " │ ├─ uv.u IS NULL\n" + 397 " │ └─ LeftOuterMergeJoin\n" + 398 " │ ├─ cmp: (xy.x = uv.u)\n" + 399 " │ ├─ IndexedTableAccess(xy)\n" + 400 " │ │ ├─ index: [xy.x]\n" + 401 " │ │ └─ filters: [{[NULL, ∞)}]\n" + 402 " │ └─ IndexedTableAccess(uv)\n" + 403 " │ ├─ index: [uv.u]\n" + 404 " │ ├─ filters: [{[NULL, ∞)}]\n" + 405 " │ └─ columns: [u]\n" + 406 " │ THEN 1 ELSE 2 END as s]\n" + 407 " └─ Project\n" + 408 " ├─ columns: [xy.x, xy.y, CASE WHEN xy.x IS NULL THEN 0 WHEN InSubquery\n" + 409 " │ ├─ left: xy.x\n" + 410 " │ └─ right: Subquery\n" + 411 " │ ├─ cacheable: true\n" + 412 " │ └─ Project\n" + 413 " │ ├─ columns: [xy.x]\n" + 414 " │ └─ Project\n" + 415 " │ ├─ columns: [xy.x, xy.y]\n" + 416 " │ └─ Filter\n" + 417 " │ ├─ uv.u IS NULL\n" + 418 " │ └─ LeftOuterMergeJoin\n" + 419 " │ ├─ cmp: (xy.x = uv.u)\n" + 420 " │ ├─ IndexedTableAccess(xy)\n" + 421 " │ │ ├─ index: [xy.x]\n" + 422 " │ │ └─ filters: [{[NULL, ∞)}]\n" + 423 " │ └─ IndexedTableAccess(uv)\n" + 424 " │ ├─ index: [uv.u]\n" + 425 " │ ├─ filters: [{[NULL, ∞)}]\n" + 426 " │ └─ columns: [u]\n" + 427 " │ THEN 1 ELSE 2 END as s]\n" + 428 " └─ Table\n" + 429 " └─ name: xy\n" + 430 "", 431 ExpectedAnalysis: "Project\n" + 432 " ├─ columns: [CASE WHEN xy.x IS NULL THEN 0 WHEN InSubquery\n" + 433 " │ ├─ left: xy.x\n" + 434 " │ └─ right: Subquery\n" + 435 " │ ├─ cacheable: true\n" + 436 " │ └─ Project\n" + 437 " │ ├─ columns: [xy.x]\n" + 438 " │ └─ Project\n" + 439 " │ ├─ columns: [xy.x, xy.y]\n" + 440 " │ └─ Filter\n" + 441 " │ ├─ uv.u IS NULL\n" + 442 " │ └─ LeftOuterMergeJoin\n" + 443 " │ ├─ cmp: (xy.x = uv.u)\n" + 444 " │ ├─ IndexedTableAccess(xy)\n" + 445 " │ │ ├─ index: [xy.x]\n" + 446 " │ │ └─ filters: [{[NULL, ∞)}]\n" + 447 " │ └─ IndexedTableAccess(uv)\n" + 448 " │ ├─ index: [uv.u]\n" + 449 " │ ├─ filters: [{[NULL, ∞)}]\n" + 450 " │ └─ columns: [u]\n" + 451 " │ THEN 1 ELSE 2 END as s]\n" + 452 " └─ Project\n" + 453 " ├─ columns: [xy.x, xy.y, CASE WHEN xy.x IS NULL THEN 0 WHEN InSubquery\n" + 454 " │ ├─ left: xy.x\n" + 455 " │ └─ right: Subquery\n" + 456 " │ ├─ cacheable: true\n" + 457 " │ └─ Project\n" + 458 " │ ├─ columns: [xy.x]\n" + 459 " │ └─ Project\n" + 460 " │ ├─ columns: [xy.x, xy.y]\n" + 461 " │ └─ Filter\n" + 462 " │ ├─ uv.u IS NULL\n" + 463 " │ └─ LeftOuterMergeJoin\n" + 464 " │ ├─ cmp: (xy.x = uv.u)\n" + 465 " │ ├─ IndexedTableAccess(xy)\n" + 466 " │ │ ├─ index: [xy.x]\n" + 467 " │ │ └─ filters: [{[NULL, ∞)}]\n" + 468 " │ └─ IndexedTableAccess(uv)\n" + 469 " │ ├─ index: [uv.u]\n" + 470 " │ ├─ filters: [{[NULL, ∞)}]\n" + 471 " │ └─ columns: [u]\n" + 472 " │ THEN 1 ELSE 2 END as s]\n" + 473 " └─ Table\n" + 474 " └─ name: xy\n" + 475 "", 476 }, 477 { 478 Query: `select * from MYTABLE where I = 2 and s = 'first row'`, 479 ExpectedPlan: "Filter\n" + 480 " ├─ Eq\n" + 481 " │ ├─ mytable.s:1!null\n" + 482 " │ └─ first row (longtext)\n" + 483 " └─ IndexedTableAccess(mytable)\n" + 484 " ├─ index: [mytable.i]\n" + 485 " ├─ static: [{[2, 2]}]\n" + 486 " ├─ colSet: (1,2)\n" + 487 " ├─ tableId: 1\n" + 488 " └─ Table\n" + 489 " ├─ name: mytable\n" + 490 " └─ columns: [i s]\n" + 491 "", 492 ExpectedEstimates: "Filter\n" + 493 " ├─ (mytable.s = 'first row')\n" + 494 " └─ IndexedTableAccess(mytable)\n" + 495 " ├─ index: [mytable.i]\n" + 496 " ├─ filters: [{[2, 2]}]\n" + 497 " └─ columns: [i s]\n" + 498 "", 499 ExpectedAnalysis: "Filter\n" + 500 " ├─ (mytable.s = 'first row')\n" + 501 " └─ IndexedTableAccess(mytable)\n" + 502 " ├─ index: [mytable.i]\n" + 503 " ├─ filters: [{[2, 2]}]\n" + 504 " └─ columns: [i s]\n" + 505 "", 506 }, 507 { 508 Query: `select /*+ JOIN_ORDER(uv,xy) */ count(*) from xy where y in (select distinct v from uv);`, 509 ExpectedPlan: "Project\n" + 510 " ├─ columns: [count(1):0!null as count(*)]\n" + 511 " └─ GroupBy\n" + 512 " ├─ select: COUNT(1 (bigint))\n" + 513 " ├─ group: \n" + 514 " └─ Project\n" + 515 " ├─ columns: [xy.x:1!null, xy.y:2]\n" + 516 " └─ LookupJoin\n" + 517 " ├─ Distinct\n" + 518 " │ └─ Project\n" + 519 " │ ├─ columns: [uv.v:1]\n" + 520 " │ └─ ProcessTable\n" + 521 " │ └─ Table\n" + 522 " │ ├─ name: uv\n" + 523 " │ └─ columns: [u v]\n" + 524 " └─ IndexedTableAccess(xy)\n" + 525 " ├─ index: [xy.y]\n" + 526 " ├─ keys: [uv.v:0]\n" + 527 " ├─ colSet: (1,2)\n" + 528 " ├─ tableId: 1\n" + 529 " └─ Table\n" + 530 " ├─ name: xy\n" + 531 " └─ columns: [x y]\n" + 532 "", 533 ExpectedEstimates: "Project\n" + 534 " ├─ columns: [count(1) as count(*)]\n" + 535 " └─ GroupBy\n" + 536 " ├─ SelectedExprs(COUNT(1))\n" + 537 " ├─ Grouping()\n" + 538 " └─ Project\n" + 539 " ├─ columns: [xy.x, xy.y]\n" + 540 " └─ LookupJoin\n" + 541 " ├─ Distinct\n" + 542 " │ └─ Project\n" + 543 " │ ├─ columns: [uv.v]\n" + 544 " │ └─ Table\n" + 545 " │ └─ name: uv\n" + 546 " └─ IndexedTableAccess(xy)\n" + 547 " ├─ index: [xy.y]\n" + 548 " └─ keys: uv.v\n" + 549 "", 550 ExpectedAnalysis: "Project\n" + 551 " ├─ columns: [count(1) as count(*)]\n" + 552 " └─ GroupBy\n" + 553 " ├─ SelectedExprs(COUNT(1))\n" + 554 " ├─ Grouping()\n" + 555 " └─ Project\n" + 556 " ├─ columns: [xy.x, xy.y]\n" + 557 " └─ LookupJoin\n" + 558 " ├─ Distinct\n" + 559 " │ └─ Project\n" + 560 " │ ├─ columns: [uv.v]\n" + 561 " │ └─ Table\n" + 562 " │ └─ name: uv\n" + 563 " └─ IndexedTableAccess(xy)\n" + 564 " ├─ index: [xy.y]\n" + 565 " └─ keys: uv.v\n" + 566 "", 567 }, 568 { 569 Query: `SELECT /*+ JOIN_ORDER(uv,xy) */ count(*) from xy where y in (select distinct u from uv);`, 570 ExpectedPlan: "Project\n" + 571 " ├─ columns: [count(1):0!null as count(*)]\n" + 572 " └─ GroupBy\n" + 573 " ├─ select: COUNT(1 (bigint))\n" + 574 " ├─ group: \n" + 575 " └─ LookupJoin\n" + 576 " ├─ Eq\n" + 577 " │ ├─ xy.y:2\n" + 578 " │ └─ uv.u:0!null\n" + 579 " ├─ OrderedDistinct\n" + 580 " │ └─ Project\n" + 581 " │ ├─ columns: [uv.u:0!null]\n" + 582 " │ └─ ProcessTable\n" + 583 " │ └─ Table\n" + 584 " │ ├─ name: uv\n" + 585 " │ └─ columns: [u v]\n" + 586 " └─ IndexedTableAccess(xy)\n" + 587 " ├─ index: [xy.y]\n" + 588 " ├─ keys: [uv.u:0!null]\n" + 589 " ├─ colSet: (1,2)\n" + 590 " ├─ tableId: 1\n" + 591 " └─ Table\n" + 592 " ├─ name: xy\n" + 593 " └─ columns: [x y]\n" + 594 "", 595 ExpectedEstimates: "Project\n" + 596 " ├─ columns: [count(1) as count(*)]\n" + 597 " └─ GroupBy\n" + 598 " ├─ SelectedExprs(COUNT(1))\n" + 599 " ├─ Grouping()\n" + 600 " └─ LookupJoin\n" + 601 " ├─ (xy.y = uv.u)\n" + 602 " ├─ OrderedDistinct\n" + 603 " │ └─ Project\n" + 604 " │ ├─ columns: [uv.u]\n" + 605 " │ └─ Table\n" + 606 " │ └─ name: uv\n" + 607 " └─ IndexedTableAccess(xy)\n" + 608 " ├─ index: [xy.y]\n" + 609 " └─ keys: uv.u\n" + 610 "", 611 ExpectedAnalysis: "Project\n" + 612 " ├─ columns: [count(1) as count(*)]\n" + 613 " └─ GroupBy\n" + 614 " ├─ SelectedExprs(COUNT(1))\n" + 615 " ├─ Grouping()\n" + 616 " └─ LookupJoin\n" + 617 " ├─ (xy.y = uv.u)\n" + 618 " ├─ OrderedDistinct\n" + 619 " │ └─ Project\n" + 620 " │ ├─ columns: [uv.u]\n" + 621 " │ └─ Table\n" + 622 " │ └─ name: uv\n" + 623 " └─ IndexedTableAccess(xy)\n" + 624 " ├─ index: [xy.y]\n" + 625 " └─ keys: uv.u\n" + 626 "", 627 }, 628 { 629 Query: `select count(*) from mytable`, 630 ExpectedPlan: "Project\n" + 631 " ├─ columns: [count(1):0!null as count(*)]\n" + 632 " └─ Project\n" + 633 " ├─ columns: [mytable.COUNT(1):0!null as COUNT(1)]\n" + 634 " └─ table_count(mytable) as COUNT(1)\n" + 635 "", 636 ExpectedEstimates: "Project\n" + 637 " ├─ columns: [count(1) as count(*)]\n" + 638 " └─ Project\n" + 639 " ├─ columns: [mytable.COUNT(1) as COUNT(1)]\n" + 640 " └─ table_count(mytable) as COUNT(1)\n" + 641 "", 642 ExpectedAnalysis: "Project\n" + 643 " ├─ columns: [count(1) as count(*)]\n" + 644 " └─ Project\n" + 645 " ├─ columns: [mytable.COUNT(1) as COUNT(1)]\n" + 646 " └─ table_count(mytable) as COUNT(1)\n" + 647 "", 648 }, 649 { 650 Query: `select count(*) as cnt from mytable`, 651 ExpectedPlan: "Project\n" + 652 " ├─ columns: [count(1):0!null as cnt]\n" + 653 " └─ Project\n" + 654 " ├─ columns: [mytable.COUNT(1):0!null as COUNT(1)]\n" + 655 " └─ table_count(mytable) as COUNT(1)\n" + 656 "", 657 ExpectedEstimates: "Project\n" + 658 " ├─ columns: [count(1) as cnt]\n" + 659 " └─ Project\n" + 660 " ├─ columns: [mytable.COUNT(1) as COUNT(1)]\n" + 661 " └─ table_count(mytable) as COUNT(1)\n" + 662 "", 663 ExpectedAnalysis: "Project\n" + 664 " ├─ columns: [count(1) as cnt]\n" + 665 " └─ Project\n" + 666 " ├─ columns: [mytable.COUNT(1) as COUNT(1)]\n" + 667 " └─ table_count(mytable) as COUNT(1)\n" + 668 "", 669 }, 670 { 671 Query: `select count(*) from keyless`, 672 ExpectedPlan: "Project\n" + 673 " ├─ columns: [count(1):0!null as count(*)]\n" + 674 " └─ GroupBy\n" + 675 " ├─ select: COUNT(1 (bigint))\n" + 676 " ├─ group: \n" + 677 " └─ ProcessTable\n" + 678 " └─ Table\n" + 679 " ├─ name: keyless\n" + 680 " └─ columns: []\n" + 681 "", 682 ExpectedEstimates: "Project\n" + 683 " ├─ columns: [count(1) as count(*)]\n" + 684 " └─ GroupBy\n" + 685 " ├─ SelectedExprs(COUNT(1))\n" + 686 " ├─ Grouping()\n" + 687 " └─ Table\n" + 688 " ├─ name: keyless\n" + 689 " └─ columns: []\n" + 690 "", 691 ExpectedAnalysis: "Project\n" + 692 " ├─ columns: [count(1) as count(*)]\n" + 693 " └─ GroupBy\n" + 694 " ├─ SelectedExprs(COUNT(1))\n" + 695 " ├─ Grouping()\n" + 696 " └─ Table\n" + 697 " ├─ name: keyless\n" + 698 " └─ columns: []\n" + 699 "", 700 }, 701 { 702 Query: `select count(*) from xy`, 703 ExpectedPlan: "Project\n" + 704 " ├─ columns: [count(1):0!null as count(*)]\n" + 705 " └─ Project\n" + 706 " ├─ columns: [xy.COUNT(1):0!null as COUNT(1)]\n" + 707 " └─ table_count(xy) as COUNT(1)\n" + 708 "", 709 ExpectedEstimates: "Project\n" + 710 " ├─ columns: [count(1) as count(*)]\n" + 711 " └─ Project\n" + 712 " ├─ columns: [xy.COUNT(1) as COUNT(1)]\n" + 713 " └─ table_count(xy) as COUNT(1)\n" + 714 "", 715 ExpectedAnalysis: "Project\n" + 716 " ├─ columns: [count(1) as count(*)]\n" + 717 " └─ Project\n" + 718 " ├─ columns: [xy.COUNT(1) as COUNT(1)]\n" + 719 " └─ table_count(xy) as COUNT(1)\n" + 720 "", 721 }, 722 { 723 Query: `select count(1) from mytable`, 724 ExpectedPlan: "Project\n" + 725 " ├─ columns: [count(1):0!null]\n" + 726 " └─ Project\n" + 727 " ├─ columns: [mytable.COUNT(1):0!null as COUNT(1)]\n" + 728 " └─ table_count(mytable) as COUNT(1)\n" + 729 "", 730 ExpectedEstimates: "Project\n" + 731 " ├─ columns: [count(1)]\n" + 732 " └─ Project\n" + 733 " ├─ columns: [mytable.COUNT(1) as COUNT(1)]\n" + 734 " └─ table_count(mytable) as COUNT(1)\n" + 735 "", 736 ExpectedAnalysis: "Project\n" + 737 " ├─ columns: [count(1)]\n" + 738 " └─ Project\n" + 739 " ├─ columns: [mytable.COUNT(1) as COUNT(1)]\n" + 740 " └─ table_count(mytable) as COUNT(1)\n" + 741 "", 742 }, 743 { 744 Query: `select count(1) from xy`, 745 ExpectedPlan: "Project\n" + 746 " ├─ columns: [count(1):0!null]\n" + 747 " └─ Project\n" + 748 " ├─ columns: [xy.COUNT(1):0!null as COUNT(1)]\n" + 749 " └─ table_count(xy) as COUNT(1)\n" + 750 "", 751 ExpectedEstimates: "Project\n" + 752 " ├─ columns: [count(1)]\n" + 753 " └─ Project\n" + 754 " ├─ columns: [xy.COUNT(1) as COUNT(1)]\n" + 755 " └─ table_count(xy) as COUNT(1)\n" + 756 "", 757 ExpectedAnalysis: "Project\n" + 758 " ├─ columns: [count(1)]\n" + 759 " └─ Project\n" + 760 " ├─ columns: [xy.COUNT(1) as COUNT(1)]\n" + 761 " └─ table_count(xy) as COUNT(1)\n" + 762 "", 763 }, 764 { 765 Query: `select count(1) from xy, uv`, 766 ExpectedPlan: "Project\n" + 767 " ├─ columns: [count(1):0!null]\n" + 768 " └─ GroupBy\n" + 769 " ├─ select: COUNT(1 (tinyint))\n" + 770 " ├─ group: \n" + 771 " └─ CrossJoin\n" + 772 " ├─ ProcessTable\n" + 773 " │ └─ Table\n" + 774 " │ ├─ name: uv\n" + 775 " │ └─ columns: []\n" + 776 " └─ ProcessTable\n" + 777 " └─ Table\n" + 778 " ├─ name: xy\n" + 779 " └─ columns: []\n" + 780 "", 781 ExpectedEstimates: "Project\n" + 782 " ├─ columns: [count(1)]\n" + 783 " └─ GroupBy\n" + 784 " ├─ SelectedExprs(COUNT(1))\n" + 785 " ├─ Grouping()\n" + 786 " └─ CrossJoin\n" + 787 " ├─ Table\n" + 788 " │ ├─ name: uv\n" + 789 " │ └─ columns: []\n" + 790 " └─ Table\n" + 791 " ├─ name: xy\n" + 792 " └─ columns: []\n" + 793 "", 794 ExpectedAnalysis: "Project\n" + 795 " ├─ columns: [count(1)]\n" + 796 " └─ GroupBy\n" + 797 " ├─ SelectedExprs(COUNT(1))\n" + 798 " ├─ Grouping()\n" + 799 " └─ CrossJoin\n" + 800 " ├─ Table\n" + 801 " │ ├─ name: uv\n" + 802 " │ └─ columns: []\n" + 803 " └─ Table\n" + 804 " ├─ name: xy\n" + 805 " └─ columns: []\n" + 806 "", 807 }, 808 { 809 Query: `select * from (select count(*) from xy) dt`, 810 ExpectedPlan: "SubqueryAlias\n" + 811 " ├─ name: dt\n" + 812 " ├─ outerVisibility: false\n" + 813 " ├─ isLateral: false\n" + 814 " ├─ cacheable: true\n" + 815 " ├─ colSet: (4)\n" + 816 " ├─ tableId: 2\n" + 817 " └─ Project\n" + 818 " ├─ columns: [count(1):0!null as count(*)]\n" + 819 " └─ Project\n" + 820 " ├─ columns: [xy.COUNT(1):0!null as COUNT(1)]\n" + 821 " └─ table_count(xy) as COUNT(1)\n" + 822 "", 823 ExpectedEstimates: "SubqueryAlias\n" + 824 " ├─ name: dt\n" + 825 " ├─ outerVisibility: false\n" + 826 " ├─ isLateral: false\n" + 827 " ├─ cacheable: true\n" + 828 " └─ Project\n" + 829 " ├─ columns: [count(1) as count(*)]\n" + 830 " └─ Project\n" + 831 " ├─ columns: [xy.COUNT(1) as COUNT(1)]\n" + 832 " └─ table_count(xy) as COUNT(1)\n" + 833 "", 834 ExpectedAnalysis: "SubqueryAlias\n" + 835 " ├─ name: dt\n" + 836 " ├─ outerVisibility: false\n" + 837 " ├─ isLateral: false\n" + 838 " ├─ cacheable: true\n" + 839 " └─ Project\n" + 840 " ├─ columns: [count(1) as count(*)]\n" + 841 " └─ Project\n" + 842 " ├─ columns: [xy.COUNT(1) as COUNT(1)]\n" + 843 " └─ table_count(xy) as COUNT(1)\n" + 844 "", 845 }, 846 { 847 Query: `select (select count(*) from xy), (select count(*) from uv)`, 848 ExpectedPlan: "Project\n" + 849 " ├─ columns: [Subquery\n" + 850 " │ ├─ cacheable: true\n" + 851 " │ ├─ alias-string: select count(*) from xy\n" + 852 " │ └─ Project\n" + 853 " │ ├─ columns: [count(1):1!null as count(*)]\n" + 854 " │ └─ Project\n" + 855 " │ ├─ columns: [xy.COUNT(1):1!null as COUNT(1)]\n" + 856 " │ └─ table_count(xy) as COUNT(1)\n" + 857 " │ as (select count(*) from xy), Subquery\n" + 858 " │ ├─ cacheable: true\n" + 859 " │ ├─ alias-string: select count(*) from uv\n" + 860 " │ └─ Project\n" + 861 " │ ├─ columns: [count(1):1!null as count(*)]\n" + 862 " │ └─ Project\n" + 863 " │ ├─ columns: [uv.COUNT(1):1!null as COUNT(1)]\n" + 864 " │ └─ table_count(uv) as COUNT(1)\n" + 865 " │ as (select count(*) from uv)]\n" + 866 " └─ Project\n" + 867 " ├─ columns: [dual.:0!null]\n" + 868 " └─ ProcessTable\n" + 869 " └─ Table\n" + 870 " ├─ name: \n" + 871 " └─ columns: []\n" + 872 "", 873 ExpectedEstimates: "Project\n" + 874 " ├─ columns: [Subquery\n" + 875 " │ ├─ cacheable: true\n" + 876 " │ └─ Project\n" + 877 " │ ├─ columns: [count(1) as count(*)]\n" + 878 " │ └─ Project\n" + 879 " │ ├─ columns: [xy.COUNT(1) as COUNT(1)]\n" + 880 " │ └─ table_count(xy) as COUNT(1)\n" + 881 " │ as (select count(*) from xy), Subquery\n" + 882 " │ ├─ cacheable: true\n" + 883 " │ └─ Project\n" + 884 " │ ├─ columns: [count(1) as count(*)]\n" + 885 " │ └─ Project\n" + 886 " │ ├─ columns: [uv.COUNT(1) as COUNT(1)]\n" + 887 " │ └─ table_count(uv) as COUNT(1)\n" + 888 " │ as (select count(*) from uv)]\n" + 889 " └─ Project\n" + 890 " ├─ columns: [dual.]\n" + 891 " └─ Table\n" + 892 " └─ name: \n" + 893 "", 894 ExpectedAnalysis: "Project\n" + 895 " ├─ columns: [Subquery\n" + 896 " │ ├─ cacheable: true\n" + 897 " │ └─ Project\n" + 898 " │ ├─ columns: [count(1) as count(*)]\n" + 899 " │ └─ Project\n" + 900 " │ ├─ columns: [xy.COUNT(1) as COUNT(1)]\n" + 901 " │ └─ table_count(xy) as COUNT(1)\n" + 902 " │ as (select count(*) from xy), Subquery\n" + 903 " │ ├─ cacheable: true\n" + 904 " │ └─ Project\n" + 905 " │ ├─ columns: [count(1) as count(*)]\n" + 906 " │ └─ Project\n" + 907 " │ ├─ columns: [uv.COUNT(1) as COUNT(1)]\n" + 908 " │ └─ table_count(uv) as COUNT(1)\n" + 909 " │ as (select count(*) from uv)]\n" + 910 " └─ Project\n" + 911 " ├─ columns: [dual.]\n" + 912 " └─ Table\n" + 913 " └─ name: \n" + 914 "", 915 }, 916 { 917 Query: `select (select count(*) from xy), (select count(*) from uv), count(*) from ab`, 918 ExpectedPlan: "Project\n" + 919 " ├─ columns: [Subquery\n" + 920 " │ ├─ cacheable: true\n" + 921 " │ ├─ alias-string: select count(*) from xy\n" + 922 " │ └─ Project\n" + 923 " │ ├─ columns: [count(1):1!null as count(*)]\n" + 924 " │ └─ Project\n" + 925 " │ ├─ columns: [xy.COUNT(1):1!null as COUNT(1)]\n" + 926 " │ └─ table_count(xy) as COUNT(1)\n" + 927 " │ as (select count(*) from xy), Subquery\n" + 928 " │ ├─ cacheable: true\n" + 929 " │ ├─ alias-string: select count(*) from uv\n" + 930 " │ └─ Project\n" + 931 " │ ├─ columns: [count(1):1!null as count(*)]\n" + 932 " │ └─ Project\n" + 933 " │ ├─ columns: [uv.COUNT(1):1!null as COUNT(1)]\n" + 934 " │ └─ table_count(uv) as COUNT(1)\n" + 935 " │ as (select count(*) from uv), count(1):0!null as count(*)]\n" + 936 " └─ Project\n" + 937 " ├─ columns: [ab.COUNT(1):0!null as COUNT(1)]\n" + 938 " └─ table_count(ab) as COUNT(1)\n" + 939 "", 940 ExpectedEstimates: "Project\n" + 941 " ├─ columns: [Subquery\n" + 942 " │ ├─ cacheable: true\n" + 943 " │ └─ Project\n" + 944 " │ ├─ columns: [count(1) as count(*)]\n" + 945 " │ └─ Project\n" + 946 " │ ├─ columns: [xy.COUNT(1) as COUNT(1)]\n" + 947 " │ └─ table_count(xy) as COUNT(1)\n" + 948 " │ as (select count(*) from xy), Subquery\n" + 949 " │ ├─ cacheable: true\n" + 950 " │ └─ Project\n" + 951 " │ ├─ columns: [count(1) as count(*)]\n" + 952 " │ └─ Project\n" + 953 " │ ├─ columns: [uv.COUNT(1) as COUNT(1)]\n" + 954 " │ └─ table_count(uv) as COUNT(1)\n" + 955 " │ as (select count(*) from uv), count(1) as count(*)]\n" + 956 " └─ Project\n" + 957 " ├─ columns: [ab.COUNT(1) as COUNT(1)]\n" + 958 " └─ table_count(ab) as COUNT(1)\n" + 959 "", 960 ExpectedAnalysis: "Project\n" + 961 " ├─ columns: [Subquery\n" + 962 " │ ├─ cacheable: true\n" + 963 " │ └─ Project\n" + 964 " │ ├─ columns: [count(1) as count(*)]\n" + 965 " │ └─ Project\n" + 966 " │ ├─ columns: [xy.COUNT(1) as COUNT(1)]\n" + 967 " │ └─ table_count(xy) as COUNT(1)\n" + 968 " │ as (select count(*) from xy), Subquery\n" + 969 " │ ├─ cacheable: true\n" + 970 " │ └─ Project\n" + 971 " │ ├─ columns: [count(1) as count(*)]\n" + 972 " │ └─ Project\n" + 973 " │ ├─ columns: [uv.COUNT(1) as COUNT(1)]\n" + 974 " │ └─ table_count(uv) as COUNT(1)\n" + 975 " │ as (select count(*) from uv), count(1) as count(*)]\n" + 976 " └─ Project\n" + 977 " ├─ columns: [ab.COUNT(1) as COUNT(1)]\n" + 978 " └─ table_count(ab) as COUNT(1)\n" + 979 "", 980 }, 981 { 982 Query: ` 983 SELECT COUNT(DISTINCT (s_i_id)) 984 FROM order_line1, stock1 985 WHERE 986 ol_w_id = 5 AND 987 ol_d_id = 2 AND 988 ol_o_id < 3001 AND 989 ol_o_id >= 2981 AND 990 s_w_id= 5 AND 991 s_i_id=ol_i_id AND 992 s_quantity < 15;`, 993 ExpectedPlan: "Project\n" + 994 " ├─ columns: [countdistinct([stock1.s_i_id]):0!null as COUNT(DISTINCT (s_i_id))]\n" + 995 " └─ GroupBy\n" + 996 " ├─ select: COUNTDISTINCT([stock1.s_i_id])\n" + 997 " ├─ group: \n" + 998 " └─ HashJoin\n" + 999 " ├─ Eq\n" + 1000 " │ ├─ stock1.s_i_id:4!null\n" + 1001 " │ └─ order_line1.ol_i_id:3\n" + 1002 " ├─ IndexedTableAccess(order_line1)\n" + 1003 " │ ├─ index: [order_line1.ol_w_id,order_line1.ol_d_id,order_line1.ol_o_id,order_line1.ol_number]\n" + 1004 " │ ├─ static: [{[5, 5], [2, 2], [2981, 3001), [NULL, ∞)}]\n" + 1005 " │ ├─ colSet: (1-10)\n" + 1006 " │ ├─ tableId: 1\n" + 1007 " │ └─ Table\n" + 1008 " │ ├─ name: order_line1\n" + 1009 " │ └─ columns: [ol_o_id ol_d_id ol_w_id ol_i_id]\n" + 1010 " └─ HashLookup\n" + 1011 " ├─ left-key: TUPLE(order_line1.ol_i_id:3)\n" + 1012 " ├─ right-key: TUPLE(stock1.s_i_id:0!null)\n" + 1013 " └─ Filter\n" + 1014 " ├─ LessThan\n" + 1015 " │ ├─ stock1.s_quantity:2\n" + 1016 " │ └─ 15 (tinyint)\n" + 1017 " └─ IndexedTableAccess(stock1)\n" + 1018 " ├─ index: [stock1.s_w_id,stock1.s_i_id]\n" + 1019 " ├─ static: [{[5, 5], [NULL, ∞)}]\n" + 1020 " ├─ colSet: (11-27)\n" + 1021 " ├─ tableId: 2\n" + 1022 " └─ Table\n" + 1023 " ├─ name: stock1\n" + 1024 " └─ columns: [s_i_id s_w_id s_quantity]\n" + 1025 "", 1026 ExpectedEstimates: "Project\n" + 1027 " ├─ columns: [countdistinct([stock1.s_i_id]) as COUNT(DISTINCT (s_i_id))]\n" + 1028 " └─ GroupBy\n" + 1029 " ├─ SelectedExprs(COUNTDISTINCT([stock1.s_i_id]))\n" + 1030 " ├─ Grouping()\n" + 1031 " └─ HashJoin\n" + 1032 " ├─ (stock1.s_i_id = order_line1.ol_i_id)\n" + 1033 " ├─ IndexedTableAccess(order_line1)\n" + 1034 " │ ├─ index: [order_line1.ol_w_id,order_line1.ol_d_id,order_line1.ol_o_id,order_line1.ol_number]\n" + 1035 " │ ├─ filters: [{[5, 5], [2, 2], [2981, 3001), [NULL, ∞)}]\n" + 1036 " │ └─ columns: [ol_o_id ol_d_id ol_w_id ol_i_id]\n" + 1037 " └─ HashLookup\n" + 1038 " ├─ left-key: (order_line1.ol_i_id)\n" + 1039 " ├─ right-key: (stock1.s_i_id)\n" + 1040 " └─ Filter\n" + 1041 " ├─ (stock1.s_quantity < 15)\n" + 1042 " └─ IndexedTableAccess(stock1)\n" + 1043 " ├─ index: [stock1.s_w_id,stock1.s_i_id]\n" + 1044 " ├─ filters: [{[5, 5], [NULL, ∞)}]\n" + 1045 " └─ columns: [s_i_id s_w_id s_quantity]\n" + 1046 "", 1047 ExpectedAnalysis: "Project\n" + 1048 " ├─ columns: [countdistinct([stock1.s_i_id]) as COUNT(DISTINCT (s_i_id))]\n" + 1049 " └─ GroupBy\n" + 1050 " ├─ SelectedExprs(COUNTDISTINCT([stock1.s_i_id]))\n" + 1051 " ├─ Grouping()\n" + 1052 " └─ HashJoin\n" + 1053 " ├─ (stock1.s_i_id = order_line1.ol_i_id)\n" + 1054 " ├─ IndexedTableAccess(order_line1)\n" + 1055 " │ ├─ index: [order_line1.ol_w_id,order_line1.ol_d_id,order_line1.ol_o_id,order_line1.ol_number]\n" + 1056 " │ ├─ filters: [{[5, 5], [2, 2], [2981, 3001), [NULL, ∞)}]\n" + 1057 " │ └─ columns: [ol_o_id ol_d_id ol_w_id ol_i_id]\n" + 1058 " └─ HashLookup\n" + 1059 " ├─ left-key: (order_line1.ol_i_id)\n" + 1060 " ├─ right-key: (stock1.s_i_id)\n" + 1061 " └─ Filter\n" + 1062 " ├─ (stock1.s_quantity < 15)\n" + 1063 " └─ IndexedTableAccess(stock1)\n" + 1064 " ├─ index: [stock1.s_w_id,stock1.s_i_id]\n" + 1065 " ├─ filters: [{[5, 5], [NULL, ∞)}]\n" + 1066 " └─ columns: [s_i_id s_w_id s_quantity]\n" + 1067 "", 1068 }, 1069 { 1070 Query: ` 1071 SELECT c_discount, c_last, c_credit, w_tax 1072 FROM customer1, warehouse1 1073 WHERE 1074 w_id = 1 AND 1075 c_w_id = w_id AND 1076 c_d_id = 2 AND 1077 c_id = 2327; 1078 `, 1079 ExpectedPlan: "Project\n" + 1080 " ├─ columns: [customer1.c_discount:7, customer1.c_last:5, customer1.c_credit:6, warehouse1.w_tax:1]\n" + 1081 " └─ LookupJoin\n" + 1082 " ├─ IndexedTableAccess(warehouse1)\n" + 1083 " │ ├─ index: [warehouse1.w_id]\n" + 1084 " │ ├─ static: [{[1, 1]}]\n" + 1085 " │ ├─ colSet: (22-30)\n" + 1086 " │ ├─ tableId: 2\n" + 1087 " │ └─ Table\n" + 1088 " │ ├─ name: warehouse1\n" + 1089 " │ └─ columns: [w_id w_tax]\n" + 1090 " └─ Filter\n" + 1091 " ├─ AND\n" + 1092 " │ ├─ Eq\n" + 1093 " │ │ ├─ customer1.c_d_id:1!null\n" + 1094 " │ │ └─ 2 (tinyint)\n" + 1095 " │ └─ Eq\n" + 1096 " │ ├─ customer1.c_id:0!null\n" + 1097 " │ └─ 2327 (smallint)\n" + 1098 " └─ IndexedTableAccess(customer1)\n" + 1099 " ├─ index: [customer1.c_w_id,customer1.c_d_id,customer1.c_id]\n" + 1100 " ├─ keys: [warehouse1.w_id:0!null 2 (tinyint) 2327 (smallint)]\n" + 1101 " ├─ colSet: (1-21)\n" + 1102 " ├─ tableId: 1\n" + 1103 " └─ Table\n" + 1104 " ├─ name: customer1\n" + 1105 " └─ columns: [c_id c_d_id c_w_id c_last c_credit c_discount]\n" + 1106 "", 1107 ExpectedEstimates: "Project\n" + 1108 " ├─ columns: [customer1.c_discount, customer1.c_last, customer1.c_credit, warehouse1.w_tax]\n" + 1109 " └─ LookupJoin (estimated cost=16.500 rows=5)\n" + 1110 " ├─ IndexedTableAccess(warehouse1)\n" + 1111 " │ ├─ index: [warehouse1.w_id]\n" + 1112 " │ ├─ filters: [{[1, 1]}]\n" + 1113 " │ └─ columns: [w_id w_tax]\n" + 1114 " └─ Filter\n" + 1115 " ├─ ((customer1.c_d_id = 2) AND (customer1.c_id = 2327))\n" + 1116 " └─ IndexedTableAccess(customer1)\n" + 1117 " ├─ index: [customer1.c_w_id,customer1.c_d_id,customer1.c_id]\n" + 1118 " ├─ columns: [c_id c_d_id c_w_id c_last c_credit c_discount]\n" + 1119 " └─ keys: warehouse1.w_id, 2, 2327\n" + 1120 "", 1121 ExpectedAnalysis: "Project\n" + 1122 " ├─ columns: [customer1.c_discount, customer1.c_last, customer1.c_credit, warehouse1.w_tax]\n" + 1123 " └─ LookupJoin (estimated cost=16.500 rows=5) (actual rows=0 loops=1)\n" + 1124 " ├─ IndexedTableAccess(warehouse1)\n" + 1125 " │ ├─ index: [warehouse1.w_id]\n" + 1126 " │ ├─ filters: [{[1, 1]}]\n" + 1127 " │ └─ columns: [w_id w_tax]\n" + 1128 " └─ Filter\n" + 1129 " ├─ ((customer1.c_d_id = 2) AND (customer1.c_id = 2327))\n" + 1130 " └─ IndexedTableAccess(customer1)\n" + 1131 " ├─ index: [customer1.c_w_id,customer1.c_d_id,customer1.c_id]\n" + 1132 " ├─ columns: [c_id c_d_id c_w_id c_last c_credit c_discount]\n" + 1133 " └─ keys: warehouse1.w_id, 2, 2327\n" + 1134 "", 1135 }, 1136 { 1137 Query: `select * from asset am join asset am2 on (am.orgId = am2.orgId and am.name = am2.name and am.val = am2.val);`, 1138 ExpectedPlan: "MergeJoin\n" + 1139 " ├─ cmp: Eq\n" + 1140 " │ ├─ TUPLE(am.orgId:1, am.name:3, am.val:4)\n" + 1141 " │ └─ TUPLE(am2.orgId:6, am2.name:8, am2.val:9)\n" + 1142 " ├─ TableAlias(am)\n" + 1143 " │ └─ IndexedTableAccess(asset)\n" + 1144 " │ ├─ index: [asset.orgId,asset.name,asset.val]\n" + 1145 " │ ├─ static: [{[NULL, ∞), [NULL, ∞), [NULL, ∞)}]\n" + 1146 " │ ├─ colSet: (1-5)\n" + 1147 " │ ├─ tableId: 1\n" + 1148 " │ └─ Table\n" + 1149 " │ ├─ name: asset\n" + 1150 " │ └─ columns: [id orgid assetid name val]\n" + 1151 " └─ TableAlias(am2)\n" + 1152 " └─ IndexedTableAccess(asset)\n" + 1153 " ├─ index: [asset.orgId,asset.name,asset.val]\n" + 1154 " ├─ static: [{[NULL, ∞), [NULL, ∞), [NULL, ∞)}]\n" + 1155 " ├─ colSet: (6-10)\n" + 1156 " ├─ tableId: 2\n" + 1157 " └─ Table\n" + 1158 " ├─ name: asset\n" + 1159 " └─ columns: [id orgid assetid name val]\n" + 1160 "", 1161 ExpectedEstimates: "MergeJoin (estimated cost=24.390 rows=14)\n" + 1162 " ├─ cmp: ((am.orgId, am.name, am.val) = (am2.orgId, am2.name, am2.val))\n" + 1163 " ├─ TableAlias(am)\n" + 1164 " │ └─ IndexedTableAccess(asset)\n" + 1165 " │ ├─ index: [asset.orgId,asset.name,asset.val]\n" + 1166 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞), [NULL, ∞)}]\n" + 1167 " │ └─ columns: [id orgid assetid name val]\n" + 1168 " └─ TableAlias(am2)\n" + 1169 " └─ IndexedTableAccess(asset)\n" + 1170 " ├─ index: [asset.orgId,asset.name,asset.val]\n" + 1171 " ├─ filters: [{[NULL, ∞), [NULL, ∞), [NULL, ∞)}]\n" + 1172 " └─ columns: [id orgid assetid name val]\n" + 1173 "", 1174 ExpectedAnalysis: "MergeJoin (estimated cost=24.390 rows=14) (actual rows=12 loops=1)\n" + 1175 " ├─ cmp: ((am.orgId, am.name, am.val) = (am2.orgId, am2.name, am2.val))\n" + 1176 " ├─ TableAlias(am)\n" + 1177 " │ └─ IndexedTableAccess(asset)\n" + 1178 " │ ├─ index: [asset.orgId,asset.name,asset.val]\n" + 1179 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞), [NULL, ∞)}]\n" + 1180 " │ └─ columns: [id orgid assetid name val]\n" + 1181 " └─ TableAlias(am2)\n" + 1182 " └─ IndexedTableAccess(asset)\n" + 1183 " ├─ index: [asset.orgId,asset.name,asset.val]\n" + 1184 " ├─ filters: [{[NULL, ∞), [NULL, ∞), [NULL, ∞)}]\n" + 1185 " └─ columns: [id orgid assetid name val]\n" + 1186 "", 1187 }, 1188 { 1189 Query: ` 1190 select /*+ LOOKUP_JOIN(style, dimension) LOOKUP_JOIN(dimension, color) */ style.assetId 1191 from asset style 1192 join asset dimension 1193 on style.assetId = dimension.assetId 1194 join asset color 1195 on style.assetId = color.assetId 1196 where 1197 dimension.val = 'wide' and 1198 style.val = 'curve' and 1199 color.val = 'blue' and 1200 dimension.name = 'dimension' and 1201 style.name = 'style' and 1202 color.name = 'color' and 1203 dimension.orgId = 'org1' and 1204 style.orgId = 'org1' and 1205 color.orgId = 'org1'; 1206 `, 1207 ExpectedPlan: "Project\n" + 1208 " ├─ columns: [style.assetId:1]\n" + 1209 " └─ LookupJoin\n" + 1210 " ├─ LookupJoin\n" + 1211 " │ ├─ Filter\n" + 1212 " │ │ ├─ AND\n" + 1213 " │ │ │ ├─ AND\n" + 1214 " │ │ │ │ ├─ Eq\n" + 1215 " │ │ │ │ │ ├─ style.val:3\n" + 1216 " │ │ │ │ │ └─ curve (longtext)\n" + 1217 " │ │ │ │ └─ Eq\n" + 1218 " │ │ │ │ ├─ style.name:2\n" + 1219 " │ │ │ │ └─ style (longtext)\n" + 1220 " │ │ │ └─ Eq\n" + 1221 " │ │ │ ├─ style.orgId:0\n" + 1222 " │ │ │ └─ org1 (longtext)\n" + 1223 " │ │ └─ TableAlias(style)\n" + 1224 " │ │ └─ IndexedTableAccess(asset)\n" + 1225 " │ │ ├─ index: [asset.orgId,asset.name,asset.assetId]\n" + 1226 " │ │ ├─ static: [{[org1, org1], [style, style], [NULL, ∞)}]\n" + 1227 " │ │ ├─ colSet: (1-5)\n" + 1228 " │ │ ├─ tableId: 1\n" + 1229 " │ │ └─ Table\n" + 1230 " │ │ ├─ name: asset\n" + 1231 " │ │ └─ columns: [orgid assetid name val]\n" + 1232 " │ └─ Filter\n" + 1233 " │ ├─ AND\n" + 1234 " │ │ ├─ AND\n" + 1235 " │ │ │ ├─ Eq\n" + 1236 " │ │ │ │ ├─ dimension.val:3\n" + 1237 " │ │ │ │ └─ wide (longtext)\n" + 1238 " │ │ │ └─ Eq\n" + 1239 " │ │ │ ├─ dimension.name:2\n" + 1240 " │ │ │ └─ dimension (longtext)\n" + 1241 " │ │ └─ Eq\n" + 1242 " │ │ ├─ dimension.orgId:0\n" + 1243 " │ │ └─ org1 (longtext)\n" + 1244 " │ └─ TableAlias(dimension)\n" + 1245 " │ └─ IndexedTableAccess(asset)\n" + 1246 " │ ├─ index: [asset.orgId,asset.name,asset.assetId]\n" + 1247 " │ ├─ keys: [org1 (longtext) dimension (longtext) style.assetId:1]\n" + 1248 " │ ├─ colSet: (6-10)\n" + 1249 " │ ├─ tableId: 2\n" + 1250 " │ └─ Table\n" + 1251 " │ ├─ name: asset\n" + 1252 " │ └─ columns: [orgid assetid name val]\n" + 1253 " └─ Filter\n" + 1254 " ├─ AND\n" + 1255 " │ ├─ AND\n" + 1256 " │ │ ├─ Eq\n" + 1257 " │ │ │ ├─ color.val:3\n" + 1258 " │ │ │ └─ blue (longtext)\n" + 1259 " │ │ └─ Eq\n" + 1260 " │ │ ├─ color.name:2\n" + 1261 " │ │ └─ color (longtext)\n" + 1262 " │ └─ Eq\n" + 1263 " │ ├─ color.orgId:0\n" + 1264 " │ └─ org1 (longtext)\n" + 1265 " └─ TableAlias(color)\n" + 1266 " └─ IndexedTableAccess(asset)\n" + 1267 " ├─ index: [asset.orgId,asset.name,asset.assetId]\n" + 1268 " ├─ keys: [org1 (longtext) color (longtext) style.assetId:1]\n" + 1269 " ├─ colSet: (11-15)\n" + 1270 " ├─ tableId: 3\n" + 1271 " └─ Table\n" + 1272 " ├─ name: asset\n" + 1273 " └─ columns: [orgid assetid name val]\n" + 1274 "", 1275 ExpectedEstimates: "Project\n" + 1276 " ├─ columns: [style.assetId]\n" + 1277 " └─ LookupJoin (estimated cost=13.200 rows=4)\n" + 1278 " ├─ LookupJoin (estimated cost=13.200 rows=4)\n" + 1279 " │ ├─ Filter\n" + 1280 " │ │ ├─ (((style.val = 'curve') AND (style.name = 'style')) AND (style.orgId = 'org1'))\n" + 1281 " │ │ └─ TableAlias(style)\n" + 1282 " │ │ └─ IndexedTableAccess(asset)\n" + 1283 " │ │ ├─ index: [asset.orgId,asset.name,asset.assetId]\n" + 1284 " │ │ ├─ filters: [{[org1, org1], [style, style], [NULL, ∞)}]\n" + 1285 " │ │ └─ columns: [orgid assetid name val]\n" + 1286 " │ └─ Filter\n" + 1287 " │ ├─ (((dimension.val = 'wide') AND (dimension.name = 'dimension')) AND (dimension.orgId = 'org1'))\n" + 1288 " │ └─ TableAlias(dimension)\n" + 1289 " │ └─ IndexedTableAccess(asset)\n" + 1290 " │ ├─ index: [asset.orgId,asset.name,asset.assetId]\n" + 1291 " │ ├─ columns: [orgid assetid name val]\n" + 1292 " │ └─ keys: 'org1', 'dimension', style.assetId\n" + 1293 " └─ Filter\n" + 1294 " ├─ (((color.val = 'blue') AND (color.name = 'color')) AND (color.orgId = 'org1'))\n" + 1295 " └─ TableAlias(color)\n" + 1296 " └─ IndexedTableAccess(asset)\n" + 1297 " ├─ index: [asset.orgId,asset.name,asset.assetId]\n" + 1298 " ├─ columns: [orgid assetid name val]\n" + 1299 " └─ keys: 'org1', 'color', style.assetId\n" + 1300 "", 1301 ExpectedAnalysis: "Project\n" + 1302 " ├─ columns: [style.assetId]\n" + 1303 " └─ LookupJoin (estimated cost=13.200 rows=4) (actual rows=1 loops=1)\n" + 1304 " ├─ LookupJoin (estimated cost=13.200 rows=4) (actual rows=1 loops=1)\n" + 1305 " │ ├─ Filter\n" + 1306 " │ │ ├─ (((style.val = 'curve') AND (style.name = 'style')) AND (style.orgId = 'org1'))\n" + 1307 " │ │ └─ TableAlias(style)\n" + 1308 " │ │ └─ IndexedTableAccess(asset)\n" + 1309 " │ │ ├─ index: [asset.orgId,asset.name,asset.assetId]\n" + 1310 " │ │ ├─ filters: [{[org1, org1], [style, style], [NULL, ∞)}]\n" + 1311 " │ │ └─ columns: [orgid assetid name val]\n" + 1312 " │ └─ Filter\n" + 1313 " │ ├─ (((dimension.val = 'wide') AND (dimension.name = 'dimension')) AND (dimension.orgId = 'org1'))\n" + 1314 " │ └─ TableAlias(dimension)\n" + 1315 " │ └─ IndexedTableAccess(asset)\n" + 1316 " │ ├─ index: [asset.orgId,asset.name,asset.assetId]\n" + 1317 " │ ├─ columns: [orgid assetid name val]\n" + 1318 " │ └─ keys: 'org1', 'dimension', style.assetId\n" + 1319 " └─ Filter\n" + 1320 " ├─ (((color.val = 'blue') AND (color.name = 'color')) AND (color.orgId = 'org1'))\n" + 1321 " └─ TableAlias(color)\n" + 1322 " └─ IndexedTableAccess(asset)\n" + 1323 " ├─ index: [asset.orgId,asset.name,asset.assetId]\n" + 1324 " ├─ columns: [orgid assetid name val]\n" + 1325 " └─ keys: 'org1', 'color', style.assetId\n" + 1326 "", 1327 }, 1328 { 1329 Query: `select * from mytable alias where i = 1 and s = 'first row'`, 1330 ExpectedPlan: "Filter\n" + 1331 " ├─ Eq\n" + 1332 " │ ├─ alias.s:1!null\n" + 1333 " │ └─ first row (longtext)\n" + 1334 " └─ TableAlias(alias)\n" + 1335 " └─ IndexedTableAccess(mytable)\n" + 1336 " ├─ index: [mytable.i]\n" + 1337 " ├─ static: [{[1, 1]}]\n" + 1338 " ├─ colSet: (1,2)\n" + 1339 " ├─ tableId: 1\n" + 1340 " └─ Table\n" + 1341 " ├─ name: mytable\n" + 1342 " └─ columns: [i s]\n" + 1343 "", 1344 ExpectedEstimates: "Filter\n" + 1345 " ├─ (alias.s = 'first row')\n" + 1346 " └─ TableAlias(alias)\n" + 1347 " └─ IndexedTableAccess(mytable)\n" + 1348 " ├─ index: [mytable.i]\n" + 1349 " ├─ filters: [{[1, 1]}]\n" + 1350 " └─ columns: [i s]\n" + 1351 "", 1352 ExpectedAnalysis: "Filter\n" + 1353 " ├─ (alias.s = 'first row')\n" + 1354 " └─ TableAlias(alias)\n" + 1355 " └─ IndexedTableAccess(mytable)\n" + 1356 " ├─ index: [mytable.i]\n" + 1357 " ├─ filters: [{[1, 1]}]\n" + 1358 " └─ columns: [i s]\n" + 1359 "", 1360 }, 1361 { 1362 Query: `SELECT col1->'$.key1' from (SELECT JSON_OBJECT('key1', 1, 'key2', 'abc')) as dt(col1);`, 1363 ExpectedPlan: "Project\n" + 1364 " ├─ columns: [json_extract(dt.col1, '$.key1') as col1->'$.key1']\n" + 1365 " └─ SubqueryAlias\n" + 1366 " ├─ name: dt\n" + 1367 " ├─ outerVisibility: false\n" + 1368 " ├─ isLateral: false\n" + 1369 " ├─ cacheable: true\n" + 1370 " ├─ colSet: (1)\n" + 1371 " ├─ tableId: 1\n" + 1372 " └─ Project\n" + 1373 " ├─ columns: [json_object('key1',1,'key2','abc') as JSON_OBJECT('key1', 1, 'key2', 'abc')]\n" + 1374 " └─ Table\n" + 1375 " ├─ name: \n" + 1376 " ├─ columns: []\n" + 1377 " ├─ colSet: ()\n" + 1378 " └─ tableId: 0\n" + 1379 "", 1380 ExpectedEstimates: "Project\n" + 1381 " ├─ columns: [json_extract(dt.col1, '$.key1') as col1->'$.key1']\n" + 1382 " └─ SubqueryAlias\n" + 1383 " ├─ name: dt\n" + 1384 " ├─ outerVisibility: false\n" + 1385 " ├─ isLateral: false\n" + 1386 " ├─ cacheable: true\n" + 1387 " └─ Project\n" + 1388 " ├─ columns: [json_object('key1',1,'key2','abc') as JSON_OBJECT('key1', 1, 'key2', 'abc')]\n" + 1389 " └─ Table\n" + 1390 " └─ name: \n" + 1391 "", 1392 ExpectedAnalysis: "Project\n" + 1393 " ├─ columns: [json_extract(dt.col1, '$.key1') as col1->'$.key1']\n" + 1394 " └─ SubqueryAlias\n" + 1395 " ├─ name: dt\n" + 1396 " ├─ outerVisibility: false\n" + 1397 " ├─ isLateral: false\n" + 1398 " ├─ cacheable: true\n" + 1399 " └─ Project\n" + 1400 " ├─ columns: [json_object('key1',1,'key2','abc') as JSON_OBJECT('key1', 1, 'key2', 'abc')]\n" + 1401 " └─ Table\n" + 1402 " └─ name: \n" + 1403 "", 1404 }, 1405 { 1406 Query: `SELECT col1->>'$.key1' from (SELECT JSON_OBJECT('key1', 1, 'key2', 'abc')) as dt(col1);`, 1407 ExpectedPlan: "Project\n" + 1408 " ├─ columns: [json_unquote(json_extract(dt.col1, '$.key1')) as col1->>'$.key1']\n" + 1409 " └─ SubqueryAlias\n" + 1410 " ├─ name: dt\n" + 1411 " ├─ outerVisibility: false\n" + 1412 " ├─ isLateral: false\n" + 1413 " ├─ cacheable: true\n" + 1414 " ├─ colSet: (1)\n" + 1415 " ├─ tableId: 1\n" + 1416 " └─ Project\n" + 1417 " ├─ columns: [json_object('key1',1,'key2','abc') as JSON_OBJECT('key1', 1, 'key2', 'abc')]\n" + 1418 " └─ Table\n" + 1419 " ├─ name: \n" + 1420 " ├─ columns: []\n" + 1421 " ├─ colSet: ()\n" + 1422 " └─ tableId: 0\n" + 1423 "", 1424 ExpectedEstimates: "Project\n" + 1425 " ├─ columns: [json_unquote(json_extract(dt.col1, '$.key1')) as col1->>'$.key1']\n" + 1426 " └─ SubqueryAlias\n" + 1427 " ├─ name: dt\n" + 1428 " ├─ outerVisibility: false\n" + 1429 " ├─ isLateral: false\n" + 1430 " ├─ cacheable: true\n" + 1431 " └─ Project\n" + 1432 " ├─ columns: [json_object('key1',1,'key2','abc') as JSON_OBJECT('key1', 1, 'key2', 'abc')]\n" + 1433 " └─ Table\n" + 1434 " └─ name: \n" + 1435 "", 1436 ExpectedAnalysis: "Project\n" + 1437 " ├─ columns: [json_unquote(json_extract(dt.col1, '$.key1')) as col1->>'$.key1']\n" + 1438 " └─ SubqueryAlias\n" + 1439 " ├─ name: dt\n" + 1440 " ├─ outerVisibility: false\n" + 1441 " ├─ isLateral: false\n" + 1442 " ├─ cacheable: true\n" + 1443 " └─ Project\n" + 1444 " ├─ columns: [json_object('key1',1,'key2','abc') as JSON_OBJECT('key1', 1, 'key2', 'abc')]\n" + 1445 " └─ Table\n" + 1446 " └─ name: \n" + 1447 "", 1448 }, 1449 { 1450 Query: ` 1451 WITH RECURSIVE included_parts(sub_part, part, quantity) AS ( 1452 SELECT sub_part, part, quantity FROM parts WHERE part = (select part from parts where part = 'pie' and sub_part = 'crust') 1453 UNION ALL 1454 SELECT p.sub_part, p.part, p.quantity 1455 FROM included_parts AS pr, parts AS p 1456 WHERE p.part = pr.sub_part 1457 ) 1458 SELECT sub_part, sum(quantity) as total_quantity 1459 FROM included_parts 1460 GROUP BY sub_part`, 1461 ExpectedPlan: "Project\n" + 1462 " ├─ columns: [included_parts.sub_part:1!null, sum(included_parts.quantity):0!null as total_quantity]\n" + 1463 " └─ GroupBy\n" + 1464 " ├─ select: SUM(included_parts.quantity:2!null), included_parts.sub_part:0!null\n" + 1465 " ├─ group: included_parts.sub_part:0!null\n" + 1466 " └─ SubqueryAlias\n" + 1467 " ├─ name: included_parts\n" + 1468 " ├─ outerVisibility: false\n" + 1469 " ├─ isLateral: false\n" + 1470 " ├─ cacheable: true\n" + 1471 " ├─ colSet: (7-9)\n" + 1472 " ├─ tableId: 3\n" + 1473 " └─ RecursiveCTE\n" + 1474 " └─ Union all\n" + 1475 " ├─ Project\n" + 1476 " │ ├─ columns: [parts.sub_part:1!null, parts.part:0!null, parts.quantity:2!null]\n" + 1477 " │ └─ Project\n" + 1478 " │ ├─ columns: [parts.part:0!null, parts.sub_part:1!null, parts.quantity:2!null]\n" + 1479 " │ └─ MergeJoin\n" + 1480 " │ ├─ cmp: Eq\n" + 1481 " │ │ ├─ parts.part:0!null\n" + 1482 " │ │ └─ parts_1.part:3!null\n" + 1483 " │ ├─ IndexedTableAccess(parts)\n" + 1484 " │ │ ├─ index: [parts.part,parts.sub_part]\n" + 1485 " │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 1486 " │ │ ├─ colSet: (1-3)\n" + 1487 " │ │ ├─ tableId: 1\n" + 1488 " │ │ └─ Table\n" + 1489 " │ │ ├─ name: parts\n" + 1490 " │ │ └─ columns: [part sub_part quantity]\n" + 1491 " │ └─ Project\n" + 1492 " │ ├─ columns: [parts_1.part:0!null]\n" + 1493 " │ └─ Filter\n" + 1494 " │ ├─ AND\n" + 1495 " │ │ ├─ Eq\n" + 1496 " │ │ │ ├─ parts_1.part:0!null\n" + 1497 " │ │ │ └─ pie (longtext)\n" + 1498 " │ │ └─ Eq\n" + 1499 " │ │ ├─ parts_1.sub_part:1!null\n" + 1500 " │ │ └─ crust (longtext)\n" + 1501 " │ └─ TableAlias(parts_1)\n" + 1502 " │ └─ IndexedTableAccess(parts)\n" + 1503 " │ ├─ index: [parts.part,parts.sub_part]\n" + 1504 " │ ├─ static: [{[pie, pie], [NULL, ∞)}]\n" + 1505 " │ ├─ colSet: (4-6)\n" + 1506 " │ ├─ tableId: 2\n" + 1507 " │ └─ Table\n" + 1508 " │ ├─ name: parts\n" + 1509 " │ └─ columns: [part sub_part quantity]\n" + 1510 " └─ Project\n" + 1511 " ├─ columns: [p.sub_part:4!null, p.part:3!null, p.quantity:5!null]\n" + 1512 " └─ LookupJoin\n" + 1513 " ├─ TableAlias(pr)\n" + 1514 " │ └─ RecursiveTable(included_parts)\n" + 1515 " └─ TableAlias(p)\n" + 1516 " └─ IndexedTableAccess(parts)\n" + 1517 " ├─ index: [parts.part,parts.sub_part]\n" + 1518 " ├─ keys: [pr.sub_part:0!null]\n" + 1519 " ├─ colSet: (13-15)\n" + 1520 " ├─ tableId: 6\n" + 1521 " └─ Table\n" + 1522 " ├─ name: parts\n" + 1523 " └─ columns: [part sub_part quantity]\n" + 1524 "", 1525 ExpectedEstimates: "Project\n" + 1526 " ├─ columns: [included_parts.sub_part, sum(included_parts.quantity) as total_quantity]\n" + 1527 " └─ GroupBy\n" + 1528 " ├─ SelectedExprs(SUM(included_parts.quantity), included_parts.sub_part)\n" + 1529 " ├─ Grouping(included_parts.sub_part)\n" + 1530 " └─ SubqueryAlias\n" + 1531 " ├─ name: included_parts\n" + 1532 " ├─ outerVisibility: false\n" + 1533 " ├─ isLateral: false\n" + 1534 " ├─ cacheable: true\n" + 1535 " └─ RecursiveCTE\n" + 1536 " └─ Union all\n" + 1537 " ├─ Project\n" + 1538 " │ ├─ columns: [parts.sub_part, parts.part, parts.quantity]\n" + 1539 " │ └─ Project\n" + 1540 " │ ├─ columns: [parts.part, parts.sub_part, parts.quantity]\n" + 1541 " │ └─ MergeJoin\n" + 1542 " │ ├─ cmp: (parts.part = parts_1.part)\n" + 1543 " │ ├─ IndexedTableAccess(parts)\n" + 1544 " │ │ ├─ index: [parts.part,parts.sub_part]\n" + 1545 " │ │ └─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 1546 " │ └─ Project\n" + 1547 " │ ├─ columns: [parts_1.part]\n" + 1548 " │ └─ Filter\n" + 1549 " │ ├─ ((parts_1.part = 'pie') AND (parts_1.sub_part = 'crust'))\n" + 1550 " │ └─ TableAlias(parts_1)\n" + 1551 " │ └─ IndexedTableAccess(parts)\n" + 1552 " │ ├─ index: [parts.part,parts.sub_part]\n" + 1553 " │ └─ filters: [{[pie, pie], [NULL, ∞)}]\n" + 1554 " └─ Project\n" + 1555 " ├─ columns: [p.sub_part, p.part, p.quantity]\n" + 1556 " └─ LookupJoin\n" + 1557 " ├─ TableAlias(pr)\n" + 1558 " │ └─ RecursiveTable(included_parts)\n" + 1559 " └─ TableAlias(p)\n" + 1560 " └─ IndexedTableAccess(parts)\n" + 1561 " ├─ index: [parts.part,parts.sub_part]\n" + 1562 " ├─ columns: [part sub_part quantity]\n" + 1563 " └─ keys: pr.sub_part\n" + 1564 "", 1565 ExpectedAnalysis: "Project\n" + 1566 " ├─ columns: [included_parts.sub_part, sum(included_parts.quantity) as total_quantity]\n" + 1567 " └─ GroupBy\n" + 1568 " ├─ SelectedExprs(SUM(included_parts.quantity), included_parts.sub_part)\n" + 1569 " ├─ Grouping(included_parts.sub_part)\n" + 1570 " └─ SubqueryAlias\n" + 1571 " ├─ name: included_parts\n" + 1572 " ├─ outerVisibility: false\n" + 1573 " ├─ isLateral: false\n" + 1574 " ├─ cacheable: true\n" + 1575 " └─ RecursiveCTE\n" + 1576 " └─ Union all\n" + 1577 " ├─ Project\n" + 1578 " │ ├─ columns: [parts.sub_part, parts.part, parts.quantity]\n" + 1579 " │ └─ Project\n" + 1580 " │ ├─ columns: [parts.part, parts.sub_part, parts.quantity]\n" + 1581 " │ └─ MergeJoin\n" + 1582 " │ ├─ cmp: (parts.part = parts_1.part)\n" + 1583 " │ ├─ IndexedTableAccess(parts)\n" + 1584 " │ │ ├─ index: [parts.part,parts.sub_part]\n" + 1585 " │ │ └─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 1586 " │ └─ Project\n" + 1587 " │ ├─ columns: [parts_1.part]\n" + 1588 " │ └─ Filter\n" + 1589 " │ ├─ ((parts_1.part = 'pie') AND (parts_1.sub_part = 'crust'))\n" + 1590 " │ └─ TableAlias(parts_1)\n" + 1591 " │ └─ IndexedTableAccess(parts)\n" + 1592 " │ ├─ index: [parts.part,parts.sub_part]\n" + 1593 " │ └─ filters: [{[pie, pie], [NULL, ∞)}]\n" + 1594 " └─ Project\n" + 1595 " ├─ columns: [p.sub_part, p.part, p.quantity]\n" + 1596 " └─ LookupJoin\n" + 1597 " ├─ TableAlias(pr)\n" + 1598 " │ └─ RecursiveTable(included_parts)\n" + 1599 " └─ TableAlias(p)\n" + 1600 " └─ IndexedTableAccess(parts)\n" + 1601 " ├─ index: [parts.part,parts.sub_part]\n" + 1602 " ├─ columns: [part sub_part quantity]\n" + 1603 " └─ keys: pr.sub_part\n" + 1604 "", 1605 }, 1606 { 1607 Query: ` 1608 Select x 1609 from (select * from xy) sq1 1610 union all 1611 select u 1612 from (select * from uv) sq2 1613 limit 1 1614 offset 2;`, 1615 ExpectedPlan: "Union all\n" + 1616 " ├─ limit: 1\n" + 1617 " ├─ offset: 2\n" + 1618 " ├─ Project\n" + 1619 " │ ├─ columns: [sq1.x:0!null]\n" + 1620 " │ └─ SubqueryAlias\n" + 1621 " │ ├─ name: sq1\n" + 1622 " │ ├─ outerVisibility: false\n" + 1623 " │ ├─ isLateral: false\n" + 1624 " │ ├─ cacheable: true\n" + 1625 " │ ├─ colSet: (3,4)\n" + 1626 " │ ├─ tableId: 2\n" + 1627 " │ └─ Table\n" + 1628 " │ ├─ name: xy\n" + 1629 " │ ├─ columns: [x y]\n" + 1630 " │ ├─ colSet: (1,2)\n" + 1631 " │ └─ tableId: 1\n" + 1632 " └─ Project\n" + 1633 " ├─ columns: [sq2.u:0!null]\n" + 1634 " └─ SubqueryAlias\n" + 1635 " ├─ name: sq2\n" + 1636 " ├─ outerVisibility: false\n" + 1637 " ├─ isLateral: false\n" + 1638 " ├─ cacheable: true\n" + 1639 " ├─ colSet: (7,8)\n" + 1640 " ├─ tableId: 4\n" + 1641 " └─ Table\n" + 1642 " ├─ name: uv\n" + 1643 " ├─ columns: [u v]\n" + 1644 " ├─ colSet: (5,6)\n" + 1645 " └─ tableId: 3\n" + 1646 "", 1647 ExpectedEstimates: "Union all\n" + 1648 " ├─ limit: 1\n" + 1649 " ├─ offset: 2\n" + 1650 " ├─ Project\n" + 1651 " │ ├─ columns: [sq1.x]\n" + 1652 " │ └─ SubqueryAlias\n" + 1653 " │ ├─ name: sq1\n" + 1654 " │ ├─ outerVisibility: false\n" + 1655 " │ ├─ isLateral: false\n" + 1656 " │ ├─ cacheable: true\n" + 1657 " │ └─ Table\n" + 1658 " │ ├─ name: xy\n" + 1659 " │ └─ columns: [x y]\n" + 1660 " └─ Project\n" + 1661 " ├─ columns: [sq2.u]\n" + 1662 " └─ SubqueryAlias\n" + 1663 " ├─ name: sq2\n" + 1664 " ├─ outerVisibility: false\n" + 1665 " ├─ isLateral: false\n" + 1666 " ├─ cacheable: true\n" + 1667 " └─ Table\n" + 1668 " ├─ name: uv\n" + 1669 " └─ columns: [u v]\n" + 1670 "", 1671 ExpectedAnalysis: "Union all\n" + 1672 " ├─ limit: 1\n" + 1673 " ├─ offset: 2\n" + 1674 " ├─ Project\n" + 1675 " │ ├─ columns: [sq1.x]\n" + 1676 " │ └─ SubqueryAlias\n" + 1677 " │ ├─ name: sq1\n" + 1678 " │ ├─ outerVisibility: false\n" + 1679 " │ ├─ isLateral: false\n" + 1680 " │ ├─ cacheable: true\n" + 1681 " │ └─ Table\n" + 1682 " │ ├─ name: xy\n" + 1683 " │ └─ columns: [x y]\n" + 1684 " └─ Project\n" + 1685 " ├─ columns: [sq2.u]\n" + 1686 " └─ SubqueryAlias\n" + 1687 " ├─ name: sq2\n" + 1688 " ├─ outerVisibility: false\n" + 1689 " ├─ isLateral: false\n" + 1690 " ├─ cacheable: true\n" + 1691 " └─ Table\n" + 1692 " ├─ name: uv\n" + 1693 " └─ columns: [u v]\n" + 1694 "", 1695 }, 1696 { 1697 Query: ` 1698 Select * from ( 1699 With recursive cte(s) as (select 1 union select x from xy join cte on x = s) 1700 Select * from cte 1701 Union 1702 Select x from xy where x in (select * from cte where x = 1) 1703 ) dt;`, 1704 ExpectedPlan: "SubqueryAlias\n" + 1705 " ├─ name: dt\n" + 1706 " ├─ outerVisibility: false\n" + 1707 " ├─ isLateral: false\n" + 1708 " ├─ cacheable: true\n" + 1709 " ├─ colSet: (7)\n" + 1710 " ├─ tableId: 7\n" + 1711 " └─ Union distinct\n" + 1712 " ├─ Project\n" + 1713 " │ ├─ columns: [cte.s:0!null as s]\n" + 1714 " │ └─ SubqueryAlias\n" + 1715 " │ ├─ name: cte\n" + 1716 " │ ├─ outerVisibility: false\n" + 1717 " │ ├─ isLateral: false\n" + 1718 " │ ├─ cacheable: true\n" + 1719 " │ ├─ colSet: (2)\n" + 1720 " │ ├─ tableId: 1\n" + 1721 " │ └─ RecursiveCTE\n" + 1722 " │ └─ Union distinct\n" + 1723 " │ ├─ Project\n" + 1724 " │ │ ├─ columns: [1 (tinyint)]\n" + 1725 " │ │ └─ Table\n" + 1726 " │ │ ├─ name: \n" + 1727 " │ │ ├─ columns: []\n" + 1728 " │ │ ├─ colSet: ()\n" + 1729 " │ │ └─ tableId: 0\n" + 1730 " │ └─ Project\n" + 1731 " │ ├─ columns: [xy.x:1!null]\n" + 1732 " │ └─ LookupJoin\n" + 1733 " │ ├─ RecursiveTable(cte)\n" + 1734 " │ └─ IndexedTableAccess(xy)\n" + 1735 " │ ├─ index: [xy.x]\n" + 1736 " │ ├─ keys: [cte.s:0!null]\n" + 1737 " │ ├─ colSet: (3,4)\n" + 1738 " │ ├─ tableId: 3\n" + 1739 " │ └─ Table\n" + 1740 " │ ├─ name: xy\n" + 1741 " │ └─ columns: [x]\n" + 1742 " └─ Project\n" + 1743 " ├─ columns: [convert\n" + 1744 " │ ├─ type: signed\n" + 1745 " │ └─ xy.x:0!null\n" + 1746 " │ as x]\n" + 1747 " └─ Project\n" + 1748 " ├─ columns: [xy.x:0!null]\n" + 1749 " └─ Filter\n" + 1750 " ├─ InSubquery\n" + 1751 " │ ├─ left: xy.x:0!null\n" + 1752 " │ └─ right: Subquery\n" + 1753 " │ ├─ cacheable: false\n" + 1754 " │ ├─ alias-string: select * from cte where x = 1\n" + 1755 " │ └─ Filter\n" + 1756 " │ ├─ Eq\n" + 1757 " │ │ ├─ xy.x:0!null\n" + 1758 " │ │ └─ 1 (tinyint)\n" + 1759 " │ └─ SubqueryAlias\n" + 1760 " │ ├─ name: cte\n" + 1761 " │ ├─ outerVisibility: true\n" + 1762 " │ ├─ isLateral: false\n" + 1763 " │ ├─ cacheable: true\n" + 1764 " │ ├─ colSet: (2)\n" + 1765 " │ ├─ tableId: 1\n" + 1766 " │ └─ RecursiveCTE\n" + 1767 " │ └─ Union distinct\n" + 1768 " │ ├─ Project\n" + 1769 " │ │ ├─ columns: [1 (tinyint)]\n" + 1770 " │ │ └─ Table\n" + 1771 " │ │ ├─ name: \n" + 1772 " │ │ ├─ columns: []\n" + 1773 " │ │ ├─ colSet: ()\n" + 1774 " │ │ └─ tableId: 0\n" + 1775 " │ └─ Project\n" + 1776 " │ ├─ columns: [xy.x:3!null]\n" + 1777 " │ └─ LookupJoin\n" + 1778 " │ ├─ RecursiveTable(cte)\n" + 1779 " │ └─ IndexedTableAccess(xy)\n" + 1780 " │ ├─ index: [xy.x]\n" + 1781 " │ ├─ keys: [cte.s:2!null]\n" + 1782 " │ ├─ colSet: (3,4)\n" + 1783 " │ ├─ tableId: 3\n" + 1784 " │ └─ Table\n" + 1785 " │ ├─ name: xy\n" + 1786 " │ └─ columns: [x]\n" + 1787 " └─ Table\n" + 1788 " ├─ name: xy\n" + 1789 " ├─ columns: [x y]\n" + 1790 " ├─ colSet: (5,6)\n" + 1791 " └─ tableId: 5\n" + 1792 "", 1793 ExpectedEstimates: "SubqueryAlias\n" + 1794 " ├─ name: dt\n" + 1795 " ├─ outerVisibility: false\n" + 1796 " ├─ isLateral: false\n" + 1797 " ├─ cacheable: true\n" + 1798 " └─ Union distinct\n" + 1799 " ├─ Project\n" + 1800 " │ ├─ columns: [cte.s as s]\n" + 1801 " │ └─ SubqueryAlias\n" + 1802 " │ ├─ name: cte\n" + 1803 " │ ├─ outerVisibility: false\n" + 1804 " │ ├─ isLateral: false\n" + 1805 " │ ├─ cacheable: true\n" + 1806 " │ └─ RecursiveCTE\n" + 1807 " │ └─ Union distinct\n" + 1808 " │ ├─ Project\n" + 1809 " │ │ ├─ columns: [1]\n" + 1810 " │ │ └─ Table\n" + 1811 " │ │ └─ name: \n" + 1812 " │ └─ Project\n" + 1813 " │ ├─ columns: [xy.x]\n" + 1814 " │ └─ LookupJoin\n" + 1815 " │ ├─ RecursiveTable(cte)\n" + 1816 " │ └─ IndexedTableAccess(xy)\n" + 1817 " │ ├─ index: [xy.x]\n" + 1818 " │ ├─ columns: [x]\n" + 1819 " │ └─ keys: cte.s\n" + 1820 " └─ Project\n" + 1821 " ├─ columns: [convert(xy.x, signed) as x]\n" + 1822 " └─ Project\n" + 1823 " ├─ columns: [xy.x]\n" + 1824 " └─ Filter\n" + 1825 " ├─ InSubquery\n" + 1826 " │ ├─ left: xy.x\n" + 1827 " │ └─ right: Subquery\n" + 1828 " │ ├─ cacheable: false\n" + 1829 " │ └─ Filter\n" + 1830 " │ ├─ (xy.x = 1)\n" + 1831 " │ └─ SubqueryAlias\n" + 1832 " │ ├─ name: cte\n" + 1833 " │ ├─ outerVisibility: true\n" + 1834 " │ ├─ isLateral: false\n" + 1835 " │ ├─ cacheable: true\n" + 1836 " │ └─ RecursiveCTE\n" + 1837 " │ └─ Union distinct\n" + 1838 " │ ├─ Project\n" + 1839 " │ │ ├─ columns: [1]\n" + 1840 " │ │ └─ Table\n" + 1841 " │ │ └─ name: \n" + 1842 " │ └─ Project\n" + 1843 " │ ├─ columns: [xy.x]\n" + 1844 " │ └─ LookupJoin\n" + 1845 " │ ├─ RecursiveTable(cte)\n" + 1846 " │ └─ IndexedTableAccess(xy)\n" + 1847 " │ ├─ index: [xy.x]\n" + 1848 " │ ├─ columns: [x]\n" + 1849 " │ └─ keys: cte.s\n" + 1850 " └─ Table\n" + 1851 " └─ name: xy\n" + 1852 "", 1853 ExpectedAnalysis: "SubqueryAlias\n" + 1854 " ├─ name: dt\n" + 1855 " ├─ outerVisibility: false\n" + 1856 " ├─ isLateral: false\n" + 1857 " ├─ cacheable: true\n" + 1858 " └─ Union distinct\n" + 1859 " ├─ Project\n" + 1860 " │ ├─ columns: [cte.s as s]\n" + 1861 " │ └─ SubqueryAlias\n" + 1862 " │ ├─ name: cte\n" + 1863 " │ ├─ outerVisibility: false\n" + 1864 " │ ├─ isLateral: false\n" + 1865 " │ ├─ cacheable: true\n" + 1866 " │ └─ RecursiveCTE\n" + 1867 " │ └─ Union distinct\n" + 1868 " │ ├─ Project\n" + 1869 " │ │ ├─ columns: [1]\n" + 1870 " │ │ └─ Table\n" + 1871 " │ │ └─ name: \n" + 1872 " │ └─ Project\n" + 1873 " │ ├─ columns: [xy.x]\n" + 1874 " │ └─ LookupJoin\n" + 1875 " │ ├─ RecursiveTable(cte)\n" + 1876 " │ └─ IndexedTableAccess(xy)\n" + 1877 " │ ├─ index: [xy.x]\n" + 1878 " │ ├─ columns: [x]\n" + 1879 " │ └─ keys: cte.s\n" + 1880 " └─ Project\n" + 1881 " ├─ columns: [convert(xy.x, signed) as x]\n" + 1882 " └─ Project\n" + 1883 " ├─ columns: [xy.x]\n" + 1884 " └─ Filter\n" + 1885 " ├─ InSubquery\n" + 1886 " │ ├─ left: xy.x\n" + 1887 " │ └─ right: Subquery\n" + 1888 " │ ├─ cacheable: false\n" + 1889 " │ └─ Filter\n" + 1890 " │ ├─ (xy.x = 1)\n" + 1891 " │ └─ SubqueryAlias\n" + 1892 " │ ├─ name: cte\n" + 1893 " │ ├─ outerVisibility: true\n" + 1894 " │ ├─ isLateral: false\n" + 1895 " │ ├─ cacheable: true\n" + 1896 " │ └─ RecursiveCTE\n" + 1897 " │ └─ Union distinct\n" + 1898 " │ ├─ Project\n" + 1899 " │ │ ├─ columns: [1]\n" + 1900 " │ │ └─ Table\n" + 1901 " │ │ └─ name: \n" + 1902 " │ └─ Project\n" + 1903 " │ ├─ columns: [xy.x]\n" + 1904 " │ └─ LookupJoin\n" + 1905 " │ ├─ RecursiveTable(cte)\n" + 1906 " │ └─ IndexedTableAccess(xy)\n" + 1907 " │ ├─ index: [xy.x]\n" + 1908 " │ ├─ columns: [x]\n" + 1909 " │ └─ keys: cte.s\n" + 1910 " └─ Table\n" + 1911 " └─ name: xy\n" + 1912 "", 1913 }, 1914 { 1915 Query: ` 1916 Select * from ( 1917 With recursive cte(s) as (select 1 union select x from xy join cte on x = s) 1918 Select * from cte 1919 Union 1920 Select x from xy where x in (select * from cte) 1921 ) dt;`, 1922 ExpectedPlan: "SubqueryAlias\n" + 1923 " ├─ name: dt\n" + 1924 " ├─ outerVisibility: false\n" + 1925 " ├─ isLateral: false\n" + 1926 " ├─ cacheable: true\n" + 1927 " ├─ colSet: (7)\n" + 1928 " ├─ tableId: 7\n" + 1929 " └─ Union distinct\n" + 1930 " ├─ Project\n" + 1931 " │ ├─ columns: [cte.s:0!null as s]\n" + 1932 " │ └─ SubqueryAlias\n" + 1933 " │ ├─ name: cte\n" + 1934 " │ ├─ outerVisibility: false\n" + 1935 " │ ├─ isLateral: false\n" + 1936 " │ ├─ cacheable: true\n" + 1937 " │ ├─ colSet: (2)\n" + 1938 " │ ├─ tableId: 1\n" + 1939 " │ └─ RecursiveCTE\n" + 1940 " │ └─ Union distinct\n" + 1941 " │ ├─ Project\n" + 1942 " │ │ ├─ columns: [1 (tinyint)]\n" + 1943 " │ │ └─ Table\n" + 1944 " │ │ ├─ name: \n" + 1945 " │ │ ├─ columns: []\n" + 1946 " │ │ ├─ colSet: ()\n" + 1947 " │ │ └─ tableId: 0\n" + 1948 " │ └─ Project\n" + 1949 " │ ├─ columns: [xy.x:1!null]\n" + 1950 " │ └─ LookupJoin\n" + 1951 " │ ├─ RecursiveTable(cte)\n" + 1952 " │ └─ IndexedTableAccess(xy)\n" + 1953 " │ ├─ index: [xy.x]\n" + 1954 " │ ├─ keys: [cte.s:0!null]\n" + 1955 " │ ├─ colSet: (3,4)\n" + 1956 " │ ├─ tableId: 3\n" + 1957 " │ └─ Table\n" + 1958 " │ ├─ name: xy\n" + 1959 " │ └─ columns: [x]\n" + 1960 " └─ Project\n" + 1961 " ├─ columns: [convert\n" + 1962 " │ ├─ type: signed\n" + 1963 " │ └─ xy.x:0!null\n" + 1964 " │ as x]\n" + 1965 " └─ Project\n" + 1966 " ├─ columns: [xy.x:1!null]\n" + 1967 " └─ LookupJoin\n" + 1968 " ├─ Eq\n" + 1969 " │ ├─ xy.x:1!null\n" + 1970 " │ └─ cte.s:0!null\n" + 1971 " ├─ Distinct\n" + 1972 " │ └─ SubqueryAlias\n" + 1973 " │ ├─ name: cte\n" + 1974 " │ ├─ outerVisibility: false\n" + 1975 " │ ├─ isLateral: false\n" + 1976 " │ ├─ cacheable: true\n" + 1977 " │ ├─ colSet: (2)\n" + 1978 " │ ├─ tableId: 1\n" + 1979 " │ └─ RecursiveCTE\n" + 1980 " │ └─ Union distinct\n" + 1981 " │ ├─ Project\n" + 1982 " │ │ ├─ columns: [1 (tinyint)]\n" + 1983 " │ │ └─ Table\n" + 1984 " │ │ ├─ name: \n" + 1985 " │ │ ├─ columns: []\n" + 1986 " │ │ ├─ colSet: ()\n" + 1987 " │ │ └─ tableId: 0\n" + 1988 " │ └─ Project\n" + 1989 " │ ├─ columns: [xy.x:1!null]\n" + 1990 " │ └─ LookupJoin\n" + 1991 " │ ├─ RecursiveTable(cte)\n" + 1992 " │ └─ IndexedTableAccess(xy)\n" + 1993 " │ ├─ index: [xy.x]\n" + 1994 " │ ├─ keys: [cte.s:0!null]\n" + 1995 " │ ├─ colSet: (3,4)\n" + 1996 " │ ├─ tableId: 3\n" + 1997 " │ └─ Table\n" + 1998 " │ ├─ name: xy\n" + 1999 " │ └─ columns: [x]\n" + 2000 " └─ IndexedTableAccess(xy)\n" + 2001 " ├─ index: [xy.x]\n" + 2002 " ├─ keys: [cte.s:0!null]\n" + 2003 " ├─ colSet: (5,6)\n" + 2004 " ├─ tableId: 5\n" + 2005 " └─ Table\n" + 2006 " ├─ name: xy\n" + 2007 " └─ columns: [x y]\n" + 2008 "", 2009 ExpectedEstimates: "SubqueryAlias\n" + 2010 " ├─ name: dt\n" + 2011 " ├─ outerVisibility: false\n" + 2012 " ├─ isLateral: false\n" + 2013 " ├─ cacheable: true\n" + 2014 " └─ Union distinct\n" + 2015 " ├─ Project\n" + 2016 " │ ├─ columns: [cte.s as s]\n" + 2017 " │ └─ SubqueryAlias\n" + 2018 " │ ├─ name: cte\n" + 2019 " │ ├─ outerVisibility: false\n" + 2020 " │ ├─ isLateral: false\n" + 2021 " │ ├─ cacheable: true\n" + 2022 " │ └─ RecursiveCTE\n" + 2023 " │ └─ Union distinct\n" + 2024 " │ ├─ Project\n" + 2025 " │ │ ├─ columns: [1]\n" + 2026 " │ │ └─ Table\n" + 2027 " │ │ └─ name: \n" + 2028 " │ └─ Project\n" + 2029 " │ ├─ columns: [xy.x]\n" + 2030 " │ └─ LookupJoin\n" + 2031 " │ ├─ RecursiveTable(cte)\n" + 2032 " │ └─ IndexedTableAccess(xy)\n" + 2033 " │ ├─ index: [xy.x]\n" + 2034 " │ ├─ columns: [x]\n" + 2035 " │ └─ keys: cte.s\n" + 2036 " └─ Project\n" + 2037 " ├─ columns: [convert(xy.x, signed) as x]\n" + 2038 " └─ Project\n" + 2039 " ├─ columns: [xy.x]\n" + 2040 " └─ LookupJoin\n" + 2041 " ├─ (xy.x = cte.s)\n" + 2042 " ├─ Distinct\n" + 2043 " │ └─ SubqueryAlias\n" + 2044 " │ ├─ name: cte\n" + 2045 " │ ├─ outerVisibility: false\n" + 2046 " │ ├─ isLateral: false\n" + 2047 " │ ├─ cacheable: true\n" + 2048 " │ └─ RecursiveCTE\n" + 2049 " │ └─ Union distinct\n" + 2050 " │ ├─ Project\n" + 2051 " │ │ ├─ columns: [1]\n" + 2052 " │ │ └─ Table\n" + 2053 " │ │ └─ name: \n" + 2054 " │ └─ Project\n" + 2055 " │ ├─ columns: [xy.x]\n" + 2056 " │ └─ LookupJoin\n" + 2057 " │ ├─ RecursiveTable(cte)\n" + 2058 " │ └─ IndexedTableAccess(xy)\n" + 2059 " │ ├─ index: [xy.x]\n" + 2060 " │ ├─ columns: [x]\n" + 2061 " │ └─ keys: cte.s\n" + 2062 " └─ IndexedTableAccess(xy)\n" + 2063 " ├─ index: [xy.x]\n" + 2064 " └─ keys: cte.s\n" + 2065 "", 2066 ExpectedAnalysis: "SubqueryAlias\n" + 2067 " ├─ name: dt\n" + 2068 " ├─ outerVisibility: false\n" + 2069 " ├─ isLateral: false\n" + 2070 " ├─ cacheable: true\n" + 2071 " └─ Union distinct\n" + 2072 " ├─ Project\n" + 2073 " │ ├─ columns: [cte.s as s]\n" + 2074 " │ └─ SubqueryAlias\n" + 2075 " │ ├─ name: cte\n" + 2076 " │ ├─ outerVisibility: false\n" + 2077 " │ ├─ isLateral: false\n" + 2078 " │ ├─ cacheable: true\n" + 2079 " │ └─ RecursiveCTE\n" + 2080 " │ └─ Union distinct\n" + 2081 " │ ├─ Project\n" + 2082 " │ │ ├─ columns: [1]\n" + 2083 " │ │ └─ Table\n" + 2084 " │ │ └─ name: \n" + 2085 " │ └─ Project\n" + 2086 " │ ├─ columns: [xy.x]\n" + 2087 " │ └─ LookupJoin\n" + 2088 " │ ├─ RecursiveTable(cte)\n" + 2089 " │ └─ IndexedTableAccess(xy)\n" + 2090 " │ ├─ index: [xy.x]\n" + 2091 " │ ├─ columns: [x]\n" + 2092 " │ └─ keys: cte.s\n" + 2093 " └─ Project\n" + 2094 " ├─ columns: [convert(xy.x, signed) as x]\n" + 2095 " └─ Project\n" + 2096 " ├─ columns: [xy.x]\n" + 2097 " └─ LookupJoin\n" + 2098 " ├─ (xy.x = cte.s)\n" + 2099 " ├─ Distinct\n" + 2100 " │ └─ SubqueryAlias\n" + 2101 " │ ├─ name: cte\n" + 2102 " │ ├─ outerVisibility: false\n" + 2103 " │ ├─ isLateral: false\n" + 2104 " │ ├─ cacheable: true\n" + 2105 " │ └─ RecursiveCTE\n" + 2106 " │ └─ Union distinct\n" + 2107 " │ ├─ Project\n" + 2108 " │ │ ├─ columns: [1]\n" + 2109 " │ │ └─ Table\n" + 2110 " │ │ └─ name: \n" + 2111 " │ └─ Project\n" + 2112 " │ ├─ columns: [xy.x]\n" + 2113 " │ └─ LookupJoin\n" + 2114 " │ ├─ RecursiveTable(cte)\n" + 2115 " │ └─ IndexedTableAccess(xy)\n" + 2116 " │ ├─ index: [xy.x]\n" + 2117 " │ ├─ columns: [x]\n" + 2118 " │ └─ keys: cte.s\n" + 2119 " └─ IndexedTableAccess(xy)\n" + 2120 " ├─ index: [xy.x]\n" + 2121 " └─ keys: cte.s\n" + 2122 "", 2123 }, 2124 { 2125 Query: `select /*+ LOOKUP_JOIN(xy,scalarSubq0) */ * from xy where x in (select a from ab);`, 2126 ExpectedPlan: "Project\n" + 2127 " ├─ columns: [xy.x:0!null, xy.y:1]\n" + 2128 " └─ MergeJoin\n" + 2129 " ├─ cmp: Eq\n" + 2130 " │ ├─ xy.x:0!null\n" + 2131 " │ └─ ab.a:2!null\n" + 2132 " ├─ IndexedTableAccess(xy)\n" + 2133 " │ ├─ index: [xy.x]\n" + 2134 " │ ├─ static: [{[NULL, ∞)}]\n" + 2135 " │ ├─ colSet: (1,2)\n" + 2136 " │ ├─ tableId: 1\n" + 2137 " │ └─ Table\n" + 2138 " │ ├─ name: xy\n" + 2139 " │ └─ columns: [x y]\n" + 2140 " └─ Project\n" + 2141 " ├─ columns: [ab.a:0!null]\n" + 2142 " └─ IndexedTableAccess(ab)\n" + 2143 " ├─ index: [ab.a]\n" + 2144 " ├─ static: [{[NULL, ∞)}]\n" + 2145 " ├─ colSet: (3,4)\n" + 2146 " ├─ tableId: 2\n" + 2147 " └─ Table\n" + 2148 " ├─ name: ab\n" + 2149 " └─ columns: [a b]\n" + 2150 "", 2151 ExpectedEstimates: "Project\n" + 2152 " ├─ columns: [xy.x, xy.y]\n" + 2153 " └─ MergeJoin (estimated cost=2030.000 rows=1000)\n" + 2154 " ├─ cmp: (xy.x = ab.a)\n" + 2155 " ├─ IndexedTableAccess(xy)\n" + 2156 " │ ├─ index: [xy.x]\n" + 2157 " │ └─ filters: [{[NULL, ∞)}]\n" + 2158 " └─ Project\n" + 2159 " ├─ columns: [ab.a]\n" + 2160 " └─ IndexedTableAccess(ab)\n" + 2161 " ├─ index: [ab.a]\n" + 2162 " └─ filters: [{[NULL, ∞)}]\n" + 2163 "", 2164 ExpectedAnalysis: "Project\n" + 2165 " ├─ columns: [xy.x, xy.y]\n" + 2166 " └─ MergeJoin (estimated cost=2030.000 rows=1000) (actual rows=4 loops=1)\n" + 2167 " ├─ cmp: (xy.x = ab.a)\n" + 2168 " ├─ IndexedTableAccess(xy)\n" + 2169 " │ ├─ index: [xy.x]\n" + 2170 " │ └─ filters: [{[NULL, ∞)}]\n" + 2171 " └─ Project\n" + 2172 " ├─ columns: [ab.a]\n" + 2173 " └─ IndexedTableAccess(ab)\n" + 2174 " ├─ index: [ab.a]\n" + 2175 " └─ filters: [{[NULL, ∞)}]\n" + 2176 "", 2177 }, 2178 { 2179 Query: `select /*+ LOOKUP_JOIN(xy,ab) MERGE_JOIN(ab,uv) JOIN_ORDER(ab,uv,xy) */ * from xy where EXISTS (select 1 from ab join uv on a = u where x = a);`, 2180 ExpectedPlan: "Project\n" + 2181 " ├─ columns: [xy.x:1!null, xy.y:2]\n" + 2182 " └─ LookupJoin\n" + 2183 " ├─ Eq\n" + 2184 " │ ├─ xy.x:1!null\n" + 2185 " │ └─ ab.a:0!null\n" + 2186 " ├─ OrderedDistinct\n" + 2187 " │ └─ Project\n" + 2188 " │ ├─ columns: [ab.a:0!null]\n" + 2189 " │ └─ MergeJoin\n" + 2190 " │ ├─ cmp: Eq\n" + 2191 " │ │ ├─ ab.a:0!null\n" + 2192 " │ │ └─ uv.u:1!null\n" + 2193 " │ ├─ IndexedTableAccess(ab)\n" + 2194 " │ │ ├─ index: [ab.a]\n" + 2195 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 2196 " │ │ ├─ colSet: (3,4)\n" + 2197 " │ │ ├─ tableId: 2\n" + 2198 " │ │ └─ Table\n" + 2199 " │ │ ├─ name: ab\n" + 2200 " │ │ └─ columns: [a]\n" + 2201 " │ └─ IndexedTableAccess(uv)\n" + 2202 " │ ├─ index: [uv.u]\n" + 2203 " │ ├─ static: [{[NULL, ∞)}]\n" + 2204 " │ ├─ colSet: (5,6)\n" + 2205 " │ ├─ tableId: 3\n" + 2206 " │ └─ Table\n" + 2207 " │ ├─ name: uv\n" + 2208 " │ └─ columns: [u]\n" + 2209 " └─ IndexedTableAccess(xy)\n" + 2210 " ├─ index: [xy.x]\n" + 2211 " ├─ keys: [ab.a:0!null]\n" + 2212 " ├─ colSet: (1,2)\n" + 2213 " ├─ tableId: 1\n" + 2214 " └─ Table\n" + 2215 " ├─ name: xy\n" + 2216 " └─ columns: [x y]\n" + 2217 "", 2218 ExpectedEstimates: "Project\n" + 2219 " ├─ columns: [xy.x, xy.y]\n" + 2220 " └─ LookupJoin (estimated cost=13.200 rows=4)\n" + 2221 " ├─ (xy.x = ab.a)\n" + 2222 " ├─ OrderedDistinct\n" + 2223 " │ └─ Project\n" + 2224 " │ ├─ columns: [ab.a]\n" + 2225 " │ └─ MergeJoin\n" + 2226 " │ ├─ cmp: (ab.a = uv.u)\n" + 2227 " │ ├─ IndexedTableAccess(ab)\n" + 2228 " │ │ ├─ index: [ab.a]\n" + 2229 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 2230 " │ │ └─ columns: [a]\n" + 2231 " │ └─ IndexedTableAccess(uv)\n" + 2232 " │ ├─ index: [uv.u]\n" + 2233 " │ ├─ filters: [{[NULL, ∞)}]\n" + 2234 " │ └─ columns: [u]\n" + 2235 " └─ IndexedTableAccess(xy)\n" + 2236 " ├─ index: [xy.x]\n" + 2237 " └─ keys: ab.a\n" + 2238 "", 2239 ExpectedAnalysis: "Project\n" + 2240 " ├─ columns: [xy.x, xy.y]\n" + 2241 " └─ LookupJoin (estimated cost=13.200 rows=4) (actual rows=4 loops=1)\n" + 2242 " ├─ (xy.x = ab.a)\n" + 2243 " ├─ OrderedDistinct\n" + 2244 " │ └─ Project\n" + 2245 " │ ├─ columns: [ab.a]\n" + 2246 " │ └─ MergeJoin\n" + 2247 " │ ├─ cmp: (ab.a = uv.u)\n" + 2248 " │ ├─ IndexedTableAccess(ab)\n" + 2249 " │ │ ├─ index: [ab.a]\n" + 2250 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 2251 " │ │ └─ columns: [a]\n" + 2252 " │ └─ IndexedTableAccess(uv)\n" + 2253 " │ ├─ index: [uv.u]\n" + 2254 " │ ├─ filters: [{[NULL, ∞)}]\n" + 2255 " │ └─ columns: [u]\n" + 2256 " └─ IndexedTableAccess(xy)\n" + 2257 " ├─ index: [xy.x]\n" + 2258 " └─ keys: ab.a\n" + 2259 "", 2260 }, 2261 { 2262 Query: `select * from uv where not exists (select * from xy where not exists (select * from xy where not(u = 1)))`, 2263 ExpectedPlan: "AntiJoin\n" + 2264 " ├─ Or\n" + 2265 " │ ├─ NOT\n" + 2266 " │ │ └─ EXISTS Subquery\n" + 2267 " │ │ ├─ cacheable: true\n" + 2268 " │ │ ├─ alias-string: select * from xy where not (u = 1)\n" + 2269 " │ │ └─ Table\n" + 2270 " │ │ ├─ name: xy\n" + 2271 " │ │ ├─ columns: [x y]\n" + 2272 " │ │ ├─ colSet: (5,6)\n" + 2273 " │ │ └─ tableId: 3\n" + 2274 " │ └─ Eq\n" + 2275 " │ ├─ uv.u:0!null\n" + 2276 " │ └─ 1 (tinyint)\n" + 2277 " ├─ ProcessTable\n" + 2278 " │ └─ Table\n" + 2279 " │ ├─ name: uv\n" + 2280 " │ └─ columns: [u v]\n" + 2281 " └─ ProcessTable\n" + 2282 " └─ Table\n" + 2283 " ├─ name: xy\n" + 2284 " └─ columns: [x y]\n" + 2285 "", 2286 ExpectedEstimates: "AntiJoin (estimated cost=2024.000 rows=5)\n" + 2287 " ├─ ((NOT(EXISTS Subquery\n" + 2288 " │ ├─ cacheable: true\n" + 2289 " │ └─ Table\n" + 2290 " │ ├─ name: xy\n" + 2291 " │ └─ columns: [x y]\n" + 2292 " │ )) OR (uv.u = 1))\n" + 2293 " ├─ Table\n" + 2294 " │ └─ name: uv\n" + 2295 " └─ Table\n" + 2296 " └─ name: xy\n" + 2297 "", 2298 ExpectedAnalysis: "AntiJoin (estimated cost=2024.000 rows=5) (actual rows=3 loops=1)\n" + 2299 " ├─ ((NOT(EXISTS Subquery\n" + 2300 " │ ├─ cacheable: true\n" + 2301 " │ └─ Table\n" + 2302 " │ ├─ name: xy\n" + 2303 " │ └─ columns: [x y]\n" + 2304 " │ )) OR (uv.u = 1))\n" + 2305 " ├─ Table\n" + 2306 " │ └─ name: uv\n" + 2307 " └─ Table\n" + 2308 " └─ name: xy\n" + 2309 "", 2310 }, 2311 { 2312 Query: `select x from xy where x in ( 2313 select (select u from uv where u = sq.p) 2314 from (select p from pq) sq); 2315 `, 2316 ExpectedPlan: "Project\n" + 2317 " ├─ columns: [xy.x:0!null]\n" + 2318 " └─ Filter\n" + 2319 " ├─ InSubquery\n" + 2320 " │ ├─ left: xy.x:0!null\n" + 2321 " │ └─ right: Subquery\n" + 2322 " │ ├─ cacheable: true\n" + 2323 " │ ├─ alias-string: select (select u from uv where u = sq.p) from (select p from pq) as sq\n" + 2324 " │ └─ Project\n" + 2325 " │ ├─ columns: [Subquery\n" + 2326 " │ │ ├─ cacheable: false\n" + 2327 " │ │ ├─ alias-string: select u from uv where u = sq.p\n" + 2328 " │ │ └─ Filter\n" + 2329 " │ │ ├─ Eq\n" + 2330 " │ │ │ ├─ uv.u:3!null\n" + 2331 " │ │ │ └─ sq.p:2!null\n" + 2332 " │ │ └─ IndexedTableAccess(uv)\n" + 2333 " │ │ ├─ index: [uv.u]\n" + 2334 " │ │ ├─ keys: [sq.p:2!null]\n" + 2335 " │ │ ├─ colSet: (6,7)\n" + 2336 " │ │ ├─ tableId: 4\n" + 2337 " │ │ └─ Table\n" + 2338 " │ │ ├─ name: uv\n" + 2339 " │ │ └─ columns: [u]\n" + 2340 " │ │ as (select u from uv where u = sq.p)]\n" + 2341 " │ └─ SubqueryAlias\n" + 2342 " │ ├─ name: sq\n" + 2343 " │ ├─ outerVisibility: true\n" + 2344 " │ ├─ isLateral: false\n" + 2345 " │ ├─ cacheable: true\n" + 2346 " │ ├─ colSet: (5)\n" + 2347 " │ ├─ tableId: 3\n" + 2348 " │ └─ Table\n" + 2349 " │ ├─ name: pq\n" + 2350 " │ ├─ columns: [p]\n" + 2351 " │ ├─ colSet: (3,4)\n" + 2352 " │ └─ tableId: 2\n" + 2353 " └─ ProcessTable\n" + 2354 " └─ Table\n" + 2355 " ├─ name: xy\n" + 2356 " └─ columns: [x y]\n" + 2357 "", 2358 ExpectedEstimates: "Project\n" + 2359 " ├─ columns: [xy.x]\n" + 2360 " └─ Filter\n" + 2361 " ├─ InSubquery\n" + 2362 " │ ├─ left: xy.x\n" + 2363 " │ └─ right: Subquery\n" + 2364 " │ ├─ cacheable: true\n" + 2365 " │ └─ Project\n" + 2366 " │ ├─ columns: [Subquery\n" + 2367 " │ │ ├─ cacheable: false\n" + 2368 " │ │ └─ Filter\n" + 2369 " │ │ ├─ (uv.u = sq.p)\n" + 2370 " │ │ └─ IndexedTableAccess(uv)\n" + 2371 " │ │ ├─ index: [uv.u]\n" + 2372 " │ │ ├─ columns: [u]\n" + 2373 " │ │ └─ keys: sq.p\n" + 2374 " │ │ as (select u from uv where u = sq.p)]\n" + 2375 " │ └─ SubqueryAlias\n" + 2376 " │ ├─ name: sq\n" + 2377 " │ ├─ outerVisibility: true\n" + 2378 " │ ├─ isLateral: false\n" + 2379 " │ ├─ cacheable: true\n" + 2380 " │ └─ Table\n" + 2381 " │ ├─ name: pq\n" + 2382 " │ └─ columns: [p]\n" + 2383 " └─ Table\n" + 2384 " └─ name: xy\n" + 2385 "", 2386 ExpectedAnalysis: "Project\n" + 2387 " ├─ columns: [xy.x]\n" + 2388 " └─ Filter\n" + 2389 " ├─ InSubquery\n" + 2390 " │ ├─ left: xy.x\n" + 2391 " │ └─ right: Subquery\n" + 2392 " │ ├─ cacheable: true\n" + 2393 " │ └─ Project\n" + 2394 " │ ├─ columns: [Subquery\n" + 2395 " │ │ ├─ cacheable: false\n" + 2396 " │ │ └─ Filter\n" + 2397 " │ │ ├─ (uv.u = sq.p)\n" + 2398 " │ │ └─ IndexedTableAccess(uv)\n" + 2399 " │ │ ├─ index: [uv.u]\n" + 2400 " │ │ ├─ columns: [u]\n" + 2401 " │ │ └─ keys: sq.p\n" + 2402 " │ │ as (select u from uv where u = sq.p)]\n" + 2403 " │ └─ SubqueryAlias\n" + 2404 " │ ├─ name: sq\n" + 2405 " │ ├─ outerVisibility: true\n" + 2406 " │ ├─ isLateral: false\n" + 2407 " │ ├─ cacheable: true\n" + 2408 " │ └─ Table\n" + 2409 " │ ├─ name: pq\n" + 2410 " │ └─ columns: [p]\n" + 2411 " └─ Table\n" + 2412 " └─ name: xy\n" + 2413 "", 2414 }, 2415 { 2416 Query: `SELECT mytable.s FROM mytable WHERE mytable.i = (SELECT othertable.i2 FROM othertable WHERE othertable.s2 = 'second')`, 2417 ExpectedPlan: "Project\n" + 2418 " ├─ columns: [mytable.s:2!null]\n" + 2419 " └─ LookupJoin\n" + 2420 " ├─ Eq\n" + 2421 " │ ├─ mytable.i:1!null\n" + 2422 " │ └─ othertable.i2:0!null\n" + 2423 " ├─ Distinct\n" + 2424 " │ └─ Project\n" + 2425 " │ ├─ columns: [othertable.i2:1!null]\n" + 2426 " │ └─ Filter\n" + 2427 " │ ├─ Eq\n" + 2428 " │ │ ├─ othertable.s2:0!null\n" + 2429 " │ │ └─ second (longtext)\n" + 2430 " │ └─ IndexedTableAccess(othertable)\n" + 2431 " │ ├─ index: [othertable.s2]\n" + 2432 " │ ├─ static: [{[second, second]}]\n" + 2433 " │ ├─ colSet: (3,4)\n" + 2434 " │ ├─ tableId: 2\n" + 2435 " │ └─ Table\n" + 2436 " │ ├─ name: othertable\n" + 2437 " │ └─ columns: [s2 i2]\n" + 2438 " └─ IndexedTableAccess(mytable)\n" + 2439 " ├─ index: [mytable.i]\n" + 2440 " ├─ keys: [othertable.i2:0!null]\n" + 2441 " ├─ colSet: (1,2)\n" + 2442 " ├─ tableId: 1\n" + 2443 " └─ Table\n" + 2444 " ├─ name: mytable\n" + 2445 " └─ columns: [i s]\n" + 2446 "", 2447 ExpectedEstimates: "Project\n" + 2448 " ├─ columns: [mytable.s]\n" + 2449 " └─ LookupJoin (estimated cost=3.300 rows=0)\n" + 2450 " ├─ (mytable.i = othertable.i2)\n" + 2451 " ├─ Distinct\n" + 2452 " │ └─ Project\n" + 2453 " │ ├─ columns: [othertable.i2]\n" + 2454 " │ └─ Filter\n" + 2455 " │ ├─ (othertable.s2 = 'second')\n" + 2456 " │ └─ IndexedTableAccess(othertable)\n" + 2457 " │ ├─ index: [othertable.s2]\n" + 2458 " │ └─ filters: [{[second, second]}]\n" + 2459 " └─ IndexedTableAccess(mytable)\n" + 2460 " ├─ index: [mytable.i]\n" + 2461 " └─ keys: othertable.i2\n" + 2462 "", 2463 ExpectedAnalysis: "Project\n" + 2464 " ├─ columns: [mytable.s]\n" + 2465 " └─ LookupJoin (estimated cost=3.300 rows=0) (actual rows=1 loops=1)\n" + 2466 " ├─ (mytable.i = othertable.i2)\n" + 2467 " ├─ Distinct\n" + 2468 " │ └─ Project\n" + 2469 " │ ├─ columns: [othertable.i2]\n" + 2470 " │ └─ Filter\n" + 2471 " │ ├─ (othertable.s2 = 'second')\n" + 2472 " │ └─ IndexedTableAccess(othertable)\n" + 2473 " │ ├─ index: [othertable.s2]\n" + 2474 " │ └─ filters: [{[second, second]}]\n" + 2475 " └─ IndexedTableAccess(mytable)\n" + 2476 " ├─ index: [mytable.i]\n" + 2477 " └─ keys: othertable.i2\n" + 2478 "", 2479 }, 2480 { 2481 Query: `SELECT mytable.s FROM mytable WHERE mytable.i IN (SELECT othertable.i2 FROM othertable) ORDER BY mytable.i ASC`, 2482 ExpectedPlan: "Project\n" + 2483 " ├─ columns: [mytable.s:1!null]\n" + 2484 " └─ Sort(mytable.i:0!null ASC nullsFirst)\n" + 2485 " └─ SemiJoin\n" + 2486 " ├─ Eq\n" + 2487 " │ ├─ mytable.i:0!null\n" + 2488 " │ └─ othertable.i2:2!null\n" + 2489 " ├─ ProcessTable\n" + 2490 " │ └─ Table\n" + 2491 " │ ├─ name: mytable\n" + 2492 " │ └─ columns: [i s]\n" + 2493 " └─ Project\n" + 2494 " ├─ columns: [othertable.i2:1!null]\n" + 2495 " └─ ProcessTable\n" + 2496 " └─ Table\n" + 2497 " ├─ name: othertable\n" + 2498 " └─ columns: [s2 i2]\n" + 2499 "", 2500 ExpectedEstimates: "Project\n" + 2501 " ├─ columns: [mytable.s]\n" + 2502 " └─ Sort(mytable.i ASC)\n" + 2503 " └─ SemiJoin\n" + 2504 " ├─ (mytable.i = othertable.i2)\n" + 2505 " ├─ Table\n" + 2506 " │ └─ name: mytable\n" + 2507 " └─ Project\n" + 2508 " ├─ columns: [othertable.i2]\n" + 2509 " └─ Table\n" + 2510 " └─ name: othertable\n" + 2511 "", 2512 ExpectedAnalysis: "Project\n" + 2513 " ├─ columns: [mytable.s]\n" + 2514 " └─ Sort(mytable.i ASC)\n" + 2515 " └─ SemiJoin\n" + 2516 " ├─ (mytable.i = othertable.i2)\n" + 2517 " ├─ Table\n" + 2518 " │ └─ name: mytable\n" + 2519 " └─ Project\n" + 2520 " ├─ columns: [othertable.i2]\n" + 2521 " └─ Table\n" + 2522 " └─ name: othertable\n" + 2523 "", 2524 }, 2525 { 2526 Query: `select /*+ JOIN_ORDER(rs, xy) */ * from rs left join xy on y = s order by 1, 3`, 2527 ExpectedPlan: "Project\n" + 2528 " ├─ columns: [rs.r:0!null, rs.s:1, xy.x:2!null, xy.y:3]\n" + 2529 " └─ Sort(rs.r:0!null ASC nullsFirst, xy.x:2!null ASC nullsFirst)\n" + 2530 " └─ LeftOuterMergeJoin\n" + 2531 " ├─ cmp: Eq\n" + 2532 " │ ├─ rs.s:1\n" + 2533 " │ └─ xy.y:3\n" + 2534 " ├─ IndexedTableAccess(rs)\n" + 2535 " │ ├─ index: [rs.s]\n" + 2536 " │ ├─ static: [{[NULL, ∞)}]\n" + 2537 " │ ├─ colSet: (1,2)\n" + 2538 " │ ├─ tableId: 1\n" + 2539 " │ └─ Table\n" + 2540 " │ ├─ name: rs\n" + 2541 " │ └─ columns: [r s]\n" + 2542 " └─ IndexedTableAccess(xy)\n" + 2543 " ├─ index: [xy.y]\n" + 2544 " ├─ static: [{[NULL, ∞)}]\n" + 2545 " ├─ colSet: (3,4)\n" + 2546 " ├─ tableId: 2\n" + 2547 " └─ Table\n" + 2548 " ├─ name: xy\n" + 2549 " └─ columns: [x y]\n" + 2550 "", 2551 ExpectedEstimates: "Project\n" + 2552 " ├─ columns: [rs.r, rs.s, xy.x, xy.y]\n" + 2553 " └─ Sort(rs.r ASC, xy.x ASC)\n" + 2554 " └─ LeftOuterMergeJoin\n" + 2555 " ├─ cmp: (rs.s = xy.y)\n" + 2556 " ├─ IndexedTableAccess(rs)\n" + 2557 " │ ├─ index: [rs.s]\n" + 2558 " │ ├─ filters: [{[NULL, ∞)}]\n" + 2559 " │ └─ columns: [r s]\n" + 2560 " └─ IndexedTableAccess(xy)\n" + 2561 " ├─ index: [xy.y]\n" + 2562 " ├─ filters: [{[NULL, ∞)}]\n" + 2563 " └─ columns: [x y]\n" + 2564 "", 2565 ExpectedAnalysis: "Project\n" + 2566 " ├─ columns: [rs.r, rs.s, xy.x, xy.y]\n" + 2567 " └─ Sort(rs.r ASC, xy.x ASC)\n" + 2568 " └─ LeftOuterMergeJoin\n" + 2569 " ├─ cmp: (rs.s = xy.y)\n" + 2570 " ├─ IndexedTableAccess(rs)\n" + 2571 " │ ├─ index: [rs.s]\n" + 2572 " │ ├─ filters: [{[NULL, ∞)}]\n" + 2573 " │ └─ columns: [r s]\n" + 2574 " └─ IndexedTableAccess(xy)\n" + 2575 " ├─ index: [xy.y]\n" + 2576 " ├─ filters: [{[NULL, ∞)}]\n" + 2577 " └─ columns: [x y]\n" + 2578 "", 2579 }, 2580 { 2581 Query: `select * from uv join (select /*+ JOIN_ORDER(ab, xy) */ * from ab join xy on y = a) r on u = r.a`, 2582 ExpectedPlan: "Project\n" + 2583 " ├─ columns: [uv.u:4!null, uv.v:5, r.a:0!null, r.b:1, r.x:2!null, r.y:3]\n" + 2584 " └─ HashJoin\n" + 2585 " ├─ Eq\n" + 2586 " │ ├─ uv.u:4!null\n" + 2587 " │ └─ r.a:0!null\n" + 2588 " ├─ SubqueryAlias\n" + 2589 " │ ├─ name: r\n" + 2590 " │ ├─ outerVisibility: false\n" + 2591 " │ ├─ isLateral: false\n" + 2592 " │ ├─ cacheable: true\n" + 2593 " │ ├─ colSet: (7-10)\n" + 2594 " │ ├─ tableId: 4\n" + 2595 " │ └─ MergeJoin\n" + 2596 " │ ├─ cmp: Eq\n" + 2597 " │ │ ├─ ab.a:0!null\n" + 2598 " │ │ └─ xy.y:3\n" + 2599 " │ ├─ IndexedTableAccess(ab)\n" + 2600 " │ │ ├─ index: [ab.a]\n" + 2601 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 2602 " │ │ ├─ colSet: (3,4)\n" + 2603 " │ │ ├─ tableId: 2\n" + 2604 " │ │ └─ Table\n" + 2605 " │ │ ├─ name: ab\n" + 2606 " │ │ └─ columns: [a b]\n" + 2607 " │ └─ IndexedTableAccess(xy)\n" + 2608 " │ ├─ index: [xy.y]\n" + 2609 " │ ├─ static: [{[NULL, ∞)}]\n" + 2610 " │ ├─ colSet: (5,6)\n" + 2611 " │ ├─ tableId: 3\n" + 2612 " │ └─ Table\n" + 2613 " │ ├─ name: xy\n" + 2614 " │ └─ columns: [x y]\n" + 2615 " └─ HashLookup\n" + 2616 " ├─ left-key: TUPLE(r.a:0!null)\n" + 2617 " ├─ right-key: TUPLE(uv.u:0!null)\n" + 2618 " └─ ProcessTable\n" + 2619 " └─ Table\n" + 2620 " ├─ name: uv\n" + 2621 " └─ columns: [u v]\n" + 2622 "", 2623 ExpectedEstimates: "Project\n" + 2624 " ├─ columns: [uv.u, uv.v, r.a, r.b, r.x, r.y]\n" + 2625 " └─ HashJoin (estimated cost=114.000 rows=100)\n" + 2626 " ├─ (uv.u = r.a)\n" + 2627 " ├─ SubqueryAlias\n" + 2628 " │ ├─ name: r\n" + 2629 " │ ├─ outerVisibility: false\n" + 2630 " │ ├─ isLateral: false\n" + 2631 " │ ├─ cacheable: true\n" + 2632 " │ └─ MergeJoin\n" + 2633 " │ ├─ cmp: (ab.a = xy.y)\n" + 2634 " │ ├─ IndexedTableAccess(ab)\n" + 2635 " │ │ ├─ index: [ab.a]\n" + 2636 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 2637 " │ │ └─ columns: [a b]\n" + 2638 " │ └─ IndexedTableAccess(xy)\n" + 2639 " │ ├─ index: [xy.y]\n" + 2640 " │ ├─ filters: [{[NULL, ∞)}]\n" + 2641 " │ └─ columns: [x y]\n" + 2642 " └─ HashLookup\n" + 2643 " ├─ left-key: (r.a)\n" + 2644 " ├─ right-key: (uv.u)\n" + 2645 " └─ Table\n" + 2646 " ├─ name: uv\n" + 2647 " └─ columns: [u v]\n" + 2648 "", 2649 ExpectedAnalysis: "Project\n" + 2650 " ├─ columns: [uv.u, uv.v, r.a, r.b, r.x, r.y]\n" + 2651 " └─ HashJoin (estimated cost=114.000 rows=100) (actual rows=4 loops=1)\n" + 2652 " ├─ (uv.u = r.a)\n" + 2653 " ├─ SubqueryAlias\n" + 2654 " │ ├─ name: r\n" + 2655 " │ ├─ outerVisibility: false\n" + 2656 " │ ├─ isLateral: false\n" + 2657 " │ ├─ cacheable: true\n" + 2658 " │ └─ MergeJoin\n" + 2659 " │ ├─ cmp: (ab.a = xy.y)\n" + 2660 " │ ├─ IndexedTableAccess(ab)\n" + 2661 " │ │ ├─ index: [ab.a]\n" + 2662 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 2663 " │ │ └─ columns: [a b]\n" + 2664 " │ └─ IndexedTableAccess(xy)\n" + 2665 " │ ├─ index: [xy.y]\n" + 2666 " │ ├─ filters: [{[NULL, ∞)}]\n" + 2667 " │ └─ columns: [x y]\n" + 2668 " └─ HashLookup\n" + 2669 " ├─ left-key: (r.a)\n" + 2670 " ├─ right-key: (uv.u)\n" + 2671 " └─ Table\n" + 2672 " ├─ name: uv\n" + 2673 " └─ columns: [u v]\n" + 2674 "", 2675 }, 2676 { 2677 Query: `select /*+ JOIN_ORDER(ab, xy) */ * from ab join xy on y = a`, 2678 ExpectedPlan: "MergeJoin\n" + 2679 " ├─ cmp: Eq\n" + 2680 " │ ├─ ab.a:0!null\n" + 2681 " │ └─ xy.y:3\n" + 2682 " ├─ IndexedTableAccess(ab)\n" + 2683 " │ ├─ index: [ab.a]\n" + 2684 " │ ├─ static: [{[NULL, ∞)}]\n" + 2685 " │ ├─ colSet: (1,2)\n" + 2686 " │ ├─ tableId: 1\n" + 2687 " │ └─ Table\n" + 2688 " │ ├─ name: ab\n" + 2689 " │ └─ columns: [a b]\n" + 2690 " └─ IndexedTableAccess(xy)\n" + 2691 " ├─ index: [xy.y]\n" + 2692 " ├─ static: [{[NULL, ∞)}]\n" + 2693 " ├─ colSet: (3,4)\n" + 2694 " ├─ tableId: 2\n" + 2695 " └─ Table\n" + 2696 " ├─ name: xy\n" + 2697 " └─ columns: [x y]\n" + 2698 "", 2699 ExpectedEstimates: "MergeJoin (estimated cost=2030.000 rows=1000)\n" + 2700 " ├─ cmp: (ab.a = xy.y)\n" + 2701 " ├─ IndexedTableAccess(ab)\n" + 2702 " │ ├─ index: [ab.a]\n" + 2703 " │ ├─ filters: [{[NULL, ∞)}]\n" + 2704 " │ └─ columns: [a b]\n" + 2705 " └─ IndexedTableAccess(xy)\n" + 2706 " ├─ index: [xy.y]\n" + 2707 " ├─ filters: [{[NULL, ∞)}]\n" + 2708 " └─ columns: [x y]\n" + 2709 "", 2710 ExpectedAnalysis: "MergeJoin (estimated cost=2030.000 rows=1000) (actual rows=4 loops=1)\n" + 2711 " ├─ cmp: (ab.a = xy.y)\n" + 2712 " ├─ IndexedTableAccess(ab)\n" + 2713 " │ ├─ index: [ab.a]\n" + 2714 " │ ├─ filters: [{[NULL, ∞)}]\n" + 2715 " │ └─ columns: [a b]\n" + 2716 " └─ IndexedTableAccess(xy)\n" + 2717 " ├─ index: [xy.y]\n" + 2718 " ├─ filters: [{[NULL, ∞)}]\n" + 2719 " └─ columns: [x y]\n" + 2720 "", 2721 }, 2722 { 2723 Query: `select /*+ JOIN_ORDER(rs, xy) */ * from rs join xy on y = s order by 1, 3`, 2724 ExpectedPlan: "Sort(rs.r:0!null ASC nullsFirst, xy.x:2!null ASC nullsFirst)\n" + 2725 " └─ MergeJoin\n" + 2726 " ├─ cmp: Eq\n" + 2727 " │ ├─ rs.s:1\n" + 2728 " │ └─ xy.y:3\n" + 2729 " ├─ IndexedTableAccess(rs)\n" + 2730 " │ ├─ index: [rs.s]\n" + 2731 " │ ├─ static: [{[NULL, ∞)}]\n" + 2732 " │ ├─ colSet: (1,2)\n" + 2733 " │ ├─ tableId: 1\n" + 2734 " │ └─ Table\n" + 2735 " │ ├─ name: rs\n" + 2736 " │ └─ columns: [r s]\n" + 2737 " └─ IndexedTableAccess(xy)\n" + 2738 " ├─ index: [xy.y]\n" + 2739 " ├─ static: [{[NULL, ∞)}]\n" + 2740 " ├─ colSet: (3,4)\n" + 2741 " ├─ tableId: 2\n" + 2742 " └─ Table\n" + 2743 " ├─ name: xy\n" + 2744 " └─ columns: [x y]\n" + 2745 "", 2746 ExpectedEstimates: "Sort(rs.r ASC, xy.x ASC)\n" + 2747 " └─ MergeJoin\n" + 2748 " ├─ cmp: (rs.s = xy.y)\n" + 2749 " ├─ IndexedTableAccess(rs)\n" + 2750 " │ ├─ index: [rs.s]\n" + 2751 " │ ├─ filters: [{[NULL, ∞)}]\n" + 2752 " │ └─ columns: [r s]\n" + 2753 " └─ IndexedTableAccess(xy)\n" + 2754 " ├─ index: [xy.y]\n" + 2755 " ├─ filters: [{[NULL, ∞)}]\n" + 2756 " └─ columns: [x y]\n" + 2757 "", 2758 ExpectedAnalysis: "Sort(rs.r ASC, xy.x ASC)\n" + 2759 " └─ MergeJoin\n" + 2760 " ├─ cmp: (rs.s = xy.y)\n" + 2761 " ├─ IndexedTableAccess(rs)\n" + 2762 " │ ├─ index: [rs.s]\n" + 2763 " │ ├─ filters: [{[NULL, ∞)}]\n" + 2764 " │ └─ columns: [r s]\n" + 2765 " └─ IndexedTableAccess(xy)\n" + 2766 " ├─ index: [xy.y]\n" + 2767 " ├─ filters: [{[NULL, ∞)}]\n" + 2768 " └─ columns: [x y]\n" + 2769 "", 2770 }, 2771 { 2772 Query: `select /*+ JOIN_ORDER(rs, xy) */ * from rs join xy on y = s`, 2773 ExpectedPlan: "MergeJoin\n" + 2774 " ├─ cmp: Eq\n" + 2775 " │ ├─ rs.s:1\n" + 2776 " │ └─ xy.y:3\n" + 2777 " ├─ IndexedTableAccess(rs)\n" + 2778 " │ ├─ index: [rs.s]\n" + 2779 " │ ├─ static: [{[NULL, ∞)}]\n" + 2780 " │ ├─ colSet: (1,2)\n" + 2781 " │ ├─ tableId: 1\n" + 2782 " │ └─ Table\n" + 2783 " │ ├─ name: rs\n" + 2784 " │ └─ columns: [r s]\n" + 2785 " └─ IndexedTableAccess(xy)\n" + 2786 " ├─ index: [xy.y]\n" + 2787 " ├─ static: [{[NULL, ∞)}]\n" + 2788 " ├─ colSet: (3,4)\n" + 2789 " ├─ tableId: 2\n" + 2790 " └─ Table\n" + 2791 " ├─ name: xy\n" + 2792 " └─ columns: [x y]\n" + 2793 "", 2794 ExpectedEstimates: "MergeJoin (estimated cost=2030.000 rows=1000)\n" + 2795 " ├─ cmp: (rs.s = xy.y)\n" + 2796 " ├─ IndexedTableAccess(rs)\n" + 2797 " │ ├─ index: [rs.s]\n" + 2798 " │ ├─ filters: [{[NULL, ∞)}]\n" + 2799 " │ └─ columns: [r s]\n" + 2800 " └─ IndexedTableAccess(xy)\n" + 2801 " ├─ index: [xy.y]\n" + 2802 " ├─ filters: [{[NULL, ∞)}]\n" + 2803 " └─ columns: [x y]\n" + 2804 "", 2805 ExpectedAnalysis: "MergeJoin (estimated cost=2030.000 rows=1000) (actual rows=3 loops=1)\n" + 2806 " ├─ cmp: (rs.s = xy.y)\n" + 2807 " ├─ IndexedTableAccess(rs)\n" + 2808 " │ ├─ index: [rs.s]\n" + 2809 " │ ├─ filters: [{[NULL, ∞)}]\n" + 2810 " │ └─ columns: [r s]\n" + 2811 " └─ IndexedTableAccess(xy)\n" + 2812 " ├─ index: [xy.y]\n" + 2813 " ├─ filters: [{[NULL, ∞)}]\n" + 2814 " └─ columns: [x y]\n" + 2815 "", 2816 }, 2817 { 2818 Query: `select /*+ JOIN_ORDER(rs, xy) */ * from rs join xy on y+10 = s`, 2819 ExpectedPlan: "MergeJoin\n" + 2820 " ├─ cmp: Eq\n" + 2821 " │ ├─ rs.s:1\n" + 2822 " │ └─ (xy.y:3 + 10 (tinyint))\n" + 2823 " ├─ IndexedTableAccess(rs)\n" + 2824 " │ ├─ index: [rs.s]\n" + 2825 " │ ├─ static: [{[NULL, ∞)}]\n" + 2826 " │ ├─ colSet: (1,2)\n" + 2827 " │ ├─ tableId: 1\n" + 2828 " │ └─ Table\n" + 2829 " │ ├─ name: rs\n" + 2830 " │ └─ columns: [r s]\n" + 2831 " └─ IndexedTableAccess(xy)\n" + 2832 " ├─ index: [xy.y]\n" + 2833 " ├─ static: [{[NULL, ∞)}]\n" + 2834 " ├─ colSet: (3,4)\n" + 2835 " ├─ tableId: 2\n" + 2836 " └─ Table\n" + 2837 " ├─ name: xy\n" + 2838 " └─ columns: [x y]\n" + 2839 "", 2840 ExpectedEstimates: "MergeJoin (estimated cost=2032.530 rows=1250)\n" + 2841 " ├─ cmp: (rs.s = (xy.y + 10))\n" + 2842 " ├─ IndexedTableAccess(rs)\n" + 2843 " │ ├─ index: [rs.s]\n" + 2844 " │ ├─ filters: [{[NULL, ∞)}]\n" + 2845 " │ └─ columns: [r s]\n" + 2846 " └─ IndexedTableAccess(xy)\n" + 2847 " ├─ index: [xy.y]\n" + 2848 " ├─ filters: [{[NULL, ∞)}]\n" + 2849 " └─ columns: [x y]\n" + 2850 "", 2851 ExpectedAnalysis: "MergeJoin (estimated cost=2032.530 rows=1250) (actual rows=0 loops=1)\n" + 2852 " ├─ cmp: (rs.s = (xy.y + 10))\n" + 2853 " ├─ IndexedTableAccess(rs)\n" + 2854 " │ ├─ index: [rs.s]\n" + 2855 " │ ├─ filters: [{[NULL, ∞)}]\n" + 2856 " │ └─ columns: [r s]\n" + 2857 " └─ IndexedTableAccess(xy)\n" + 2858 " ├─ index: [xy.y]\n" + 2859 " ├─ filters: [{[NULL, ∞)}]\n" + 2860 " └─ columns: [x y]\n" + 2861 "", 2862 }, 2863 { 2864 Query: `select /*+ JOIN_ORDER(rs, xy) */ * from rs join xy on 10 = s+y`, 2865 ExpectedPlan: "InnerJoin\n" + 2866 " ├─ Eq\n" + 2867 " │ ├─ 10 (tinyint)\n" + 2868 " │ └─ (rs.s:1 + xy.y:3)\n" + 2869 " ├─ ProcessTable\n" + 2870 " │ └─ Table\n" + 2871 " │ ├─ name: rs\n" + 2872 " │ └─ columns: [r s]\n" + 2873 " └─ ProcessTable\n" + 2874 " └─ Table\n" + 2875 " ├─ name: xy\n" + 2876 " └─ columns: [x y]\n" + 2877 "", 2878 ExpectedEstimates: "InnerJoin (estimated cost=1010001.000 rows=1250)\n" + 2879 " ├─ (10 = (rs.s + xy.y))\n" + 2880 " ├─ Table\n" + 2881 " │ ├─ name: rs\n" + 2882 " │ └─ columns: [r s]\n" + 2883 " └─ Table\n" + 2884 " ├─ name: xy\n" + 2885 " └─ columns: [x y]\n" + 2886 "", 2887 ExpectedAnalysis: "InnerJoin (estimated cost=1010001.000 rows=1250) (actual rows=0 loops=1)\n" + 2888 " ├─ (10 = (rs.s + xy.y))\n" + 2889 " ├─ Table\n" + 2890 " │ ├─ name: rs\n" + 2891 " │ └─ columns: [r s]\n" + 2892 " └─ Table\n" + 2893 " ├─ name: xy\n" + 2894 " └─ columns: [x y]\n" + 2895 "", 2896 }, 2897 { 2898 Query: `select * from ab where a in (select x from xy where x in (select u from uv where u = a));`, 2899 ExpectedPlan: "Filter\n" + 2900 " ├─ InSubquery\n" + 2901 " │ ├─ left: ab.a:0!null\n" + 2902 " │ └─ right: Subquery\n" + 2903 " │ ├─ cacheable: false\n" + 2904 " │ ├─ alias-string: select x from xy where x in (select u from uv where u = a)\n" + 2905 " │ └─ Project\n" + 2906 " │ ├─ columns: [xy.x:2!null]\n" + 2907 " │ └─ Filter\n" + 2908 " │ ├─ InSubquery\n" + 2909 " │ │ ├─ left: xy.x:2!null\n" + 2910 " │ │ └─ right: Subquery\n" + 2911 " │ │ ├─ cacheable: false\n" + 2912 " │ │ ├─ alias-string: select u from uv where u = a\n" + 2913 " │ │ └─ Filter\n" + 2914 " │ │ ├─ Eq\n" + 2915 " │ │ │ ├─ uv.u:4!null\n" + 2916 " │ │ │ └─ ab.a:0!null\n" + 2917 " │ │ └─ IndexedTableAccess(uv)\n" + 2918 " │ │ ├─ index: [uv.u]\n" + 2919 " │ │ ├─ keys: [ab.a:0!null]\n" + 2920 " │ │ ├─ colSet: (5,6)\n" + 2921 " │ │ ├─ tableId: 3\n" + 2922 " │ │ └─ Table\n" + 2923 " │ │ ├─ name: uv\n" + 2924 " │ │ └─ columns: [u]\n" + 2925 " │ └─ Table\n" + 2926 " │ ├─ name: xy\n" + 2927 " │ ├─ columns: [x y]\n" + 2928 " │ ├─ colSet: (3,4)\n" + 2929 " │ └─ tableId: 2\n" + 2930 " └─ ProcessTable\n" + 2931 " └─ Table\n" + 2932 " ├─ name: ab\n" + 2933 " └─ columns: [a b]\n" + 2934 "", 2935 ExpectedEstimates: "Filter\n" + 2936 " ├─ InSubquery\n" + 2937 " │ ├─ left: ab.a\n" + 2938 " │ └─ right: Subquery\n" + 2939 " │ ├─ cacheable: false\n" + 2940 " │ └─ Project\n" + 2941 " │ ├─ columns: [xy.x]\n" + 2942 " │ └─ Filter\n" + 2943 " │ ├─ InSubquery\n" + 2944 " │ │ ├─ left: xy.x\n" + 2945 " │ │ └─ right: Subquery\n" + 2946 " │ │ ├─ cacheable: false\n" + 2947 " │ │ └─ Filter\n" + 2948 " │ │ ├─ (uv.u = ab.a)\n" + 2949 " │ │ └─ IndexedTableAccess(uv)\n" + 2950 " │ │ ├─ index: [uv.u]\n" + 2951 " │ │ ├─ columns: [u]\n" + 2952 " │ │ └─ keys: ab.a\n" + 2953 " │ └─ Table\n" + 2954 " │ └─ name: xy\n" + 2955 " └─ Table\n" + 2956 " └─ name: ab\n" + 2957 "", 2958 ExpectedAnalysis: "Filter\n" + 2959 " ├─ InSubquery\n" + 2960 " │ ├─ left: ab.a\n" + 2961 " │ └─ right: Subquery\n" + 2962 " │ ├─ cacheable: false\n" + 2963 " │ └─ Project\n" + 2964 " │ ├─ columns: [xy.x]\n" + 2965 " │ └─ Filter\n" + 2966 " │ ├─ InSubquery\n" + 2967 " │ │ ├─ left: xy.x\n" + 2968 " │ │ └─ right: Subquery\n" + 2969 " │ │ ├─ cacheable: false\n" + 2970 " │ │ └─ Filter\n" + 2971 " │ │ ├─ (uv.u = ab.a)\n" + 2972 " │ │ └─ IndexedTableAccess(uv)\n" + 2973 " │ │ ├─ index: [uv.u]\n" + 2974 " │ │ ├─ columns: [u]\n" + 2975 " │ │ └─ keys: ab.a\n" + 2976 " │ └─ Table\n" + 2977 " │ └─ name: xy\n" + 2978 " └─ Table\n" + 2979 " └─ name: ab\n" + 2980 "", 2981 }, 2982 { 2983 Query: `select * from ab where a in (select y from xy where y in (select v from uv where v = a));`, 2984 ExpectedPlan: "Filter\n" + 2985 " ├─ InSubquery\n" + 2986 " │ ├─ left: ab.a:0!null\n" + 2987 " │ └─ right: Subquery\n" + 2988 " │ ├─ cacheable: false\n" + 2989 " │ ├─ alias-string: select y from xy where y in (select v from uv where v = a)\n" + 2990 " │ └─ Project\n" + 2991 " │ ├─ columns: [xy.y:3]\n" + 2992 " │ └─ Filter\n" + 2993 " │ ├─ InSubquery\n" + 2994 " │ │ ├─ left: xy.y:3\n" + 2995 " │ │ └─ right: Subquery\n" + 2996 " │ │ ├─ cacheable: false\n" + 2997 " │ │ ├─ alias-string: select v from uv where v = a\n" + 2998 " │ │ └─ Filter\n" + 2999 " │ │ ├─ Eq\n" + 3000 " │ │ │ ├─ uv.v:4\n" + 3001 " │ │ │ └─ ab.a:0!null\n" + 3002 " │ │ └─ Table\n" + 3003 " │ │ ├─ name: uv\n" + 3004 " │ │ ├─ columns: [v]\n" + 3005 " │ │ ├─ colSet: (5,6)\n" + 3006 " │ │ └─ tableId: 3\n" + 3007 " │ └─ Table\n" + 3008 " │ ├─ name: xy\n" + 3009 " │ ├─ columns: [x y]\n" + 3010 " │ ├─ colSet: (3,4)\n" + 3011 " │ └─ tableId: 2\n" + 3012 " └─ ProcessTable\n" + 3013 " └─ Table\n" + 3014 " ├─ name: ab\n" + 3015 " └─ columns: [a b]\n" + 3016 "", 3017 ExpectedEstimates: "Filter\n" + 3018 " ├─ InSubquery\n" + 3019 " │ ├─ left: ab.a\n" + 3020 " │ └─ right: Subquery\n" + 3021 " │ ├─ cacheable: false\n" + 3022 " │ └─ Project\n" + 3023 " │ ├─ columns: [xy.y]\n" + 3024 " │ └─ Filter\n" + 3025 " │ ├─ InSubquery\n" + 3026 " │ │ ├─ left: xy.y\n" + 3027 " │ │ └─ right: Subquery\n" + 3028 " │ │ ├─ cacheable: false\n" + 3029 " │ │ └─ Filter\n" + 3030 " │ │ ├─ (uv.v = ab.a)\n" + 3031 " │ │ └─ Table\n" + 3032 " │ │ ├─ name: uv\n" + 3033 " │ │ └─ columns: [v]\n" + 3034 " │ └─ Table\n" + 3035 " │ └─ name: xy\n" + 3036 " └─ Table\n" + 3037 " └─ name: ab\n" + 3038 "", 3039 ExpectedAnalysis: "Filter\n" + 3040 " ├─ InSubquery\n" + 3041 " │ ├─ left: ab.a\n" + 3042 " │ └─ right: Subquery\n" + 3043 " │ ├─ cacheable: false\n" + 3044 " │ └─ Project\n" + 3045 " │ ├─ columns: [xy.y]\n" + 3046 " │ └─ Filter\n" + 3047 " │ ├─ InSubquery\n" + 3048 " │ │ ├─ left: xy.y\n" + 3049 " │ │ └─ right: Subquery\n" + 3050 " │ │ ├─ cacheable: false\n" + 3051 " │ │ └─ Filter\n" + 3052 " │ │ ├─ (uv.v = ab.a)\n" + 3053 " │ │ └─ Table\n" + 3054 " │ │ ├─ name: uv\n" + 3055 " │ │ └─ columns: [v]\n" + 3056 " │ └─ Table\n" + 3057 " │ └─ name: xy\n" + 3058 " └─ Table\n" + 3059 " └─ name: ab\n" + 3060 "", 3061 }, 3062 { 3063 Query: `select * from ab where b in (select y from xy where y in (select v from uv where v = b));`, 3064 ExpectedPlan: "Filter\n" + 3065 " ├─ InSubquery\n" + 3066 " │ ├─ left: ab.b:1\n" + 3067 " │ └─ right: Subquery\n" + 3068 " │ ├─ cacheable: false\n" + 3069 " │ ├─ alias-string: select y from xy where y in (select v from uv where v = b)\n" + 3070 " │ └─ Project\n" + 3071 " │ ├─ columns: [xy.y:3]\n" + 3072 " │ └─ Filter\n" + 3073 " │ ├─ InSubquery\n" + 3074 " │ │ ├─ left: xy.y:3\n" + 3075 " │ │ └─ right: Subquery\n" + 3076 " │ │ ├─ cacheable: false\n" + 3077 " │ │ ├─ alias-string: select v from uv where v = b\n" + 3078 " │ │ └─ Filter\n" + 3079 " │ │ ├─ Eq\n" + 3080 " │ │ │ ├─ uv.v:4\n" + 3081 " │ │ │ └─ ab.b:1\n" + 3082 " │ │ └─ Table\n" + 3083 " │ │ ├─ name: uv\n" + 3084 " │ │ ├─ columns: [v]\n" + 3085 " │ │ ├─ colSet: (5,6)\n" + 3086 " │ │ └─ tableId: 3\n" + 3087 " │ └─ Table\n" + 3088 " │ ├─ name: xy\n" + 3089 " │ ├─ columns: [x y]\n" + 3090 " │ ├─ colSet: (3,4)\n" + 3091 " │ └─ tableId: 2\n" + 3092 " └─ ProcessTable\n" + 3093 " └─ Table\n" + 3094 " ├─ name: ab\n" + 3095 " └─ columns: [a b]\n" + 3096 "", 3097 ExpectedEstimates: "Filter\n" + 3098 " ├─ InSubquery\n" + 3099 " │ ├─ left: ab.b\n" + 3100 " │ └─ right: Subquery\n" + 3101 " │ ├─ cacheable: false\n" + 3102 " │ └─ Project\n" + 3103 " │ ├─ columns: [xy.y]\n" + 3104 " │ └─ Filter\n" + 3105 " │ ├─ InSubquery\n" + 3106 " │ │ ├─ left: xy.y\n" + 3107 " │ │ └─ right: Subquery\n" + 3108 " │ │ ├─ cacheable: false\n" + 3109 " │ │ └─ Filter\n" + 3110 " │ │ ├─ (uv.v = ab.b)\n" + 3111 " │ │ └─ Table\n" + 3112 " │ │ ├─ name: uv\n" + 3113 " │ │ └─ columns: [v]\n" + 3114 " │ └─ Table\n" + 3115 " │ └─ name: xy\n" + 3116 " └─ Table\n" + 3117 " └─ name: ab\n" + 3118 "", 3119 ExpectedAnalysis: "Filter\n" + 3120 " ├─ InSubquery\n" + 3121 " │ ├─ left: ab.b\n" + 3122 " │ └─ right: Subquery\n" + 3123 " │ ├─ cacheable: false\n" + 3124 " │ └─ Project\n" + 3125 " │ ├─ columns: [xy.y]\n" + 3126 " │ └─ Filter\n" + 3127 " │ ├─ InSubquery\n" + 3128 " │ │ ├─ left: xy.y\n" + 3129 " │ │ └─ right: Subquery\n" + 3130 " │ │ ├─ cacheable: false\n" + 3131 " │ │ └─ Filter\n" + 3132 " │ │ ├─ (uv.v = ab.b)\n" + 3133 " │ │ └─ Table\n" + 3134 " │ │ ├─ name: uv\n" + 3135 " │ │ └─ columns: [v]\n" + 3136 " │ └─ Table\n" + 3137 " │ └─ name: xy\n" + 3138 " └─ Table\n" + 3139 " └─ name: ab\n" + 3140 "", 3141 }, 3142 { 3143 Query: `select ab.* from ab join pq on a = p where b = (select y from xy where y in (select v from uv where v = b)) order by a;`, 3144 ExpectedPlan: "Project\n" + 3145 " ├─ columns: [ab.a:2!null, ab.b:3]\n" + 3146 " └─ Sort(ab.a:2!null ASC nullsFirst)\n" + 3147 " └─ Filter\n" + 3148 " ├─ Eq\n" + 3149 " │ ├─ ab.b:3\n" + 3150 " │ └─ Subquery\n" + 3151 " │ ├─ cacheable: false\n" + 3152 " │ ├─ alias-string: select y from xy where y in (select v from uv where v = b)\n" + 3153 " │ └─ Project\n" + 3154 " │ ├─ columns: [xy.y:5]\n" + 3155 " │ └─ Filter\n" + 3156 " │ ├─ InSubquery\n" + 3157 " │ │ ├─ left: xy.y:5\n" + 3158 " │ │ └─ right: Subquery\n" + 3159 " │ │ ├─ cacheable: false\n" + 3160 " │ │ ├─ alias-string: select v from uv where v = b\n" + 3161 " │ │ └─ Filter\n" + 3162 " │ │ ├─ Eq\n" + 3163 " │ │ │ ├─ uv.v:6\n" + 3164 " │ │ │ └─ ab.b:3\n" + 3165 " │ │ └─ Table\n" + 3166 " │ │ ├─ name: uv\n" + 3167 " │ │ ├─ columns: [v]\n" + 3168 " │ │ ├─ colSet: (7,8)\n" + 3169 " │ │ └─ tableId: 4\n" + 3170 " │ └─ Table\n" + 3171 " │ ├─ name: xy\n" + 3172 " │ ├─ columns: [x y]\n" + 3173 " │ ├─ colSet: (5,6)\n" + 3174 " │ └─ tableId: 3\n" + 3175 " └─ LookupJoin\n" + 3176 " ├─ ProcessTable\n" + 3177 " │ └─ Table\n" + 3178 " │ ├─ name: pq\n" + 3179 " │ └─ columns: [p q]\n" + 3180 " └─ IndexedTableAccess(ab)\n" + 3181 " ├─ index: [ab.a]\n" + 3182 " ├─ keys: [pq.p:0!null]\n" + 3183 " ├─ colSet: (1,2)\n" + 3184 " ├─ tableId: 1\n" + 3185 " └─ Table\n" + 3186 " ├─ name: ab\n" + 3187 " └─ columns: [a b]\n" + 3188 "", 3189 ExpectedEstimates: "Project\n" + 3190 " ├─ columns: [ab.a, ab.b]\n" + 3191 " └─ Sort(ab.a ASC)\n" + 3192 " └─ Filter\n" + 3193 " ├─ (ab.b = Subquery\n" + 3194 " │ ├─ cacheable: false\n" + 3195 " │ └─ Project\n" + 3196 " │ ├─ columns: [xy.y]\n" + 3197 " │ └─ Filter\n" + 3198 " │ ├─ InSubquery\n" + 3199 " │ │ ├─ left: xy.y\n" + 3200 " │ │ └─ right: Subquery\n" + 3201 " │ │ ├─ cacheable: false\n" + 3202 " │ │ └─ Filter\n" + 3203 " │ │ ├─ (uv.v = ab.b)\n" + 3204 " │ │ └─ Table\n" + 3205 " │ │ ├─ name: uv\n" + 3206 " │ │ └─ columns: [v]\n" + 3207 " │ └─ Table\n" + 3208 " │ └─ name: xy\n" + 3209 " │ )\n" + 3210 " └─ LookupJoin\n" + 3211 " ├─ Table\n" + 3212 " │ └─ name: pq\n" + 3213 " └─ IndexedTableAccess(ab)\n" + 3214 " ├─ index: [ab.a]\n" + 3215 " └─ keys: pq.p\n" + 3216 "", 3217 ExpectedAnalysis: "Project\n" + 3218 " ├─ columns: [ab.a, ab.b]\n" + 3219 " └─ Sort(ab.a ASC)\n" + 3220 " └─ Filter\n" + 3221 " ├─ (ab.b = Subquery\n" + 3222 " │ ├─ cacheable: false\n" + 3223 " │ └─ Project\n" + 3224 " │ ├─ columns: [xy.y]\n" + 3225 " │ └─ Filter\n" + 3226 " │ ├─ InSubquery\n" + 3227 " │ │ ├─ left: xy.y\n" + 3228 " │ │ └─ right: Subquery\n" + 3229 " │ │ ├─ cacheable: false\n" + 3230 " │ │ └─ Filter\n" + 3231 " │ │ ├─ (uv.v = ab.b)\n" + 3232 " │ │ └─ Table\n" + 3233 " │ │ ├─ name: uv\n" + 3234 " │ │ └─ columns: [v]\n" + 3235 " │ └─ Table\n" + 3236 " │ └─ name: xy\n" + 3237 " │ )\n" + 3238 " └─ LookupJoin\n" + 3239 " ├─ Table\n" + 3240 " │ └─ name: pq\n" + 3241 " └─ IndexedTableAccess(ab)\n" + 3242 " ├─ index: [ab.a]\n" + 3243 " └─ keys: pq.p\n" + 3244 "", 3245 }, 3246 { 3247 Query: `select y, (select 1 from uv where y = 1 and u = x) is_one from xy join uv on x = v order by y;`, 3248 ExpectedPlan: "Project\n" + 3249 " ├─ columns: [xy.y:1, Subquery\n" + 3250 " │ ├─ cacheable: false\n" + 3251 " │ ├─ alias-string: select 1 from uv where y = 1 and u = x\n" + 3252 " │ └─ Project\n" + 3253 " │ ├─ columns: [1 (tinyint)]\n" + 3254 " │ └─ Filter\n" + 3255 " │ ├─ AND\n" + 3256 " │ │ ├─ Eq\n" + 3257 " │ │ │ ├─ xy.y:1\n" + 3258 " │ │ │ └─ 1 (tinyint)\n" + 3259 " │ │ └─ Eq\n" + 3260 " │ │ ├─ uv.u:5!null\n" + 3261 " │ │ └─ xy.x:0!null\n" + 3262 " │ └─ IndexedTableAccess(uv)\n" + 3263 " │ ├─ index: [uv.u]\n" + 3264 " │ ├─ keys: [xy.x:0!null]\n" + 3265 " │ ├─ colSet: (5,6)\n" + 3266 " │ ├─ tableId: 3\n" + 3267 " │ └─ Table\n" + 3268 " │ ├─ name: uv\n" + 3269 " │ └─ columns: [u]\n" + 3270 " │ as is_one]\n" + 3271 " └─ Sort(xy.y:1 ASC nullsFirst)\n" + 3272 " └─ Project\n" + 3273 " ├─ columns: [xy.x:2!null, xy.y:3, uv.u:0!null, uv.v:1, Subquery\n" + 3274 " │ ├─ cacheable: false\n" + 3275 " │ ├─ alias-string: select 1 from uv where y = 1 and u = x\n" + 3276 " │ └─ Project\n" + 3277 " │ ├─ columns: [1 (tinyint)]\n" + 3278 " │ └─ Filter\n" + 3279 " │ ├─ AND\n" + 3280 " │ │ ├─ Eq\n" + 3281 " │ │ │ ├─ xy.y:3\n" + 3282 " │ │ │ └─ 1 (tinyint)\n" + 3283 " │ │ └─ Eq\n" + 3284 " │ │ ├─ uv.u:4!null\n" + 3285 " │ │ └─ xy.x:2!null\n" + 3286 " │ └─ IndexedTableAccess(uv)\n" + 3287 " │ ├─ index: [uv.u]\n" + 3288 " │ ├─ keys: [xy.x:2!null]\n" + 3289 " │ ├─ colSet: (5,6)\n" + 3290 " │ ├─ tableId: 3\n" + 3291 " │ └─ Table\n" + 3292 " │ ├─ name: uv\n" + 3293 " │ └─ columns: [u]\n" + 3294 " │ as is_one]\n" + 3295 " └─ LookupJoin\n" + 3296 " ├─ ProcessTable\n" + 3297 " │ └─ Table\n" + 3298 " │ ├─ name: uv\n" + 3299 " │ └─ columns: [u v]\n" + 3300 " └─ IndexedTableAccess(xy)\n" + 3301 " ├─ index: [xy.x]\n" + 3302 " ├─ keys: [uv.v:1]\n" + 3303 " ├─ colSet: (1,2)\n" + 3304 " ├─ tableId: 1\n" + 3305 " └─ Table\n" + 3306 " ├─ name: xy\n" + 3307 " └─ columns: [x y]\n" + 3308 "", 3309 ExpectedEstimates: "Project\n" + 3310 " ├─ columns: [xy.y, Subquery\n" + 3311 " │ ├─ cacheable: false\n" + 3312 " │ └─ Project\n" + 3313 " │ ├─ columns: [1]\n" + 3314 " │ └─ Filter\n" + 3315 " │ ├─ ((xy.y = 1) AND (uv.u = xy.x))\n" + 3316 " │ └─ IndexedTableAccess(uv)\n" + 3317 " │ ├─ index: [uv.u]\n" + 3318 " │ ├─ columns: [u]\n" + 3319 " │ └─ keys: xy.x\n" + 3320 " │ as is_one]\n" + 3321 " └─ Sort(xy.y ASC)\n" + 3322 " └─ Project\n" + 3323 " ├─ columns: [xy.x, xy.y, uv.u, uv.v, Subquery\n" + 3324 " │ ├─ cacheable: false\n" + 3325 " │ └─ Project\n" + 3326 " │ ├─ columns: [1]\n" + 3327 " │ └─ Filter\n" + 3328 " │ ├─ ((xy.y = 1) AND (uv.u = xy.x))\n" + 3329 " │ └─ IndexedTableAccess(uv)\n" + 3330 " │ ├─ index: [uv.u]\n" + 3331 " │ ├─ columns: [u]\n" + 3332 " │ └─ keys: xy.x\n" + 3333 " │ as is_one]\n" + 3334 " └─ LookupJoin\n" + 3335 " ├─ Table\n" + 3336 " │ └─ name: uv\n" + 3337 " └─ IndexedTableAccess(xy)\n" + 3338 " ├─ index: [xy.x]\n" + 3339 " └─ keys: uv.v\n" + 3340 "", 3341 ExpectedAnalysis: "Project\n" + 3342 " ├─ columns: [xy.y, Subquery\n" + 3343 " │ ├─ cacheable: false\n" + 3344 " │ └─ Project\n" + 3345 " │ ├─ columns: [1]\n" + 3346 " │ └─ Filter\n" + 3347 " │ ├─ ((xy.y = 1) AND (uv.u = xy.x))\n" + 3348 " │ └─ IndexedTableAccess(uv)\n" + 3349 " │ ├─ index: [uv.u]\n" + 3350 " │ ├─ columns: [u]\n" + 3351 " │ └─ keys: xy.x\n" + 3352 " │ as is_one]\n" + 3353 " └─ Sort(xy.y ASC)\n" + 3354 " └─ Project\n" + 3355 " ├─ columns: [xy.x, xy.y, uv.u, uv.v, Subquery\n" + 3356 " │ ├─ cacheable: false\n" + 3357 " │ └─ Project\n" + 3358 " │ ├─ columns: [1]\n" + 3359 " │ └─ Filter\n" + 3360 " │ ├─ ((xy.y = 1) AND (uv.u = xy.x))\n" + 3361 " │ └─ IndexedTableAccess(uv)\n" + 3362 " │ ├─ index: [uv.u]\n" + 3363 " │ ├─ columns: [u]\n" + 3364 " │ └─ keys: xy.x\n" + 3365 " │ as is_one]\n" + 3366 " └─ LookupJoin\n" + 3367 " ├─ Table\n" + 3368 " │ └─ name: uv\n" + 3369 " └─ IndexedTableAccess(xy)\n" + 3370 " ├─ index: [xy.x]\n" + 3371 " └─ keys: uv.v\n" + 3372 "", 3373 }, 3374 { 3375 Query: `select * from (select y, (select 1 where y = 1) is_one from xy join uv on x = v) sq order by y`, 3376 ExpectedPlan: "Sort(sq.y:0 ASC nullsFirst)\n" + 3377 " └─ SubqueryAlias\n" + 3378 " ├─ name: sq\n" + 3379 " ├─ outerVisibility: false\n" + 3380 " ├─ isLateral: false\n" + 3381 " ├─ cacheable: true\n" + 3382 " ├─ colSet: (7,8)\n" + 3383 " ├─ tableId: 3\n" + 3384 " └─ Project\n" + 3385 " ├─ columns: [xy.y:1, Subquery\n" + 3386 " │ ├─ cacheable: false\n" + 3387 " │ ├─ alias-string: select 1 where y = 1\n" + 3388 " │ └─ Project\n" + 3389 " │ ├─ columns: [1 (tinyint)]\n" + 3390 " │ └─ Filter\n" + 3391 " │ ├─ Eq\n" + 3392 " │ │ ├─ xy.y:1\n" + 3393 " │ │ └─ 1 (tinyint)\n" + 3394 " │ └─ Table\n" + 3395 " │ ├─ name: \n" + 3396 " │ ├─ columns: []\n" + 3397 " │ ├─ colSet: ()\n" + 3398 " │ └─ tableId: 0\n" + 3399 " │ as is_one]\n" + 3400 " └─ Project\n" + 3401 " ├─ columns: [xy.x:2!null, xy.y:3, uv.u:0!null, uv.v:1, Subquery\n" + 3402 " │ ├─ cacheable: false\n" + 3403 " │ ├─ alias-string: select 1 where y = 1\n" + 3404 " │ └─ Project\n" + 3405 " │ ├─ columns: [1 (tinyint)]\n" + 3406 " │ └─ Filter\n" + 3407 " │ ├─ Eq\n" + 3408 " │ │ ├─ xy.y:3\n" + 3409 " │ │ └─ 1 (tinyint)\n" + 3410 " │ └─ Table\n" + 3411 " │ ├─ name: \n" + 3412 " │ ├─ columns: []\n" + 3413 " │ ├─ colSet: ()\n" + 3414 " │ └─ tableId: 0\n" + 3415 " │ as is_one]\n" + 3416 " └─ LookupJoin\n" + 3417 " ├─ Table\n" + 3418 " │ ├─ name: uv\n" + 3419 " │ ├─ columns: [u v]\n" + 3420 " │ ├─ colSet: (3,4)\n" + 3421 " │ └─ tableId: 2\n" + 3422 " └─ IndexedTableAccess(xy)\n" + 3423 " ├─ index: [xy.x]\n" + 3424 " ├─ keys: [uv.v:1]\n" + 3425 " ├─ colSet: (1,2)\n" + 3426 " ├─ tableId: 1\n" + 3427 " └─ Table\n" + 3428 " ├─ name: xy\n" + 3429 " └─ columns: [x y]\n" + 3430 "", 3431 ExpectedEstimates: "Sort(sq.y ASC)\n" + 3432 " └─ SubqueryAlias\n" + 3433 " ├─ name: sq\n" + 3434 " ├─ outerVisibility: false\n" + 3435 " ├─ isLateral: false\n" + 3436 " ├─ cacheable: true\n" + 3437 " └─ Project\n" + 3438 " ├─ columns: [xy.y, Subquery\n" + 3439 " │ ├─ cacheable: false\n" + 3440 " │ └─ Project\n" + 3441 " │ ├─ columns: [1]\n" + 3442 " │ └─ Filter\n" + 3443 " │ ├─ (xy.y = 1)\n" + 3444 " │ └─ Table\n" + 3445 " │ └─ name: \n" + 3446 " │ as is_one]\n" + 3447 " └─ Project\n" + 3448 " ├─ columns: [xy.x, xy.y, uv.u, uv.v, Subquery\n" + 3449 " │ ├─ cacheable: false\n" + 3450 " │ └─ Project\n" + 3451 " │ ├─ columns: [1]\n" + 3452 " │ └─ Filter\n" + 3453 " │ ├─ (xy.y = 1)\n" + 3454 " │ └─ Table\n" + 3455 " │ └─ name: \n" + 3456 " │ as is_one]\n" + 3457 " └─ LookupJoin\n" + 3458 " ├─ Table\n" + 3459 " │ └─ name: uv\n" + 3460 " └─ IndexedTableAccess(xy)\n" + 3461 " ├─ index: [xy.x]\n" + 3462 " └─ keys: uv.v\n" + 3463 "", 3464 ExpectedAnalysis: "Sort(sq.y ASC)\n" + 3465 " └─ SubqueryAlias\n" + 3466 " ├─ name: sq\n" + 3467 " ├─ outerVisibility: false\n" + 3468 " ├─ isLateral: false\n" + 3469 " ├─ cacheable: true\n" + 3470 " └─ Project\n" + 3471 " ├─ columns: [xy.y, Subquery\n" + 3472 " │ ├─ cacheable: false\n" + 3473 " │ └─ Project\n" + 3474 " │ ├─ columns: [1]\n" + 3475 " │ └─ Filter\n" + 3476 " │ ├─ (xy.y = 1)\n" + 3477 " │ └─ Table\n" + 3478 " │ └─ name: \n" + 3479 " │ as is_one]\n" + 3480 " └─ Project\n" + 3481 " ├─ columns: [xy.x, xy.y, uv.u, uv.v, Subquery\n" + 3482 " │ ├─ cacheable: false\n" + 3483 " │ └─ Project\n" + 3484 " │ ├─ columns: [1]\n" + 3485 " │ └─ Filter\n" + 3486 " │ ├─ (xy.y = 1)\n" + 3487 " │ └─ Table\n" + 3488 " │ └─ name: \n" + 3489 " │ as is_one]\n" + 3490 " └─ LookupJoin\n" + 3491 " ├─ Table\n" + 3492 " │ └─ name: uv\n" + 3493 " └─ IndexedTableAccess(xy)\n" + 3494 " ├─ index: [xy.x]\n" + 3495 " └─ keys: uv.v\n" + 3496 "", 3497 }, 3498 { 3499 Query: `select y,(select 1 where y = 1) is_one from xy join uv on x = v;`, 3500 ExpectedPlan: "Project\n" + 3501 " ├─ columns: [xy.y:1, Subquery\n" + 3502 " │ ├─ cacheable: false\n" + 3503 " │ ├─ alias-string: select 1 where y = 1\n" + 3504 " │ └─ Project\n" + 3505 " │ ├─ columns: [1 (tinyint)]\n" + 3506 " │ └─ Filter\n" + 3507 " │ ├─ Eq\n" + 3508 " │ │ ├─ xy.y:1\n" + 3509 " │ │ └─ 1 (tinyint)\n" + 3510 " │ └─ Table\n" + 3511 " │ ├─ name: \n" + 3512 " │ ├─ columns: []\n" + 3513 " │ ├─ colSet: ()\n" + 3514 " │ └─ tableId: 0\n" + 3515 " │ as is_one]\n" + 3516 " └─ Project\n" + 3517 " ├─ columns: [xy.x:2!null, xy.y:3, uv.u:0!null, uv.v:1, Subquery\n" + 3518 " │ ├─ cacheable: false\n" + 3519 " │ ├─ alias-string: select 1 where y = 1\n" + 3520 " │ └─ Project\n" + 3521 " │ ├─ columns: [1 (tinyint)]\n" + 3522 " │ └─ Filter\n" + 3523 " │ ├─ Eq\n" + 3524 " │ │ ├─ xy.y:3\n" + 3525 " │ │ └─ 1 (tinyint)\n" + 3526 " │ └─ Table\n" + 3527 " │ ├─ name: \n" + 3528 " │ ├─ columns: []\n" + 3529 " │ ├─ colSet: ()\n" + 3530 " │ └─ tableId: 0\n" + 3531 " │ as is_one]\n" + 3532 " └─ LookupJoin\n" + 3533 " ├─ ProcessTable\n" + 3534 " │ └─ Table\n" + 3535 " │ ├─ name: uv\n" + 3536 " │ └─ columns: [u v]\n" + 3537 " └─ IndexedTableAccess(xy)\n" + 3538 " ├─ index: [xy.x]\n" + 3539 " ├─ keys: [uv.v:1]\n" + 3540 " ├─ colSet: (1,2)\n" + 3541 " ├─ tableId: 1\n" + 3542 " └─ Table\n" + 3543 " ├─ name: xy\n" + 3544 " └─ columns: [x y]\n" + 3545 "", 3546 ExpectedEstimates: "Project\n" + 3547 " ├─ columns: [xy.y, Subquery\n" + 3548 " │ ├─ cacheable: false\n" + 3549 " │ └─ Project\n" + 3550 " │ ├─ columns: [1]\n" + 3551 " │ └─ Filter\n" + 3552 " │ ├─ (xy.y = 1)\n" + 3553 " │ └─ Table\n" + 3554 " │ └─ name: \n" + 3555 " │ as is_one]\n" + 3556 " └─ Project\n" + 3557 " ├─ columns: [xy.x, xy.y, uv.u, uv.v, Subquery\n" + 3558 " │ ├─ cacheable: false\n" + 3559 " │ └─ Project\n" + 3560 " │ ├─ columns: [1]\n" + 3561 " │ └─ Filter\n" + 3562 " │ ├─ (xy.y = 1)\n" + 3563 " │ └─ Table\n" + 3564 " │ └─ name: \n" + 3565 " │ as is_one]\n" + 3566 " └─ LookupJoin (estimated cost=13.200 rows=4)\n" + 3567 " ├─ Table\n" + 3568 " │ └─ name: uv\n" + 3569 " └─ IndexedTableAccess(xy)\n" + 3570 " ├─ index: [xy.x]\n" + 3571 " └─ keys: uv.v\n" + 3572 "", 3573 ExpectedAnalysis: "Project\n" + 3574 " ├─ columns: [xy.y, Subquery\n" + 3575 " │ ├─ cacheable: false\n" + 3576 " │ └─ Project\n" + 3577 " │ ├─ columns: [1]\n" + 3578 " │ └─ Filter\n" + 3579 " │ ├─ (xy.y = 1)\n" + 3580 " │ └─ Table\n" + 3581 " │ └─ name: \n" + 3582 " │ as is_one]\n" + 3583 " └─ Project\n" + 3584 " ├─ columns: [xy.x, xy.y, uv.u, uv.v, Subquery\n" + 3585 " │ ├─ cacheable: false\n" + 3586 " │ └─ Project\n" + 3587 " │ ├─ columns: [1]\n" + 3588 " │ └─ Filter\n" + 3589 " │ ├─ (xy.y = 1)\n" + 3590 " │ └─ Table\n" + 3591 " │ └─ name: \n" + 3592 " │ as is_one]\n" + 3593 " └─ LookupJoin (estimated cost=13.200 rows=4) (actual rows=4 loops=1)\n" + 3594 " ├─ Table\n" + 3595 " │ └─ name: uv\n" + 3596 " └─ IndexedTableAccess(xy)\n" + 3597 " ├─ index: [xy.x]\n" + 3598 " └─ keys: uv.v\n" + 3599 "", 3600 }, 3601 { 3602 Query: `SELECT a FROM (select i,s FROM mytable) mt (a,b) order by 1;`, 3603 ExpectedPlan: "Project\n" + 3604 " ├─ columns: [mt.a:0!null]\n" + 3605 " └─ Sort(mt.a:0!null ASC nullsFirst)\n" + 3606 " └─ SubqueryAlias\n" + 3607 " ├─ name: mt\n" + 3608 " ├─ outerVisibility: false\n" + 3609 " ├─ isLateral: false\n" + 3610 " ├─ cacheable: true\n" + 3611 " ├─ colSet: (3,4)\n" + 3612 " ├─ tableId: 2\n" + 3613 " └─ Table\n" + 3614 " ├─ name: mytable\n" + 3615 " ├─ columns: [i s]\n" + 3616 " ├─ colSet: (1,2)\n" + 3617 " └─ tableId: 1\n" + 3618 "", 3619 ExpectedEstimates: "Project\n" + 3620 " ├─ columns: [mt.a]\n" + 3621 " └─ Sort(mt.a ASC)\n" + 3622 " └─ SubqueryAlias\n" + 3623 " ├─ name: mt\n" + 3624 " ├─ outerVisibility: false\n" + 3625 " ├─ isLateral: false\n" + 3626 " ├─ cacheable: true\n" + 3627 " └─ Table\n" + 3628 " ├─ name: mytable\n" + 3629 " └─ columns: [i s]\n" + 3630 "", 3631 ExpectedAnalysis: "Project\n" + 3632 " ├─ columns: [mt.a]\n" + 3633 " └─ Sort(mt.a ASC)\n" + 3634 " └─ SubqueryAlias\n" + 3635 " ├─ name: mt\n" + 3636 " ├─ outerVisibility: false\n" + 3637 " ├─ isLateral: false\n" + 3638 " ├─ cacheable: true\n" + 3639 " └─ Table\n" + 3640 " ├─ name: mytable\n" + 3641 " └─ columns: [i s]\n" + 3642 "", 3643 }, 3644 { 3645 Query: ` 3646 WITH RECURSIVE bus_dst as ( 3647 SELECT origin as dst FROM bus_routes WHERE origin='New York' 3648 UNION 3649 SELECT bus_routes.dst FROM bus_routes JOIN bus_dst ON concat(bus_dst.dst, 'aa') = concat(bus_routes.origin, 'aa') 3650 ) 3651 SELECT * FROM bus_dst 3652 ORDER BY dst`, 3653 ExpectedPlan: "Sort(bus_dst.dst:0!null ASC nullsFirst)\n" + 3654 " └─ SubqueryAlias\n" + 3655 " ├─ name: bus_dst\n" + 3656 " ├─ outerVisibility: false\n" + 3657 " ├─ isLateral: false\n" + 3658 " ├─ cacheable: true\n" + 3659 " ├─ colSet: (4)\n" + 3660 " ├─ tableId: 2\n" + 3661 " └─ RecursiveCTE\n" + 3662 " └─ Union distinct\n" + 3663 " ├─ Project\n" + 3664 " │ ├─ columns: [bus_routes.origin:0!null as dst]\n" + 3665 " │ └─ Filter\n" + 3666 " │ ├─ Eq\n" + 3667 " │ │ ├─ bus_routes.origin:0!null\n" + 3668 " │ │ └─ New York (longtext)\n" + 3669 " │ └─ IndexedTableAccess(bus_routes)\n" + 3670 " │ ├─ index: [bus_routes.origin,bus_routes.dst]\n" + 3671 " │ ├─ static: [{[New York, New York], [NULL, ∞)}]\n" + 3672 " │ ├─ colSet: (1,2)\n" + 3673 " │ ├─ tableId: 1\n" + 3674 " │ └─ Table\n" + 3675 " │ ├─ name: bus_routes\n" + 3676 " │ └─ columns: [origin]\n" + 3677 " └─ Project\n" + 3678 " ├─ columns: [bus_routes.dst:2!null]\n" + 3679 " └─ HashJoin\n" + 3680 " ├─ Eq\n" + 3681 " │ ├─ concat(bus_dst.dst:0!null,aa (longtext))\n" + 3682 " │ └─ concat(bus_routes.origin:1!null,aa (longtext))\n" + 3683 " ├─ RecursiveTable(bus_dst)\n" + 3684 " └─ HashLookup\n" + 3685 " ├─ left-key: TUPLE(concat(bus_dst.dst:0!null,aa (longtext)))\n" + 3686 " ├─ right-key: TUPLE(concat(bus_routes.origin:0!null,aa (longtext)))\n" + 3687 " └─ Table\n" + 3688 " ├─ name: bus_routes\n" + 3689 " ├─ columns: [origin dst]\n" + 3690 " ├─ colSet: (5,6)\n" + 3691 " └─ tableId: 4\n" + 3692 "", 3693 ExpectedEstimates: "Sort(bus_dst.dst ASC)\n" + 3694 " └─ SubqueryAlias\n" + 3695 " ├─ name: bus_dst\n" + 3696 " ├─ outerVisibility: false\n" + 3697 " ├─ isLateral: false\n" + 3698 " ├─ cacheable: true\n" + 3699 " └─ RecursiveCTE\n" + 3700 " └─ Union distinct\n" + 3701 " ├─ Project\n" + 3702 " │ ├─ columns: [bus_routes.origin as dst]\n" + 3703 " │ └─ Filter\n" + 3704 " │ ├─ (bus_routes.origin = 'New York')\n" + 3705 " │ └─ IndexedTableAccess(bus_routes)\n" + 3706 " │ ├─ index: [bus_routes.origin,bus_routes.dst]\n" + 3707 " │ ├─ filters: [{[New York, New York], [NULL, ∞)}]\n" + 3708 " │ └─ columns: [origin]\n" + 3709 " └─ Project\n" + 3710 " ├─ columns: [bus_routes.dst]\n" + 3711 " └─ HashJoin\n" + 3712 " ├─ (concat(bus_dst.dst,'aa') = concat(bus_routes.origin,'aa'))\n" + 3713 " ├─ RecursiveTable(bus_dst)\n" + 3714 " └─ HashLookup\n" + 3715 " ├─ left-key: (concat(bus_dst.dst,'aa'))\n" + 3716 " ├─ right-key: (concat(bus_routes.origin,'aa'))\n" + 3717 " └─ Table\n" + 3718 " ├─ name: bus_routes\n" + 3719 " └─ columns: [origin dst]\n" + 3720 "", 3721 ExpectedAnalysis: "Sort(bus_dst.dst ASC)\n" + 3722 " └─ SubqueryAlias\n" + 3723 " ├─ name: bus_dst\n" + 3724 " ├─ outerVisibility: false\n" + 3725 " ├─ isLateral: false\n" + 3726 " ├─ cacheable: true\n" + 3727 " └─ RecursiveCTE\n" + 3728 " └─ Union distinct\n" + 3729 " ├─ Project\n" + 3730 " │ ├─ columns: [bus_routes.origin as dst]\n" + 3731 " │ └─ Filter\n" + 3732 " │ ├─ (bus_routes.origin = 'New York')\n" + 3733 " │ └─ IndexedTableAccess(bus_routes)\n" + 3734 " │ ├─ index: [bus_routes.origin,bus_routes.dst]\n" + 3735 " │ ├─ filters: [{[New York, New York], [NULL, ∞)}]\n" + 3736 " │ └─ columns: [origin]\n" + 3737 " └─ Project\n" + 3738 " ├─ columns: [bus_routes.dst]\n" + 3739 " └─ HashJoin\n" + 3740 " ├─ (concat(bus_dst.dst,'aa') = concat(bus_routes.origin,'aa'))\n" + 3741 " ├─ RecursiveTable(bus_dst)\n" + 3742 " └─ HashLookup\n" + 3743 " ├─ left-key: (concat(bus_dst.dst,'aa'))\n" + 3744 " ├─ right-key: (concat(bus_routes.origin,'aa'))\n" + 3745 " └─ Table\n" + 3746 " ├─ name: bus_routes\n" + 3747 " └─ columns: [origin dst]\n" + 3748 "", 3749 }, 3750 { 3751 Query: `with cte2 as (select u,v from uv join ab on u = b where u in (2,3)), cte1 as (select u, v from cte2 join ab on cte2.u = b) select * from xy where (x) not in (select u from cte1) order by 1`, 3752 ExpectedPlan: "Sort(xy.x:0!null ASC nullsFirst)\n" + 3753 " └─ Project\n" + 3754 " ├─ columns: [xy.x:0!null, xy.y:1]\n" + 3755 " └─ Filter\n" + 3756 " ├─ cte1.u:2!null IS NULL\n" + 3757 " └─ LeftOuterHashJoinExcludeNulls\n" + 3758 " ├─ Eq\n" + 3759 " │ ├─ xy.x:0!null\n" + 3760 " │ └─ cte1.u:2!null\n" + 3761 " ├─ ProcessTable\n" + 3762 " │ └─ Table\n" + 3763 " │ ├─ name: xy\n" + 3764 " │ └─ columns: [x y]\n" + 3765 " └─ HashLookup\n" + 3766 " ├─ left-key: TUPLE(xy.x:0!null)\n" + 3767 " ├─ right-key: TUPLE(cte1.u:0!null)\n" + 3768 " └─ Project\n" + 3769 " ├─ columns: [cte1.u:0!null]\n" + 3770 " └─ SubqueryAlias\n" + 3771 " ├─ name: cte1\n" + 3772 " ├─ outerVisibility: false\n" + 3773 " ├─ isLateral: false\n" + 3774 " ├─ cacheable: true\n" + 3775 " ├─ colSet: (9,10)\n" + 3776 " ├─ tableId: 6\n" + 3777 " └─ Project\n" + 3778 " ├─ columns: [cte2.u:1!null, cte2.v:2]\n" + 3779 " └─ HashJoin\n" + 3780 " ├─ Eq\n" + 3781 " │ ├─ cte2.u:1!null\n" + 3782 " │ └─ ab.b:0\n" + 3783 " ├─ Table\n" + 3784 " │ ├─ name: ab\n" + 3785 " │ ├─ columns: [b]\n" + 3786 " │ ├─ colSet: (7,8)\n" + 3787 " │ └─ tableId: 5\n" + 3788 " └─ HashLookup\n" + 3789 " ├─ left-key: TUPLE(ab.b:0)\n" + 3790 " ├─ right-key: TUPLE(cte2.u:0!null)\n" + 3791 " └─ SubqueryAlias\n" + 3792 " ├─ name: cte2\n" + 3793 " ├─ outerVisibility: false\n" + 3794 " ├─ isLateral: false\n" + 3795 " ├─ cacheable: true\n" + 3796 " ├─ colSet: (5,6)\n" + 3797 " ├─ tableId: 3\n" + 3798 " └─ Project\n" + 3799 " ├─ columns: [uv.u:1!null, uv.v:2]\n" + 3800 " └─ HashJoin\n" + 3801 " ├─ Eq\n" + 3802 " │ ├─ uv.u:1!null\n" + 3803 " │ └─ ab.b:0\n" + 3804 " ├─ Table\n" + 3805 " │ ├─ name: ab\n" + 3806 " │ ├─ columns: [b]\n" + 3807 " │ ├─ colSet: (3,4)\n" + 3808 " │ └─ tableId: 2\n" + 3809 " └─ HashLookup\n" + 3810 " ├─ left-key: TUPLE(ab.b:0)\n" + 3811 " ├─ right-key: TUPLE(uv.u:0!null)\n" + 3812 " └─ Filter\n" + 3813 " ├─ HashIn\n" + 3814 " │ ├─ uv.u:0!null\n" + 3815 " │ └─ TUPLE(2 (tinyint), 3 (tinyint))\n" + 3816 " └─ IndexedTableAccess(uv)\n" + 3817 " ├─ index: [uv.u]\n" + 3818 " ├─ static: [{[2, 2]}, {[3, 3]}]\n" + 3819 " ├─ colSet: (1,2)\n" + 3820 " ├─ tableId: 1\n" + 3821 " └─ Table\n" + 3822 " ├─ name: uv\n" + 3823 " └─ columns: [u v]\n" + 3824 "", 3825 ExpectedEstimates: "Sort(xy.x ASC)\n" + 3826 " └─ Project\n" + 3827 " ├─ columns: [xy.x, xy.y]\n" + 3828 " └─ Filter\n" + 3829 " ├─ cte1.u IS NULL\n" + 3830 " └─ LeftOuterHashJoinExcludeNulls\n" + 3831 " ├─ (xy.x = cte1.u)\n" + 3832 " ├─ Table\n" + 3833 " │ └─ name: xy\n" + 3834 " └─ HashLookup\n" + 3835 " ├─ left-key: (xy.x)\n" + 3836 " ├─ right-key: (cte1.u)\n" + 3837 " └─ Project\n" + 3838 " ├─ columns: [cte1.u]\n" + 3839 " └─ SubqueryAlias\n" + 3840 " ├─ name: cte1\n" + 3841 " ├─ outerVisibility: false\n" + 3842 " ├─ isLateral: false\n" + 3843 " ├─ cacheable: true\n" + 3844 " └─ Project\n" + 3845 " ├─ columns: [cte2.u, cte2.v]\n" + 3846 " └─ HashJoin\n" + 3847 " ├─ (cte2.u = ab.b)\n" + 3848 " ├─ Table\n" + 3849 " │ ├─ name: ab\n" + 3850 " │ └─ columns: [b]\n" + 3851 " └─ HashLookup\n" + 3852 " ├─ left-key: (ab.b)\n" + 3853 " ├─ right-key: (cte2.u)\n" + 3854 " └─ SubqueryAlias\n" + 3855 " ├─ name: cte2\n" + 3856 " ├─ outerVisibility: false\n" + 3857 " ├─ isLateral: false\n" + 3858 " ├─ cacheable: true\n" + 3859 " └─ Project\n" + 3860 " ├─ columns: [uv.u, uv.v]\n" + 3861 " └─ HashJoin\n" + 3862 " ├─ (uv.u = ab.b)\n" + 3863 " ├─ Table\n" + 3864 " │ ├─ name: ab\n" + 3865 " │ └─ columns: [b]\n" + 3866 " └─ HashLookup\n" + 3867 " ├─ left-key: (ab.b)\n" + 3868 " ├─ right-key: (uv.u)\n" + 3869 " └─ Filter\n" + 3870 " ├─ (uv.u HASH IN (2, 3))\n" + 3871 " └─ IndexedTableAccess(uv)\n" + 3872 " ├─ index: [uv.u]\n" + 3873 " ├─ filters: [{[2, 2]}, {[3, 3]}]\n" + 3874 " └─ columns: [u v]\n" + 3875 "", 3876 ExpectedAnalysis: "Sort(xy.x ASC)\n" + 3877 " └─ Project\n" + 3878 " ├─ columns: [xy.x, xy.y]\n" + 3879 " └─ Filter\n" + 3880 " ├─ cte1.u IS NULL\n" + 3881 " └─ LeftOuterHashJoinExcludeNulls\n" + 3882 " ├─ (xy.x = cte1.u)\n" + 3883 " ├─ Table\n" + 3884 " │ └─ name: xy\n" + 3885 " └─ HashLookup\n" + 3886 " ├─ left-key: (xy.x)\n" + 3887 " ├─ right-key: (cte1.u)\n" + 3888 " └─ Project\n" + 3889 " ├─ columns: [cte1.u]\n" + 3890 " └─ SubqueryAlias\n" + 3891 " ├─ name: cte1\n" + 3892 " ├─ outerVisibility: false\n" + 3893 " ├─ isLateral: false\n" + 3894 " ├─ cacheable: true\n" + 3895 " └─ Project\n" + 3896 " ├─ columns: [cte2.u, cte2.v]\n" + 3897 " └─ HashJoin\n" + 3898 " ├─ (cte2.u = ab.b)\n" + 3899 " ├─ Table\n" + 3900 " │ ├─ name: ab\n" + 3901 " │ └─ columns: [b]\n" + 3902 " └─ HashLookup\n" + 3903 " ├─ left-key: (ab.b)\n" + 3904 " ├─ right-key: (cte2.u)\n" + 3905 " └─ SubqueryAlias\n" + 3906 " ├─ name: cte2\n" + 3907 " ├─ outerVisibility: false\n" + 3908 " ├─ isLateral: false\n" + 3909 " ├─ cacheable: true\n" + 3910 " └─ Project\n" + 3911 " ├─ columns: [uv.u, uv.v]\n" + 3912 " └─ HashJoin\n" + 3913 " ├─ (uv.u = ab.b)\n" + 3914 " ├─ Table\n" + 3915 " │ ├─ name: ab\n" + 3916 " │ └─ columns: [b]\n" + 3917 " └─ HashLookup\n" + 3918 " ├─ left-key: (ab.b)\n" + 3919 " ├─ right-key: (uv.u)\n" + 3920 " └─ Filter\n" + 3921 " ├─ (uv.u HASH IN (2, 3))\n" + 3922 " └─ IndexedTableAccess(uv)\n" + 3923 " ├─ index: [uv.u]\n" + 3924 " ├─ filters: [{[2, 2]}, {[3, 3]}]\n" + 3925 " └─ columns: [u v]\n" + 3926 "", 3927 }, 3928 { 3929 Query: `select i+0.0/(lag(i) over (order by s)) from mytable order by 1;`, 3930 ExpectedPlan: "Project\n" + 3931 " ├─ columns: [(mytable.i:1!null + (0 (decimal(2,1)) / lag(mytable.i, 1) over ( order by mytable.s asc):0)) as i+0.0/(lag(i) over (order by s))]\n" + 3932 " └─ Sort((mytable.i:1!null + (0 (decimal(2,1)) / lag(mytable.i, 1) over ( order by mytable.s asc):0)) as i+0.0/(lag(i) over (order by s)) ASC nullsFirst)\n" + 3933 " └─ Window\n" + 3934 " ├─ lag(mytable.i, 1) over ( order by mytable.s ASC)\n" + 3935 " ├─ mytable.i:0!null\n" + 3936 " └─ ProcessTable\n" + 3937 " └─ Table\n" + 3938 " ├─ name: mytable\n" + 3939 " └─ columns: [i s]\n" + 3940 "", 3941 ExpectedEstimates: "Project\n" + 3942 " ├─ columns: [(mytable.i + (0.0 / lag(mytable.i, 1) over ( order by mytable.s asc))) as i+0.0/(lag(i) over (order by s))]\n" + 3943 " └─ Sort((mytable.i + (0.0 / lag(mytable.i, 1) over ( order by mytable.s asc))) as i+0.0/(lag(i) over (order by s)) ASC)\n" + 3944 " └─ Window(lag(mytable.i, 1) over ( order by mytable.s ASC), mytable.i)\n" + 3945 " └─ Table\n" + 3946 " ├─ name: mytable\n" + 3947 " └─ columns: [i s]\n" + 3948 "", 3949 ExpectedAnalysis: "Project\n" + 3950 " ├─ columns: [(mytable.i + (0.0 / lag(mytable.i, 1) over ( order by mytable.s asc))) as i+0.0/(lag(i) over (order by s))]\n" + 3951 " └─ Sort((mytable.i + (0.0 / lag(mytable.i, 1) over ( order by mytable.s asc))) as i+0.0/(lag(i) over (order by s)) ASC)\n" + 3952 " └─ Window(lag(mytable.i, 1) over ( order by mytable.s ASC), mytable.i)\n" + 3953 " └─ Table\n" + 3954 " ├─ name: mytable\n" + 3955 " └─ columns: [i s]\n" + 3956 "", 3957 }, 3958 { 3959 Query: `select f64/f32, f32/(lag(i) over (order by f64)) from floattable order by 1,2;`, 3960 ExpectedPlan: "Project\n" + 3961 " ├─ columns: [(floattable.f64:1!null / floattable.f32:2!null) as f64/f32, (floattable.f32:2!null / lag(floattable.i, 1) over ( order by floattable.f64 asc):0) as f32/(lag(i) over (order by f64))]\n" + 3962 " └─ Sort((floattable.f64:1!null / floattable.f32:2!null) as f64/f32 ASC nullsFirst, (floattable.f32:2!null / lag(floattable.i, 1) over ( order by floattable.f64 asc):0) as f32/(lag(i) over (order by f64)) ASC nullsFirst)\n" + 3963 " └─ Window\n" + 3964 " ├─ lag(floattable.i, 1) over ( order by floattable.f64 ASC)\n" + 3965 " ├─ floattable.f64:2!null\n" + 3966 " ├─ floattable.f32:1!null\n" + 3967 " └─ ProcessTable\n" + 3968 " └─ Table\n" + 3969 " ├─ name: floattable\n" + 3970 " └─ columns: [i f32 f64]\n" + 3971 "", 3972 ExpectedEstimates: "Project\n" + 3973 " ├─ columns: [(floattable.f64 / floattable.f32) as f64/f32, (floattable.f32 / lag(floattable.i, 1) over ( order by floattable.f64 asc)) as f32/(lag(i) over (order by f64))]\n" + 3974 " └─ Sort((floattable.f64 / floattable.f32) as f64/f32 ASC, (floattable.f32 / lag(floattable.i, 1) over ( order by floattable.f64 asc)) as f32/(lag(i) over (order by f64)) ASC)\n" + 3975 " └─ Window(lag(floattable.i, 1) over ( order by floattable.f64 ASC), floattable.f64, floattable.f32)\n" + 3976 " └─ Table\n" + 3977 " ├─ name: floattable\n" + 3978 " └─ columns: [i f32 f64]\n" + 3979 "", 3980 ExpectedAnalysis: "Project\n" + 3981 " ├─ columns: [(floattable.f64 / floattable.f32) as f64/f32, (floattable.f32 / lag(floattable.i, 1) over ( order by floattable.f64 asc)) as f32/(lag(i) over (order by f64))]\n" + 3982 " └─ Sort((floattable.f64 / floattable.f32) as f64/f32 ASC, (floattable.f32 / lag(floattable.i, 1) over ( order by floattable.f64 asc)) as f32/(lag(i) over (order by f64)) ASC)\n" + 3983 " └─ Window(lag(floattable.i, 1) over ( order by floattable.f64 ASC), floattable.f64, floattable.f32)\n" + 3984 " └─ Table\n" + 3985 " ├─ name: floattable\n" + 3986 " └─ columns: [i f32 f64]\n" + 3987 "", 3988 }, 3989 { 3990 Query: `select x from xy join uv on y = v join ab on y = b and u = -1`, 3991 ExpectedPlan: "Project\n" + 3992 " ├─ columns: [xy.x:3!null]\n" + 3993 " └─ HashJoin\n" + 3994 " ├─ AND\n" + 3995 " │ ├─ Eq\n" + 3996 " │ │ ├─ xy.y:4\n" + 3997 " │ │ └─ ab.b:0\n" + 3998 " │ └─ Eq\n" + 3999 " │ ├─ uv.v:2\n" + 4000 " │ └─ ab.b:0\n" + 4001 " ├─ ProcessTable\n" + 4002 " │ └─ Table\n" + 4003 " │ ├─ name: ab\n" + 4004 " │ └─ columns: [b]\n" + 4005 " └─ HashLookup\n" + 4006 " ├─ left-key: TUPLE(ab.b:0, ab.b:0)\n" + 4007 " ├─ right-key: TUPLE(xy.y:3, uv.v:1)\n" + 4008 " └─ LookupJoin\n" + 4009 " ├─ IndexedTableAccess(uv)\n" + 4010 " │ ├─ index: [uv.u]\n" + 4011 " │ ├─ static: [{[-1, -1]}]\n" + 4012 " │ ├─ colSet: (3,4)\n" + 4013 " │ ├─ tableId: 2\n" + 4014 " │ └─ Table\n" + 4015 " │ ├─ name: uv\n" + 4016 " │ └─ columns: [u v]\n" + 4017 " └─ IndexedTableAccess(xy)\n" + 4018 " ├─ index: [xy.y]\n" + 4019 " ├─ keys: [uv.v:2]\n" + 4020 " ├─ colSet: (1,2)\n" + 4021 " ├─ tableId: 1\n" + 4022 " └─ Table\n" + 4023 " ├─ name: xy\n" + 4024 " └─ columns: [x y]\n" + 4025 "", 4026 ExpectedEstimates: "Project\n" + 4027 " ├─ columns: [xy.x]\n" + 4028 " └─ HashJoin (estimated cost=1032.000 rows=1000)\n" + 4029 " ├─ ((xy.y = ab.b) AND (uv.v = ab.b))\n" + 4030 " ├─ Table\n" + 4031 " │ ├─ name: ab\n" + 4032 " │ └─ columns: [b]\n" + 4033 " └─ HashLookup\n" + 4034 " ├─ left-key: (ab.b, ab.b)\n" + 4035 " ├─ right-key: (xy.y, uv.v)\n" + 4036 " └─ LookupJoin\n" + 4037 " ├─ IndexedTableAccess(uv)\n" + 4038 " │ ├─ index: [uv.u]\n" + 4039 " │ ├─ filters: [{[-1, -1]}]\n" + 4040 " │ └─ columns: [u v]\n" + 4041 " └─ IndexedTableAccess(xy)\n" + 4042 " ├─ index: [xy.y]\n" + 4043 " ├─ columns: [x y]\n" + 4044 " └─ keys: uv.v\n" + 4045 "", 4046 ExpectedAnalysis: "Project\n" + 4047 " ├─ columns: [xy.x]\n" + 4048 " └─ HashJoin (estimated cost=1032.000 rows=1000) (actual rows=0 loops=1)\n" + 4049 " ├─ ((xy.y = ab.b) AND (uv.v = ab.b))\n" + 4050 " ├─ Table\n" + 4051 " │ ├─ name: ab\n" + 4052 " │ └─ columns: [b]\n" + 4053 " └─ HashLookup\n" + 4054 " ├─ left-key: (ab.b, ab.b)\n" + 4055 " ├─ right-key: (xy.y, uv.v)\n" + 4056 " └─ LookupJoin\n" + 4057 " ├─ IndexedTableAccess(uv)\n" + 4058 " │ ├─ index: [uv.u]\n" + 4059 " │ ├─ filters: [{[-1, -1]}]\n" + 4060 " │ └─ columns: [u v]\n" + 4061 " └─ IndexedTableAccess(xy)\n" + 4062 " ├─ index: [xy.y]\n" + 4063 " ├─ columns: [x y]\n" + 4064 " └─ keys: uv.v\n" + 4065 "", 4066 }, 4067 { 4068 Query: `select * from (select a,v from ab join uv on a=u) av join (select x,q from xy join pq on x = p) xq on av.v = xq.x`, 4069 ExpectedPlan: "HashJoin\n" + 4070 " ├─ Eq\n" + 4071 " │ ├─ av.v:1\n" + 4072 " │ └─ xq.x:2!null\n" + 4073 " ├─ SubqueryAlias\n" + 4074 " │ ├─ name: av\n" + 4075 " │ ├─ outerVisibility: false\n" + 4076 " │ ├─ isLateral: false\n" + 4077 " │ ├─ cacheable: true\n" + 4078 " │ ├─ colSet: (5,6)\n" + 4079 " │ ├─ tableId: 3\n" + 4080 " │ └─ Project\n" + 4081 " │ ├─ columns: [ab.a:2!null, uv.v:1]\n" + 4082 " │ └─ LookupJoin\n" + 4083 " │ ├─ Table\n" + 4084 " │ │ ├─ name: uv\n" + 4085 " │ │ ├─ columns: [u v]\n" + 4086 " │ │ ├─ colSet: (3,4)\n" + 4087 " │ │ └─ tableId: 2\n" + 4088 " │ └─ IndexedTableAccess(ab)\n" + 4089 " │ ├─ index: [ab.a]\n" + 4090 " │ ├─ keys: [uv.u:0!null]\n" + 4091 " │ ├─ colSet: (1,2)\n" + 4092 " │ ├─ tableId: 1\n" + 4093 " │ └─ Table\n" + 4094 " │ ├─ name: ab\n" + 4095 " │ └─ columns: [a]\n" + 4096 " └─ HashLookup\n" + 4097 " ├─ left-key: TUPLE(av.v:1)\n" + 4098 " ├─ right-key: TUPLE(xq.x:0!null)\n" + 4099 " └─ SubqueryAlias\n" + 4100 " ├─ name: xq\n" + 4101 " ├─ outerVisibility: false\n" + 4102 " ├─ isLateral: false\n" + 4103 " ├─ cacheable: true\n" + 4104 " ├─ colSet: (11,12)\n" + 4105 " ├─ tableId: 6\n" + 4106 " └─ Project\n" + 4107 " ├─ columns: [xy.x:2!null, pq.q:1]\n" + 4108 " └─ LookupJoin\n" + 4109 " ├─ Table\n" + 4110 " │ ├─ name: pq\n" + 4111 " │ ├─ columns: [p q]\n" + 4112 " │ ├─ colSet: (9,10)\n" + 4113 " │ └─ tableId: 5\n" + 4114 " └─ IndexedTableAccess(xy)\n" + 4115 " ├─ index: [xy.x]\n" + 4116 " ├─ keys: [pq.p:0!null]\n" + 4117 " ├─ colSet: (7,8)\n" + 4118 " ├─ tableId: 4\n" + 4119 " └─ Table\n" + 4120 " ├─ name: xy\n" + 4121 " └─ columns: [x]\n" + 4122 "", 4123 ExpectedEstimates: "HashJoin (estimated cost=402.250 rows=125)\n" + 4124 " ├─ (av.v = xq.x)\n" + 4125 " ├─ SubqueryAlias\n" + 4126 " │ ├─ name: av\n" + 4127 " │ ├─ outerVisibility: false\n" + 4128 " │ ├─ isLateral: false\n" + 4129 " │ ├─ cacheable: true\n" + 4130 " │ └─ Project\n" + 4131 " │ ├─ columns: [ab.a, uv.v]\n" + 4132 " │ └─ LookupJoin\n" + 4133 " │ ├─ Table\n" + 4134 " │ │ ├─ name: uv\n" + 4135 " │ │ └─ columns: [u v]\n" + 4136 " │ └─ IndexedTableAccess(ab)\n" + 4137 " │ ├─ index: [ab.a]\n" + 4138 " │ ├─ columns: [a]\n" + 4139 " │ └─ keys: uv.u\n" + 4140 " └─ HashLookup\n" + 4141 " ├─ left-key: (av.v)\n" + 4142 " ├─ right-key: (xq.x)\n" + 4143 " └─ SubqueryAlias\n" + 4144 " ├─ name: xq\n" + 4145 " ├─ outerVisibility: false\n" + 4146 " ├─ isLateral: false\n" + 4147 " ├─ cacheable: true\n" + 4148 " └─ Project\n" + 4149 " ├─ columns: [xy.x, pq.q]\n" + 4150 " └─ LookupJoin\n" + 4151 " ├─ Table\n" + 4152 " │ ├─ name: pq\n" + 4153 " │ └─ columns: [p q]\n" + 4154 " └─ IndexedTableAccess(xy)\n" + 4155 " ├─ index: [xy.x]\n" + 4156 " ├─ columns: [x]\n" + 4157 " └─ keys: pq.p\n" + 4158 "", 4159 ExpectedAnalysis: "HashJoin (estimated cost=402.250 rows=125) (actual rows=4 loops=1)\n" + 4160 " ├─ (av.v = xq.x)\n" + 4161 " ├─ SubqueryAlias\n" + 4162 " │ ├─ name: av\n" + 4163 " │ ├─ outerVisibility: false\n" + 4164 " │ ├─ isLateral: false\n" + 4165 " │ ├─ cacheable: true\n" + 4166 " │ └─ Project\n" + 4167 " │ ├─ columns: [ab.a, uv.v]\n" + 4168 " │ └─ LookupJoin\n" + 4169 " │ ├─ Table\n" + 4170 " │ │ ├─ name: uv\n" + 4171 " │ │ └─ columns: [u v]\n" + 4172 " │ └─ IndexedTableAccess(ab)\n" + 4173 " │ ├─ index: [ab.a]\n" + 4174 " │ ├─ columns: [a]\n" + 4175 " │ └─ keys: uv.u\n" + 4176 " └─ HashLookup\n" + 4177 " ├─ left-key: (av.v)\n" + 4178 " ├─ right-key: (xq.x)\n" + 4179 " └─ SubqueryAlias\n" + 4180 " ├─ name: xq\n" + 4181 " ├─ outerVisibility: false\n" + 4182 " ├─ isLateral: false\n" + 4183 " ├─ cacheable: true\n" + 4184 " └─ Project\n" + 4185 " ├─ columns: [xy.x, pq.q]\n" + 4186 " └─ LookupJoin\n" + 4187 " ├─ Table\n" + 4188 " │ ├─ name: pq\n" + 4189 " │ └─ columns: [p q]\n" + 4190 " └─ IndexedTableAccess(xy)\n" + 4191 " ├─ index: [xy.x]\n" + 4192 " ├─ columns: [x]\n" + 4193 " └─ keys: pq.p\n" + 4194 "", 4195 }, 4196 { 4197 Query: `select * from mytable t1 natural join mytable t2 join othertable t3 on t2.i = t3.i2;`, 4198 ExpectedPlan: "Project\n" + 4199 " ├─ columns: [t1.i:0!null, t1.s:1!null, t3.s2:4!null, t3.i2:5!null]\n" + 4200 " └─ LookupJoin\n" + 4201 " ├─ MergeJoin\n" + 4202 " │ ├─ cmp: Eq\n" + 4203 " │ │ ├─ t1.s:1!null\n" + 4204 " │ │ └─ t2.s:3!null\n" + 4205 " │ ├─ sel: Eq\n" + 4206 " │ │ ├─ t1.i:0!null\n" + 4207 " │ │ └─ t2.i:2!null\n" + 4208 " │ ├─ TableAlias(t1)\n" + 4209 " │ │ └─ IndexedTableAccess(mytable)\n" + 4210 " │ │ ├─ index: [mytable.s]\n" + 4211 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 4212 " │ │ ├─ colSet: (1,2)\n" + 4213 " │ │ ├─ tableId: 1\n" + 4214 " │ │ └─ Table\n" + 4215 " │ │ ├─ name: mytable\n" + 4216 " │ │ └─ columns: [i s]\n" + 4217 " │ └─ TableAlias(t2)\n" + 4218 " │ └─ IndexedTableAccess(mytable)\n" + 4219 " │ ├─ index: [mytable.s]\n" + 4220 " │ ├─ static: [{[NULL, ∞)}]\n" + 4221 " │ ├─ colSet: (3,4)\n" + 4222 " │ ├─ tableId: 2\n" + 4223 " │ └─ Table\n" + 4224 " │ ├─ name: mytable\n" + 4225 " │ └─ columns: [i s]\n" + 4226 " └─ TableAlias(t3)\n" + 4227 " └─ IndexedTableAccess(othertable)\n" + 4228 " ├─ index: [othertable.i2]\n" + 4229 " ├─ keys: [t2.i:2!null]\n" + 4230 " ├─ colSet: (5,6)\n" + 4231 " ├─ tableId: 3\n" + 4232 " └─ Table\n" + 4233 " ├─ name: othertable\n" + 4234 " └─ columns: [s2 i2]\n" + 4235 "", 4236 ExpectedEstimates: "Project\n" + 4237 " ├─ columns: [t1.i, t1.s, t3.s2, t3.i2]\n" + 4238 " └─ LookupJoin (estimated cost=9.900 rows=3)\n" + 4239 " ├─ MergeJoin (estimated cost=6.090 rows=3)\n" + 4240 " │ ├─ cmp: (t1.s = t2.s)\n" + 4241 " │ ├─ sel: (t1.i = t2.i)\n" + 4242 " │ ├─ TableAlias(t1)\n" + 4243 " │ │ └─ IndexedTableAccess(mytable)\n" + 4244 " │ │ ├─ index: [mytable.s]\n" + 4245 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 4246 " │ │ └─ columns: [i s]\n" + 4247 " │ └─ TableAlias(t2)\n" + 4248 " │ └─ IndexedTableAccess(mytable)\n" + 4249 " │ ├─ index: [mytable.s]\n" + 4250 " │ ├─ filters: [{[NULL, ∞)}]\n" + 4251 " │ └─ columns: [i s]\n" + 4252 " └─ TableAlias(t3)\n" + 4253 " └─ IndexedTableAccess(othertable)\n" + 4254 " ├─ index: [othertable.i2]\n" + 4255 " ├─ columns: [s2 i2]\n" + 4256 " └─ keys: t2.i\n" + 4257 "", 4258 ExpectedAnalysis: "Project\n" + 4259 " ├─ columns: [t1.i, t1.s, t3.s2, t3.i2]\n" + 4260 " └─ LookupJoin (estimated cost=9.900 rows=3) (actual rows=3 loops=1)\n" + 4261 " ├─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=1)\n" + 4262 " │ ├─ cmp: (t1.s = t2.s)\n" + 4263 " │ ├─ sel: (t1.i = t2.i)\n" + 4264 " │ ├─ TableAlias(t1)\n" + 4265 " │ │ └─ IndexedTableAccess(mytable)\n" + 4266 " │ │ ├─ index: [mytable.s]\n" + 4267 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 4268 " │ │ └─ columns: [i s]\n" + 4269 " │ └─ TableAlias(t2)\n" + 4270 " │ └─ IndexedTableAccess(mytable)\n" + 4271 " │ ├─ index: [mytable.s]\n" + 4272 " │ ├─ filters: [{[NULL, ∞)}]\n" + 4273 " │ └─ columns: [i s]\n" + 4274 " └─ TableAlias(t3)\n" + 4275 " └─ IndexedTableAccess(othertable)\n" + 4276 " ├─ index: [othertable.i2]\n" + 4277 " ├─ columns: [s2 i2]\n" + 4278 " └─ keys: t2.i\n" + 4279 "", 4280 }, 4281 { 4282 Query: `select x, a from xy inner join ab on a+1 = x OR a+2 = x OR a+3 = x `, 4283 ExpectedPlan: "Project\n" + 4284 " ├─ columns: [xy.x:1!null, ab.a:0!null]\n" + 4285 " └─ LookupJoin\n" + 4286 " ├─ Or\n" + 4287 " │ ├─ Or\n" + 4288 " │ │ ├─ Eq\n" + 4289 " │ │ │ ├─ (ab.a:0!null + 1 (tinyint))\n" + 4290 " │ │ │ └─ xy.x:1!null\n" + 4291 " │ │ └─ Eq\n" + 4292 " │ │ ├─ (ab.a:0!null + 2 (tinyint))\n" + 4293 " │ │ └─ xy.x:1!null\n" + 4294 " │ └─ Eq\n" + 4295 " │ ├─ (ab.a:0!null + 3 (tinyint))\n" + 4296 " │ └─ xy.x:1!null\n" + 4297 " ├─ ProcessTable\n" + 4298 " │ └─ Table\n" + 4299 " │ ├─ name: ab\n" + 4300 " │ └─ columns: [a]\n" + 4301 " └─ Concat\n" + 4302 " ├─ IndexedTableAccess(xy)\n" + 4303 " │ ├─ index: [xy.x]\n" + 4304 " │ ├─ keys: [(ab.a:0!null + 3 (tinyint))]\n" + 4305 " │ ├─ colSet: (1,2)\n" + 4306 " │ ├─ tableId: 1\n" + 4307 " │ └─ Table\n" + 4308 " │ ├─ name: xy\n" + 4309 " │ └─ columns: [x]\n" + 4310 " └─ Concat\n" + 4311 " ├─ IndexedTableAccess(xy)\n" + 4312 " │ ├─ index: [xy.x]\n" + 4313 " │ ├─ keys: [(ab.a:0!null + 2 (tinyint))]\n" + 4314 " │ ├─ colSet: (1,2)\n" + 4315 " │ ├─ tableId: 1\n" + 4316 " │ └─ Table\n" + 4317 " │ ├─ name: xy\n" + 4318 " │ └─ columns: [x]\n" + 4319 " └─ IndexedTableAccess(xy)\n" + 4320 " ├─ index: [xy.x]\n" + 4321 " ├─ keys: [(ab.a:0!null + 1 (tinyint))]\n" + 4322 " ├─ colSet: (1,2)\n" + 4323 " ├─ tableId: 1\n" + 4324 " └─ Table\n" + 4325 " ├─ name: xy\n" + 4326 " └─ columns: [x]\n" + 4327 "", 4328 ExpectedEstimates: "Project\n" + 4329 " ├─ columns: [xy.x, ab.a]\n" + 4330 " └─ LookupJoin (estimated cost=-852.625 rows=1250)\n" + 4331 " ├─ ((((ab.a + 1) = xy.x) OR ((ab.a + 2) = xy.x)) OR ((ab.a + 3) = xy.x))\n" + 4332 " ├─ Table\n" + 4333 " │ ├─ name: ab\n" + 4334 " │ └─ columns: [a]\n" + 4335 " └─ Concat\n" + 4336 " ├─ IndexedTableAccess(xy)\n" + 4337 " │ ├─ index: [xy.x]\n" + 4338 " │ ├─ columns: [x]\n" + 4339 " │ └─ keys: (ab.a + 3)\n" + 4340 " └─ Concat\n" + 4341 " ├─ IndexedTableAccess(xy)\n" + 4342 " │ ├─ index: [xy.x]\n" + 4343 " │ ├─ columns: [x]\n" + 4344 " │ └─ keys: (ab.a + 2)\n" + 4345 " └─ IndexedTableAccess(xy)\n" + 4346 " ├─ index: [xy.x]\n" + 4347 " ├─ columns: [x]\n" + 4348 " └─ keys: (ab.a + 1)\n" + 4349 "", 4350 ExpectedAnalysis: "Project\n" + 4351 " ├─ columns: [xy.x, ab.a]\n" + 4352 " └─ LookupJoin (estimated cost=-852.625 rows=1250) (actual rows=6 loops=1)\n" + 4353 " ├─ ((((ab.a + 1) = xy.x) OR ((ab.a + 2) = xy.x)) OR ((ab.a + 3) = xy.x))\n" + 4354 " ├─ Table\n" + 4355 " │ ├─ name: ab\n" + 4356 " │ └─ columns: [a]\n" + 4357 " └─ Concat\n" + 4358 " ├─ IndexedTableAccess(xy)\n" + 4359 " │ ├─ index: [xy.x]\n" + 4360 " │ ├─ columns: [x]\n" + 4361 " │ └─ keys: (ab.a + 3)\n" + 4362 " └─ Concat\n" + 4363 " ├─ IndexedTableAccess(xy)\n" + 4364 " │ ├─ index: [xy.x]\n" + 4365 " │ ├─ columns: [x]\n" + 4366 " │ └─ keys: (ab.a + 2)\n" + 4367 " └─ IndexedTableAccess(xy)\n" + 4368 " ├─ index: [xy.x]\n" + 4369 " ├─ columns: [x]\n" + 4370 " └─ keys: (ab.a + 1)\n" + 4371 "", 4372 }, 4373 { 4374 Query: `select x, 1 in (select a from ab where exists (select * from uv where a = u)) s from xy`, 4375 ExpectedPlan: "Project\n" + 4376 " ├─ columns: [xy.x:0!null, InSubquery\n" + 4377 " │ ├─ left: 1 (tinyint)\n" + 4378 " │ └─ right: Subquery\n" + 4379 " │ ├─ cacheable: true\n" + 4380 " │ ├─ alias-string: select a from ab where exists (select * from uv where a = u)\n" + 4381 " │ └─ Project\n" + 4382 " │ ├─ columns: [ab.a:4!null]\n" + 4383 " │ └─ LookupJoin\n" + 4384 " │ ├─ Eq\n" + 4385 " │ │ ├─ ab.a:4!null\n" + 4386 " │ │ └─ uv.u:3!null\n" + 4387 " │ ├─ OrderedDistinct\n" + 4388 " │ │ └─ Project\n" + 4389 " │ │ ├─ columns: [uv.u:3!null]\n" + 4390 " │ │ └─ Table\n" + 4391 " │ │ ├─ name: uv\n" + 4392 " │ │ ├─ columns: [u v]\n" + 4393 " │ │ ├─ colSet: (5,6)\n" + 4394 " │ │ └─ tableId: 3\n" + 4395 " │ └─ IndexedTableAccess(ab)\n" + 4396 " │ ├─ index: [ab.a]\n" + 4397 " │ ├─ keys: [uv.u:3!null]\n" + 4398 " │ ├─ colSet: (3,4)\n" + 4399 " │ ├─ tableId: 2\n" + 4400 " │ └─ Table\n" + 4401 " │ ├─ name: ab\n" + 4402 " │ └─ columns: [a b]\n" + 4403 " │ as s]\n" + 4404 " └─ Project\n" + 4405 " ├─ columns: [xy.x:0!null, xy.y:1, InSubquery\n" + 4406 " │ ├─ left: 1 (tinyint)\n" + 4407 " │ └─ right: Subquery\n" + 4408 " │ ├─ cacheable: true\n" + 4409 " │ ├─ alias-string: select a from ab where exists (select * from uv where a = u)\n" + 4410 " │ └─ Project\n" + 4411 " │ ├─ columns: [ab.a:3!null]\n" + 4412 " │ └─ LookupJoin\n" + 4413 " │ ├─ Eq\n" + 4414 " │ │ ├─ ab.a:3!null\n" + 4415 " │ │ └─ uv.u:2!null\n" + 4416 " │ ├─ OrderedDistinct\n" + 4417 " │ │ └─ Project\n" + 4418 " │ │ ├─ columns: [uv.u:2!null]\n" + 4419 " │ │ └─ Table\n" + 4420 " │ │ ├─ name: uv\n" + 4421 " │ │ ├─ columns: [u v]\n" + 4422 " │ │ ├─ colSet: (5,6)\n" + 4423 " │ │ └─ tableId: 3\n" + 4424 " │ └─ IndexedTableAccess(ab)\n" + 4425 " │ ├─ index: [ab.a]\n" + 4426 " │ ├─ keys: [uv.u:2!null]\n" + 4427 " │ ├─ colSet: (3,4)\n" + 4428 " │ ├─ tableId: 2\n" + 4429 " │ └─ Table\n" + 4430 " │ ├─ name: ab\n" + 4431 " │ └─ columns: [a b]\n" + 4432 " │ as s]\n" + 4433 " └─ ProcessTable\n" + 4434 " └─ Table\n" + 4435 " ├─ name: xy\n" + 4436 " └─ columns: [x y]\n" + 4437 "", 4438 ExpectedEstimates: "Project\n" + 4439 " ├─ columns: [xy.x, InSubquery\n" + 4440 " │ ├─ left: 1\n" + 4441 " │ └─ right: Subquery\n" + 4442 " │ ├─ cacheable: true\n" + 4443 " │ └─ Project\n" + 4444 " │ ├─ columns: [ab.a]\n" + 4445 " │ └─ LookupJoin\n" + 4446 " │ ├─ (ab.a = uv.u)\n" + 4447 " │ ├─ OrderedDistinct\n" + 4448 " │ │ └─ Project\n" + 4449 " │ │ ├─ columns: [uv.u]\n" + 4450 " │ │ └─ Table\n" + 4451 " │ │ ├─ name: uv\n" + 4452 " │ │ └─ columns: [u v]\n" + 4453 " │ └─ IndexedTableAccess(ab)\n" + 4454 " │ ├─ index: [ab.a]\n" + 4455 " │ └─ keys: uv.u\n" + 4456 " │ as s]\n" + 4457 " └─ Project\n" + 4458 " ├─ columns: [xy.x, xy.y, InSubquery\n" + 4459 " │ ├─ left: 1\n" + 4460 " │ └─ right: Subquery\n" + 4461 " │ ├─ cacheable: true\n" + 4462 " │ └─ Project\n" + 4463 " │ ├─ columns: [ab.a]\n" + 4464 " │ └─ LookupJoin\n" + 4465 " │ ├─ (ab.a = uv.u)\n" + 4466 " │ ├─ OrderedDistinct\n" + 4467 " │ │ └─ Project\n" + 4468 " │ │ ├─ columns: [uv.u]\n" + 4469 " │ │ └─ Table\n" + 4470 " │ │ ├─ name: uv\n" + 4471 " │ │ └─ columns: [u v]\n" + 4472 " │ └─ IndexedTableAccess(ab)\n" + 4473 " │ ├─ index: [ab.a]\n" + 4474 " │ └─ keys: uv.u\n" + 4475 " │ as s]\n" + 4476 " └─ Table\n" + 4477 " └─ name: xy\n" + 4478 "", 4479 ExpectedAnalysis: "Project\n" + 4480 " ├─ columns: [xy.x, InSubquery\n" + 4481 " │ ├─ left: 1\n" + 4482 " │ └─ right: Subquery\n" + 4483 " │ ├─ cacheable: true\n" + 4484 " │ └─ Project\n" + 4485 " │ ├─ columns: [ab.a]\n" + 4486 " │ └─ LookupJoin\n" + 4487 " │ ├─ (ab.a = uv.u)\n" + 4488 " │ ├─ OrderedDistinct\n" + 4489 " │ │ └─ Project\n" + 4490 " │ │ ├─ columns: [uv.u]\n" + 4491 " │ │ └─ Table\n" + 4492 " │ │ ├─ name: uv\n" + 4493 " │ │ └─ columns: [u v]\n" + 4494 " │ └─ IndexedTableAccess(ab)\n" + 4495 " │ ├─ index: [ab.a]\n" + 4496 " │ └─ keys: uv.u\n" + 4497 " │ as s]\n" + 4498 " └─ Project\n" + 4499 " ├─ columns: [xy.x, xy.y, InSubquery\n" + 4500 " │ ├─ left: 1\n" + 4501 " │ └─ right: Subquery\n" + 4502 " │ ├─ cacheable: true\n" + 4503 " │ └─ Project\n" + 4504 " │ ├─ columns: [ab.a]\n" + 4505 " │ └─ LookupJoin\n" + 4506 " │ ├─ (ab.a = uv.u)\n" + 4507 " │ ├─ OrderedDistinct\n" + 4508 " │ │ └─ Project\n" + 4509 " │ │ ├─ columns: [uv.u]\n" + 4510 " │ │ └─ Table\n" + 4511 " │ │ ├─ name: uv\n" + 4512 " │ │ └─ columns: [u v]\n" + 4513 " │ └─ IndexedTableAccess(ab)\n" + 4514 " │ ├─ index: [ab.a]\n" + 4515 " │ └─ keys: uv.u\n" + 4516 " │ as s]\n" + 4517 " └─ Table\n" + 4518 " └─ name: xy\n" + 4519 "", 4520 }, 4521 { 4522 Query: `with cte (a,b) as (select * from ab) select * from cte`, 4523 ExpectedPlan: "SubqueryAlias\n" + 4524 " ├─ name: cte\n" + 4525 " ├─ outerVisibility: false\n" + 4526 " ├─ isLateral: false\n" + 4527 " ├─ cacheable: true\n" + 4528 " ├─ colSet: (3,4)\n" + 4529 " ├─ tableId: 2\n" + 4530 " └─ Table\n" + 4531 " ├─ name: ab\n" + 4532 " ├─ columns: [a b]\n" + 4533 " ├─ colSet: (1,2)\n" + 4534 " └─ tableId: 1\n" + 4535 "", 4536 ExpectedEstimates: "SubqueryAlias\n" + 4537 " ├─ name: cte\n" + 4538 " ├─ outerVisibility: false\n" + 4539 " ├─ isLateral: false\n" + 4540 " ├─ cacheable: true\n" + 4541 " └─ Table\n" + 4542 " ├─ name: ab\n" + 4543 " └─ columns: [a b]\n" + 4544 "", 4545 ExpectedAnalysis: "SubqueryAlias\n" + 4546 " ├─ name: cte\n" + 4547 " ├─ outerVisibility: false\n" + 4548 " ├─ isLateral: false\n" + 4549 " ├─ cacheable: true\n" + 4550 " └─ Table\n" + 4551 " ├─ name: ab\n" + 4552 " └─ columns: [a b]\n" + 4553 "", 4554 }, 4555 { 4556 Query: `select * from ab where exists (select * from uv where a = 1)`, 4557 ExpectedPlan: "Project\n" + 4558 " ├─ columns: [ab.a:2!null, ab.b:3]\n" + 4559 " └─ CrossJoin\n" + 4560 " ├─ Limit(1)\n" + 4561 " │ └─ ProcessTable\n" + 4562 " │ └─ Table\n" + 4563 " │ ├─ name: uv\n" + 4564 " │ └─ columns: [u v]\n" + 4565 " └─ IndexedTableAccess(ab)\n" + 4566 " ├─ index: [ab.a]\n" + 4567 " ├─ static: [{[1, 1]}]\n" + 4568 " ├─ colSet: (1,2)\n" + 4569 " ├─ tableId: 1\n" + 4570 " └─ Table\n" + 4571 " ├─ name: ab\n" + 4572 " └─ columns: [a b]\n" + 4573 "", 4574 ExpectedEstimates: "Project\n" + 4575 " ├─ columns: [ab.a, ab.b]\n" + 4576 " └─ CrossJoin (estimated cost=2021.000 rows=2000)\n" + 4577 " ├─ Limit(1)\n" + 4578 " │ └─ Table\n" + 4579 " │ ├─ name: uv\n" + 4580 " │ └─ columns: [u v]\n" + 4581 " └─ IndexedTableAccess(ab)\n" + 4582 " ├─ index: [ab.a]\n" + 4583 " └─ filters: [{[1, 1]}]\n" + 4584 "", 4585 ExpectedAnalysis: "Project\n" + 4586 " ├─ columns: [ab.a, ab.b]\n" + 4587 " └─ CrossJoin (estimated cost=2021.000 rows=2000) (actual rows=1 loops=1)\n" + 4588 " ├─ Limit(1)\n" + 4589 " │ └─ Table\n" + 4590 " │ ├─ name: uv\n" + 4591 " │ └─ columns: [u v]\n" + 4592 " └─ IndexedTableAccess(ab)\n" + 4593 " ├─ index: [ab.a]\n" + 4594 " └─ filters: [{[1, 1]}]\n" + 4595 "", 4596 }, 4597 { 4598 Query: `select * from ab where exists (select * from ab where a = 1)`, 4599 ExpectedPlan: "Project\n" + 4600 " ├─ columns: [ab.a:2!null, ab.b:3]\n" + 4601 " └─ CrossJoin\n" + 4602 " ├─ Limit(1)\n" + 4603 " │ └─ TableAlias(ab_1)\n" + 4604 " │ └─ IndexedTableAccess(ab)\n" + 4605 " │ ├─ index: [ab.a]\n" + 4606 " │ ├─ static: [{[1, 1]}]\n" + 4607 " │ ├─ colSet: (3,4)\n" + 4608 " │ ├─ tableId: 2\n" + 4609 " │ └─ Table\n" + 4610 " │ ├─ name: ab\n" + 4611 " │ └─ columns: [a b]\n" + 4612 " └─ ProcessTable\n" + 4613 " └─ Table\n" + 4614 " ├─ name: ab\n" + 4615 " └─ columns: [a b]\n" + 4616 "", 4617 ExpectedEstimates: "Project\n" + 4618 " ├─ columns: [ab.a, ab.b]\n" + 4619 " └─ CrossJoin (estimated cost=505001.000 rows=500000)\n" + 4620 " ├─ Limit(1)\n" + 4621 " │ └─ TableAlias(ab_1)\n" + 4622 " │ └─ IndexedTableAccess(ab)\n" + 4623 " │ ├─ index: [ab.a]\n" + 4624 " │ ├─ filters: [{[1, 1]}]\n" + 4625 " │ └─ columns: [a b]\n" + 4626 " └─ Table\n" + 4627 " └─ name: ab\n" + 4628 "", 4629 ExpectedAnalysis: "Project\n" + 4630 " ├─ columns: [ab.a, ab.b]\n" + 4631 " └─ CrossJoin (estimated cost=505001.000 rows=500000) (actual rows=4 loops=1)\n" + 4632 " ├─ Limit(1)\n" + 4633 " │ └─ TableAlias(ab_1)\n" + 4634 " │ └─ IndexedTableAccess(ab)\n" + 4635 " │ ├─ index: [ab.a]\n" + 4636 " │ ├─ filters: [{[1, 1]}]\n" + 4637 " │ └─ columns: [a b]\n" + 4638 " └─ Table\n" + 4639 " └─ name: ab\n" + 4640 "", 4641 }, 4642 { 4643 Query: `select * from ab s where exists (select * from ab where a = 1 or s.a = 1)`, 4644 ExpectedPlan: "SemiJoin\n" + 4645 " ├─ Or\n" + 4646 " │ ├─ Eq\n" + 4647 " │ │ ├─ ab.a:2!null\n" + 4648 " │ │ └─ 1 (tinyint)\n" + 4649 " │ └─ Eq\n" + 4650 " │ ├─ s.a:0!null\n" + 4651 " │ └─ 1 (tinyint)\n" + 4652 " ├─ TableAlias(s)\n" + 4653 " │ └─ ProcessTable\n" + 4654 " │ └─ Table\n" + 4655 " │ ├─ name: ab\n" + 4656 " │ └─ columns: [a b]\n" + 4657 " └─ Table\n" + 4658 " ├─ name: ab\n" + 4659 " ├─ columns: [a b]\n" + 4660 " ├─ colSet: (3,4)\n" + 4661 " └─ tableId: 2\n" + 4662 "", 4663 ExpectedEstimates: "SemiJoin (estimated cost=506000.000 rows=1250)\n" + 4664 " ├─ ((ab.a = 1) OR (s.a = 1))\n" + 4665 " ├─ TableAlias(s)\n" + 4666 " │ └─ Table\n" + 4667 " │ └─ name: ab\n" + 4668 " └─ Table\n" + 4669 " ├─ name: ab\n" + 4670 " └─ columns: [a b]\n" + 4671 "", 4672 ExpectedAnalysis: "SemiJoin (estimated cost=506000.000 rows=1250) (actual rows=4 loops=1)\n" + 4673 " ├─ ((ab.a = 1) OR (s.a = 1))\n" + 4674 " ├─ TableAlias(s)\n" + 4675 " │ └─ Table\n" + 4676 " │ └─ name: ab\n" + 4677 " └─ Table\n" + 4678 " ├─ name: ab\n" + 4679 " └─ columns: [a b]\n" + 4680 "", 4681 }, 4682 { 4683 Query: `select * from uv where exists (select 1, count(a) from ab where u = a group by a)`, 4684 ExpectedPlan: "SemiLookupJoin\n" + 4685 " ├─ ProcessTable\n" + 4686 " │ └─ Table\n" + 4687 " │ ├─ name: uv\n" + 4688 " │ └─ columns: [u v]\n" + 4689 " └─ IndexedTableAccess(ab)\n" + 4690 " ├─ index: [ab.a]\n" + 4691 " ├─ keys: [uv.u:0!null]\n" + 4692 " ├─ colSet: (3,4)\n" + 4693 " ├─ tableId: 2\n" + 4694 " └─ Table\n" + 4695 " ├─ name: ab\n" + 4696 " └─ columns: [a]\n" + 4697 "", 4698 ExpectedEstimates: "SemiLookupJoin (estimated cost=13.200 rows=4)\n" + 4699 " ├─ Table\n" + 4700 " │ └─ name: uv\n" + 4701 " └─ IndexedTableAccess(ab)\n" + 4702 " ├─ index: [ab.a]\n" + 4703 " ├─ columns: [a]\n" + 4704 " └─ keys: uv.u\n" + 4705 "", 4706 ExpectedAnalysis: "SemiLookupJoin (estimated cost=13.200 rows=4) (actual rows=4 loops=1)\n" + 4707 " ├─ Table\n" + 4708 " │ └─ name: uv\n" + 4709 " └─ IndexedTableAccess(ab)\n" + 4710 " ├─ index: [ab.a]\n" + 4711 " ├─ columns: [a]\n" + 4712 " └─ keys: uv.u\n" + 4713 "", 4714 }, 4715 { 4716 Query: `SELECT count(*), i, concat(i, i), 123, 'abc', concat('abc', 'def') FROM emptytable;`, 4717 ExpectedPlan: "Project\n" + 4718 " ├─ columns: [count(1):0!null as count(*), emptytable.i:1!null, concat(emptytable.i:1!null,emptytable.i:1!null) as concat(i, i), 123 (tinyint), abc (longtext) as abc, concat(abc (longtext),def (longtext)) as concat('abc', 'def')]\n" + 4719 " └─ GroupBy\n" + 4720 " ├─ select: COUNT(1 (bigint)), emptytable.i:0!null\n" + 4721 " ├─ group: \n" + 4722 " └─ ProcessTable\n" + 4723 " └─ Table\n" + 4724 " ├─ name: emptytable\n" + 4725 " └─ columns: [i]\n" + 4726 "", 4727 ExpectedEstimates: "Project\n" + 4728 " ├─ columns: [count(1) as count(*), emptytable.i, concat(emptytable.i,emptytable.i) as concat(i, i), 123, 'abc' as abc, concat('abc','def') as concat('abc', 'def')]\n" + 4729 " └─ GroupBy\n" + 4730 " ├─ SelectedExprs(COUNT(1), emptytable.i)\n" + 4731 " ├─ Grouping()\n" + 4732 " └─ Table\n" + 4733 " ├─ name: emptytable\n" + 4734 " └─ columns: [i]\n" + 4735 "", 4736 ExpectedAnalysis: "Project\n" + 4737 " ├─ columns: [count(1) as count(*), emptytable.i, concat(emptytable.i,emptytable.i) as concat(i, i), 123, 'abc' as abc, concat('abc','def') as concat('abc', 'def')]\n" + 4738 " └─ GroupBy\n" + 4739 " ├─ SelectedExprs(COUNT(1), emptytable.i)\n" + 4740 " ├─ Grouping()\n" + 4741 " └─ Table\n" + 4742 " ├─ name: emptytable\n" + 4743 " └─ columns: [i]\n" + 4744 "", 4745 }, 4746 { 4747 Query: `SELECT count(*), i, concat(i, i), 123, 'abc', concat('abc', 'def') FROM mytable where false;`, 4748 ExpectedPlan: "Project\n" + 4749 " ├─ columns: [count(1):0!null as count(*), mytable.i:1!null, concat(mytable.i:1!null,mytable.i:1!null) as concat(i, i), 123 (tinyint), abc (longtext) as abc, concat(abc (longtext),def (longtext)) as concat('abc', 'def')]\n" + 4750 " └─ GroupBy\n" + 4751 " ├─ select: COUNT(1 (bigint)), mytable.i:0!null\n" + 4752 " ├─ group: \n" + 4753 " └─ EmptyTable\n" + 4754 "", 4755 ExpectedEstimates: "Project\n" + 4756 " ├─ columns: [count(1) as count(*), mytable.i, concat(mytable.i,mytable.i) as concat(i, i), 123, 'abc' as abc, concat('abc','def') as concat('abc', 'def')]\n" + 4757 " └─ GroupBy\n" + 4758 " ├─ SelectedExprs(COUNT(1), mytable.i)\n" + 4759 " ├─ Grouping()\n" + 4760 " └─ EmptyTable\n" + 4761 "", 4762 ExpectedAnalysis: "Project\n" + 4763 " ├─ columns: [count(1) as count(*), mytable.i, concat(mytable.i,mytable.i) as concat(i, i), 123, 'abc' as abc, concat('abc','def') as concat('abc', 'def')]\n" + 4764 " └─ GroupBy\n" + 4765 " ├─ SelectedExprs(COUNT(1), mytable.i)\n" + 4766 " ├─ Grouping()\n" + 4767 " └─ EmptyTable\n" + 4768 "", 4769 }, 4770 { 4771 Query: `select count(*) cnt from ab where exists (select * from xy where x = a) group by a`, 4772 ExpectedPlan: "Project\n" + 4773 " ├─ columns: [count(1):0!null as cnt]\n" + 4774 " └─ GroupBy\n" + 4775 " ├─ select: COUNT(1 (bigint))\n" + 4776 " ├─ group: ab.a:0!null\n" + 4777 " └─ Project\n" + 4778 " ├─ columns: [ab.a:0!null, ab.b:1]\n" + 4779 " └─ MergeJoin\n" + 4780 " ├─ cmp: Eq\n" + 4781 " │ ├─ ab.a:0!null\n" + 4782 " │ └─ xy.x:2!null\n" + 4783 " ├─ IndexedTableAccess(ab)\n" + 4784 " │ ├─ index: [ab.a]\n" + 4785 " │ ├─ static: [{[NULL, ∞)}]\n" + 4786 " │ ├─ colSet: (1,2)\n" + 4787 " │ ├─ tableId: 1\n" + 4788 " │ └─ Table\n" + 4789 " │ ├─ name: ab\n" + 4790 " │ └─ columns: [a b]\n" + 4791 " └─ Project\n" + 4792 " ├─ columns: [xy.x:0!null]\n" + 4793 " └─ IndexedTableAccess(xy)\n" + 4794 " ├─ index: [xy.x]\n" + 4795 " ├─ static: [{[NULL, ∞)}]\n" + 4796 " ├─ colSet: (3,4)\n" + 4797 " ├─ tableId: 2\n" + 4798 " └─ Table\n" + 4799 " ├─ name: xy\n" + 4800 " └─ columns: [x y]\n" + 4801 "", 4802 ExpectedEstimates: "Project\n" + 4803 " ├─ columns: [count(1) as cnt]\n" + 4804 " └─ GroupBy\n" + 4805 " ├─ SelectedExprs(COUNT(1))\n" + 4806 " ├─ Grouping(ab.a)\n" + 4807 " └─ Project\n" + 4808 " ├─ columns: [ab.a, ab.b]\n" + 4809 " └─ MergeJoin\n" + 4810 " ├─ cmp: (ab.a = xy.x)\n" + 4811 " ├─ IndexedTableAccess(ab)\n" + 4812 " │ ├─ index: [ab.a]\n" + 4813 " │ └─ filters: [{[NULL, ∞)}]\n" + 4814 " └─ Project\n" + 4815 " ├─ columns: [xy.x]\n" + 4816 " └─ IndexedTableAccess(xy)\n" + 4817 " ├─ index: [xy.x]\n" + 4818 " ├─ filters: [{[NULL, ∞)}]\n" + 4819 " └─ columns: [x y]\n" + 4820 "", 4821 ExpectedAnalysis: "Project\n" + 4822 " ├─ columns: [count(1) as cnt]\n" + 4823 " └─ GroupBy\n" + 4824 " ├─ SelectedExprs(COUNT(1))\n" + 4825 " ├─ Grouping(ab.a)\n" + 4826 " └─ Project\n" + 4827 " ├─ columns: [ab.a, ab.b]\n" + 4828 " └─ MergeJoin\n" + 4829 " ├─ cmp: (ab.a = xy.x)\n" + 4830 " ├─ IndexedTableAccess(ab)\n" + 4831 " │ ├─ index: [ab.a]\n" + 4832 " │ └─ filters: [{[NULL, ∞)}]\n" + 4833 " └─ Project\n" + 4834 " ├─ columns: [xy.x]\n" + 4835 " └─ IndexedTableAccess(xy)\n" + 4836 " ├─ index: [xy.x]\n" + 4837 " ├─ filters: [{[NULL, ∞)}]\n" + 4838 " └─ columns: [x y]\n" + 4839 "", 4840 }, 4841 { 4842 Query: `SELECT pk, u, v FROM one_pk JOIN (SELECT count(*) AS u, 123 AS v FROM emptytable) uv WHERE pk = u;`, 4843 ExpectedPlan: "Project\n" + 4844 " ├─ columns: [one_pk.pk:2!null, uv.u:0!null, uv.v:1!null]\n" + 4845 " └─ HashJoin\n" + 4846 " ├─ Eq\n" + 4847 " │ ├─ one_pk.pk:2!null\n" + 4848 " │ └─ uv.u:0!null\n" + 4849 " ├─ SubqueryAlias\n" + 4850 " │ ├─ name: uv\n" + 4851 " │ ├─ outerVisibility: false\n" + 4852 " │ ├─ isLateral: false\n" + 4853 " │ ├─ cacheable: true\n" + 4854 " │ ├─ colSet: (12,13)\n" + 4855 " │ ├─ tableId: 3\n" + 4856 " │ └─ Project\n" + 4857 " │ ├─ columns: [count(1):0!null as u, 123 (tinyint) as v]\n" + 4858 " │ └─ Project\n" + 4859 " │ ├─ columns: [emptytable.COUNT(1):0!null as COUNT(1)]\n" + 4860 " │ └─ table_count(emptytable) as COUNT(1)\n" + 4861 " └─ HashLookup\n" + 4862 " ├─ left-key: TUPLE(uv.u:0!null)\n" + 4863 " ├─ right-key: TUPLE(one_pk.pk:0!null)\n" + 4864 " └─ ProcessTable\n" + 4865 " └─ Table\n" + 4866 " ├─ name: one_pk\n" + 4867 " └─ columns: [pk]\n" + 4868 "", 4869 ExpectedEstimates: "Project\n" + 4870 " ├─ columns: [one_pk.pk, uv.u, uv.v]\n" + 4871 " └─ HashJoin (estimated cost=114.000 rows=100)\n" + 4872 " ├─ (one_pk.pk = uv.u)\n" + 4873 " ├─ SubqueryAlias\n" + 4874 " │ ├─ name: uv\n" + 4875 " │ ├─ outerVisibility: false\n" + 4876 " │ ├─ isLateral: false\n" + 4877 " │ ├─ cacheable: true\n" + 4878 " │ └─ Project\n" + 4879 " │ ├─ columns: [count(1) as u, 123 as v]\n" + 4880 " │ └─ Project\n" + 4881 " │ ├─ columns: [emptytable.COUNT(1) as COUNT(1)]\n" + 4882 " │ └─ table_count(emptytable) as COUNT(1)\n" + 4883 " └─ HashLookup\n" + 4884 " ├─ left-key: (uv.u)\n" + 4885 " ├─ right-key: (one_pk.pk)\n" + 4886 " └─ Table\n" + 4887 " ├─ name: one_pk\n" + 4888 " └─ columns: [pk]\n" + 4889 "", 4890 ExpectedAnalysis: "Project\n" + 4891 " ├─ columns: [one_pk.pk, uv.u, uv.v]\n" + 4892 " └─ HashJoin (estimated cost=114.000 rows=100) (actual rows=1 loops=1)\n" + 4893 " ├─ (one_pk.pk = uv.u)\n" + 4894 " ├─ SubqueryAlias\n" + 4895 " │ ├─ name: uv\n" + 4896 " │ ├─ outerVisibility: false\n" + 4897 " │ ├─ isLateral: false\n" + 4898 " │ ├─ cacheable: true\n" + 4899 " │ └─ Project\n" + 4900 " │ ├─ columns: [count(1) as u, 123 as v]\n" + 4901 " │ └─ Project\n" + 4902 " │ ├─ columns: [emptytable.COUNT(1) as COUNT(1)]\n" + 4903 " │ └─ table_count(emptytable) as COUNT(1)\n" + 4904 " └─ HashLookup\n" + 4905 " ├─ left-key: (uv.u)\n" + 4906 " ├─ right-key: (one_pk.pk)\n" + 4907 " └─ Table\n" + 4908 " ├─ name: one_pk\n" + 4909 " └─ columns: [pk]\n" + 4910 "", 4911 }, 4912 { 4913 Query: `SELECT pk, u, v FROM one_pk JOIN (SELECT count(*) AS u, 123 AS v FROM mytable WHERE false) uv WHERE pk = u;`, 4914 ExpectedPlan: "Project\n" + 4915 " ├─ columns: [one_pk.pk:2!null, uv.u:0!null, uv.v:1!null]\n" + 4916 " └─ HashJoin\n" + 4917 " ├─ Eq\n" + 4918 " │ ├─ one_pk.pk:2!null\n" + 4919 " │ └─ uv.u:0!null\n" + 4920 " ├─ SubqueryAlias\n" + 4921 " │ ├─ name: uv\n" + 4922 " │ ├─ outerVisibility: false\n" + 4923 " │ ├─ isLateral: false\n" + 4924 " │ ├─ cacheable: true\n" + 4925 " │ ├─ colSet: (12,13)\n" + 4926 " │ ├─ tableId: 3\n" + 4927 " │ └─ Project\n" + 4928 " │ ├─ columns: [count(1):0!null as u, 123 (tinyint) as v]\n" + 4929 " │ └─ GroupBy\n" + 4930 " │ ├─ select: COUNT(1 (bigint))\n" + 4931 " │ ├─ group: \n" + 4932 " │ └─ EmptyTable\n" + 4933 " └─ HashLookup\n" + 4934 " ├─ left-key: TUPLE(uv.u:0!null)\n" + 4935 " ├─ right-key: TUPLE(one_pk.pk:0!null)\n" + 4936 " └─ ProcessTable\n" + 4937 " └─ Table\n" + 4938 " ├─ name: one_pk\n" + 4939 " └─ columns: [pk]\n" + 4940 "", 4941 ExpectedEstimates: "Project\n" + 4942 " ├─ columns: [one_pk.pk, uv.u, uv.v]\n" + 4943 " └─ HashJoin (estimated cost=114.000 rows=100)\n" + 4944 " ├─ (one_pk.pk = uv.u)\n" + 4945 " ├─ SubqueryAlias\n" + 4946 " │ ├─ name: uv\n" + 4947 " │ ├─ outerVisibility: false\n" + 4948 " │ ├─ isLateral: false\n" + 4949 " │ ├─ cacheable: true\n" + 4950 " │ └─ Project\n" + 4951 " │ ├─ columns: [count(1) as u, 123 as v]\n" + 4952 " │ └─ GroupBy\n" + 4953 " │ ├─ SelectedExprs(COUNT(1))\n" + 4954 " │ ├─ Grouping()\n" + 4955 " │ └─ EmptyTable\n" + 4956 " └─ HashLookup\n" + 4957 " ├─ left-key: (uv.u)\n" + 4958 " ├─ right-key: (one_pk.pk)\n" + 4959 " └─ Table\n" + 4960 " ├─ name: one_pk\n" + 4961 " └─ columns: [pk]\n" + 4962 "", 4963 ExpectedAnalysis: "Project\n" + 4964 " ├─ columns: [one_pk.pk, uv.u, uv.v]\n" + 4965 " └─ HashJoin (estimated cost=114.000 rows=100) (actual rows=1 loops=1)\n" + 4966 " ├─ (one_pk.pk = uv.u)\n" + 4967 " ├─ SubqueryAlias\n" + 4968 " │ ├─ name: uv\n" + 4969 " │ ├─ outerVisibility: false\n" + 4970 " │ ├─ isLateral: false\n" + 4971 " │ ├─ cacheable: true\n" + 4972 " │ └─ Project\n" + 4973 " │ ├─ columns: [count(1) as u, 123 as v]\n" + 4974 " │ └─ GroupBy\n" + 4975 " │ ├─ SelectedExprs(COUNT(1))\n" + 4976 " │ ├─ Grouping()\n" + 4977 " │ └─ EmptyTable\n" + 4978 " └─ HashLookup\n" + 4979 " ├─ left-key: (uv.u)\n" + 4980 " ├─ right-key: (one_pk.pk)\n" + 4981 " └─ Table\n" + 4982 " ├─ name: one_pk\n" + 4983 " └─ columns: [pk]\n" + 4984 "", 4985 }, 4986 { 4987 Query: `SELECT pk FROM one_pk WHERE (pk, 123) IN (SELECT count(*) AS u, 123 AS v FROM emptytable);`, 4988 ExpectedPlan: "Project\n" + 4989 " ├─ columns: [one_pk.pk:0!null]\n" + 4990 " └─ Filter\n" + 4991 " ├─ InSubquery\n" + 4992 " │ ├─ left: TUPLE(one_pk.pk:0!null, 123 (tinyint))\n" + 4993 " │ └─ right: Subquery\n" + 4994 " │ ├─ cacheable: true\n" + 4995 " │ ├─ alias-string: select count(*) u, 123 v from emptytable\n" + 4996 " │ └─ Project\n" + 4997 " │ ├─ columns: [count(1):6!null as u, 123 (tinyint) as v]\n" + 4998 " │ └─ Project\n" + 4999 " │ ├─ columns: [emptytable.COUNT(1):6!null as COUNT(1)]\n" + 5000 " │ └─ table_count(emptytable) as COUNT(1)\n" + 5001 " └─ ProcessTable\n" + 5002 " └─ Table\n" + 5003 " ├─ name: one_pk\n" + 5004 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 5005 "", 5006 ExpectedEstimates: "Project\n" + 5007 " ├─ columns: [one_pk.pk]\n" + 5008 " └─ Filter\n" + 5009 " ├─ InSubquery\n" + 5010 " │ ├─ left: (one_pk.pk, 123)\n" + 5011 " │ └─ right: Subquery\n" + 5012 " │ ├─ cacheable: true\n" + 5013 " │ └─ Project\n" + 5014 " │ ├─ columns: [count(1) as u, 123 as v]\n" + 5015 " │ └─ Project\n" + 5016 " │ ├─ columns: [emptytable.COUNT(1) as COUNT(1)]\n" + 5017 " │ └─ table_count(emptytable) as COUNT(1)\n" + 5018 " └─ Table\n" + 5019 " └─ name: one_pk\n" + 5020 "", 5021 ExpectedAnalysis: "Project\n" + 5022 " ├─ columns: [one_pk.pk]\n" + 5023 " └─ Filter\n" + 5024 " ├─ InSubquery\n" + 5025 " │ ├─ left: (one_pk.pk, 123)\n" + 5026 " │ └─ right: Subquery\n" + 5027 " │ ├─ cacheable: true\n" + 5028 " │ └─ Project\n" + 5029 " │ ├─ columns: [count(1) as u, 123 as v]\n" + 5030 " │ └─ Project\n" + 5031 " │ ├─ columns: [emptytable.COUNT(1) as COUNT(1)]\n" + 5032 " │ └─ table_count(emptytable) as COUNT(1)\n" + 5033 " └─ Table\n" + 5034 " └─ name: one_pk\n" + 5035 "", 5036 }, 5037 { 5038 Query: `SELECT pk FROM one_pk WHERE (pk, 123) IN (SELECT count(*) AS u, 123 AS v FROM mytable WHERE false);`, 5039 ExpectedPlan: "Project\n" + 5040 " ├─ columns: [one_pk.pk:0!null]\n" + 5041 " └─ Filter\n" + 5042 " ├─ InSubquery\n" + 5043 " │ ├─ left: TUPLE(one_pk.pk:0!null, 123 (tinyint))\n" + 5044 " │ └─ right: Subquery\n" + 5045 " │ ├─ cacheable: true\n" + 5046 " │ ├─ alias-string: select count(*) u, 123 v from mytable where false\n" + 5047 " │ └─ Project\n" + 5048 " │ ├─ columns: [count(1):6!null as u, 123 (tinyint) as v]\n" + 5049 " │ └─ GroupBy\n" + 5050 " │ ├─ select: COUNT(1 (bigint))\n" + 5051 " │ ├─ group: \n" + 5052 " │ └─ EmptyTable\n" + 5053 " └─ ProcessTable\n" + 5054 " └─ Table\n" + 5055 " ├─ name: one_pk\n" + 5056 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 5057 "", 5058 ExpectedEstimates: "Project\n" + 5059 " ├─ columns: [one_pk.pk]\n" + 5060 " └─ Filter\n" + 5061 " ├─ InSubquery\n" + 5062 " │ ├─ left: (one_pk.pk, 123)\n" + 5063 " │ └─ right: Subquery\n" + 5064 " │ ├─ cacheable: true\n" + 5065 " │ └─ Project\n" + 5066 " │ ├─ columns: [count(1) as u, 123 as v]\n" + 5067 " │ └─ GroupBy\n" + 5068 " │ ├─ SelectedExprs(COUNT(1))\n" + 5069 " │ ├─ Grouping()\n" + 5070 " │ └─ EmptyTable\n" + 5071 " └─ Table\n" + 5072 " └─ name: one_pk\n" + 5073 "", 5074 ExpectedAnalysis: "Project\n" + 5075 " ├─ columns: [one_pk.pk]\n" + 5076 " └─ Filter\n" + 5077 " ├─ InSubquery\n" + 5078 " │ ├─ left: (one_pk.pk, 123)\n" + 5079 " │ └─ right: Subquery\n" + 5080 " │ ├─ cacheable: true\n" + 5081 " │ └─ Project\n" + 5082 " │ ├─ columns: [count(1) as u, 123 as v]\n" + 5083 " │ └─ GroupBy\n" + 5084 " │ ├─ SelectedExprs(COUNT(1))\n" + 5085 " │ ├─ Grouping()\n" + 5086 " │ └─ EmptyTable\n" + 5087 " └─ Table\n" + 5088 " └─ name: one_pk\n" + 5089 "", 5090 }, 5091 { 5092 Query: `SELECT i FROM mytable WHERE EXISTS (SELECT * FROM (SELECT count(*) as u, 123 as v FROM emptytable) uv);`, 5093 ExpectedPlan: "Project\n" + 5094 " ├─ columns: [mytable.i:2!null]\n" + 5095 " └─ CrossHashJoin\n" + 5096 " ├─ Limit(1)\n" + 5097 " │ └─ SubqueryAlias\n" + 5098 " │ ├─ name: uv\n" + 5099 " │ ├─ outerVisibility: true\n" + 5100 " │ ├─ isLateral: false\n" + 5101 " │ ├─ cacheable: true\n" + 5102 " │ ├─ colSet: (8,9)\n" + 5103 " │ ├─ tableId: 3\n" + 5104 " │ └─ Project\n" + 5105 " │ ├─ columns: [count(1):0!null as u, 123 (tinyint) as v]\n" + 5106 " │ └─ Project\n" + 5107 " │ ├─ columns: [emptytable.COUNT(1):0!null as COUNT(1)]\n" + 5108 " │ └─ table_count(emptytable) as COUNT(1)\n" + 5109 " └─ HashLookup\n" + 5110 " ├─ left-key: TUPLE()\n" + 5111 " ├─ right-key: TUPLE()\n" + 5112 " └─ ProcessTable\n" + 5113 " └─ Table\n" + 5114 " ├─ name: mytable\n" + 5115 " └─ columns: [i s]\n" + 5116 "", 5117 ExpectedEstimates: "Project\n" + 5118 " ├─ columns: [mytable.i]\n" + 5119 " └─ CrossHashJoin (estimated cost=110.030 rows=3)\n" + 5120 " ├─ Limit(1)\n" + 5121 " │ └─ SubqueryAlias\n" + 5122 " │ ├─ name: uv\n" + 5123 " │ ├─ outerVisibility: true\n" + 5124 " │ ├─ isLateral: false\n" + 5125 " │ ├─ cacheable: true\n" + 5126 " │ └─ Project\n" + 5127 " │ ├─ columns: [count(1) as u, 123 as v]\n" + 5128 " │ └─ Project\n" + 5129 " │ ├─ columns: [emptytable.COUNT(1) as COUNT(1)]\n" + 5130 " │ └─ table_count(emptytable) as COUNT(1)\n" + 5131 " └─ HashLookup\n" + 5132 " ├─ left-key: ()\n" + 5133 " ├─ right-key: ()\n" + 5134 " └─ Table\n" + 5135 " └─ name: mytable\n" + 5136 "", 5137 ExpectedAnalysis: "Project\n" + 5138 " ├─ columns: [mytable.i]\n" + 5139 " └─ CrossHashJoin (estimated cost=110.030 rows=3) (actual rows=3 loops=1)\n" + 5140 " ├─ Limit(1)\n" + 5141 " │ └─ SubqueryAlias\n" + 5142 " │ ├─ name: uv\n" + 5143 " │ ├─ outerVisibility: true\n" + 5144 " │ ├─ isLateral: false\n" + 5145 " │ ├─ cacheable: true\n" + 5146 " │ └─ Project\n" + 5147 " │ ├─ columns: [count(1) as u, 123 as v]\n" + 5148 " │ └─ Project\n" + 5149 " │ ├─ columns: [emptytable.COUNT(1) as COUNT(1)]\n" + 5150 " │ └─ table_count(emptytable) as COUNT(1)\n" + 5151 " └─ HashLookup\n" + 5152 " ├─ left-key: ()\n" + 5153 " ├─ right-key: ()\n" + 5154 " └─ Table\n" + 5155 " └─ name: mytable\n" + 5156 "", 5157 }, 5158 { 5159 Query: `SELECT count(*), (SELECT i FROM mytable WHERE i = 1 group by i);`, 5160 ExpectedPlan: "Project\n" + 5161 " ├─ columns: [count(1):0!null as count(*), Subquery\n" + 5162 " │ ├─ cacheable: true\n" + 5163 " │ ├─ alias-string: select i from mytable where i = 1 group by i\n" + 5164 " │ └─ GroupBy\n" + 5165 " │ ├─ select: mytable.i:1!null\n" + 5166 " │ ├─ group: mytable.i:1!null\n" + 5167 " │ └─ IndexedTableAccess(mytable)\n" + 5168 " │ ├─ index: [mytable.i]\n" + 5169 " │ ├─ static: [{[1, 1]}]\n" + 5170 " │ ├─ colSet: (2,3)\n" + 5171 " │ ├─ tableId: 1\n" + 5172 " │ └─ Table\n" + 5173 " │ ├─ name: mytable\n" + 5174 " │ └─ columns: [i]\n" + 5175 " │ as (SELECT i FROM mytable WHERE i = 1 group by i)]\n" + 5176 " └─ GroupBy\n" + 5177 " ├─ select: COUNT(1 (bigint))\n" + 5178 " ├─ group: \n" + 5179 " └─ ProcessTable\n" + 5180 " └─ Table\n" + 5181 " ├─ name: \n" + 5182 " └─ columns: []\n" + 5183 "", 5184 ExpectedEstimates: "Project\n" + 5185 " ├─ columns: [count(1) as count(*), Subquery\n" + 5186 " │ ├─ cacheable: true\n" + 5187 " │ └─ GroupBy\n" + 5188 " │ ├─ SelectedExprs(mytable.i)\n" + 5189 " │ ├─ Grouping(mytable.i)\n" + 5190 " │ └─ IndexedTableAccess(mytable)\n" + 5191 " │ ├─ index: [mytable.i]\n" + 5192 " │ ├─ filters: [{[1, 1]}]\n" + 5193 " │ └─ columns: [i]\n" + 5194 " │ as (SELECT i FROM mytable WHERE i = 1 group by i)]\n" + 5195 " └─ GroupBy\n" + 5196 " ├─ SelectedExprs(COUNT(1))\n" + 5197 " ├─ Grouping()\n" + 5198 " └─ Table\n" + 5199 " └─ name: \n" + 5200 "", 5201 ExpectedAnalysis: "Project\n" + 5202 " ├─ columns: [count(1) as count(*), Subquery\n" + 5203 " │ ├─ cacheable: true\n" + 5204 " │ └─ GroupBy\n" + 5205 " │ ├─ SelectedExprs(mytable.i)\n" + 5206 " │ ├─ Grouping(mytable.i)\n" + 5207 " │ └─ IndexedTableAccess(mytable)\n" + 5208 " │ ├─ index: [mytable.i]\n" + 5209 " │ ├─ filters: [{[1, 1]}]\n" + 5210 " │ └─ columns: [i]\n" + 5211 " │ as (SELECT i FROM mytable WHERE i = 1 group by i)]\n" + 5212 " └─ GroupBy\n" + 5213 " ├─ SelectedExprs(COUNT(1))\n" + 5214 " ├─ Grouping()\n" + 5215 " └─ Table\n" + 5216 " └─ name: \n" + 5217 "", 5218 }, 5219 { 5220 Query: `with cte(a,b) as (select * from ab) select * from xy where exists (select * from cte where a = x)`, 5221 ExpectedPlan: "Project\n" + 5222 " ├─ columns: [xy.x:1!null, xy.y:2]\n" + 5223 " └─ LookupJoin\n" + 5224 " ├─ Eq\n" + 5225 " │ ├─ cte.a:0!null\n" + 5226 " │ └─ xy.x:1!null\n" + 5227 " ├─ Distinct\n" + 5228 " │ └─ Project\n" + 5229 " │ ├─ columns: [cte.a:0!null]\n" + 5230 " │ └─ SubqueryAlias\n" + 5231 " │ ├─ name: cte\n" + 5232 " │ ├─ outerVisibility: true\n" + 5233 " │ ├─ isLateral: false\n" + 5234 " │ ├─ cacheable: true\n" + 5235 " │ ├─ colSet: (3,4)\n" + 5236 " │ ├─ tableId: 2\n" + 5237 " │ └─ Table\n" + 5238 " │ ├─ name: ab\n" + 5239 " │ ├─ columns: [a b]\n" + 5240 " │ ├─ colSet: (1,2)\n" + 5241 " │ └─ tableId: 1\n" + 5242 " └─ IndexedTableAccess(xy)\n" + 5243 " ├─ index: [xy.x]\n" + 5244 " ├─ keys: [cte.a:0!null]\n" + 5245 " ├─ colSet: (5,6)\n" + 5246 " ├─ tableId: 4\n" + 5247 " └─ Table\n" + 5248 " ├─ name: xy\n" + 5249 " └─ columns: [x y]\n" + 5250 "", 5251 ExpectedEstimates: "Project\n" + 5252 " ├─ columns: [xy.x, xy.y]\n" + 5253 " └─ LookupJoin (estimated cost=330.000 rows=100)\n" + 5254 " ├─ (cte.a = xy.x)\n" + 5255 " ├─ Distinct\n" + 5256 " │ └─ Project\n" + 5257 " │ ├─ columns: [cte.a]\n" + 5258 " │ └─ SubqueryAlias\n" + 5259 " │ ├─ name: cte\n" + 5260 " │ ├─ outerVisibility: true\n" + 5261 " │ ├─ isLateral: false\n" + 5262 " │ ├─ cacheable: true\n" + 5263 " │ └─ Table\n" + 5264 " │ ├─ name: ab\n" + 5265 " │ └─ columns: [a b]\n" + 5266 " └─ IndexedTableAccess(xy)\n" + 5267 " ├─ index: [xy.x]\n" + 5268 " └─ keys: cte.a\n" + 5269 "", 5270 ExpectedAnalysis: "Project\n" + 5271 " ├─ columns: [xy.x, xy.y]\n" + 5272 " └─ LookupJoin (estimated cost=330.000 rows=100) (actual rows=4 loops=1)\n" + 5273 " ├─ (cte.a = xy.x)\n" + 5274 " ├─ Distinct\n" + 5275 " │ └─ Project\n" + 5276 " │ ├─ columns: [cte.a]\n" + 5277 " │ └─ SubqueryAlias\n" + 5278 " │ ├─ name: cte\n" + 5279 " │ ├─ outerVisibility: true\n" + 5280 " │ ├─ isLateral: false\n" + 5281 " │ ├─ cacheable: true\n" + 5282 " │ └─ Table\n" + 5283 " │ ├─ name: ab\n" + 5284 " │ └─ columns: [a b]\n" + 5285 " └─ IndexedTableAccess(xy)\n" + 5286 " ├─ index: [xy.x]\n" + 5287 " └─ keys: cte.a\n" + 5288 "", 5289 }, 5290 { 5291 Query: `select * from xy where exists (select * from ab where a = x) order by x`, 5292 ExpectedPlan: "Sort(xy.x:0!null ASC nullsFirst)\n" + 5293 " └─ Project\n" + 5294 " ├─ columns: [xy.x:0!null, xy.y:1]\n" + 5295 " └─ MergeJoin\n" + 5296 " ├─ cmp: Eq\n" + 5297 " │ ├─ xy.x:0!null\n" + 5298 " │ └─ ab.a:2!null\n" + 5299 " ├─ IndexedTableAccess(xy)\n" + 5300 " │ ├─ index: [xy.x]\n" + 5301 " │ ├─ static: [{[NULL, ∞)}]\n" + 5302 " │ ├─ colSet: (1,2)\n" + 5303 " │ ├─ tableId: 1\n" + 5304 " │ └─ Table\n" + 5305 " │ ├─ name: xy\n" + 5306 " │ └─ columns: [x y]\n" + 5307 " └─ Project\n" + 5308 " ├─ columns: [ab.a:0!null]\n" + 5309 " └─ IndexedTableAccess(ab)\n" + 5310 " ├─ index: [ab.a]\n" + 5311 " ├─ static: [{[NULL, ∞)}]\n" + 5312 " ├─ colSet: (3,4)\n" + 5313 " ├─ tableId: 2\n" + 5314 " └─ Table\n" + 5315 " ├─ name: ab\n" + 5316 " └─ columns: [a b]\n" + 5317 "", 5318 ExpectedEstimates: "Sort(xy.x ASC)\n" + 5319 " └─ Project\n" + 5320 " ├─ columns: [xy.x, xy.y]\n" + 5321 " └─ MergeJoin\n" + 5322 " ├─ cmp: (xy.x = ab.a)\n" + 5323 " ├─ IndexedTableAccess(xy)\n" + 5324 " │ ├─ index: [xy.x]\n" + 5325 " │ └─ filters: [{[NULL, ∞)}]\n" + 5326 " └─ Project\n" + 5327 " ├─ columns: [ab.a]\n" + 5328 " └─ IndexedTableAccess(ab)\n" + 5329 " ├─ index: [ab.a]\n" + 5330 " ├─ filters: [{[NULL, ∞)}]\n" + 5331 " └─ columns: [a b]\n" + 5332 "", 5333 ExpectedAnalysis: "Sort(xy.x ASC)\n" + 5334 " └─ Project\n" + 5335 " ├─ columns: [xy.x, xy.y]\n" + 5336 " └─ MergeJoin\n" + 5337 " ├─ cmp: (xy.x = ab.a)\n" + 5338 " ├─ IndexedTableAccess(xy)\n" + 5339 " │ ├─ index: [xy.x]\n" + 5340 " │ └─ filters: [{[NULL, ∞)}]\n" + 5341 " └─ Project\n" + 5342 " ├─ columns: [ab.a]\n" + 5343 " └─ IndexedTableAccess(ab)\n" + 5344 " ├─ index: [ab.a]\n" + 5345 " ├─ filters: [{[NULL, ∞)}]\n" + 5346 " └─ columns: [a b]\n" + 5347 "", 5348 }, 5349 { 5350 Query: `select * from xy where exists (select * from ab where a = x order by a limit 2) order by x limit 5`, 5351 ExpectedPlan: "Limit(5)\n" + 5352 " └─ TopN(Limit: [5 (bigint)]; xy.x:0!null ASC nullsFirst)\n" + 5353 " └─ Project\n" + 5354 " ├─ columns: [xy.x:0!null, xy.y:1]\n" + 5355 " └─ MergeJoin\n" + 5356 " ├─ cmp: Eq\n" + 5357 " │ ├─ xy.x:0!null\n" + 5358 " │ └─ ab.a:2!null\n" + 5359 " ├─ IndexedTableAccess(xy)\n" + 5360 " │ ├─ index: [xy.x]\n" + 5361 " │ ├─ static: [{[NULL, ∞)}]\n" + 5362 " │ ├─ colSet: (1,2)\n" + 5363 " │ ├─ tableId: 1\n" + 5364 " │ └─ Table\n" + 5365 " │ ├─ name: xy\n" + 5366 " │ └─ columns: [x y]\n" + 5367 " └─ Project\n" + 5368 " ├─ columns: [ab.a:0!null]\n" + 5369 " └─ IndexedTableAccess(ab)\n" + 5370 " ├─ index: [ab.a]\n" + 5371 " ├─ static: [{[NULL, ∞)}]\n" + 5372 " ├─ colSet: (3,4)\n" + 5373 " ├─ tableId: 2\n" + 5374 " └─ Table\n" + 5375 " ├─ name: ab\n" + 5376 " └─ columns: [a b]\n" + 5377 "", 5378 ExpectedEstimates: "Limit(5)\n" + 5379 " └─ TopN(Limit: [5]; xy.x ASC)\n" + 5380 " └─ Project\n" + 5381 " ├─ columns: [xy.x, xy.y]\n" + 5382 " └─ MergeJoin\n" + 5383 " ├─ cmp: (xy.x = ab.a)\n" + 5384 " ├─ IndexedTableAccess(xy)\n" + 5385 " │ ├─ index: [xy.x]\n" + 5386 " │ └─ filters: [{[NULL, ∞)}]\n" + 5387 " └─ Project\n" + 5388 " ├─ columns: [ab.a]\n" + 5389 " └─ IndexedTableAccess(ab)\n" + 5390 " ├─ index: [ab.a]\n" + 5391 " ├─ filters: [{[NULL, ∞)}]\n" + 5392 " └─ columns: [a b]\n" + 5393 "", 5394 ExpectedAnalysis: "Limit(5)\n" + 5395 " └─ TopN(Limit: [5]; xy.x ASC)\n" + 5396 " └─ Project\n" + 5397 " ├─ columns: [xy.x, xy.y]\n" + 5398 " └─ MergeJoin\n" + 5399 " ├─ cmp: (xy.x = ab.a)\n" + 5400 " ├─ IndexedTableAccess(xy)\n" + 5401 " │ ├─ index: [xy.x]\n" + 5402 " │ └─ filters: [{[NULL, ∞)}]\n" + 5403 " └─ Project\n" + 5404 " ├─ columns: [ab.a]\n" + 5405 " └─ IndexedTableAccess(ab)\n" + 5406 " ├─ index: [ab.a]\n" + 5407 " ├─ filters: [{[NULL, ∞)}]\n" + 5408 " └─ columns: [a b]\n" + 5409 "", 5410 }, 5411 { 5412 Query: ` 5413 select * from 5414 ( 5415 select * from ab 5416 left join uv on a = u 5417 where exists (select * from pq where u = p) 5418 ) alias2 5419 inner join xy on a = x;`, 5420 ExpectedPlan: "LookupJoin\n" + 5421 " ├─ SubqueryAlias\n" + 5422 " │ ├─ name: alias2\n" + 5423 " │ ├─ outerVisibility: false\n" + 5424 " │ ├─ isLateral: false\n" + 5425 " │ ├─ cacheable: true\n" + 5426 " │ ├─ colSet: (7-10)\n" + 5427 " │ ├─ tableId: 4\n" + 5428 " │ └─ Project\n" + 5429 " │ ├─ columns: [ab.a:0!null, ab.b:1, uv.u:2!null, uv.v:3]\n" + 5430 " │ └─ SemiJoin\n" + 5431 " │ ├─ Eq\n" + 5432 " │ │ ├─ uv.u:2!null\n" + 5433 " │ │ └─ pq.p:4!null\n" + 5434 " │ ├─ LeftOuterMergeJoin\n" + 5435 " │ │ ├─ cmp: Eq\n" + 5436 " │ │ │ ├─ ab.a:0!null\n" + 5437 " │ │ │ └─ uv.u:2!null\n" + 5438 " │ │ ├─ IndexedTableAccess(ab)\n" + 5439 " │ │ │ ├─ index: [ab.a]\n" + 5440 " │ │ │ ├─ static: [{[NULL, ∞)}]\n" + 5441 " │ │ │ ├─ colSet: (1,2)\n" + 5442 " │ │ │ ├─ tableId: 1\n" + 5443 " │ │ │ └─ Table\n" + 5444 " │ │ │ ├─ name: ab\n" + 5445 " │ │ │ └─ columns: [a b]\n" + 5446 " │ │ └─ IndexedTableAccess(uv)\n" + 5447 " │ │ ├─ index: [uv.u]\n" + 5448 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 5449 " │ │ ├─ colSet: (3,4)\n" + 5450 " │ │ ├─ tableId: 2\n" + 5451 " │ │ └─ Table\n" + 5452 " │ │ ├─ name: uv\n" + 5453 " │ │ └─ columns: [u v]\n" + 5454 " │ └─ Table\n" + 5455 " │ ├─ name: pq\n" + 5456 " │ ├─ columns: [p q]\n" + 5457 " │ ├─ colSet: (5,6)\n" + 5458 " │ └─ tableId: 3\n" + 5459 " └─ IndexedTableAccess(xy)\n" + 5460 " ├─ index: [xy.x]\n" + 5461 " ├─ keys: [alias2.a:0!null]\n" + 5462 " ├─ colSet: (11,12)\n" + 5463 " ├─ tableId: 5\n" + 5464 " └─ Table\n" + 5465 " ├─ name: xy\n" + 5466 " └─ columns: [x y]\n" + 5467 "", 5468 ExpectedEstimates: "LookupJoin (estimated cost=330.000 rows=100)\n" + 5469 " ├─ SubqueryAlias\n" + 5470 " │ ├─ name: alias2\n" + 5471 " │ ├─ outerVisibility: false\n" + 5472 " │ ├─ isLateral: false\n" + 5473 " │ ├─ cacheable: true\n" + 5474 " │ └─ Project\n" + 5475 " │ ├─ columns: [ab.a, ab.b, uv.u, uv.v]\n" + 5476 " │ └─ SemiJoin\n" + 5477 " │ ├─ (uv.u = pq.p)\n" + 5478 " │ ├─ LeftOuterMergeJoin\n" + 5479 " │ │ ├─ cmp: (ab.a = uv.u)\n" + 5480 " │ │ ├─ IndexedTableAccess(ab)\n" + 5481 " │ │ │ ├─ index: [ab.a]\n" + 5482 " │ │ │ └─ filters: [{[NULL, ∞)}]\n" + 5483 " │ │ └─ IndexedTableAccess(uv)\n" + 5484 " │ │ ├─ index: [uv.u]\n" + 5485 " │ │ └─ filters: [{[NULL, ∞)}]\n" + 5486 " │ └─ Table\n" + 5487 " │ ├─ name: pq\n" + 5488 " │ └─ columns: [p q]\n" + 5489 " └─ IndexedTableAccess(xy)\n" + 5490 " ├─ index: [xy.x]\n" + 5491 " ├─ columns: [x y]\n" + 5492 " └─ keys: alias2.a\n" + 5493 "", 5494 ExpectedAnalysis: "LookupJoin (estimated cost=330.000 rows=100) (actual rows=4 loops=1)\n" + 5495 " ├─ SubqueryAlias\n" + 5496 " │ ├─ name: alias2\n" + 5497 " │ ├─ outerVisibility: false\n" + 5498 " │ ├─ isLateral: false\n" + 5499 " │ ├─ cacheable: true\n" + 5500 " │ └─ Project\n" + 5501 " │ ├─ columns: [ab.a, ab.b, uv.u, uv.v]\n" + 5502 " │ └─ SemiJoin\n" + 5503 " │ ├─ (uv.u = pq.p)\n" + 5504 " │ ├─ LeftOuterMergeJoin\n" + 5505 " │ │ ├─ cmp: (ab.a = uv.u)\n" + 5506 " │ │ ├─ IndexedTableAccess(ab)\n" + 5507 " │ │ │ ├─ index: [ab.a]\n" + 5508 " │ │ │ └─ filters: [{[NULL, ∞)}]\n" + 5509 " │ │ └─ IndexedTableAccess(uv)\n" + 5510 " │ │ ├─ index: [uv.u]\n" + 5511 " │ │ └─ filters: [{[NULL, ∞)}]\n" + 5512 " │ └─ Table\n" + 5513 " │ ├─ name: pq\n" + 5514 " │ └─ columns: [p q]\n" + 5515 " └─ IndexedTableAccess(xy)\n" + 5516 " ├─ index: [xy.x]\n" + 5517 " ├─ columns: [x y]\n" + 5518 " └─ keys: alias2.a\n" + 5519 "", 5520 }, 5521 { 5522 Query: ` 5523 select * from ab 5524 where exists 5525 ( 5526 select * from uv 5527 left join pq on u = p 5528 where a = u 5529 );`, 5530 ExpectedPlan: "Project\n" + 5531 " ├─ columns: [ab.a:1!null, ab.b:2]\n" + 5532 " └─ LookupJoin\n" + 5533 " ├─ Eq\n" + 5534 " │ ├─ ab.a:1!null\n" + 5535 " │ └─ uv.u:0!null\n" + 5536 " ├─ OrderedDistinct\n" + 5537 " │ └─ Project\n" + 5538 " │ ├─ columns: [uv.u:0!null]\n" + 5539 " │ └─ LeftOuterMergeJoin\n" + 5540 " │ ├─ cmp: Eq\n" + 5541 " │ │ ├─ uv.u:0!null\n" + 5542 " │ │ └─ pq.p:2!null\n" + 5543 " │ ├─ IndexedTableAccess(uv)\n" + 5544 " │ │ ├─ index: [uv.u]\n" + 5545 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 5546 " │ │ ├─ colSet: (3,4)\n" + 5547 " │ │ ├─ tableId: 2\n" + 5548 " │ │ └─ Table\n" + 5549 " │ │ ├─ name: uv\n" + 5550 " │ │ └─ columns: [u v]\n" + 5551 " │ └─ IndexedTableAccess(pq)\n" + 5552 " │ ├─ index: [pq.p]\n" + 5553 " │ ├─ static: [{[NULL, ∞)}]\n" + 5554 " │ ├─ colSet: (5,6)\n" + 5555 " │ ├─ tableId: 3\n" + 5556 " │ └─ Table\n" + 5557 " │ ├─ name: pq\n" + 5558 " │ └─ columns: [p q]\n" + 5559 " └─ IndexedTableAccess(ab)\n" + 5560 " ├─ index: [ab.a]\n" + 5561 " ├─ keys: [uv.u:0!null]\n" + 5562 " ├─ colSet: (1,2)\n" + 5563 " ├─ tableId: 1\n" + 5564 " └─ Table\n" + 5565 " ├─ name: ab\n" + 5566 " └─ columns: [a b]\n" + 5567 "", 5568 ExpectedEstimates: "Project\n" + 5569 " ├─ columns: [ab.a, ab.b]\n" + 5570 " └─ LookupJoin (estimated cost=16.500 rows=5)\n" + 5571 " ├─ (ab.a = uv.u)\n" + 5572 " ├─ OrderedDistinct\n" + 5573 " │ └─ Project\n" + 5574 " │ ├─ columns: [uv.u]\n" + 5575 " │ └─ LeftOuterMergeJoin\n" + 5576 " │ ├─ cmp: (uv.u = pq.p)\n" + 5577 " │ ├─ IndexedTableAccess(uv)\n" + 5578 " │ │ ├─ index: [uv.u]\n" + 5579 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 5580 " │ │ └─ columns: [u v]\n" + 5581 " │ └─ IndexedTableAccess(pq)\n" + 5582 " │ ├─ index: [pq.p]\n" + 5583 " │ ├─ filters: [{[NULL, ∞)}]\n" + 5584 " │ └─ columns: [p q]\n" + 5585 " └─ IndexedTableAccess(ab)\n" + 5586 " ├─ index: [ab.a]\n" + 5587 " └─ keys: uv.u\n" + 5588 "", 5589 ExpectedAnalysis: "Project\n" + 5590 " ├─ columns: [ab.a, ab.b]\n" + 5591 " └─ LookupJoin (estimated cost=16.500 rows=5) (actual rows=4 loops=1)\n" + 5592 " ├─ (ab.a = uv.u)\n" + 5593 " ├─ OrderedDistinct\n" + 5594 " │ └─ Project\n" + 5595 " │ ├─ columns: [uv.u]\n" + 5596 " │ └─ LeftOuterMergeJoin\n" + 5597 " │ ├─ cmp: (uv.u = pq.p)\n" + 5598 " │ ├─ IndexedTableAccess(uv)\n" + 5599 " │ │ ├─ index: [uv.u]\n" + 5600 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 5601 " │ │ └─ columns: [u v]\n" + 5602 " │ └─ IndexedTableAccess(pq)\n" + 5603 " │ ├─ index: [pq.p]\n" + 5604 " │ ├─ filters: [{[NULL, ∞)}]\n" + 5605 " │ └─ columns: [p q]\n" + 5606 " └─ IndexedTableAccess(ab)\n" + 5607 " ├─ index: [ab.a]\n" + 5608 " └─ keys: uv.u\n" + 5609 "", 5610 }, 5611 { 5612 Query: ` 5613 select * from 5614 ( 5615 select * from ab 5616 where not exists (select * from uv where a = u) 5617 ) alias1 5618 where exists (select * from pq where a = p) 5619 `, 5620 ExpectedPlan: "Project\n" + 5621 " ├─ columns: [alias1.a:0!null, alias1.b:1]\n" + 5622 " └─ HashJoin\n" + 5623 " ├─ Eq\n" + 5624 " │ ├─ alias1.a:0!null\n" + 5625 " │ └─ pq.p:2!null\n" + 5626 " ├─ SubqueryAlias\n" + 5627 " │ ├─ name: alias1\n" + 5628 " │ ├─ outerVisibility: false\n" + 5629 " │ ├─ isLateral: false\n" + 5630 " │ ├─ cacheable: true\n" + 5631 " │ ├─ colSet: (5,6)\n" + 5632 " │ ├─ tableId: 3\n" + 5633 " │ └─ Project\n" + 5634 " │ ├─ columns: [ab.a:0!null, ab.b:1]\n" + 5635 " │ └─ Filter\n" + 5636 " │ ├─ uv.u:2!null IS NULL\n" + 5637 " │ └─ LeftOuterMergeJoin\n" + 5638 " │ ├─ cmp: Eq\n" + 5639 " │ │ ├─ ab.a:0!null\n" + 5640 " │ │ └─ uv.u:2!null\n" + 5641 " │ ├─ IndexedTableAccess(ab)\n" + 5642 " │ │ ├─ index: [ab.a]\n" + 5643 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 5644 " │ │ ├─ colSet: (1,2)\n" + 5645 " │ │ ├─ tableId: 1\n" + 5646 " │ │ └─ Table\n" + 5647 " │ │ ├─ name: ab\n" + 5648 " │ │ └─ columns: [a b]\n" + 5649 " │ └─ Project\n" + 5650 " │ ├─ columns: [uv.u:0!null]\n" + 5651 " │ └─ IndexedTableAccess(uv)\n" + 5652 " │ ├─ index: [uv.u]\n" + 5653 " │ ├─ static: [{[NULL, ∞)}]\n" + 5654 " │ ├─ colSet: (3,4)\n" + 5655 " │ ├─ tableId: 2\n" + 5656 " │ └─ Table\n" + 5657 " │ ├─ name: uv\n" + 5658 " │ └─ columns: [u v]\n" + 5659 " └─ HashLookup\n" + 5660 " ├─ left-key: TUPLE(alias1.a:0!null)\n" + 5661 " ├─ right-key: TUPLE(pq.p:0!null)\n" + 5662 " └─ OrderedDistinct\n" + 5663 " └─ Project\n" + 5664 " ├─ columns: [pq.p:0!null]\n" + 5665 " └─ ProcessTable\n" + 5666 " └─ Table\n" + 5667 " ├─ name: pq\n" + 5668 " └─ columns: [p q]\n" + 5669 "", 5670 ExpectedEstimates: "Project\n" + 5671 " ├─ columns: [alias1.a, alias1.b]\n" + 5672 " └─ HashJoin (estimated cost=114.000 rows=100)\n" + 5673 " ├─ (alias1.a = pq.p)\n" + 5674 " ├─ SubqueryAlias\n" + 5675 " │ ├─ name: alias1\n" + 5676 " │ ├─ outerVisibility: false\n" + 5677 " │ ├─ isLateral: false\n" + 5678 " │ ├─ cacheable: true\n" + 5679 " │ └─ Project\n" + 5680 " │ ├─ columns: [ab.a, ab.b]\n" + 5681 " │ └─ Filter\n" + 5682 " │ ├─ uv.u IS NULL\n" + 5683 " │ └─ LeftOuterMergeJoin\n" + 5684 " │ ├─ cmp: (ab.a = uv.u)\n" + 5685 " │ ├─ IndexedTableAccess(ab)\n" + 5686 " │ │ ├─ index: [ab.a]\n" + 5687 " │ │ └─ filters: [{[NULL, ∞)}]\n" + 5688 " │ └─ Project\n" + 5689 " │ ├─ columns: [uv.u]\n" + 5690 " │ └─ IndexedTableAccess(uv)\n" + 5691 " │ ├─ index: [uv.u]\n" + 5692 " │ ├─ filters: [{[NULL, ∞)}]\n" + 5693 " │ └─ columns: [u v]\n" + 5694 " └─ HashLookup\n" + 5695 " ├─ left-key: (alias1.a)\n" + 5696 " ├─ right-key: (pq.p)\n" + 5697 " └─ OrderedDistinct\n" + 5698 " └─ Project\n" + 5699 " ├─ columns: [pq.p]\n" + 5700 " └─ Table\n" + 5701 " ├─ name: pq\n" + 5702 " └─ columns: [p q]\n" + 5703 "", 5704 ExpectedAnalysis: "Project\n" + 5705 " ├─ columns: [alias1.a, alias1.b]\n" + 5706 " └─ HashJoin (estimated cost=114.000 rows=100) (actual rows=0 loops=1)\n" + 5707 " ├─ (alias1.a = pq.p)\n" + 5708 " ├─ SubqueryAlias\n" + 5709 " │ ├─ name: alias1\n" + 5710 " │ ├─ outerVisibility: false\n" + 5711 " │ ├─ isLateral: false\n" + 5712 " │ ├─ cacheable: true\n" + 5713 " │ └─ Project\n" + 5714 " │ ├─ columns: [ab.a, ab.b]\n" + 5715 " │ └─ Filter\n" + 5716 " │ ├─ uv.u IS NULL\n" + 5717 " │ └─ LeftOuterMergeJoin\n" + 5718 " │ ├─ cmp: (ab.a = uv.u)\n" + 5719 " │ ├─ IndexedTableAccess(ab)\n" + 5720 " │ │ ├─ index: [ab.a]\n" + 5721 " │ │ └─ filters: [{[NULL, ∞)}]\n" + 5722 " │ └─ Project\n" + 5723 " │ ├─ columns: [uv.u]\n" + 5724 " │ └─ IndexedTableAccess(uv)\n" + 5725 " │ ├─ index: [uv.u]\n" + 5726 " │ ├─ filters: [{[NULL, ∞)}]\n" + 5727 " │ └─ columns: [u v]\n" + 5728 " └─ HashLookup\n" + 5729 " ├─ left-key: (alias1.a)\n" + 5730 " ├─ right-key: (pq.p)\n" + 5731 " └─ OrderedDistinct\n" + 5732 " └─ Project\n" + 5733 " ├─ columns: [pq.p]\n" + 5734 " └─ Table\n" + 5735 " ├─ name: pq\n" + 5736 " └─ columns: [p q]\n" + 5737 "", 5738 }, 5739 { 5740 Query: ` 5741 select * from ab 5742 inner join uv on a = u 5743 full join pq on a = p 5744 `, 5745 ExpectedPlan: "Project\n" + 5746 " ├─ columns: [ab.a:2!null, ab.b:3, uv.u:0!null, uv.v:1, pq.p:4!null, pq.q:5]\n" + 5747 " └─ FullOuterJoin\n" + 5748 " ├─ Eq\n" + 5749 " │ ├─ ab.a:2!null\n" + 5750 " │ └─ pq.p:4!null\n" + 5751 " ├─ LookupJoin\n" + 5752 " │ ├─ ProcessTable\n" + 5753 " │ │ └─ Table\n" + 5754 " │ │ ├─ name: uv\n" + 5755 " │ │ └─ columns: [u v]\n" + 5756 " │ └─ IndexedTableAccess(ab)\n" + 5757 " │ ├─ index: [ab.a]\n" + 5758 " │ ├─ keys: [uv.u:0!null]\n" + 5759 " │ ├─ colSet: (1,2)\n" + 5760 " │ ├─ tableId: 1\n" + 5761 " │ └─ Table\n" + 5762 " │ ├─ name: ab\n" + 5763 " │ └─ columns: [a b]\n" + 5764 " └─ ProcessTable\n" + 5765 " └─ Table\n" + 5766 " ├─ name: pq\n" + 5767 " └─ columns: [p q]\n" + 5768 "", 5769 ExpectedEstimates: "Project\n" + 5770 " ├─ columns: [ab.a, ab.b, uv.u, uv.v, pq.p, pq.q]\n" + 5771 " └─ FullOuterJoin (estimated cost=30.320 rows=5)\n" + 5772 " ├─ (ab.a = pq.p)\n" + 5773 " ├─ LookupJoin (estimated cost=13.200 rows=4)\n" + 5774 " │ ├─ Table\n" + 5775 " │ │ ├─ name: uv\n" + 5776 " │ │ └─ columns: [u v]\n" + 5777 " │ └─ IndexedTableAccess(ab)\n" + 5778 " │ ├─ index: [ab.a]\n" + 5779 " │ ├─ columns: [a b]\n" + 5780 " │ └─ keys: uv.u\n" + 5781 " └─ Table\n" + 5782 " ├─ name: pq\n" + 5783 " └─ columns: [p q]\n" + 5784 "", 5785 ExpectedAnalysis: "Project\n" + 5786 " ├─ columns: [ab.a, ab.b, uv.u, uv.v, pq.p, pq.q]\n" + 5787 " └─ FullOuterJoin (estimated cost=30.320 rows=5) (actual rows=4 loops=1)\n" + 5788 " ├─ (ab.a = pq.p)\n" + 5789 " ├─ LookupJoin (estimated cost=13.200 rows=4) (actual rows=4 loops=1)\n" + 5790 " │ ├─ Table\n" + 5791 " │ │ ├─ name: uv\n" + 5792 " │ │ └─ columns: [u v]\n" + 5793 " │ └─ IndexedTableAccess(ab)\n" + 5794 " │ ├─ index: [ab.a]\n" + 5795 " │ ├─ columns: [a b]\n" + 5796 " │ └─ keys: uv.u\n" + 5797 " └─ Table\n" + 5798 " ├─ name: pq\n" + 5799 " └─ columns: [p q]\n" + 5800 "", 5801 }, 5802 { 5803 Query: ` 5804 select * from 5805 ( 5806 select * from ab 5807 inner join xy on true 5808 ) alias1 5809 inner join uv on true 5810 inner join pq on true 5811 `, 5812 ExpectedPlan: "CrossHashJoin\n" + 5813 " ├─ CrossHashJoin\n" + 5814 " │ ├─ SubqueryAlias\n" + 5815 " │ │ ├─ name: alias1\n" + 5816 " │ │ ├─ outerVisibility: false\n" + 5817 " │ │ ├─ isLateral: false\n" + 5818 " │ │ ├─ cacheable: true\n" + 5819 " │ │ ├─ colSet: (5-8)\n" + 5820 " │ │ ├─ tableId: 3\n" + 5821 " │ │ └─ Project\n" + 5822 " │ │ ├─ columns: [ab.a:2!null, ab.b:3, xy.x:0!null, xy.y:1]\n" + 5823 " │ │ └─ CrossJoin\n" + 5824 " │ │ ├─ Table\n" + 5825 " │ │ │ ├─ name: xy\n" + 5826 " │ │ │ ├─ columns: [x y]\n" + 5827 " │ │ │ ├─ colSet: (3,4)\n" + 5828 " │ │ │ └─ tableId: 2\n" + 5829 " │ │ └─ Table\n" + 5830 " │ │ ├─ name: ab\n" + 5831 " │ │ ├─ columns: [a b]\n" + 5832 " │ │ ├─ colSet: (1,2)\n" + 5833 " │ │ └─ tableId: 1\n" + 5834 " │ └─ HashLookup\n" + 5835 " │ ├─ left-key: TUPLE()\n" + 5836 " │ ├─ right-key: TUPLE()\n" + 5837 " │ └─ ProcessTable\n" + 5838 " │ └─ Table\n" + 5839 " │ ├─ name: uv\n" + 5840 " │ └─ columns: [u v]\n" + 5841 " └─ HashLookup\n" + 5842 " ├─ left-key: TUPLE()\n" + 5843 " ├─ right-key: TUPLE()\n" + 5844 " └─ ProcessTable\n" + 5845 " └─ Table\n" + 5846 " ├─ name: pq\n" + 5847 " └─ columns: [p q]\n" + 5848 "", 5849 ExpectedEstimates: "CrossHashJoin (estimated cost=17.100 rows=5)\n" + 5850 " ├─ CrossHashJoin (estimated cost=113.050 rows=5)\n" + 5851 " │ ├─ SubqueryAlias\n" + 5852 " │ │ ├─ name: alias1\n" + 5853 " │ │ ├─ outerVisibility: false\n │ │ ├─ isLateral: false\n" + 5854 " │ │ ├─ cacheable: true\n" + 5855 " │ │ └─ Project\n" + 5856 " │ │ ├─ columns: [ab.a, ab.b, xy.x, xy.y]\n" + 5857 " │ │ └─ CrossJoin\n" + 5858 " │ │ ├─ Table\n" + 5859 " │ │ │ ├─ name: xy\n" + 5860 " │ │ │ └─ columns: [x y]\n" + 5861 " │ │ └─ Table\n" + 5862 " │ │ ├─ name: ab\n" + 5863 " │ │ └─ columns: [a b]\n" + 5864 " │ └─ HashLookup\n" + 5865 " │ ├─ left-key: ()\n" + 5866 " │ ├─ right-key: ()\n" + 5867 " │ └─ Table\n" + 5868 " │ ├─ name: uv\n" + 5869 " │ └─ columns: [u v]\n" + 5870 " └─ HashLookup\n" + 5871 " ├─ left-key: ()\n" + 5872 " ├─ right-key: ()\n" + 5873 " └─ Table\n" + 5874 " ├─ name: pq\n" + 5875 " └─ columns: [p q]\n" + 5876 "", 5877 ExpectedAnalysis: "CrossHashJoin (estimated cost=17.100 rows=5) (actual rows=256 loops=1)\n" + 5878 " ├─ CrossHashJoin (estimated cost=113.050 rows=5) (actual rows=64 loops=1)\n" + 5879 " │ ├─ SubqueryAlias\n" + 5880 " │ │ ├─ name: alias1\n" + 5881 " │ │ ├─ outerVisibility: false\n" + 5882 " │ │ ├─ isLateral: false\n" + 5883 " │ │ ├─ cacheable: true\n" + 5884 " │ │ └─ Project\n" + 5885 " │ │ ├─ columns: [ab.a, ab.b, xy.x, xy.y]\n" + 5886 " │ │ └─ CrossJoin\n" + 5887 " │ │ ├─ Table\n" + 5888 " │ │ │ ├─ name: xy\n" + 5889 " │ │ │ └─ columns: [x y]\n" + 5890 " │ │ └─ Table\n" + 5891 " │ │ ├─ name: ab\n" + 5892 " │ │ └─ columns: [a b]\n" + 5893 " │ └─ HashLookup\n" + 5894 " │ ├─ left-key: ()\n" + 5895 " │ ├─ right-key: ()\n" + 5896 " │ └─ Table\n" + 5897 " │ ├─ name: uv\n" + 5898 " │ └─ columns: [u v]\n" + 5899 " └─ HashLookup\n" + 5900 " ├─ left-key: ()\n" + 5901 " ├─ right-key: ()\n" + 5902 " └─ Table\n" + 5903 " ├─ name: pq\n" + 5904 " └─ columns: [p q]\n" + 5905 "", 5906 }, 5907 { 5908 Query: ` 5909 select * from 5910 ( 5911 select * from ab 5912 where not exists (select * from xy where a = x) 5913 ) alias1 5914 left join pq on alias1.a = p 5915 where exists (select * from uv where a = u) 5916 `, 5917 ExpectedPlan: "Project\n" + 5918 " ├─ columns: [alias1.a:0!null, alias1.b:1, pq.p:2!null, pq.q:3]\n" + 5919 " └─ SemiJoin\n" + 5920 " ├─ Eq\n" + 5921 " │ ├─ alias1.a:0!null\n" + 5922 " │ └─ uv.u:4!null\n" + 5923 " ├─ LeftOuterHashJoin\n" + 5924 " │ ├─ Eq\n" + 5925 " │ │ ├─ alias1.a:0!null\n" + 5926 " │ │ └─ pq.p:2!null\n" + 5927 " │ ├─ SubqueryAlias\n" + 5928 " │ │ ├─ name: alias1\n" + 5929 " │ │ ├─ outerVisibility: false\n" + 5930 " │ │ ├─ isLateral: false\n" + 5931 " │ │ ├─ cacheable: true\n" + 5932 " │ │ ├─ colSet: (5,6)\n" + 5933 " │ │ ├─ tableId: 3\n" + 5934 " │ │ └─ Project\n" + 5935 " │ │ ├─ columns: [ab.a:0!null, ab.b:1]\n" + 5936 " │ │ └─ Filter\n" + 5937 " │ │ ├─ xy.x:2!null IS NULL\n" + 5938 " │ │ └─ LeftOuterMergeJoin\n" + 5939 " │ │ ├─ cmp: Eq\n" + 5940 " │ │ │ ├─ ab.a:0!null\n" + 5941 " │ │ │ └─ xy.x:2!null\n" + 5942 " │ │ ├─ IndexedTableAccess(ab)\n" + 5943 " │ │ │ ├─ index: [ab.a]\n" + 5944 " │ │ │ ├─ static: [{[NULL, ∞)}]\n" + 5945 " │ │ │ ├─ colSet: (1,2)\n" + 5946 " │ │ │ ├─ tableId: 1\n" + 5947 " │ │ │ └─ Table\n" + 5948 " │ │ │ ├─ name: ab\n" + 5949 " │ │ │ └─ columns: [a b]\n" + 5950 " │ │ └─ Project\n" + 5951 " │ │ ├─ columns: [xy.x:0!null]\n" + 5952 " │ │ └─ IndexedTableAccess(xy)\n" + 5953 " │ │ ├─ index: [xy.x]\n" + 5954 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 5955 " │ │ ├─ colSet: (3,4)\n" + 5956 " │ │ ├─ tableId: 2\n" + 5957 " │ │ └─ Table\n" + 5958 " │ │ ├─ name: xy\n" + 5959 " │ │ └─ columns: [x y]\n" + 5960 " │ └─ HashLookup\n" + 5961 " │ ├─ left-key: TUPLE(alias1.a:0!null)\n" + 5962 " │ ├─ right-key: TUPLE(pq.p:0!null)\n" + 5963 " │ └─ ProcessTable\n" + 5964 " │ └─ Table\n" + 5965 " │ ├─ name: pq\n" + 5966 " │ └─ columns: [p q]\n" + 5967 " └─ ProcessTable\n" + 5968 " └─ Table\n" + 5969 " ├─ name: uv\n" + 5970 " └─ columns: [u v]\n" + 5971 "", 5972 ExpectedEstimates: "Project\n" + 5973 " ├─ columns: [alias1.a, alias1.b, pq.p, pq.q]\n" + 5974 " └─ SemiJoin (estimated cost=15.100 rows=5)\n" + 5975 " ├─ (alias1.a = uv.u)\n" + 5976 " ├─ LeftOuterHashJoin (estimated cost=113.050 rows=5)\n" + 5977 " │ ├─ (alias1.a = pq.p)\n" + 5978 " │ ├─ SubqueryAlias\n" + 5979 " │ │ ├─ name: alias1\n" + 5980 " │ │ ├─ outerVisibility: false\n" + 5981 " │ │ ├─ isLateral: false\n" + 5982 " │ │ ├─ cacheable: true\n" + 5983 " │ │ └─ Project\n" + 5984 " │ │ ├─ columns: [ab.a, ab.b]\n" + 5985 " │ │ └─ Filter\n" + 5986 " │ │ ├─ xy.x IS NULL\n" + 5987 " │ │ └─ LeftOuterMergeJoin\n" + 5988 " │ │ ├─ cmp: (ab.a = xy.x)\n" + 5989 " │ │ ├─ IndexedTableAccess(ab)\n" + 5990 " │ │ │ ├─ index: [ab.a]\n" + 5991 " │ │ │ └─ filters: [{[NULL, ∞)}]\n" + 5992 " │ │ └─ Project\n" + 5993 " │ │ ├─ columns: [xy.x]\n" + 5994 " │ │ └─ IndexedTableAccess(xy)\n" + 5995 " │ │ ├─ index: [xy.x]\n" + 5996 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 5997 " │ │ └─ columns: [x y]\n" + 5998 " │ └─ HashLookup\n" + 5999 " │ ├─ left-key: (alias1.a)\n" + 6000 " │ ├─ right-key: (pq.p)\n" + 6001 " │ └─ Table\n" + 6002 " │ └─ name: pq\n" + 6003 " └─ Table\n" + 6004 " ├─ name: uv\n" + 6005 " └─ columns: [u v]\n" + 6006 "", 6007 ExpectedAnalysis: "Project\n" + 6008 " ├─ columns: [alias1.a, alias1.b, pq.p, pq.q]\n" + 6009 " └─ SemiJoin (estimated cost=15.100 rows=5) (actual rows=0 loops=1)\n" + 6010 " ├─ (alias1.a = uv.u)\n" + 6011 " ├─ LeftOuterHashJoin (estimated cost=113.050 rows=5) (actual rows=0 loops=1)\n" + 6012 " │ ├─ (alias1.a = pq.p)\n" + 6013 " │ ├─ SubqueryAlias\n" + 6014 " │ │ ├─ name: alias1\n" + 6015 " │ │ ├─ outerVisibility: false\n" + 6016 " │ │ ├─ isLateral: false\n" + 6017 " │ │ ├─ cacheable: true\n" + 6018 " │ │ └─ Project\n" + 6019 " │ │ ├─ columns: [ab.a, ab.b]\n" + 6020 " │ │ └─ Filter\n" + 6021 " │ │ ├─ xy.x IS NULL\n" + 6022 " │ │ └─ LeftOuterMergeJoin\n" + 6023 " │ │ ├─ cmp: (ab.a = xy.x)\n" + 6024 " │ │ ├─ IndexedTableAccess(ab)\n" + 6025 " │ │ │ ├─ index: [ab.a]\n" + 6026 " │ │ │ └─ filters: [{[NULL, ∞)}]\n" + 6027 " │ │ └─ Project\n" + 6028 " │ │ ├─ columns: [xy.x]\n" + 6029 " │ │ └─ IndexedTableAccess(xy)\n" + 6030 " │ │ ├─ index: [xy.x]\n" + 6031 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 6032 " │ │ └─ columns: [x y]\n" + 6033 " │ └─ HashLookup\n" + 6034 " │ ├─ left-key: (alias1.a)\n" + 6035 " │ ├─ right-key: (pq.p)\n" + 6036 " │ └─ Table\n" + 6037 " │ └─ name: pq\n" + 6038 " └─ Table\n" + 6039 " ├─ name: uv\n" + 6040 " └─ columns: [u v]\n" + 6041 "", 6042 }, 6043 { 6044 Query: `select i from mytable a where exists (select 1 from mytable b where a.i = b.i)`, 6045 ExpectedPlan: "Project\n" + 6046 " ├─ columns: [a.i:0!null]\n" + 6047 " └─ Project\n" + 6048 " ├─ columns: [a.i:0!null, a.s:1!null]\n" + 6049 " └─ MergeJoin\n" + 6050 " ├─ cmp: Eq\n" + 6051 " │ ├─ a.i:0!null\n" + 6052 " │ └─ b.i:2!null\n" + 6053 " ├─ TableAlias(a)\n" + 6054 " │ └─ IndexedTableAccess(mytable)\n" + 6055 " │ ├─ index: [mytable.i,mytable.s]\n" + 6056 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 6057 " │ ├─ colSet: (1,2)\n" + 6058 " │ ├─ tableId: 1\n" + 6059 " │ └─ Table\n" + 6060 " │ ├─ name: mytable\n" + 6061 " │ └─ columns: [i s]\n" + 6062 " └─ TableAlias(b)\n" + 6063 " └─ IndexedTableAccess(mytable)\n" + 6064 " ├─ index: [mytable.i]\n" + 6065 " ├─ static: [{[NULL, ∞)}]\n" + 6066 " ├─ colSet: (3,4)\n" + 6067 " ├─ tableId: 2\n" + 6068 " └─ Table\n" + 6069 " ├─ name: mytable\n" + 6070 " └─ columns: [i]\n" + 6071 "", 6072 ExpectedEstimates: "Project\n" + 6073 " ├─ columns: [a.i]\n" + 6074 " └─ Project\n" + 6075 " ├─ columns: [a.i, a.s]\n" + 6076 " └─ MergeJoin (estimated cost=6.090 rows=3)\n" + 6077 " ├─ cmp: (a.i = b.i)\n" + 6078 " ├─ TableAlias(a)\n" + 6079 " │ └─ IndexedTableAccess(mytable)\n" + 6080 " │ ├─ index: [mytable.i,mytable.s]\n" + 6081 " │ └─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6082 " └─ TableAlias(b)\n" + 6083 " └─ IndexedTableAccess(mytable)\n" + 6084 " ├─ index: [mytable.i]\n" + 6085 " ├─ filters: [{[NULL, ∞)}]\n" + 6086 " └─ columns: [i]\n" + 6087 "", 6088 ExpectedAnalysis: "Project\n" + 6089 " ├─ columns: [a.i]\n" + 6090 " └─ Project\n" + 6091 " ├─ columns: [a.i, a.s]\n" + 6092 " └─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=1)\n" + 6093 " ├─ cmp: (a.i = b.i)\n" + 6094 " ├─ TableAlias(a)\n" + 6095 " │ └─ IndexedTableAccess(mytable)\n" + 6096 " │ ├─ index: [mytable.i,mytable.s]\n" + 6097 " │ └─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6098 " └─ TableAlias(b)\n" + 6099 " └─ IndexedTableAccess(mytable)\n" + 6100 " ├─ index: [mytable.i]\n" + 6101 " ├─ filters: [{[NULL, ∞)}]\n" + 6102 " └─ columns: [i]\n" + 6103 "", 6104 }, 6105 { 6106 Query: `select i from mytable a where not exists (select 1 from mytable b where a.i = b.i)`, 6107 ExpectedPlan: "Project\n" + 6108 " ├─ columns: [a.i:0!null]\n" + 6109 " └─ Project\n" + 6110 " ├─ columns: [a.i:0!null, a.s:1!null]\n" + 6111 " └─ Filter\n" + 6112 " ├─ b.i:2!null IS NULL\n" + 6113 " └─ LeftOuterMergeJoin\n" + 6114 " ├─ cmp: Eq\n" + 6115 " │ ├─ a.i:0!null\n" + 6116 " │ └─ b.i:2!null\n" + 6117 " ├─ TableAlias(a)\n" + 6118 " │ └─ IndexedTableAccess(mytable)\n" + 6119 " │ ├─ index: [mytable.i,mytable.s]\n" + 6120 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 6121 " │ ├─ colSet: (1,2)\n" + 6122 " │ ├─ tableId: 1\n" + 6123 " │ └─ Table\n" + 6124 " │ ├─ name: mytable\n" + 6125 " │ └─ columns: [i s]\n" + 6126 " └─ TableAlias(b)\n" + 6127 " └─ IndexedTableAccess(mytable)\n" + 6128 " ├─ index: [mytable.i,mytable.s]\n" + 6129 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 6130 " ├─ colSet: (3,4)\n" + 6131 " ├─ tableId: 2\n" + 6132 " └─ Table\n" + 6133 " ├─ name: mytable\n" + 6134 " └─ columns: [i]\n" + 6135 "", 6136 ExpectedEstimates: "Project\n" + 6137 " ├─ columns: [a.i]\n" + 6138 " └─ Project\n" + 6139 " ├─ columns: [a.i, a.s]\n" + 6140 " └─ Filter\n" + 6141 " ├─ b.i IS NULL\n" + 6142 " └─ LeftOuterMergeJoin (estimated cost=6.120 rows=3)\n" + 6143 " ├─ cmp: (a.i = b.i)\n" + 6144 " ├─ TableAlias(a)\n" + 6145 " │ └─ IndexedTableAccess(mytable)\n" + 6146 " │ ├─ index: [mytable.i,mytable.s]\n" + 6147 " │ └─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6148 " └─ TableAlias(b)\n" + 6149 " └─ IndexedTableAccess(mytable)\n" + 6150 " ├─ index: [mytable.i,mytable.s]\n" + 6151 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6152 " └─ columns: [i]\n" + 6153 "", 6154 ExpectedAnalysis: "Project\n" + 6155 " ├─ columns: [a.i]\n" + 6156 " └─ Project\n" + 6157 " ├─ columns: [a.i, a.s]\n" + 6158 " └─ Filter\n" + 6159 " ├─ b.i IS NULL\n" + 6160 " └─ LeftOuterMergeJoin (estimated cost=6.120 rows=3) (actual rows=3 loops=1)\n" + 6161 " ├─ cmp: (a.i = b.i)\n" + 6162 " ├─ TableAlias(a)\n" + 6163 " │ └─ IndexedTableAccess(mytable)\n" + 6164 " │ ├─ index: [mytable.i,mytable.s]\n" + 6165 " │ └─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6166 " └─ TableAlias(b)\n" + 6167 " └─ IndexedTableAccess(mytable)\n" + 6168 " ├─ index: [mytable.i,mytable.s]\n" + 6169 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6170 " └─ columns: [i]\n" + 6171 "", 6172 }, 6173 { 6174 Query: `select i from mytable full join othertable on mytable.i = othertable.i2`, 6175 ExpectedPlan: "Project\n" + 6176 " ├─ columns: [mytable.i:0!null]\n" + 6177 " └─ FullOuterJoin\n" + 6178 " ├─ Eq\n" + 6179 " │ ├─ mytable.i:0!null\n" + 6180 " │ └─ othertable.i2:1!null\n" + 6181 " ├─ ProcessTable\n" + 6182 " │ └─ Table\n" + 6183 " │ ├─ name: mytable\n" + 6184 " │ └─ columns: [i]\n" + 6185 " └─ ProcessTable\n" + 6186 " └─ Table\n" + 6187 " ├─ name: othertable\n" + 6188 " └─ columns: [i2]\n" + 6189 "", 6190 ExpectedEstimates: "Project\n" + 6191 " ├─ columns: [mytable.i]\n" + 6192 " └─ FullOuterJoin (estimated cost=16.180 rows=3)\n" + 6193 " ├─ (mytable.i = othertable.i2)\n" + 6194 " ├─ Table\n" + 6195 " │ ├─ name: mytable\n" + 6196 " │ └─ columns: [i]\n" + 6197 " └─ Table\n" + 6198 " ├─ name: othertable\n" + 6199 " └─ columns: [i2]\n" + 6200 "", 6201 ExpectedAnalysis: "Project\n" + 6202 " ├─ columns: [mytable.i]\n" + 6203 " └─ FullOuterJoin (estimated cost=16.180 rows=3) (actual rows=3 loops=1)\n" + 6204 " ├─ (mytable.i = othertable.i2)\n" + 6205 " ├─ Table\n" + 6206 " │ ├─ name: mytable\n" + 6207 " │ └─ columns: [i]\n" + 6208 " └─ Table\n" + 6209 " ├─ name: othertable\n" + 6210 " └─ columns: [i2]\n" + 6211 "", 6212 }, 6213 { 6214 Query: `SELECT mytable.i FROM mytable INNER JOIN othertable ON (mytable.i = othertable.i2) LEFT JOIN othertable T4 ON (mytable.i = T4.i2) ORDER BY othertable.i2, T4.s2`, 6215 ExpectedPlan: "Project\n" + 6216 " ├─ columns: [mytable.i:0!null]\n" + 6217 " └─ Sort(othertable.i2:1!null ASC nullsFirst, t4.s2:2!null ASC nullsFirst)\n" + 6218 " └─ LeftOuterJoin\n" + 6219 " ├─ Eq\n" + 6220 " │ ├─ mytable.i:0!null\n" + 6221 " │ └─ t4.i2:3!null\n" + 6222 " ├─ MergeJoin\n" + 6223 " │ ├─ cmp: Eq\n" + 6224 " │ │ ├─ mytable.i:0!null\n" + 6225 " │ │ └─ othertable.i2:1!null\n" + 6226 " │ ├─ IndexedTableAccess(mytable)\n" + 6227 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 6228 " │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 6229 " │ │ ├─ colSet: (1,2)\n" + 6230 " │ │ ├─ tableId: 1\n" + 6231 " │ │ └─ Table\n" + 6232 " │ │ ├─ name: mytable\n" + 6233 " │ │ └─ columns: [i]\n" + 6234 " │ └─ IndexedTableAccess(othertable)\n" + 6235 " │ ├─ index: [othertable.i2]\n" + 6236 " │ ├─ static: [{[NULL, ∞)}]\n" + 6237 " │ ├─ colSet: (3,4)\n" + 6238 " │ ├─ tableId: 2\n" + 6239 " │ └─ Table\n" + 6240 " │ ├─ name: othertable\n" + 6241 " │ └─ columns: [i2]\n" + 6242 " └─ TableAlias(t4)\n" + 6243 " └─ ProcessTable\n" + 6244 " └─ Table\n" + 6245 " ├─ name: othertable\n" + 6246 " └─ columns: [s2 i2]\n" + 6247 "", 6248 ExpectedEstimates: "Project\n" + 6249 " ├─ columns: [mytable.i]\n" + 6250 " └─ Sort(othertable.i2 ASC, t4.s2 ASC)\n" + 6251 " └─ LeftOuterJoin\n" + 6252 " ├─ (mytable.i = t4.i2)\n" + 6253 " ├─ MergeJoin\n" + 6254 " │ ├─ cmp: (mytable.i = othertable.i2)\n" + 6255 " │ ├─ IndexedTableAccess(mytable)\n" + 6256 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 6257 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6258 " │ │ └─ columns: [i]\n" + 6259 " │ └─ IndexedTableAccess(othertable)\n" + 6260 " │ ├─ index: [othertable.i2]\n" + 6261 " │ ├─ filters: [{[NULL, ∞)}]\n" + 6262 " │ └─ columns: [i2]\n" + 6263 " └─ TableAlias(t4)\n" + 6264 " └─ Table\n" + 6265 " ├─ name: othertable\n" + 6266 " └─ columns: [s2 i2]\n" + 6267 "", 6268 ExpectedAnalysis: "Project\n" + 6269 " ├─ columns: [mytable.i]\n" + 6270 " └─ Sort(othertable.i2 ASC, t4.s2 ASC)\n" + 6271 " └─ LeftOuterJoin\n" + 6272 " ├─ (mytable.i = t4.i2)\n" + 6273 " ├─ MergeJoin\n" + 6274 " │ ├─ cmp: (mytable.i = othertable.i2)\n" + 6275 " │ ├─ IndexedTableAccess(mytable)\n" + 6276 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 6277 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6278 " │ │ └─ columns: [i]\n" + 6279 " │ └─ IndexedTableAccess(othertable)\n" + 6280 " │ ├─ index: [othertable.i2]\n" + 6281 " │ ├─ filters: [{[NULL, ∞)}]\n" + 6282 " │ └─ columns: [i2]\n" + 6283 " └─ TableAlias(t4)\n" + 6284 " └─ Table\n" + 6285 " ├─ name: othertable\n" + 6286 " └─ columns: [s2 i2]\n" + 6287 "", 6288 }, 6289 { 6290 Query: `SELECT * FROM one_pk ORDER BY pk`, 6291 ExpectedPlan: "IndexedTableAccess(one_pk)\n" + 6292 " ├─ index: [one_pk.pk]\n" + 6293 " ├─ static: [{[NULL, ∞)}]\n" + 6294 " ├─ colSet: (1-6)\n" + 6295 " ├─ tableId: 1\n" + 6296 " └─ Table\n" + 6297 " ├─ name: one_pk\n" + 6298 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 6299 "", 6300 ExpectedEstimates: "IndexedTableAccess(one_pk)\n" + 6301 " ├─ index: [one_pk.pk]\n" + 6302 " ├─ filters: [{[NULL, ∞)}]\n" + 6303 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 6304 "", 6305 ExpectedAnalysis: "IndexedTableAccess(one_pk)\n" + 6306 " ├─ index: [one_pk.pk]\n" + 6307 " ├─ filters: [{[NULL, ∞)}]\n" + 6308 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 6309 "", 6310 }, 6311 { 6312 Query: `SELECT * FROM two_pk ORDER BY pk1, pk2`, 6313 ExpectedPlan: "IndexedTableAccess(two_pk)\n" + 6314 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 6315 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 6316 " ├─ colSet: (1-7)\n" + 6317 " ├─ tableId: 1\n" + 6318 " └─ Table\n" + 6319 " ├─ name: two_pk\n" + 6320 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 6321 "", 6322 ExpectedEstimates: "IndexedTableAccess(two_pk)\n" + 6323 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 6324 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6325 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 6326 "", 6327 ExpectedAnalysis: "IndexedTableAccess(two_pk)\n" + 6328 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 6329 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6330 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 6331 "", 6332 }, 6333 { 6334 Query: `SELECT * FROM two_pk ORDER BY pk1`, 6335 ExpectedPlan: "IndexedTableAccess(two_pk)\n" + 6336 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 6337 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 6338 " ├─ colSet: (1-7)\n" + 6339 " ├─ tableId: 1\n" + 6340 " └─ Table\n" + 6341 " ├─ name: two_pk\n" + 6342 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 6343 "", 6344 ExpectedEstimates: "IndexedTableAccess(two_pk)\n" + 6345 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 6346 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6347 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 6348 "", 6349 ExpectedAnalysis: "IndexedTableAccess(two_pk)\n" + 6350 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 6351 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6352 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 6353 "", 6354 }, 6355 { 6356 Query: `SELECT pk1 AS one, pk2 AS two FROM two_pk ORDER BY pk1, pk2`, 6357 ExpectedPlan: "Project\n" + 6358 " ├─ columns: [two_pk.pk1:0!null as one, two_pk.pk2:1!null as two]\n" + 6359 " └─ Project\n" + 6360 " ├─ columns: [two_pk.pk1:0!null, two_pk.pk2:1!null, two_pk.c1:2!null, two_pk.c2:3!null, two_pk.c3:4!null, two_pk.c4:5!null, two_pk.c5:6!null, two_pk.pk1:0!null as one, two_pk.pk2:1!null as two]\n" + 6361 " └─ IndexedTableAccess(two_pk)\n" + 6362 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 6363 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 6364 " ├─ colSet: (1-7)\n" + 6365 " ├─ tableId: 1\n" + 6366 " └─ Table\n" + 6367 " ├─ name: two_pk\n" + 6368 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 6369 "", 6370 ExpectedEstimates: "Project\n" + 6371 " ├─ columns: [two_pk.pk1 as one, two_pk.pk2 as two]\n" + 6372 " └─ Project\n" + 6373 " ├─ columns: [two_pk.pk1, two_pk.pk2, two_pk.c1, two_pk.c2, two_pk.c3, two_pk.c4, two_pk.c5, two_pk.pk1 as one, two_pk.pk2 as two]\n" + 6374 " └─ IndexedTableAccess(two_pk)\n" + 6375 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 6376 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6377 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 6378 "", 6379 ExpectedAnalysis: "Project\n" + 6380 " ├─ columns: [two_pk.pk1 as one, two_pk.pk2 as two]\n" + 6381 " └─ Project\n" + 6382 " ├─ columns: [two_pk.pk1, two_pk.pk2, two_pk.c1, two_pk.c2, two_pk.c3, two_pk.c4, two_pk.c5, two_pk.pk1 as one, two_pk.pk2 as two]\n" + 6383 " └─ IndexedTableAccess(two_pk)\n" + 6384 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 6385 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6386 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 6387 "", 6388 }, 6389 { 6390 Query: `SELECT pk1 AS one, pk2 AS two FROM two_pk ORDER BY one, two`, 6391 ExpectedPlan: "Project\n" + 6392 " ├─ columns: [two_pk.pk1:0!null as one, two_pk.pk2:1!null as two]\n" + 6393 " └─ Project\n" + 6394 " ├─ columns: [two_pk.pk1:0!null, two_pk.pk2:1!null, two_pk.c1:2!null, two_pk.c2:3!null, two_pk.c3:4!null, two_pk.c4:5!null, two_pk.c5:6!null, two_pk.pk1:0!null as one, two_pk.pk2:1!null as two]\n" + 6395 " └─ IndexedTableAccess(two_pk)\n" + 6396 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 6397 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 6398 " ├─ colSet: (1-7)\n" + 6399 " ├─ tableId: 1\n" + 6400 " └─ Table\n" + 6401 " ├─ name: two_pk\n" + 6402 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 6403 "", 6404 ExpectedEstimates: "Project\n" + 6405 " ├─ columns: [two_pk.pk1 as one, two_pk.pk2 as two]\n" + 6406 " └─ Project\n" + 6407 " ├─ columns: [two_pk.pk1, two_pk.pk2, two_pk.c1, two_pk.c2, two_pk.c3, two_pk.c4, two_pk.c5, two_pk.pk1 as one, two_pk.pk2 as two]\n" + 6408 " └─ IndexedTableAccess(two_pk)\n" + 6409 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 6410 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6411 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 6412 "", 6413 ExpectedAnalysis: "Project\n" + 6414 " ├─ columns: [two_pk.pk1 as one, two_pk.pk2 as two]\n" + 6415 " └─ Project\n" + 6416 " ├─ columns: [two_pk.pk1, two_pk.pk2, two_pk.c1, two_pk.c2, two_pk.c3, two_pk.c4, two_pk.c5, two_pk.pk1 as one, two_pk.pk2 as two]\n" + 6417 " └─ IndexedTableAccess(two_pk)\n" + 6418 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 6419 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6420 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 6421 "", 6422 }, 6423 { 6424 Query: `SELECT t1.i FROM mytable t1 JOIN mytable t2 on t1.i = t2.i + 1 where t1.i = 2 and t2.i = 1`, 6425 ExpectedPlan: "Project\n" + 6426 " ├─ columns: [t1.i:0!null]\n" + 6427 " └─ LookupJoin\n" + 6428 " ├─ Eq\n" + 6429 " │ ├─ t1.i:0!null\n" + 6430 " │ └─ (t2.i:1!null + 1 (tinyint))\n" + 6431 " ├─ TableAlias(t1)\n" + 6432 " │ └─ IndexedTableAccess(mytable)\n" + 6433 " │ ├─ index: [mytable.i]\n" + 6434 " │ ├─ static: [{[2, 2]}]\n" + 6435 " │ ├─ colSet: (1,2)\n" + 6436 " │ ├─ tableId: 1\n" + 6437 " │ └─ Table\n" + 6438 " │ ├─ name: mytable\n" + 6439 " │ └─ columns: [i]\n" + 6440 " └─ Filter\n" + 6441 " ├─ Eq\n" + 6442 " │ ├─ t2.i:0!null\n" + 6443 " │ └─ 1 (tinyint)\n" + 6444 " └─ TableAlias(t2)\n" + 6445 " └─ IndexedTableAccess(mytable)\n" + 6446 " ├─ index: [mytable.i]\n" + 6447 " ├─ keys: [1 (tinyint)]\n" + 6448 " ├─ colSet: (3,4)\n" + 6449 " ├─ tableId: 2\n" + 6450 " └─ Table\n" + 6451 " ├─ name: mytable\n" + 6452 " └─ columns: [i]\n" + 6453 "", 6454 ExpectedEstimates: "Project\n" + 6455 " ├─ columns: [t1.i]\n" + 6456 " └─ LookupJoin (estimated cost=9.900 rows=3)\n" + 6457 " ├─ (t1.i = (t2.i + 1))\n" + 6458 " ├─ TableAlias(t1)\n" + 6459 " │ └─ IndexedTableAccess(mytable)\n" + 6460 " │ ├─ index: [mytable.i]\n" + 6461 " │ ├─ filters: [{[2, 2]}]\n" + 6462 " │ └─ columns: [i]\n" + 6463 " └─ Filter\n" + 6464 " ├─ (t2.i = 1)\n" + 6465 " └─ TableAlias(t2)\n" + 6466 " └─ IndexedTableAccess(mytable)\n" + 6467 " ├─ index: [mytable.i]\n" + 6468 " ├─ columns: [i]\n" + 6469 " └─ keys: 1\n" + 6470 "", 6471 ExpectedAnalysis: "Project\n" + 6472 " ├─ columns: [t1.i]\n" + 6473 " └─ LookupJoin (estimated cost=9.900 rows=3) (actual rows=1 loops=1)\n" + 6474 " ├─ (t1.i = (t2.i + 1))\n" + 6475 " ├─ TableAlias(t1)\n" + 6476 " │ └─ IndexedTableAccess(mytable)\n" + 6477 " │ ├─ index: [mytable.i]\n" + 6478 " │ ├─ filters: [{[2, 2]}]\n" + 6479 " │ └─ columns: [i]\n" + 6480 " └─ Filter\n" + 6481 " ├─ (t2.i = 1)\n" + 6482 " └─ TableAlias(t2)\n" + 6483 " └─ IndexedTableAccess(mytable)\n" + 6484 " ├─ index: [mytable.i]\n" + 6485 " ├─ columns: [i]\n" + 6486 " └─ keys: 1\n" + 6487 "", 6488 }, 6489 { 6490 Query: `select row_number() over (order by i desc), mytable.i as i2 6491 from mytable join othertable on i = i2 order by 1`, 6492 ExpectedPlan: "Project\n" + 6493 " ├─ columns: [row_number() over ( order by mytable.i desc):0!null as row_number() over (order by i desc), mytable.i:1!null as i2]\n" + 6494 " └─ Sort(row_number() over ( order by mytable.i desc):0!null as row_number() over (order by i desc) ASC nullsFirst)\n" + 6495 " └─ Project\n" + 6496 " ├─ columns: [row_number() over ( order by mytable.i desc):0!null, mytable.i:1!null, mytable.i:1!null as i2]\n" + 6497 " └─ Window\n" + 6498 " ├─ row_number() over ( order by mytable.i DESC)\n" + 6499 " ├─ mytable.i:0!null\n" + 6500 " └─ MergeJoin\n" + 6501 " ├─ cmp: Eq\n" + 6502 " │ ├─ mytable.i:0!null\n" + 6503 " │ └─ othertable.i2:1!null\n" + 6504 " ├─ IndexedTableAccess(mytable)\n" + 6505 " │ ├─ index: [mytable.i,mytable.s]\n" + 6506 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 6507 " │ ├─ colSet: (1,2)\n" + 6508 " │ ├─ tableId: 1\n" + 6509 " │ └─ Table\n" + 6510 " │ ├─ name: mytable\n" + 6511 " │ └─ columns: [i]\n" + 6512 " └─ IndexedTableAccess(othertable)\n" + 6513 " ├─ index: [othertable.i2]\n" + 6514 " ├─ static: [{[NULL, ∞)}]\n" + 6515 " ├─ colSet: (3,4)\n" + 6516 " ├─ tableId: 2\n" + 6517 " └─ Table\n" + 6518 " ├─ name: othertable\n" + 6519 " └─ columns: [i2]\n" + 6520 "", 6521 ExpectedEstimates: "Project\n" + 6522 " ├─ columns: [row_number() over ( order by mytable.i desc) as row_number() over (order by i desc), mytable.i as i2]\n" + 6523 " └─ Sort(row_number() over ( order by mytable.i desc) as row_number() over (order by i desc) ASC)\n" + 6524 " └─ Project\n" + 6525 " ├─ columns: [row_number() over ( order by mytable.i desc), mytable.i, mytable.i as i2]\n" + 6526 " └─ Window(row_number() over ( order by mytable.i DESC), mytable.i)\n" + 6527 " └─ MergeJoin\n" + 6528 " ├─ cmp: (mytable.i = othertable.i2)\n" + 6529 " ├─ IndexedTableAccess(mytable)\n" + 6530 " │ ├─ index: [mytable.i,mytable.s]\n" + 6531 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6532 " │ └─ columns: [i]\n" + 6533 " └─ IndexedTableAccess(othertable)\n" + 6534 " ├─ index: [othertable.i2]\n" + 6535 " ├─ filters: [{[NULL, ∞)}]\n" + 6536 " └─ columns: [i2]\n" + 6537 "", 6538 ExpectedAnalysis: "Project\n" + 6539 " ├─ columns: [row_number() over ( order by mytable.i desc) as row_number() over (order by i desc), mytable.i as i2]\n" + 6540 " └─ Sort(row_number() over ( order by mytable.i desc) as row_number() over (order by i desc) ASC)\n" + 6541 " └─ Project\n" + 6542 " ├─ columns: [row_number() over ( order by mytable.i desc), mytable.i, mytable.i as i2]\n" + 6543 " └─ Window(row_number() over ( order by mytable.i DESC), mytable.i)\n" + 6544 " └─ MergeJoin\n" + 6545 " ├─ cmp: (mytable.i = othertable.i2)\n" + 6546 " ├─ IndexedTableAccess(mytable)\n" + 6547 " │ ├─ index: [mytable.i,mytable.s]\n" + 6548 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 6549 " │ └─ columns: [i]\n" + 6550 " └─ IndexedTableAccess(othertable)\n" + 6551 " ├─ index: [othertable.i2]\n" + 6552 " ├─ filters: [{[NULL, ∞)}]\n" + 6553 " └─ columns: [i2]\n" + 6554 "", 6555 }, 6556 { 6557 Query: `SELECT * FROM one_pk_two_idx WHERE v1 < 2 AND v2 IS NOT NULL`, 6558 ExpectedPlan: "Filter\n" + 6559 " ├─ NOT\n" + 6560 " │ └─ one_pk_two_idx.v2:2 IS NULL\n" + 6561 " └─ IndexedTableAccess(one_pk_two_idx)\n" + 6562 " ├─ index: [one_pk_two_idx.v1]\n" + 6563 " ├─ static: [{(NULL, 2)}]\n" + 6564 " ├─ colSet: (1-3)\n" + 6565 " ├─ tableId: 1\n" + 6566 " └─ Table\n" + 6567 " ├─ name: one_pk_two_idx\n" + 6568 " └─ columns: [pk v1 v2]\n" + 6569 "", 6570 ExpectedEstimates: "Filter\n" + 6571 " ├─ (NOT(one_pk_two_idx.v2 IS NULL))\n" + 6572 " └─ IndexedTableAccess(one_pk_two_idx)\n" + 6573 " ├─ index: [one_pk_two_idx.v1]\n" + 6574 " ├─ filters: [{(NULL, 2)}]\n" + 6575 " └─ columns: [pk v1 v2]\n" + 6576 "", 6577 ExpectedAnalysis: "Filter\n" + 6578 " ├─ (NOT(one_pk_two_idx.v2 IS NULL))\n" + 6579 " └─ IndexedTableAccess(one_pk_two_idx)\n" + 6580 " ├─ index: [one_pk_two_idx.v1]\n" + 6581 " ├─ filters: [{(NULL, 2)}]\n" + 6582 " └─ columns: [pk v1 v2]\n" + 6583 "", 6584 }, 6585 { 6586 Query: `SELECT * FROM one_pk_two_idx WHERE v1 IN (1, 2) AND v2 <= 2`, 6587 ExpectedPlan: "Filter\n" + 6588 " ├─ AND\n" + 6589 " │ ├─ HashIn\n" + 6590 " │ │ ├─ one_pk_two_idx.v1:1\n" + 6591 " │ │ └─ TUPLE(1 (tinyint), 2 (tinyint))\n" + 6592 " │ └─ LessThanOrEqual\n" + 6593 " │ ├─ one_pk_two_idx.v2:2\n" + 6594 " │ └─ 2 (tinyint)\n" + 6595 " └─ IndexedTableAccess(one_pk_two_idx)\n" + 6596 " ├─ index: [one_pk_two_idx.v1]\n" + 6597 " ├─ static: [{[1, 1]}, {[2, 2]}]\n" + 6598 " ├─ colSet: (1-3)\n" + 6599 " ├─ tableId: 1\n" + 6600 " └─ Table\n" + 6601 " ├─ name: one_pk_two_idx\n" + 6602 " └─ columns: [pk v1 v2]\n" + 6603 "", 6604 ExpectedEstimates: "Filter\n" + 6605 " ├─ ((one_pk_two_idx.v1 HASH IN (1, 2)) AND (one_pk_two_idx.v2 <= 2))\n" + 6606 " └─ IndexedTableAccess(one_pk_two_idx)\n" + 6607 " ├─ index: [one_pk_two_idx.v1]\n" + 6608 " ├─ filters: [{[1, 1]}, {[2, 2]}]\n" + 6609 " └─ columns: [pk v1 v2]\n" + 6610 "", 6611 ExpectedAnalysis: "Filter\n" + 6612 " ├─ ((one_pk_two_idx.v1 HASH IN (1, 2)) AND (one_pk_two_idx.v2 <= 2))\n" + 6613 " └─ IndexedTableAccess(one_pk_two_idx)\n" + 6614 " ├─ index: [one_pk_two_idx.v1]\n" + 6615 " ├─ filters: [{[1, 1]}, {[2, 2]}]\n" + 6616 " └─ columns: [pk v1 v2]\n" + 6617 "", 6618 }, 6619 { 6620 Query: `SELECT * FROM one_pk_three_idx WHERE v1 > 2 AND v2 = 3`, 6621 ExpectedPlan: "IndexedTableAccess(one_pk_three_idx)\n" + 6622 " ├─ index: [one_pk_three_idx.v1,one_pk_three_idx.v2,one_pk_three_idx.v3]\n" + 6623 " ├─ static: [{(2, ∞), [3, 3], [NULL, ∞)}]\n" + 6624 " ├─ colSet: (1-4)\n" + 6625 " ├─ tableId: 1\n" + 6626 " └─ Table\n" + 6627 " ├─ name: one_pk_three_idx\n" + 6628 " └─ columns: [pk v1 v2 v3]\n" + 6629 "", 6630 ExpectedEstimates: "IndexedTableAccess(one_pk_three_idx)\n" + 6631 " ├─ index: [one_pk_three_idx.v1,one_pk_three_idx.v2,one_pk_three_idx.v3]\n" + 6632 " ├─ filters: [{(2, ∞), [3, 3], [NULL, ∞)}]\n" + 6633 " └─ columns: [pk v1 v2 v3]\n" + 6634 "", 6635 ExpectedAnalysis: "IndexedTableAccess(one_pk_three_idx)\n" + 6636 " ├─ index: [one_pk_three_idx.v1,one_pk_three_idx.v2,one_pk_three_idx.v3]\n" + 6637 " ├─ filters: [{(2, ∞), [3, 3], [NULL, ∞)}]\n" + 6638 " └─ columns: [pk v1 v2 v3]\n" + 6639 "", 6640 }, 6641 { 6642 Query: `SELECT * FROM one_pk_three_idx WHERE v1 > 2 AND v3 = 3`, 6643 ExpectedPlan: "IndexedTableAccess(one_pk_three_idx)\n" + 6644 " ├─ index: [one_pk_three_idx.v1,one_pk_three_idx.v2,one_pk_three_idx.v3]\n" + 6645 " ├─ static: [{(2, ∞), [NULL, ∞), [3, 3]}]\n" + 6646 " ├─ colSet: (1-4)\n" + 6647 " ├─ tableId: 1\n" + 6648 " └─ Table\n" + 6649 " ├─ name: one_pk_three_idx\n" + 6650 " └─ columns: [pk v1 v2 v3]\n" + 6651 "", 6652 ExpectedEstimates: "IndexedTableAccess(one_pk_three_idx)\n" + 6653 " ├─ index: [one_pk_three_idx.v1,one_pk_three_idx.v2,one_pk_three_idx.v3]\n" + 6654 " ├─ filters: [{(2, ∞), [NULL, ∞), [3, 3]}]\n" + 6655 " └─ columns: [pk v1 v2 v3]\n" + 6656 "", 6657 ExpectedAnalysis: "IndexedTableAccess(one_pk_three_idx)\n" + 6658 " ├─ index: [one_pk_three_idx.v1,one_pk_three_idx.v2,one_pk_three_idx.v3]\n" + 6659 " ├─ filters: [{(2, ∞), [NULL, ∞), [3, 3]}]\n" + 6660 " └─ columns: [pk v1 v2 v3]\n" + 6661 "", 6662 }, 6663 { 6664 Query: `select row_number() over (order by i desc), mytable.i as i2 6665 from mytable join othertable on i = i2 6666 where mytable.i = 2 6667 order by 1`, 6668 ExpectedPlan: "Project\n" + 6669 " ├─ columns: [row_number() over ( order by mytable.i desc):0!null as row_number() over (order by i desc), mytable.i:1!null as i2]\n" + 6670 " └─ Sort(row_number() over ( order by mytable.i desc):0!null as row_number() over (order by i desc) ASC nullsFirst)\n" + 6671 " └─ Project\n" + 6672 " ├─ columns: [row_number() over ( order by mytable.i desc):0!null, mytable.i:1!null, mytable.i:1!null as i2]\n" + 6673 " └─ Window\n" + 6674 " ├─ row_number() over ( order by mytable.i DESC)\n" + 6675 " ├─ mytable.i:1!null\n" + 6676 " └─ MergeJoin\n" + 6677 " ├─ cmp: Eq\n" + 6678 " │ ├─ othertable.i2:0!null\n" + 6679 " │ └─ mytable.i:1!null\n" + 6680 " ├─ IndexedTableAccess(othertable)\n" + 6681 " │ ├─ index: [othertable.i2]\n" + 6682 " │ ├─ static: [{[NULL, ∞)}]\n" + 6683 " │ ├─ colSet: (3,4)\n" + 6684 " │ ├─ tableId: 2\n" + 6685 " │ └─ Table\n" + 6686 " │ ├─ name: othertable\n" + 6687 " │ └─ columns: [i2]\n" + 6688 " └─ Filter\n" + 6689 " ├─ Eq\n" + 6690 " │ ├─ mytable.i:0!null\n" + 6691 " │ └─ 2 (tinyint)\n" + 6692 " └─ IndexedTableAccess(mytable)\n" + 6693 " ├─ index: [mytable.i,mytable.s]\n" + 6694 " ├─ static: [{[2, 2], [NULL, ∞)}]\n" + 6695 " ├─ colSet: (1,2)\n" + 6696 " ├─ tableId: 1\n" + 6697 " └─ Table\n" + 6698 " ├─ name: mytable\n" + 6699 " └─ columns: [i]\n" + 6700 "", 6701 ExpectedEstimates: "Project\n" + 6702 " ├─ columns: [row_number() over ( order by mytable.i desc) as row_number() over (order by i desc), mytable.i as i2]\n" + 6703 " └─ Sort(row_number() over ( order by mytable.i desc) as row_number() over (order by i desc) ASC)\n" + 6704 " └─ Project\n" + 6705 " ├─ columns: [row_number() over ( order by mytable.i desc), mytable.i, mytable.i as i2]\n" + 6706 " └─ Window(row_number() over ( order by mytable.i DESC), mytable.i)\n" + 6707 " └─ MergeJoin\n" + 6708 " ├─ cmp: (othertable.i2 = mytable.i)\n" + 6709 " ├─ IndexedTableAccess(othertable)\n" + 6710 " │ ├─ index: [othertable.i2]\n" + 6711 " │ ├─ filters: [{[NULL, ∞)}]\n" + 6712 " │ └─ columns: [i2]\n" + 6713 " └─ Filter\n" + 6714 " ├─ (mytable.i = 2)\n" + 6715 " └─ IndexedTableAccess(mytable)\n" + 6716 " ├─ index: [mytable.i,mytable.s]\n" + 6717 " ├─ filters: [{[2, 2], [NULL, ∞)}]\n" + 6718 " └─ columns: [i]\n" + 6719 "", 6720 ExpectedAnalysis: "Project\n" + 6721 " ├─ columns: [row_number() over ( order by mytable.i desc) as row_number() over (order by i desc), mytable.i as i2]\n" + 6722 " └─ Sort(row_number() over ( order by mytable.i desc) as row_number() over (order by i desc) ASC)\n" + 6723 " └─ Project\n" + 6724 " ├─ columns: [row_number() over ( order by mytable.i desc), mytable.i, mytable.i as i2]\n" + 6725 " └─ Window(row_number() over ( order by mytable.i DESC), mytable.i)\n" + 6726 " └─ MergeJoin\n" + 6727 " ├─ cmp: (othertable.i2 = mytable.i)\n" + 6728 " ├─ IndexedTableAccess(othertable)\n" + 6729 " │ ├─ index: [othertable.i2]\n" + 6730 " │ ├─ filters: [{[NULL, ∞)}]\n" + 6731 " │ └─ columns: [i2]\n" + 6732 " └─ Filter\n" + 6733 " ├─ (mytable.i = 2)\n" + 6734 " └─ IndexedTableAccess(mytable)\n" + 6735 " ├─ index: [mytable.i,mytable.s]\n" + 6736 " ├─ filters: [{[2, 2], [NULL, ∞)}]\n" + 6737 " └─ columns: [i]\n" + 6738 "", 6739 }, 6740 { 6741 Query: `INSERT INTO mytable(i,s) SELECT t1.i, 'hello' FROM mytable t1 JOIN mytable t2 on t1.i = t2.i + 1 where t1.i = 2 and t2.i = 1`, 6742 ExpectedPlan: "RowUpdateAccumulator\n" + 6743 " └─ Insert(i, s)\n" + 6744 " ├─ InsertDestination\n" + 6745 " │ └─ ProcessTable\n" + 6746 " │ └─ Table\n" + 6747 " │ ├─ name: mytable\n" + 6748 " │ └─ columns: [i s]\n" + 6749 " └─ Project\n" + 6750 " ├─ columns: [i:0!null, s:1!null]\n" + 6751 " └─ Project\n" + 6752 " ├─ columns: [t1.i:0!null, hello (longtext)]\n" + 6753 " └─ LookupJoin\n" + 6754 " ├─ Eq\n" + 6755 " │ ├─ t1.i:0!null\n" + 6756 " │ └─ (t2.i:1!null + 1 (tinyint))\n" + 6757 " ├─ TableAlias(t1)\n" + 6758 " │ └─ IndexedTableAccess(mytable)\n" + 6759 " │ ├─ index: [mytable.i]\n" + 6760 " │ ├─ static: [{[2, 2]}]\n" + 6761 " │ ├─ colSet: (3,4)\n" + 6762 " │ ├─ tableId: 2\n" + 6763 " │ └─ Table\n" + 6764 " │ ├─ name: mytable\n" + 6765 " │ └─ columns: [i]\n" + 6766 " └─ Filter\n" + 6767 " ├─ Eq\n" + 6768 " │ ├─ t2.i:0!null\n" + 6769 " │ └─ 1 (tinyint)\n" + 6770 " └─ TableAlias(t2)\n" + 6771 " └─ IndexedTableAccess(mytable)\n" + 6772 " ├─ index: [mytable.i]\n" + 6773 " ├─ keys: [1 (tinyint)]\n" + 6774 " ├─ colSet: (5,6)\n" + 6775 " ├─ tableId: 3\n" + 6776 " └─ Table\n" + 6777 " ├─ name: mytable\n" + 6778 " └─ columns: [i]\n" + 6779 "", 6780 }, 6781 { 6782 Query: `SELECT /*+ JOIN_ORDER(t1, t2) */ t1.i FROM mytable t1 JOIN mytable t2 on t1.i = t2.i + 1 where t1.i = 2 and t2.i = 1`, 6783 ExpectedPlan: "Project\n" + 6784 " ├─ columns: [t1.i:0!null]\n" + 6785 " └─ LookupJoin\n" + 6786 " ├─ Eq\n" + 6787 " │ ├─ t1.i:0!null\n" + 6788 " │ └─ (t2.i:1!null + 1 (tinyint))\n" + 6789 " ├─ TableAlias(t1)\n" + 6790 " │ └─ IndexedTableAccess(mytable)\n" + 6791 " │ ├─ index: [mytable.i]\n" + 6792 " │ ├─ static: [{[2, 2]}]\n" + 6793 " │ ├─ colSet: (1,2)\n" + 6794 " │ ├─ tableId: 1\n" + 6795 " │ └─ Table\n" + 6796 " │ ├─ name: mytable\n" + 6797 " │ └─ columns: [i]\n" + 6798 " └─ Filter\n" + 6799 " ├─ Eq\n" + 6800 " │ ├─ t2.i:0!null\n" + 6801 " │ └─ 1 (tinyint)\n" + 6802 " └─ TableAlias(t2)\n" + 6803 " └─ IndexedTableAccess(mytable)\n" + 6804 " ├─ index: [mytable.i]\n" + 6805 " ├─ keys: [1 (tinyint)]\n" + 6806 " ├─ colSet: (3,4)\n" + 6807 " ├─ tableId: 2\n" + 6808 " └─ Table\n" + 6809 " ├─ name: mytable\n" + 6810 " └─ columns: [i]\n" + 6811 "", 6812 ExpectedEstimates: "Project\n" + 6813 " ├─ columns: [t1.i]\n" + 6814 " └─ LookupJoin (estimated cost=9.900 rows=3)\n" + 6815 " ├─ (t1.i = (t2.i + 1))\n" + 6816 " ├─ TableAlias(t1)\n" + 6817 " │ └─ IndexedTableAccess(mytable)\n" + 6818 " │ ├─ index: [mytable.i]\n" + 6819 " │ ├─ filters: [{[2, 2]}]\n" + 6820 " │ └─ columns: [i]\n" + 6821 " └─ Filter\n" + 6822 " ├─ (t2.i = 1)\n" + 6823 " └─ TableAlias(t2)\n" + 6824 " └─ IndexedTableAccess(mytable)\n" + 6825 " ├─ index: [mytable.i]\n" + 6826 " ├─ columns: [i]\n" + 6827 " └─ keys: 1\n" + 6828 "", 6829 ExpectedAnalysis: "Project\n" + 6830 " ├─ columns: [t1.i]\n" + 6831 " └─ LookupJoin (estimated cost=9.900 rows=3) (actual rows=1 loops=1)\n" + 6832 " ├─ (t1.i = (t2.i + 1))\n" + 6833 " ├─ TableAlias(t1)\n" + 6834 " │ └─ IndexedTableAccess(mytable)\n" + 6835 " │ ├─ index: [mytable.i]\n" + 6836 " │ ├─ filters: [{[2, 2]}]\n" + 6837 " │ └─ columns: [i]\n" + 6838 " └─ Filter\n" + 6839 " ├─ (t2.i = 1)\n" + 6840 " └─ TableAlias(t2)\n" + 6841 " └─ IndexedTableAccess(mytable)\n" + 6842 " ├─ index: [mytable.i]\n" + 6843 " ├─ columns: [i]\n" + 6844 " └─ keys: 1\n" + 6845 "", 6846 }, 6847 { 6848 Query: `SELECT /*+ JOIN_ORDER(t1, mytable) */ t1.i FROM mytable t1 JOIN mytable t2 on t1.i = t2.i + 1 where t1.i = 2 and t2.i = 1`, 6849 ExpectedPlan: "Project\n" + 6850 " ├─ columns: [t1.i:0!null]\n" + 6851 " └─ LookupJoin\n" + 6852 " ├─ Eq\n" + 6853 " │ ├─ t1.i:0!null\n" + 6854 " │ └─ (t2.i:1!null + 1 (tinyint))\n" + 6855 " ├─ TableAlias(t1)\n" + 6856 " │ └─ IndexedTableAccess(mytable)\n" + 6857 " │ ├─ index: [mytable.i]\n" + 6858 " │ ├─ static: [{[2, 2]}]\n" + 6859 " │ ├─ colSet: (1,2)\n" + 6860 " │ ├─ tableId: 1\n" + 6861 " │ └─ Table\n" + 6862 " │ ├─ name: mytable\n" + 6863 " │ └─ columns: [i]\n" + 6864 " └─ Filter\n" + 6865 " ├─ Eq\n" + 6866 " │ ├─ t2.i:0!null\n" + 6867 " │ └─ 1 (tinyint)\n" + 6868 " └─ TableAlias(t2)\n" + 6869 " └─ IndexedTableAccess(mytable)\n" + 6870 " ├─ index: [mytable.i]\n" + 6871 " ├─ keys: [1 (tinyint)]\n" + 6872 " ├─ colSet: (3,4)\n" + 6873 " ├─ tableId: 2\n" + 6874 " └─ Table\n" + 6875 " ├─ name: mytable\n" + 6876 " └─ columns: [i]\n" + 6877 "", 6878 ExpectedEstimates: "Project\n" + 6879 " ├─ columns: [t1.i]\n" + 6880 " └─ LookupJoin (estimated cost=9.900 rows=3)\n" + 6881 " ├─ (t1.i = (t2.i + 1))\n" + 6882 " ├─ TableAlias(t1)\n" + 6883 " │ └─ IndexedTableAccess(mytable)\n" + 6884 " │ ├─ index: [mytable.i]\n" + 6885 " │ ├─ filters: [{[2, 2]}]\n" + 6886 " │ └─ columns: [i]\n" + 6887 " └─ Filter\n" + 6888 " ├─ (t2.i = 1)\n" + 6889 " └─ TableAlias(t2)\n" + 6890 " └─ IndexedTableAccess(mytable)\n" + 6891 " ├─ index: [mytable.i]\n" + 6892 " ├─ columns: [i]\n" + 6893 " └─ keys: 1\n" + 6894 "", 6895 ExpectedAnalysis: "Project\n" + 6896 " ├─ columns: [t1.i]\n" + 6897 " └─ LookupJoin (estimated cost=9.900 rows=3) (actual rows=1 loops=1)\n" + 6898 " ├─ (t1.i = (t2.i + 1))\n" + 6899 " ├─ TableAlias(t1)\n" + 6900 " │ └─ IndexedTableAccess(mytable)\n" + 6901 " │ ├─ index: [mytable.i]\n" + 6902 " │ ├─ filters: [{[2, 2]}]\n" + 6903 " │ └─ columns: [i]\n" + 6904 " └─ Filter\n" + 6905 " ├─ (t2.i = 1)\n" + 6906 " └─ TableAlias(t2)\n" + 6907 " └─ IndexedTableAccess(mytable)\n" + 6908 " ├─ index: [mytable.i]\n" + 6909 " ├─ columns: [i]\n" + 6910 " └─ keys: 1\n" + 6911 "", 6912 }, 6913 { 6914 Query: `SELECT /*+ JOIN_ORDER(t1, t2, t3) */ t1.i FROM mytable t1 JOIN mytable t2 on t1.i = t2.i + 1 where t1.i = 2 and t2.i = 1`, 6915 ExpectedPlan: "Project\n" + 6916 " ├─ columns: [t1.i:0!null]\n" + 6917 " └─ LookupJoin\n" + 6918 " ├─ Eq\n" + 6919 " │ ├─ t1.i:0!null\n" + 6920 " │ └─ (t2.i:1!null + 1 (tinyint))\n" + 6921 " ├─ TableAlias(t1)\n" + 6922 " │ └─ IndexedTableAccess(mytable)\n" + 6923 " │ ├─ index: [mytable.i]\n" + 6924 " │ ├─ static: [{[2, 2]}]\n" + 6925 " │ ├─ colSet: (1,2)\n" + 6926 " │ ├─ tableId: 1\n" + 6927 " │ └─ Table\n" + 6928 " │ ├─ name: mytable\n" + 6929 " │ └─ columns: [i]\n" + 6930 " └─ Filter\n" + 6931 " ├─ Eq\n" + 6932 " │ ├─ t2.i:0!null\n" + 6933 " │ └─ 1 (tinyint)\n" + 6934 " └─ TableAlias(t2)\n" + 6935 " └─ IndexedTableAccess(mytable)\n" + 6936 " ├─ index: [mytable.i]\n" + 6937 " ├─ keys: [1 (tinyint)]\n" + 6938 " ├─ colSet: (3,4)\n" + 6939 " ├─ tableId: 2\n" + 6940 " └─ Table\n" + 6941 " ├─ name: mytable\n" + 6942 " └─ columns: [i]\n" + 6943 "", 6944 ExpectedEstimates: "Project\n" + 6945 " ├─ columns: [t1.i]\n" + 6946 " └─ LookupJoin (estimated cost=9.900 rows=3)\n" + 6947 " ├─ (t1.i = (t2.i + 1))\n" + 6948 " ├─ TableAlias(t1)\n" + 6949 " │ └─ IndexedTableAccess(mytable)\n" + 6950 " │ ├─ index: [mytable.i]\n" + 6951 " │ ├─ filters: [{[2, 2]}]\n" + 6952 " │ └─ columns: [i]\n" + 6953 " └─ Filter\n" + 6954 " ├─ (t2.i = 1)\n" + 6955 " └─ TableAlias(t2)\n" + 6956 " └─ IndexedTableAccess(mytable)\n" + 6957 " ├─ index: [mytable.i]\n" + 6958 " ├─ columns: [i]\n" + 6959 " └─ keys: 1\n" + 6960 "", 6961 ExpectedAnalysis: "Project\n" + 6962 " ├─ columns: [t1.i]\n" + 6963 " └─ LookupJoin (estimated cost=9.900 rows=3) (actual rows=1 loops=1)\n" + 6964 " ├─ (t1.i = (t2.i + 1))\n" + 6965 " ├─ TableAlias(t1)\n" + 6966 " │ └─ IndexedTableAccess(mytable)\n" + 6967 " │ ├─ index: [mytable.i]\n" + 6968 " │ ├─ filters: [{[2, 2]}]\n" + 6969 " │ └─ columns: [i]\n" + 6970 " └─ Filter\n" + 6971 " ├─ (t2.i = 1)\n" + 6972 " └─ TableAlias(t2)\n" + 6973 " └─ IndexedTableAccess(mytable)\n" + 6974 " ├─ index: [mytable.i]\n" + 6975 " ├─ columns: [i]\n" + 6976 " └─ keys: 1\n" + 6977 "", 6978 }, 6979 { 6980 Query: `SELECT t1.i FROM mytable t1 JOIN mytable t2 on t1.i = t2.i + 1 where t1.i = 2 and t2.i = 1`, 6981 ExpectedPlan: "Project\n" + 6982 " ├─ columns: [t1.i:0!null]\n" + 6983 " └─ LookupJoin\n" + 6984 " ├─ Eq\n" + 6985 " │ ├─ t1.i:0!null\n" + 6986 " │ └─ (t2.i:1!null + 1 (tinyint))\n" + 6987 " ├─ TableAlias(t1)\n" + 6988 " │ └─ IndexedTableAccess(mytable)\n" + 6989 " │ ├─ index: [mytable.i]\n" + 6990 " │ ├─ static: [{[2, 2]}]\n" + 6991 " │ ├─ colSet: (1,2)\n" + 6992 " │ ├─ tableId: 1\n" + 6993 " │ └─ Table\n" + 6994 " │ ├─ name: mytable\n" + 6995 " │ └─ columns: [i]\n" + 6996 " └─ Filter\n" + 6997 " ├─ Eq\n" + 6998 " │ ├─ t2.i:0!null\n" + 6999 " │ └─ 1 (tinyint)\n" + 7000 " └─ TableAlias(t2)\n" + 7001 " └─ IndexedTableAccess(mytable)\n" + 7002 " ├─ index: [mytable.i]\n" + 7003 " ├─ keys: [1 (tinyint)]\n" + 7004 " ├─ colSet: (3,4)\n" + 7005 " ├─ tableId: 2\n" + 7006 " └─ Table\n" + 7007 " ├─ name: mytable\n" + 7008 " └─ columns: [i]\n" + 7009 "", 7010 ExpectedEstimates: "Project\n" + 7011 " ├─ columns: [t1.i]\n" + 7012 " └─ LookupJoin (estimated cost=9.900 rows=3)\n" + 7013 " ├─ (t1.i = (t2.i + 1))\n" + 7014 " ├─ TableAlias(t1)\n" + 7015 " │ └─ IndexedTableAccess(mytable)\n" + 7016 " │ ├─ index: [mytable.i]\n" + 7017 " │ ├─ filters: [{[2, 2]}]\n" + 7018 " │ └─ columns: [i]\n" + 7019 " └─ Filter\n" + 7020 " ├─ (t2.i = 1)\n" + 7021 " └─ TableAlias(t2)\n" + 7022 " └─ IndexedTableAccess(mytable)\n" + 7023 " ├─ index: [mytable.i]\n" + 7024 " ├─ columns: [i]\n" + 7025 " └─ keys: 1\n" + 7026 "", 7027 ExpectedAnalysis: "Project\n" + 7028 " ├─ columns: [t1.i]\n" + 7029 " └─ LookupJoin (estimated cost=9.900 rows=3) (actual rows=1 loops=1)\n" + 7030 " ├─ (t1.i = (t2.i + 1))\n" + 7031 " ├─ TableAlias(t1)\n" + 7032 " │ └─ IndexedTableAccess(mytable)\n" + 7033 " │ ├─ index: [mytable.i]\n" + 7034 " │ ├─ filters: [{[2, 2]}]\n" + 7035 " │ └─ columns: [i]\n" + 7036 " └─ Filter\n" + 7037 " ├─ (t2.i = 1)\n" + 7038 " └─ TableAlias(t2)\n" + 7039 " └─ IndexedTableAccess(mytable)\n" + 7040 " ├─ index: [mytable.i]\n" + 7041 " ├─ columns: [i]\n" + 7042 " └─ keys: 1\n" + 7043 "", 7044 }, 7045 { 7046 Query: `SELECT i, i2, s2 FROM mytable INNER JOIN othertable ON i = i2`, 7047 ExpectedPlan: "Project\n" + 7048 " ├─ columns: [mytable.i:0!null, othertable.i2:2!null, othertable.s2:1!null]\n" + 7049 " └─ MergeJoin\n" + 7050 " ├─ cmp: Eq\n" + 7051 " │ ├─ mytable.i:0!null\n" + 7052 " │ └─ othertable.i2:2!null\n" + 7053 " ├─ IndexedTableAccess(mytable)\n" + 7054 " │ ├─ index: [mytable.i,mytable.s]\n" + 7055 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 7056 " │ ├─ colSet: (1,2)\n" + 7057 " │ ├─ tableId: 1\n" + 7058 " │ └─ Table\n" + 7059 " │ ├─ name: mytable\n" + 7060 " │ └─ columns: [i]\n" + 7061 " └─ IndexedTableAccess(othertable)\n" + 7062 " ├─ index: [othertable.i2]\n" + 7063 " ├─ static: [{[NULL, ∞)}]\n" + 7064 " ├─ colSet: (3,4)\n" + 7065 " ├─ tableId: 2\n" + 7066 " └─ Table\n" + 7067 " ├─ name: othertable\n" + 7068 " └─ columns: [s2 i2]\n" + 7069 "", 7070 ExpectedEstimates: "Project\n" + 7071 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7072 " └─ MergeJoin (estimated cost=6.090 rows=3)\n" + 7073 " ├─ cmp: (mytable.i = othertable.i2)\n" + 7074 " ├─ IndexedTableAccess(mytable)\n" + 7075 " │ ├─ index: [mytable.i,mytable.s]\n" + 7076 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 7077 " │ └─ columns: [i]\n" + 7078 " └─ IndexedTableAccess(othertable)\n" + 7079 " ├─ index: [othertable.i2]\n" + 7080 " ├─ filters: [{[NULL, ∞)}]\n" + 7081 " └─ columns: [s2 i2]\n" + 7082 "", 7083 ExpectedAnalysis: "Project\n" + 7084 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7085 " └─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=1)\n" + 7086 " ├─ cmp: (mytable.i = othertable.i2)\n" + 7087 " ├─ IndexedTableAccess(mytable)\n" + 7088 " │ ├─ index: [mytable.i,mytable.s]\n" + 7089 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 7090 " │ └─ columns: [i]\n" + 7091 " └─ IndexedTableAccess(othertable)\n" + 7092 " ├─ index: [othertable.i2]\n" + 7093 " ├─ filters: [{[NULL, ∞)}]\n" + 7094 " └─ columns: [s2 i2]\n" + 7095 "", 7096 }, 7097 { 7098 Query: `SELECT i, i2, s2 FROM mytable INNER JOIN othertable ON i = i2 OR s = s2`, 7099 ExpectedPlan: "Project\n" + 7100 " ├─ columns: [mytable.i:0!null, othertable.i2:3!null, othertable.s2:2!null]\n" + 7101 " └─ LookupJoin\n" + 7102 " ├─ Or\n" + 7103 " │ ├─ Eq\n" + 7104 " │ │ ├─ mytable.i:0!null\n" + 7105 " │ │ └─ othertable.i2:3!null\n" + 7106 " │ └─ Eq\n" + 7107 " │ ├─ mytable.s:1!null\n" + 7108 " │ └─ othertable.s2:2!null\n" + 7109 " ├─ ProcessTable\n" + 7110 " │ └─ Table\n" + 7111 " │ ├─ name: mytable\n" + 7112 " │ └─ columns: [i s]\n" + 7113 " └─ Concat\n" + 7114 " ├─ IndexedTableAccess(othertable)\n" + 7115 " │ ├─ index: [othertable.s2]\n" + 7116 " │ ├─ keys: [mytable.s:1!null]\n" + 7117 " │ ├─ colSet: (3,4)\n" + 7118 " │ ├─ tableId: 2\n" + 7119 " │ └─ Table\n" + 7120 " │ ├─ name: othertable\n" + 7121 " │ └─ columns: [s2 i2]\n" + 7122 " └─ IndexedTableAccess(othertable)\n" + 7123 " ├─ index: [othertable.i2]\n" + 7124 " ├─ keys: [mytable.i:0!null]\n" + 7125 " ├─ colSet: (3,4)\n" + 7126 " ├─ tableId: 2\n" + 7127 " └─ Table\n" + 7128 " ├─ name: othertable\n" + 7129 " └─ columns: [s2 i2]\n" + 7130 "", 7131 ExpectedEstimates: "Project\n" + 7132 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7133 " └─ LookupJoin (estimated cost=-2.705 rows=3)\n" + 7134 " ├─ ((mytable.i = othertable.i2) OR (mytable.s = othertable.s2))\n" + 7135 " ├─ Table\n" + 7136 " │ ├─ name: mytable\n" + 7137 " │ └─ columns: [i s]\n" + 7138 " └─ Concat\n" + 7139 " ├─ IndexedTableAccess(othertable)\n" + 7140 " │ ├─ index: [othertable.s2]\n" + 7141 " │ ├─ columns: [s2 i2]\n" + 7142 " │ └─ keys: mytable.s\n" + 7143 " └─ IndexedTableAccess(othertable)\n" + 7144 " ├─ index: [othertable.i2]\n" + 7145 " ├─ columns: [s2 i2]\n" + 7146 " └─ keys: mytable.i\n" + 7147 "", 7148 ExpectedAnalysis: "Project\n" + 7149 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7150 " └─ LookupJoin (estimated cost=-2.705 rows=3) (actual rows=3 loops=1)\n" + 7151 " ├─ ((mytable.i = othertable.i2) OR (mytable.s = othertable.s2))\n" + 7152 " ├─ Table\n" + 7153 " │ ├─ name: mytable\n" + 7154 " │ └─ columns: [i s]\n" + 7155 " └─ Concat\n" + 7156 " ├─ IndexedTableAccess(othertable)\n" + 7157 " │ ├─ index: [othertable.s2]\n" + 7158 " │ ├─ columns: [s2 i2]\n" + 7159 " │ └─ keys: mytable.s\n" + 7160 " └─ IndexedTableAccess(othertable)\n" + 7161 " ├─ index: [othertable.i2]\n" + 7162 " ├─ columns: [s2 i2]\n" + 7163 " └─ keys: mytable.i\n" + 7164 "", 7165 }, 7166 { 7167 Query: `SELECT i, i2, s2 FROM mytable INNER JOIN othertable ot ON i = i2 OR s = s2`, 7168 ExpectedPlan: "Project\n" + 7169 " ├─ columns: [mytable.i:0!null, ot.i2:3!null, ot.s2:2!null]\n" + 7170 " └─ LookupJoin\n" + 7171 " ├─ Or\n" + 7172 " │ ├─ Eq\n" + 7173 " │ │ ├─ mytable.i:0!null\n" + 7174 " │ │ └─ ot.i2:3!null\n" + 7175 " │ └─ Eq\n" + 7176 " │ ├─ mytable.s:1!null\n" + 7177 " │ └─ ot.s2:2!null\n" + 7178 " ├─ ProcessTable\n" + 7179 " │ └─ Table\n" + 7180 " │ ├─ name: mytable\n" + 7181 " │ └─ columns: [i s]\n" + 7182 " └─ TableAlias(ot)\n" + 7183 " └─ Concat\n" + 7184 " ├─ TableAlias(ot)\n" + 7185 " │ └─ IndexedTableAccess(othertable)\n" + 7186 " │ ├─ index: [othertable.s2]\n" + 7187 " │ ├─ keys: [mytable.s:1!null]\n" + 7188 " │ ├─ colSet: (3,4)\n" + 7189 " │ ├─ tableId: 2\n" + 7190 " │ └─ Table\n" + 7191 " │ ├─ name: othertable\n" + 7192 " │ └─ columns: [s2 i2]\n" + 7193 " └─ TableAlias(ot)\n" + 7194 " └─ IndexedTableAccess(othertable)\n" + 7195 " ├─ index: [othertable.i2]\n" + 7196 " ├─ keys: [mytable.i:0!null]\n" + 7197 " ├─ colSet: (3,4)\n" + 7198 " ├─ tableId: 2\n" + 7199 " └─ Table\n" + 7200 " ├─ name: othertable\n" + 7201 " └─ columns: [s2 i2]\n" + 7202 "", 7203 ExpectedEstimates: "Project\n" + 7204 " ├─ columns: [mytable.i, ot.i2, ot.s2]\n" + 7205 " └─ LookupJoin (estimated cost=-2.705 rows=3)\n" + 7206 " ├─ ((mytable.i = ot.i2) OR (mytable.s = ot.s2))\n" + 7207 " ├─ Table\n" + 7208 " │ ├─ name: mytable\n" + 7209 " │ └─ columns: [i s]\n" + 7210 " └─ TableAlias(ot)\n" + 7211 " └─ Concat\n" + 7212 " ├─ TableAlias(ot)\n" + 7213 " │ └─ IndexedTableAccess(othertable)\n" + 7214 " │ ├─ index: [othertable.s2]\n" + 7215 " │ ├─ columns: [s2 i2]\n" + 7216 " │ └─ keys: mytable.s\n" + 7217 " └─ TableAlias(ot)\n" + 7218 " └─ IndexedTableAccess(othertable)\n" + 7219 " ├─ index: [othertable.i2]\n" + 7220 " ├─ columns: [s2 i2]\n" + 7221 " └─ keys: mytable.i\n" + 7222 "", 7223 ExpectedAnalysis: "Project\n" + 7224 " ├─ columns: [mytable.i, ot.i2, ot.s2]\n" + 7225 " └─ LookupJoin (estimated cost=-2.705 rows=3) (actual rows=3 loops=1)\n" + 7226 " ├─ ((mytable.i = ot.i2) OR (mytable.s = ot.s2))\n" + 7227 " ├─ Table\n" + 7228 " │ ├─ name: mytable\n" + 7229 " │ └─ columns: [i s]\n" + 7230 " └─ TableAlias(ot)\n" + 7231 " └─ Concat\n" + 7232 " ├─ TableAlias(ot)\n" + 7233 " │ └─ IndexedTableAccess(othertable)\n" + 7234 " │ ├─ index: [othertable.s2]\n" + 7235 " │ ├─ columns: [s2 i2]\n" + 7236 " │ └─ keys: mytable.s\n" + 7237 " └─ TableAlias(ot)\n" + 7238 " └─ IndexedTableAccess(othertable)\n" + 7239 " ├─ index: [othertable.i2]\n" + 7240 " ├─ columns: [s2 i2]\n" + 7241 " └─ keys: mytable.i\n" + 7242 "", 7243 }, 7244 { 7245 Query: `SELECT i, i2, s2 FROM mytable INNER JOIN othertable ON i = i2 OR SUBSTRING_INDEX(s, ' ', 1) = s2`, 7246 ExpectedPlan: "Project\n" + 7247 " ├─ columns: [mytable.i:0!null, othertable.i2:3!null, othertable.s2:2!null]\n" + 7248 " └─ LookupJoin\n" + 7249 " ├─ Or\n" + 7250 " │ ├─ Eq\n" + 7251 " │ │ ├─ mytable.i:0!null\n" + 7252 " │ │ └─ othertable.i2:3!null\n" + 7253 " │ └─ Eq\n" + 7254 " │ ├─ SUBSTRING_INDEX(mytable.s, ' ', 1)\n" + 7255 " │ └─ othertable.s2:2!null\n" + 7256 " ├─ ProcessTable\n" + 7257 " │ └─ Table\n" + 7258 " │ ├─ name: mytable\n" + 7259 " │ └─ columns: [i s]\n" + 7260 " └─ Concat\n" + 7261 " ├─ IndexedTableAccess(othertable)\n" + 7262 " │ ├─ index: [othertable.s2]\n" + 7263 " │ ├─ keys: [SUBSTRING_INDEX(mytable.s, ' ', 1)]\n" + 7264 " │ ├─ colSet: (3,4)\n" + 7265 " │ ├─ tableId: 2\n" + 7266 " │ └─ Table\n" + 7267 " │ ├─ name: othertable\n" + 7268 " │ └─ columns: [s2 i2]\n" + 7269 " └─ IndexedTableAccess(othertable)\n" + 7270 " ├─ index: [othertable.i2]\n" + 7271 " ├─ keys: [mytable.i:0!null]\n" + 7272 " ├─ colSet: (3,4)\n" + 7273 " ├─ tableId: 2\n" + 7274 " └─ Table\n" + 7275 " ├─ name: othertable\n" + 7276 " └─ columns: [s2 i2]\n" + 7277 "", 7278 ExpectedEstimates: "Project\n" + 7279 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7280 " └─ LookupJoin (estimated cost=-2.705 rows=3)\n" + 7281 " ├─ ((mytable.i = othertable.i2) OR (SUBSTRING_INDEX(mytable.s, ' ', 1) = othertable.s2))\n" + 7282 " ├─ Table\n" + 7283 " │ ├─ name: mytable\n" + 7284 " │ └─ columns: [i s]\n" + 7285 " └─ Concat\n" + 7286 " ├─ IndexedTableAccess(othertable)\n" + 7287 " │ ├─ index: [othertable.s2]\n" + 7288 " │ ├─ columns: [s2 i2]\n" + 7289 " │ └─ keys: SUBSTRING_INDEX(mytable.s, ' ', 1)\n" + 7290 " └─ IndexedTableAccess(othertable)\n" + 7291 " ├─ index: [othertable.i2]\n" + 7292 " ├─ columns: [s2 i2]\n" + 7293 " └─ keys: mytable.i\n" + 7294 "", 7295 ExpectedAnalysis: "Project\n" + 7296 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7297 " └─ LookupJoin (estimated cost=-2.705 rows=3) (actual rows=5 loops=1)\n" + 7298 " ├─ ((mytable.i = othertable.i2) OR (SUBSTRING_INDEX(mytable.s, ' ', 1) = othertable.s2))\n" + 7299 " ├─ Table\n" + 7300 " │ ├─ name: mytable\n" + 7301 " │ └─ columns: [i s]\n" + 7302 " └─ Concat\n" + 7303 " ├─ IndexedTableAccess(othertable)\n" + 7304 " │ ├─ index: [othertable.s2]\n" + 7305 " │ ├─ columns: [s2 i2]\n" + 7306 " │ └─ keys: SUBSTRING_INDEX(mytable.s, ' ', 1)\n" + 7307 " └─ IndexedTableAccess(othertable)\n" + 7308 " ├─ index: [othertable.i2]\n" + 7309 " ├─ columns: [s2 i2]\n" + 7310 " └─ keys: mytable.i\n" + 7311 "", 7312 }, 7313 { 7314 Query: `SELECT i, i2, s2 FROM mytable INNER JOIN othertable ON i = i2 OR SUBSTRING_INDEX(s, ' ', 1) = s2 OR SUBSTRING_INDEX(s, ' ', 2) = s2`, 7315 ExpectedPlan: "Project\n" + 7316 " ├─ columns: [mytable.i:0!null, othertable.i2:3!null, othertable.s2:2!null]\n" + 7317 " └─ LookupJoin\n" + 7318 " ├─ Or\n" + 7319 " │ ├─ Or\n" + 7320 " │ │ ├─ Eq\n" + 7321 " │ │ │ ├─ mytable.i:0!null\n" + 7322 " │ │ │ └─ othertable.i2:3!null\n" + 7323 " │ │ └─ Eq\n" + 7324 " │ │ ├─ SUBSTRING_INDEX(mytable.s, ' ', 1)\n" + 7325 " │ │ └─ othertable.s2:2!null\n" + 7326 " │ └─ Eq\n" + 7327 " │ ├─ SUBSTRING_INDEX(mytable.s, ' ', 2)\n" + 7328 " │ └─ othertable.s2:2!null\n" + 7329 " ├─ ProcessTable\n" + 7330 " │ └─ Table\n" + 7331 " │ ├─ name: mytable\n" + 7332 " │ └─ columns: [i s]\n" + 7333 " └─ Concat\n" + 7334 " ├─ IndexedTableAccess(othertable)\n" + 7335 " │ ├─ index: [othertable.s2]\n" + 7336 " │ ├─ keys: [SUBSTRING_INDEX(mytable.s, ' ', 2)]\n" + 7337 " │ ├─ colSet: (3,4)\n" + 7338 " │ ├─ tableId: 2\n" + 7339 " │ └─ Table\n" + 7340 " │ ├─ name: othertable\n" + 7341 " │ └─ columns: [s2 i2]\n" + 7342 " └─ Concat\n" + 7343 " ├─ IndexedTableAccess(othertable)\n" + 7344 " │ ├─ index: [othertable.s2]\n" + 7345 " │ ├─ keys: [SUBSTRING_INDEX(mytable.s, ' ', 1)]\n" + 7346 " │ ├─ colSet: (3,4)\n" + 7347 " │ ├─ tableId: 2\n" + 7348 " │ └─ Table\n" + 7349 " │ ├─ name: othertable\n" + 7350 " │ └─ columns: [s2 i2]\n" + 7351 " └─ IndexedTableAccess(othertable)\n" + 7352 " ├─ index: [othertable.i2]\n" + 7353 " ├─ keys: [mytable.i:0!null]\n" + 7354 " ├─ colSet: (3,4)\n" + 7355 " ├─ tableId: 2\n" + 7356 " └─ Table\n" + 7357 " ├─ name: othertable\n" + 7358 " └─ columns: [s2 i2]\n" + 7359 "", 7360 ExpectedEstimates: "Project\n" + 7361 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7362 " └─ LookupJoin (estimated cost=-2.558 rows=3)\n" + 7363 " ├─ (((mytable.i = othertable.i2) OR (SUBSTRING_INDEX(mytable.s, ' ', 1) = othertable.s2)) OR (SUBSTRING_INDEX(mytable.s, ' ', 2) = othertable.s2))\n" + 7364 " ├─ Table\n" + 7365 " │ ├─ name: mytable\n" + 7366 " │ └─ columns: [i s]\n" + 7367 " └─ Concat\n" + 7368 " ├─ IndexedTableAccess(othertable)\n" + 7369 " │ ├─ index: [othertable.s2]\n" + 7370 " │ ├─ columns: [s2 i2]\n" + 7371 " │ └─ keys: SUBSTRING_INDEX(mytable.s, ' ', 2)\n" + 7372 " └─ Concat\n" + 7373 " ├─ IndexedTableAccess(othertable)\n" + 7374 " │ ├─ index: [othertable.s2]\n" + 7375 " │ ├─ columns: [s2 i2]\n" + 7376 " │ └─ keys: SUBSTRING_INDEX(mytable.s, ' ', 1)\n" + 7377 " └─ IndexedTableAccess(othertable)\n" + 7378 " ├─ index: [othertable.i2]\n" + 7379 " ├─ columns: [s2 i2]\n" + 7380 " └─ keys: mytable.i\n" + 7381 "", 7382 ExpectedAnalysis: "Project\n" + 7383 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7384 " └─ LookupJoin (estimated cost=-2.558 rows=3) (actual rows=5 loops=1)\n" + 7385 " ├─ (((mytable.i = othertable.i2) OR (SUBSTRING_INDEX(mytable.s, ' ', 1) = othertable.s2)) OR (SUBSTRING_INDEX(mytable.s, ' ', 2) = othertable.s2))\n" + 7386 " ├─ Table\n" + 7387 " │ ├─ name: mytable\n" + 7388 " │ └─ columns: [i s]\n" + 7389 " └─ Concat\n" + 7390 " ├─ IndexedTableAccess(othertable)\n" + 7391 " │ ├─ index: [othertable.s2]\n" + 7392 " │ ├─ columns: [s2 i2]\n" + 7393 " │ └─ keys: SUBSTRING_INDEX(mytable.s, ' ', 2)\n" + 7394 " └─ Concat\n" + 7395 " ├─ IndexedTableAccess(othertable)\n" + 7396 " │ ├─ index: [othertable.s2]\n" + 7397 " │ ├─ columns: [s2 i2]\n" + 7398 " │ └─ keys: SUBSTRING_INDEX(mytable.s, ' ', 1)\n" + 7399 " └─ IndexedTableAccess(othertable)\n" + 7400 " ├─ index: [othertable.i2]\n" + 7401 " ├─ columns: [s2 i2]\n" + 7402 " └─ keys: mytable.i\n" + 7403 "", 7404 }, 7405 { 7406 Query: `SELECT i, i2, s2 FROM mytable INNER JOIN othertable ON i = i2 UNION SELECT i, i2, s2 FROM mytable INNER JOIN othertable ON i = i2`, 7407 ExpectedPlan: "Union distinct\n" + 7408 " ├─ Project\n" + 7409 " │ ├─ columns: [mytable.i:0!null, othertable.i2:2!null, othertable.s2:1!null]\n" + 7410 " │ └─ MergeJoin\n" + 7411 " │ ├─ cmp: Eq\n" + 7412 " │ │ ├─ mytable.i:0!null\n" + 7413 " │ │ └─ othertable.i2:2!null\n" + 7414 " │ ├─ IndexedTableAccess(mytable)\n" + 7415 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 7416 " │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 7417 " │ │ ├─ colSet: (1,2)\n" + 7418 " │ │ ├─ tableId: 1\n" + 7419 " │ │ └─ Table\n" + 7420 " │ │ ├─ name: mytable\n" + 7421 " │ │ └─ columns: [i]\n" + 7422 " │ └─ IndexedTableAccess(othertable)\n" + 7423 " │ ├─ index: [othertable.i2]\n" + 7424 " │ ├─ static: [{[NULL, ∞)}]\n" + 7425 " │ ├─ colSet: (3,4)\n" + 7426 " │ ├─ tableId: 2\n" + 7427 " │ └─ Table\n" + 7428 " │ ├─ name: othertable\n" + 7429 " │ └─ columns: [s2 i2]\n" + 7430 " └─ Project\n" + 7431 " ├─ columns: [mytable.i:0!null, othertable.i2:2!null, othertable.s2:1!null]\n" + 7432 " └─ MergeJoin\n" + 7433 " ├─ cmp: Eq\n" + 7434 " │ ├─ mytable.i:0!null\n" + 7435 " │ └─ othertable.i2:2!null\n" + 7436 " ├─ IndexedTableAccess(mytable)\n" + 7437 " │ ├─ index: [mytable.i,mytable.s]\n" + 7438 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 7439 " │ ├─ colSet: (5,6)\n" + 7440 " │ ├─ tableId: 3\n" + 7441 " │ └─ Table\n" + 7442 " │ ├─ name: mytable\n" + 7443 " │ └─ columns: [i]\n" + 7444 " └─ IndexedTableAccess(othertable)\n" + 7445 " ├─ index: [othertable.i2]\n" + 7446 " ├─ static: [{[NULL, ∞)}]\n" + 7447 " ├─ colSet: (7,8)\n" + 7448 " ├─ tableId: 4\n" + 7449 " └─ Table\n" + 7450 " ├─ name: othertable\n" + 7451 " └─ columns: [s2 i2]\n" + 7452 "", 7453 ExpectedEstimates: "Union distinct\n" + 7454 " ├─ Project\n" + 7455 " │ ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7456 " │ └─ MergeJoin\n" + 7457 " │ ├─ cmp: (mytable.i = othertable.i2)\n" + 7458 " │ ├─ IndexedTableAccess(mytable)\n" + 7459 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 7460 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 7461 " │ │ └─ columns: [i]\n" + 7462 " │ └─ IndexedTableAccess(othertable)\n" + 7463 " │ ├─ index: [othertable.i2]\n" + 7464 " │ ├─ filters: [{[NULL, ∞)}]\n" + 7465 " │ └─ columns: [s2 i2]\n" + 7466 " └─ Project\n" + 7467 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7468 " └─ MergeJoin\n" + 7469 " ├─ cmp: (mytable.i = othertable.i2)\n" + 7470 " ├─ IndexedTableAccess(mytable)\n" + 7471 " │ ├─ index: [mytable.i,mytable.s]\n" + 7472 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 7473 " │ └─ columns: [i]\n" + 7474 " └─ IndexedTableAccess(othertable)\n" + 7475 " ├─ index: [othertable.i2]\n" + 7476 " ├─ filters: [{[NULL, ∞)}]\n" + 7477 " └─ columns: [s2 i2]\n" + 7478 "", 7479 ExpectedAnalysis: "Union distinct\n" + 7480 " ├─ Project\n" + 7481 " │ ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7482 " │ └─ MergeJoin\n" + 7483 " │ ├─ cmp: (mytable.i = othertable.i2)\n" + 7484 " │ ├─ IndexedTableAccess(mytable)\n" + 7485 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 7486 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 7487 " │ │ └─ columns: [i]\n" + 7488 " │ └─ IndexedTableAccess(othertable)\n" + 7489 " │ ├─ index: [othertable.i2]\n" + 7490 " │ ├─ filters: [{[NULL, ∞)}]\n" + 7491 " │ └─ columns: [s2 i2]\n" + 7492 " └─ Project\n" + 7493 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7494 " └─ MergeJoin\n" + 7495 " ├─ cmp: (mytable.i = othertable.i2)\n" + 7496 " ├─ IndexedTableAccess(mytable)\n" + 7497 " │ ├─ index: [mytable.i,mytable.s]\n" + 7498 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 7499 " │ └─ columns: [i]\n" + 7500 " └─ IndexedTableAccess(othertable)\n" + 7501 " ├─ index: [othertable.i2]\n" + 7502 " ├─ filters: [{[NULL, ∞)}]\n" + 7503 " └─ columns: [s2 i2]\n" + 7504 "", 7505 }, 7506 { 7507 Query: `SELECT sub.i, sub.i2, sub.s2, ot.i2, ot.s2 FROM (SELECT i, i2, s2 FROM mytable INNER JOIN othertable ON i = i2) sub INNER JOIN othertable ot ON sub.i = ot.i2`, 7508 ExpectedPlan: "Project\n" + 7509 " ├─ columns: [sub.i:0!null, sub.i2:1!null, sub.s2:2!null, ot.i2:4!null, ot.s2:3!null]\n" + 7510 " └─ HashJoin\n" + 7511 " ├─ Eq\n" + 7512 " │ ├─ sub.i:0!null\n" + 7513 " │ └─ ot.i2:4!null\n" + 7514 " ├─ SubqueryAlias\n" + 7515 " │ ├─ name: sub\n" + 7516 " │ ├─ outerVisibility: false\n" + 7517 " │ ├─ isLateral: false\n" + 7518 " │ ├─ cacheable: true\n" + 7519 " │ ├─ colSet: (5-7)\n" + 7520 " │ ├─ tableId: 3\n" + 7521 " │ └─ Project\n" + 7522 " │ ├─ columns: [mytable.i:0!null, othertable.i2:2!null, othertable.s2:1!null]\n" + 7523 " │ └─ MergeJoin\n" + 7524 " │ ├─ cmp: Eq\n" + 7525 " │ │ ├─ mytable.i:0!null\n" + 7526 " │ │ └─ othertable.i2:2!null\n" + 7527 " │ ├─ IndexedTableAccess(mytable)\n" + 7528 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 7529 " │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 7530 " │ │ ├─ colSet: (1,2)\n" + 7531 " │ │ ├─ tableId: 1\n" + 7532 " │ │ └─ Table\n" + 7533 " │ │ ├─ name: mytable\n" + 7534 " │ │ └─ columns: [i]\n" + 7535 " │ └─ IndexedTableAccess(othertable)\n" + 7536 " │ ├─ index: [othertable.i2]\n" + 7537 " │ ├─ static: [{[NULL, ∞)}]\n" + 7538 " │ ├─ colSet: (3,4)\n" + 7539 " │ ├─ tableId: 2\n" + 7540 " │ └─ Table\n" + 7541 " │ ├─ name: othertable\n" + 7542 " │ └─ columns: [s2 i2]\n" + 7543 " └─ HashLookup\n" + 7544 " ├─ left-key: TUPLE(sub.i:0!null)\n" + 7545 " ├─ right-key: TUPLE(ot.i2:1!null)\n" + 7546 " └─ TableAlias(ot)\n" + 7547 " └─ ProcessTable\n" + 7548 " └─ Table\n" + 7549 " ├─ name: othertable\n" + 7550 " └─ columns: [s2 i2]\n" + 7551 "", 7552 ExpectedEstimates: "Project\n" + 7553 " ├─ columns: [sub.i, sub.i2, sub.s2, ot.i2, ot.s2]\n" + 7554 " └─ HashJoin (estimated cost=111.000 rows=100)\n" + 7555 " ├─ (sub.i = ot.i2)\n" + 7556 " ├─ SubqueryAlias\n" + 7557 " │ ├─ name: sub\n" + 7558 " │ ├─ outerVisibility: false\n" + 7559 " │ ├─ isLateral: false\n" + 7560 " │ ├─ cacheable: true\n" + 7561 " │ └─ Project\n" + 7562 " │ ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7563 " │ └─ MergeJoin\n" + 7564 " │ ├─ cmp: (mytable.i = othertable.i2)\n" + 7565 " │ ├─ IndexedTableAccess(mytable)\n" + 7566 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 7567 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 7568 " │ │ └─ columns: [i]\n" + 7569 " │ └─ IndexedTableAccess(othertable)\n" + 7570 " │ ├─ index: [othertable.i2]\n" + 7571 " │ ├─ filters: [{[NULL, ∞)}]\n" + 7572 " │ └─ columns: [s2 i2]\n" + 7573 " └─ HashLookup\n" + 7574 " ├─ left-key: (sub.i)\n" + 7575 " ├─ right-key: (ot.i2)\n" + 7576 " └─ TableAlias(ot)\n" + 7577 " └─ Table\n" + 7578 " ├─ name: othertable\n" + 7579 " └─ columns: [s2 i2]\n" + 7580 "", 7581 ExpectedAnalysis: "Project\n" + 7582 " ├─ columns: [sub.i, sub.i2, sub.s2, ot.i2, ot.s2]\n" + 7583 " └─ HashJoin (estimated cost=111.000 rows=100) (actual rows=3 loops=1)\n" + 7584 " ├─ (sub.i = ot.i2)\n" + 7585 " ├─ SubqueryAlias\n" + 7586 " │ ├─ name: sub\n" + 7587 " │ ├─ outerVisibility: false\n" + 7588 " │ ├─ isLateral: false\n" + 7589 " │ ├─ cacheable: true\n" + 7590 " │ └─ Project\n" + 7591 " │ ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7592 " │ └─ MergeJoin\n" + 7593 " │ ├─ cmp: (mytable.i = othertable.i2)\n" + 7594 " │ ├─ IndexedTableAccess(mytable)\n" + 7595 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 7596 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 7597 " │ │ └─ columns: [i]\n" + 7598 " │ └─ IndexedTableAccess(othertable)\n" + 7599 " │ ├─ index: [othertable.i2]\n" + 7600 " │ ├─ filters: [{[NULL, ∞)}]\n" + 7601 " │ └─ columns: [s2 i2]\n" + 7602 " └─ HashLookup\n" + 7603 " ├─ left-key: (sub.i)\n" + 7604 " ├─ right-key: (ot.i2)\n" + 7605 " └─ TableAlias(ot)\n" + 7606 " └─ Table\n" + 7607 " ├─ name: othertable\n" + 7608 " └─ columns: [s2 i2]\n" + 7609 "", 7610 }, 7611 { 7612 Query: `SELECT sub.i, sub.i2, sub.s2, ot.i2, ot.s2 FROM othertable ot INNER JOIN (SELECT i, i2, s2 FROM mytable INNER JOIN othertable ON i = i2) sub ON sub.i = ot.i2`, 7613 ExpectedPlan: "Project\n" + 7614 " ├─ columns: [sub.i:0!null, sub.i2:1!null, sub.s2:2!null, ot.i2:4!null, ot.s2:3!null]\n" + 7615 " └─ HashJoin\n" + 7616 " ├─ Eq\n" + 7617 " │ ├─ sub.i:0!null\n" + 7618 " │ └─ ot.i2:4!null\n" + 7619 " ├─ SubqueryAlias\n" + 7620 " │ ├─ name: sub\n" + 7621 " │ ├─ outerVisibility: false\n" + 7622 " │ ├─ isLateral: false\n" + 7623 " │ ├─ cacheable: true\n" + 7624 " │ ├─ colSet: (7-9)\n" + 7625 " │ ├─ tableId: 4\n" + 7626 " │ └─ Project\n" + 7627 " │ ├─ columns: [mytable.i:0!null, othertable.i2:2!null, othertable.s2:1!null]\n" + 7628 " │ └─ MergeJoin\n" + 7629 " │ ├─ cmp: Eq\n" + 7630 " │ │ ├─ mytable.i:0!null\n" + 7631 " │ │ └─ othertable.i2:2!null\n" + 7632 " │ ├─ IndexedTableAccess(mytable)\n" + 7633 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 7634 " │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 7635 " │ │ ├─ colSet: (3,4)\n" + 7636 " │ │ ├─ tableId: 2\n" + 7637 " │ │ └─ Table\n" + 7638 " │ │ ├─ name: mytable\n" + 7639 " │ │ └─ columns: [i]\n" + 7640 " │ └─ IndexedTableAccess(othertable)\n" + 7641 " │ ├─ index: [othertable.i2]\n" + 7642 " │ ├─ static: [{[NULL, ∞)}]\n" + 7643 " │ ├─ colSet: (5,6)\n" + 7644 " │ ├─ tableId: 3\n" + 7645 " │ └─ Table\n" + 7646 " │ ├─ name: othertable\n" + 7647 " │ └─ columns: [s2 i2]\n" + 7648 " └─ HashLookup\n" + 7649 " ├─ left-key: TUPLE(sub.i:0!null)\n" + 7650 " ├─ right-key: TUPLE(ot.i2:1!null)\n" + 7651 " └─ TableAlias(ot)\n" + 7652 " └─ ProcessTable\n" + 7653 " └─ Table\n" + 7654 " ├─ name: othertable\n" + 7655 " └─ columns: [s2 i2]\n" + 7656 "", 7657 ExpectedEstimates: "Project\n" + 7658 " ├─ columns: [sub.i, sub.i2, sub.s2, ot.i2, ot.s2]\n" + 7659 " └─ HashJoin (estimated cost=111.000 rows=100)\n" + 7660 " ├─ (sub.i = ot.i2)\n" + 7661 " ├─ SubqueryAlias\n" + 7662 " │ ├─ name: sub\n" + 7663 " │ ├─ outerVisibility: false\n" + 7664 " │ ├─ isLateral: false\n" + 7665 " │ ├─ cacheable: true\n" + 7666 " │ └─ Project\n" + 7667 " │ ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7668 " │ └─ MergeJoin\n" + 7669 " │ ├─ cmp: (mytable.i = othertable.i2)\n" + 7670 " │ ├─ IndexedTableAccess(mytable)\n" + 7671 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 7672 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 7673 " │ │ └─ columns: [i]\n" + 7674 " │ └─ IndexedTableAccess(othertable)\n" + 7675 " │ ├─ index: [othertable.i2]\n" + 7676 " │ ├─ filters: [{[NULL, ∞)}]\n" + 7677 " │ └─ columns: [s2 i2]\n" + 7678 " └─ HashLookup\n" + 7679 " ├─ left-key: (sub.i)\n" + 7680 " ├─ right-key: (ot.i2)\n" + 7681 " └─ TableAlias(ot)\n" + 7682 " └─ Table\n" + 7683 " ├─ name: othertable\n" + 7684 " └─ columns: [s2 i2]\n" + 7685 "", 7686 ExpectedAnalysis: "Project\n" + 7687 " ├─ columns: [sub.i, sub.i2, sub.s2, ot.i2, ot.s2]\n" + 7688 " └─ HashJoin (estimated cost=111.000 rows=100) (actual rows=3 loops=1)\n" + 7689 " ├─ (sub.i = ot.i2)\n" + 7690 " ├─ SubqueryAlias\n" + 7691 " │ ├─ name: sub\n" + 7692 " │ ├─ outerVisibility: false\n" + 7693 " │ ├─ isLateral: false\n" + 7694 " │ ├─ cacheable: true\n" + 7695 " │ └─ Project\n" + 7696 " │ ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7697 " │ └─ MergeJoin\n" + 7698 " │ ├─ cmp: (mytable.i = othertable.i2)\n" + 7699 " │ ├─ IndexedTableAccess(mytable)\n" + 7700 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 7701 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 7702 " │ │ └─ columns: [i]\n" + 7703 " │ └─ IndexedTableAccess(othertable)\n" + 7704 " │ ├─ index: [othertable.i2]\n" + 7705 " │ ├─ filters: [{[NULL, ∞)}]\n" + 7706 " │ └─ columns: [s2 i2]\n" + 7707 " └─ HashLookup\n" + 7708 " ├─ left-key: (sub.i)\n" + 7709 " ├─ right-key: (ot.i2)\n" + 7710 " └─ TableAlias(ot)\n" + 7711 " └─ Table\n" + 7712 " ├─ name: othertable\n" + 7713 " └─ columns: [s2 i2]\n" + 7714 "", 7715 }, 7716 { 7717 Query: `SELECT sub.i, sub.i2, sub.s2, ot.i2, ot.s2 FROM othertable ot LEFT JOIN (SELECT i, i2, s2 FROM mytable INNER JOIN othertable ON i = i2 WHERE CONVERT(s2, signed) <> 0) sub ON sub.i = ot.i2 WHERE ot.i2 > 0`, 7718 ExpectedPlan: "Project\n" + 7719 " ├─ columns: [sub.i:2!null, sub.i2:3!null, sub.s2:4!null, ot.i2:1!null, ot.s2:0!null]\n" + 7720 " └─ LeftOuterJoin\n" + 7721 " ├─ Eq\n" + 7722 " │ ├─ sub.i:2!null\n" + 7723 " │ └─ ot.i2:1!null\n" + 7724 " ├─ TableAlias(ot)\n" + 7725 " │ └─ IndexedTableAccess(othertable)\n" + 7726 " │ ├─ index: [othertable.i2]\n" + 7727 " │ ├─ static: [{(0, ∞)}]\n" + 7728 " │ ├─ colSet: (1,2)\n" + 7729 " │ ├─ tableId: 1\n" + 7730 " │ └─ Table\n" + 7731 " │ ├─ name: othertable\n" + 7732 " │ └─ columns: [s2 i2]\n" + 7733 " └─ SubqueryAlias\n" + 7734 " ├─ name: sub\n" + 7735 " ├─ outerVisibility: false\n" + 7736 " ├─ isLateral: false\n" + 7737 " ├─ cacheable: true\n" + 7738 " ├─ colSet: (7-9)\n" + 7739 " ├─ tableId: 4\n" + 7740 " └─ Project\n" + 7741 " ├─ columns: [mytable.i:0!null, othertable.i2:2!null, othertable.s2:1!null]\n" + 7742 " └─ MergeJoin\n" + 7743 " ├─ cmp: Eq\n" + 7744 " │ ├─ mytable.i:0!null\n" + 7745 " │ └─ othertable.i2:2!null\n" + 7746 " ├─ IndexedTableAccess(mytable)\n" + 7747 " │ ├─ index: [mytable.i,mytable.s]\n" + 7748 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 7749 " │ ├─ colSet: (3,4)\n" + 7750 " │ ├─ tableId: 2\n" + 7751 " │ └─ Table\n" + 7752 " │ ├─ name: mytable\n" + 7753 " │ └─ columns: [i]\n" + 7754 " └─ Filter\n" + 7755 " ├─ NOT\n" + 7756 " │ └─ Eq\n" + 7757 " │ ├─ convert\n" + 7758 " │ │ ├─ type: signed\n" + 7759 " │ │ └─ othertable.s2:0!null\n" + 7760 " │ └─ 0 (tinyint)\n" + 7761 " └─ IndexedTableAccess(othertable)\n" + 7762 " ├─ index: [othertable.i2]\n" + 7763 " ├─ static: [{[NULL, ∞)}]\n" + 7764 " ├─ colSet: (5,6)\n" + 7765 " ├─ tableId: 3\n" + 7766 " └─ Table\n" + 7767 " ├─ name: othertable\n" + 7768 " └─ columns: [s2 i2]\n" + 7769 "", 7770 ExpectedEstimates: "Project\n" + 7771 " ├─ columns: [sub.i, sub.i2, sub.s2, ot.i2, ot.s2]\n" + 7772 " └─ LeftOuterJoin (estimated cost=100.000 rows=100)\n" + 7773 " ├─ (sub.i = ot.i2)\n" + 7774 " ├─ TableAlias(ot)\n" + 7775 " │ └─ IndexedTableAccess(othertable)\n" + 7776 " │ ├─ index: [othertable.i2]\n" + 7777 " │ ├─ filters: [{(0, ∞)}]\n" + 7778 " │ └─ columns: [s2 i2]\n" + 7779 " └─ SubqueryAlias\n" + 7780 " ├─ name: sub\n" + 7781 " ├─ outerVisibility: false\n" + 7782 " ├─ isLateral: false\n" + 7783 " ├─ cacheable: true\n" + 7784 " └─ Project\n" + 7785 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7786 " └─ MergeJoin\n" + 7787 " ├─ cmp: (mytable.i = othertable.i2)\n" + 7788 " ├─ IndexedTableAccess(mytable)\n" + 7789 " │ ├─ index: [mytable.i,mytable.s]\n" + 7790 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 7791 " │ └─ columns: [i]\n" + 7792 " └─ Filter\n" + 7793 " ├─ (NOT((convert(othertable.s2, signed) = 0)))\n" + 7794 " └─ IndexedTableAccess(othertable)\n" + 7795 " ├─ index: [othertable.i2]\n" + 7796 " ├─ filters: [{[NULL, ∞)}]\n" + 7797 " └─ columns: [s2 i2]\n" + 7798 "", 7799 ExpectedAnalysis: "Project\n" + 7800 " ├─ columns: [sub.i, sub.i2, sub.s2, ot.i2, ot.s2]\n" + 7801 " └─ LeftOuterJoin (estimated cost=100.000 rows=100) (actual rows=3 loops=1)\n" + 7802 " ├─ (sub.i = ot.i2)\n" + 7803 " ├─ TableAlias(ot)\n" + 7804 " │ └─ IndexedTableAccess(othertable)\n" + 7805 " │ ├─ index: [othertable.i2]\n" + 7806 " │ ├─ filters: [{(0, ∞)}]\n" + 7807 " │ └─ columns: [s2 i2]\n" + 7808 " └─ SubqueryAlias\n" + 7809 " ├─ name: sub\n" + 7810 " ├─ outerVisibility: false\n" + 7811 " ├─ isLateral: false\n" + 7812 " ├─ cacheable: true\n" + 7813 " └─ Project\n" + 7814 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 7815 " └─ MergeJoin\n" + 7816 " ├─ cmp: (mytable.i = othertable.i2)\n" + 7817 " ├─ IndexedTableAccess(mytable)\n" + 7818 " │ ├─ index: [mytable.i,mytable.s]\n" + 7819 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 7820 " │ └─ columns: [i]\n" + 7821 " └─ Filter\n" + 7822 " ├─ (NOT((convert(othertable.s2, signed) = 0)))\n" + 7823 " └─ IndexedTableAccess(othertable)\n" + 7824 " ├─ index: [othertable.i2]\n" + 7825 " ├─ filters: [{[NULL, ∞)}]\n" + 7826 " └─ columns: [s2 i2]\n" + 7827 "", 7828 }, 7829 { 7830 Query: `select /*+ JOIN_ORDER( i, k, j ) */ * from one_pk i join one_pk k on i.pk = k.pk join (select pk, rand() r from one_pk) j on i.pk = j.pk`, 7831 ExpectedPlan: "HashJoin\n" + 7832 " ├─ Eq\n" + 7833 " │ ├─ i.pk:0!null\n" + 7834 " │ └─ j.pk:12!null\n" + 7835 " ├─ MergeJoin\n" + 7836 " │ ├─ cmp: Eq\n" + 7837 " │ │ ├─ i.pk:0!null\n" + 7838 " │ │ └─ k.pk:6!null\n" + 7839 " │ ├─ TableAlias(i)\n" + 7840 " │ │ └─ IndexedTableAccess(one_pk)\n" + 7841 " │ │ ├─ index: [one_pk.pk]\n" + 7842 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 7843 " │ │ ├─ colSet: (1-6)\n" + 7844 " │ │ ├─ tableId: 1\n" + 7845 " │ │ └─ Table\n" + 7846 " │ │ ├─ name: one_pk\n" + 7847 " │ │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 7848 " │ └─ TableAlias(k)\n" + 7849 " │ └─ IndexedTableAccess(one_pk)\n" + 7850 " │ ├─ index: [one_pk.pk]\n" + 7851 " │ ├─ static: [{[NULL, ∞)}]\n" + 7852 " │ ├─ colSet: (7-12)\n" + 7853 " │ ├─ tableId: 2\n" + 7854 " │ └─ Table\n" + 7855 " │ ├─ name: one_pk\n" + 7856 " │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 7857 " └─ HashLookup\n" + 7858 " ├─ left-key: TUPLE(i.pk:0!null)\n" + 7859 " ├─ right-key: TUPLE(j.pk:0!null)\n" + 7860 " └─ SubqueryAlias\n" + 7861 " ├─ name: j\n" + 7862 " ├─ outerVisibility: false\n" + 7863 " ├─ isLateral: false\n" + 7864 " ├─ cacheable: false\n" + 7865 " ├─ colSet: (20,21)\n" + 7866 " ├─ tableId: 4\n" + 7867 " └─ Project\n" + 7868 " ├─ columns: [one_pk.pk:0!null, rand() as r]\n" + 7869 " └─ Table\n" + 7870 " ├─ name: one_pk\n" + 7871 " ├─ columns: [pk]\n" + 7872 " ├─ colSet: (13-18)\n" + 7873 " └─ tableId: 3\n" + 7874 "", 7875 ExpectedEstimates: "HashJoin (estimated cost=305.040 rows=100)\n" + 7876 " ├─ (i.pk = j.pk)\n" + 7877 " ├─ MergeJoin (estimated cost=8.120 rows=4)\n" + 7878 " │ ├─ cmp: (i.pk = k.pk)\n" + 7879 " │ ├─ TableAlias(i)\n" + 7880 " │ │ └─ IndexedTableAccess(one_pk)\n" + 7881 " │ │ ├─ index: [one_pk.pk]\n" + 7882 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 7883 " │ │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 7884 " │ └─ TableAlias(k)\n" + 7885 " │ └─ IndexedTableAccess(one_pk)\n" + 7886 " │ ├─ index: [one_pk.pk]\n" + 7887 " │ ├─ filters: [{[NULL, ∞)}]\n" + 7888 " │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 7889 " └─ HashLookup\n" + 7890 " ├─ left-key: (i.pk)\n" + 7891 " ├─ right-key: (j.pk)\n" + 7892 " └─ SubqueryAlias\n" + 7893 " ├─ name: j\n" + 7894 " ├─ outerVisibility: false\n" + 7895 " ├─ isLateral: false\n" + 7896 " ├─ cacheable: false\n" + 7897 " └─ Project\n" + 7898 " ├─ columns: [one_pk.pk, rand() as r]\n" + 7899 " └─ Table\n" + 7900 " ├─ name: one_pk\n" + 7901 " └─ columns: [pk]\n" + 7902 "", 7903 ExpectedAnalysis: "HashJoin (estimated cost=305.040 rows=100) (actual rows=4 loops=1)\n" + 7904 " ├─ (i.pk = j.pk)\n" + 7905 " ├─ MergeJoin (estimated cost=8.120 rows=4) (actual rows=4 loops=1)\n" + 7906 " │ ├─ cmp: (i.pk = k.pk)\n" + 7907 " │ ├─ TableAlias(i)\n" + 7908 " │ │ └─ IndexedTableAccess(one_pk)\n" + 7909 " │ │ ├─ index: [one_pk.pk]\n" + 7910 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 7911 " │ │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 7912 " │ └─ TableAlias(k)\n" + 7913 " │ └─ IndexedTableAccess(one_pk)\n" + 7914 " │ ├─ index: [one_pk.pk]\n" + 7915 " │ ├─ filters: [{[NULL, ∞)}]\n" + 7916 " │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 7917 " └─ HashLookup\n" + 7918 " ├─ left-key: (i.pk)\n" + 7919 " ├─ right-key: (j.pk)\n" + 7920 " └─ SubqueryAlias\n" + 7921 " ├─ name: j\n" + 7922 " ├─ outerVisibility: false\n" + 7923 " ├─ isLateral: false\n" + 7924 " ├─ cacheable: false\n" + 7925 " └─ Project\n" + 7926 " ├─ columns: [one_pk.pk, rand() as r]\n" + 7927 " └─ Table\n" + 7928 " ├─ name: one_pk\n" + 7929 " └─ columns: [pk]\n" + 7930 "", 7931 }, 7932 { 7933 Query: `select /*+ JOIN_ORDER( i, k, j ) */ * from one_pk i join one_pk k on i.pk = k.pk join (select pk, rand() r from one_pk) j on i.pk = j.pk`, 7934 ExpectedPlan: "HashJoin\n" + 7935 " ├─ Eq\n" + 7936 " │ ├─ i.pk:0!null\n" + 7937 " │ └─ j.pk:12!null\n" + 7938 " ├─ MergeJoin\n" + 7939 " │ ├─ cmp: Eq\n" + 7940 " │ │ ├─ i.pk:0!null\n" + 7941 " │ │ └─ k.pk:6!null\n" + 7942 " │ ├─ TableAlias(i)\n" + 7943 " │ │ └─ IndexedTableAccess(one_pk)\n" + 7944 " │ │ ├─ index: [one_pk.pk]\n" + 7945 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 7946 " │ │ ├─ colSet: (1-6)\n" + 7947 " │ │ ├─ tableId: 1\n" + 7948 " │ │ └─ Table\n" + 7949 " │ │ ├─ name: one_pk\n" + 7950 " │ │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 7951 " │ └─ TableAlias(k)\n" + 7952 " │ └─ IndexedTableAccess(one_pk)\n" + 7953 " │ ├─ index: [one_pk.pk]\n" + 7954 " │ ├─ static: [{[NULL, ∞)}]\n" + 7955 " │ ├─ colSet: (7-12)\n" + 7956 " │ ├─ tableId: 2\n" + 7957 " │ └─ Table\n" + 7958 " │ ├─ name: one_pk\n" + 7959 " │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 7960 " └─ HashLookup\n" + 7961 " ├─ left-key: TUPLE(i.pk:0!null)\n" + 7962 " ├─ right-key: TUPLE(j.pk:0!null)\n" + 7963 " └─ SubqueryAlias\n" + 7964 " ├─ name: j\n" + 7965 " ├─ outerVisibility: false\n" + 7966 " ├─ isLateral: false\n" + 7967 " ├─ cacheable: false\n" + 7968 " ├─ colSet: (20,21)\n" + 7969 " ├─ tableId: 4\n" + 7970 " └─ Project\n" + 7971 " ├─ columns: [one_pk.pk:0!null, rand() as r]\n" + 7972 " └─ Table\n" + 7973 " ├─ name: one_pk\n" + 7974 " ├─ columns: [pk]\n" + 7975 " ├─ colSet: (13-18)\n" + 7976 " └─ tableId: 3\n" + 7977 "", 7978 ExpectedEstimates: "HashJoin (estimated cost=305.040 rows=100)\n" + 7979 " ├─ (i.pk = j.pk)\n" + 7980 " ├─ MergeJoin (estimated cost=8.120 rows=4)\n" + 7981 " │ ├─ cmp: (i.pk = k.pk)\n" + 7982 " │ ├─ TableAlias(i)\n" + 7983 " │ │ └─ IndexedTableAccess(one_pk)\n" + 7984 " │ │ ├─ index: [one_pk.pk]\n" + 7985 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 7986 " │ │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 7987 " │ └─ TableAlias(k)\n" + 7988 " │ └─ IndexedTableAccess(one_pk)\n" + 7989 " │ ├─ index: [one_pk.pk]\n" + 7990 " │ ├─ filters: [{[NULL, ∞)}]\n" + 7991 " │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 7992 " └─ HashLookup\n" + 7993 " ├─ left-key: (i.pk)\n" + 7994 " ├─ right-key: (j.pk)\n" + 7995 " └─ SubqueryAlias\n" + 7996 " ├─ name: j\n" + 7997 " ├─ outerVisibility: false\n" + 7998 " ├─ isLateral: false\n" + 7999 " ├─ cacheable: false\n" + 8000 " └─ Project\n" + 8001 " ├─ columns: [one_pk.pk, rand() as r]\n" + 8002 " └─ Table\n" + 8003 " ├─ name: one_pk\n" + 8004 " └─ columns: [pk]\n" + 8005 "", 8006 ExpectedAnalysis: "HashJoin (estimated cost=305.040 rows=100) (actual rows=4 loops=1)\n" + 8007 " ├─ (i.pk = j.pk)\n" + 8008 " ├─ MergeJoin (estimated cost=8.120 rows=4) (actual rows=4 loops=1)\n" + 8009 " │ ├─ cmp: (i.pk = k.pk)\n" + 8010 " │ ├─ TableAlias(i)\n" + 8011 " │ │ └─ IndexedTableAccess(one_pk)\n" + 8012 " │ │ ├─ index: [one_pk.pk]\n" + 8013 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 8014 " │ │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 8015 " │ └─ TableAlias(k)\n" + 8016 " │ └─ IndexedTableAccess(one_pk)\n" + 8017 " │ ├─ index: [one_pk.pk]\n" + 8018 " │ ├─ filters: [{[NULL, ∞)}]\n" + 8019 " │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 8020 " └─ HashLookup\n" + 8021 " ├─ left-key: (i.pk)\n" + 8022 " ├─ right-key: (j.pk)\n" + 8023 " └─ SubqueryAlias\n" + 8024 " ├─ name: j\n" + 8025 " ├─ outerVisibility: false\n" + 8026 " ├─ isLateral: false\n" + 8027 " ├─ cacheable: false\n" + 8028 " └─ Project\n" + 8029 " ├─ columns: [one_pk.pk, rand() as r]\n" + 8030 " └─ Table\n" + 8031 " ├─ name: one_pk\n" + 8032 " └─ columns: [pk]\n" + 8033 "", 8034 }, 8035 { 8036 Query: `INSERT INTO mytable SELECT sub.i + 10, ot.s2 FROM othertable ot INNER JOIN (SELECT i, i2, s2 FROM mytable INNER JOIN othertable ON i = i2) sub ON sub.i = ot.i2`, 8037 ExpectedPlan: "RowUpdateAccumulator\n" + 8038 " └─ Insert(i, s)\n" + 8039 " ├─ InsertDestination\n" + 8040 " │ └─ ProcessTable\n" + 8041 " │ └─ Table\n" + 8042 " │ ├─ name: mytable\n" + 8043 " │ └─ columns: [i s]\n" + 8044 " └─ Project\n" + 8045 " ├─ columns: [i:0!null, s:1!null]\n" + 8046 " └─ Project\n" + 8047 " ├─ columns: [(sub.i:0!null + 10 (tinyint)), ot.s2:3!null]\n" + 8048 " └─ HashJoin\n" + 8049 " ├─ Eq\n" + 8050 " │ ├─ sub.i:0!null\n" + 8051 " │ └─ ot.i2:4!null\n" + 8052 " ├─ SubqueryAlias\n" + 8053 " │ ├─ name: sub\n" + 8054 " │ ├─ outerVisibility: false\n" + 8055 " │ ├─ isLateral: false\n" + 8056 " │ ├─ cacheable: true\n" + 8057 " │ ├─ colSet: (9-11)\n" + 8058 " │ ├─ tableId: 5\n" + 8059 " │ └─ Project\n" + 8060 " │ ├─ columns: [mytable.i:0!null, othertable.i2:2!null, othertable.s2:1!null]\n" + 8061 " │ └─ MergeJoin\n" + 8062 " │ ├─ cmp: Eq\n" + 8063 " │ │ ├─ mytable.i:0!null\n" + 8064 " │ │ └─ othertable.i2:2!null\n" + 8065 " │ ├─ IndexedTableAccess(mytable)\n" + 8066 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 8067 " │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 8068 " │ │ ├─ colSet: (5,6)\n" + 8069 " │ │ ├─ tableId: 3\n" + 8070 " │ │ └─ Table\n" + 8071 " │ │ ├─ name: mytable\n" + 8072 " │ │ └─ columns: [i]\n" + 8073 " │ └─ IndexedTableAccess(othertable)\n" + 8074 " │ ├─ index: [othertable.i2]\n" + 8075 " │ ├─ static: [{[NULL, ∞)}]\n" + 8076 " │ ├─ colSet: (7,8)\n" + 8077 " │ ├─ tableId: 4\n" + 8078 " │ └─ Table\n" + 8079 " │ ├─ name: othertable\n" + 8080 " │ └─ columns: [s2 i2]\n" + 8081 " └─ HashLookup\n" + 8082 " ├─ left-key: TUPLE(sub.i:0!null)\n" + 8083 " ├─ right-key: TUPLE(ot.i2:1!null)\n" + 8084 " └─ TableAlias(ot)\n" + 8085 " └─ ProcessTable\n" + 8086 " └─ Table\n" + 8087 " ├─ name: othertable\n" + 8088 " └─ columns: [s2 i2]\n" + 8089 "", 8090 }, 8091 { 8092 Query: `SELECT mytable.i, selfjoin.i FROM mytable INNER JOIN mytable selfjoin ON mytable.i = selfjoin.i WHERE selfjoin.i IN (SELECT 1 FROM DUAL)`, 8093 ExpectedPlan: "Project\n" + 8094 " ├─ columns: [mytable.i:0!null, selfjoin.i:2!null]\n" + 8095 " └─ SemiJoin\n" + 8096 " ├─ MergeJoin\n" + 8097 " │ ├─ cmp: Eq\n" + 8098 " │ │ ├─ mytable.i:0!null\n" + 8099 " │ │ └─ selfjoin.i:2!null\n" + 8100 " │ ├─ IndexedTableAccess(mytable)\n" + 8101 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 8102 " │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 8103 " │ │ ├─ colSet: (1,2)\n" + 8104 " │ │ ├─ tableId: 1\n" + 8105 " │ │ └─ Table\n" + 8106 " │ │ ├─ name: mytable\n" + 8107 " │ │ └─ columns: [i s]\n" + 8108 " │ └─ Filter\n" + 8109 " │ ├─ Eq\n" + 8110 " │ │ ├─ selfjoin.i:0!null\n" + 8111 " │ │ └─ 1 (tinyint)\n" + 8112 " │ └─ TableAlias(selfjoin)\n" + 8113 " │ └─ IndexedTableAccess(mytable)\n" + 8114 " │ ├─ index: [mytable.i]\n" + 8115 " │ ├─ static: [{[1, 1]}]\n" + 8116 " │ ├─ colSet: (3,4)\n" + 8117 " │ ├─ tableId: 2\n" + 8118 " │ └─ Table\n" + 8119 " │ ├─ name: mytable\n" + 8120 " │ └─ columns: [i s]\n" + 8121 " └─ Project\n" + 8122 " ├─ columns: [1 (tinyint)]\n" + 8123 " └─ ProcessTable\n" + 8124 " └─ Table\n" + 8125 " ├─ name: \n" + 8126 " └─ columns: []\n" + 8127 "", 8128 ExpectedEstimates: "Project\n" + 8129 " ├─ columns: [mytable.i, selfjoin.i]\n" + 8130 " └─ SemiJoin (estimated cost=154.500 rows=3)\n" + 8131 " ├─ MergeJoin (estimated cost=6.090 rows=3)\n" + 8132 " │ ├─ cmp: (mytable.i = selfjoin.i)\n" + 8133 " │ ├─ IndexedTableAccess(mytable)\n" + 8134 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 8135 " │ │ └─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8136 " │ └─ Filter\n" + 8137 " │ ├─ (selfjoin.i = 1)\n" + 8138 " │ └─ TableAlias(selfjoin)\n" + 8139 " │ └─ IndexedTableAccess(mytable)\n" + 8140 " │ ├─ index: [mytable.i]\n" + 8141 " │ └─ filters: [{[1, 1]}]\n" + 8142 " └─ Project\n" + 8143 " ├─ columns: [1]\n" + 8144 " └─ Table\n" + 8145 " └─ name: \n" + 8146 "", 8147 ExpectedAnalysis: "Project\n" + 8148 " ├─ columns: [mytable.i, selfjoin.i]\n" + 8149 " └─ SemiJoin (estimated cost=154.500 rows=3) (actual rows=1 loops=1)\n" + 8150 " ├─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=1 loops=1)\n" + 8151 " │ ├─ cmp: (mytable.i = selfjoin.i)\n" + 8152 " │ ├─ IndexedTableAccess(mytable)\n" + 8153 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 8154 " │ │ └─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8155 " │ └─ Filter\n" + 8156 " │ ├─ (selfjoin.i = 1)\n" + 8157 " │ └─ TableAlias(selfjoin)\n" + 8158 " │ └─ IndexedTableAccess(mytable)\n" + 8159 " │ ├─ index: [mytable.i]\n" + 8160 " │ └─ filters: [{[1, 1]}]\n" + 8161 " └─ Project\n" + 8162 " ├─ columns: [1]\n" + 8163 " └─ Table\n" + 8164 " └─ name: \n" + 8165 "", 8166 }, 8167 { 8168 Query: `SELECT s2, i2, i FROM mytable INNER JOIN othertable ON i = i2`, 8169 ExpectedPlan: "Project\n" + 8170 " ├─ columns: [othertable.s2:1!null, othertable.i2:2!null, mytable.i:0!null]\n" + 8171 " └─ MergeJoin\n" + 8172 " ├─ cmp: Eq\n" + 8173 " │ ├─ mytable.i:0!null\n" + 8174 " │ └─ othertable.i2:2!null\n" + 8175 " ├─ IndexedTableAccess(mytable)\n" + 8176 " │ ├─ index: [mytable.i,mytable.s]\n" + 8177 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 8178 " │ ├─ colSet: (1,2)\n" + 8179 " │ ├─ tableId: 1\n" + 8180 " │ └─ Table\n" + 8181 " │ ├─ name: mytable\n" + 8182 " │ └─ columns: [i]\n" + 8183 " └─ IndexedTableAccess(othertable)\n" + 8184 " ├─ index: [othertable.i2]\n" + 8185 " ├─ static: [{[NULL, ∞)}]\n" + 8186 " ├─ colSet: (3,4)\n" + 8187 " ├─ tableId: 2\n" + 8188 " └─ Table\n" + 8189 " ├─ name: othertable\n" + 8190 " └─ columns: [s2 i2]\n" + 8191 "", 8192 ExpectedEstimates: "Project\n" + 8193 " ├─ columns: [othertable.s2, othertable.i2, mytable.i]\n" + 8194 " └─ MergeJoin (estimated cost=6.090 rows=3)\n" + 8195 " ├─ cmp: (mytable.i = othertable.i2)\n" + 8196 " ├─ IndexedTableAccess(mytable)\n" + 8197 " │ ├─ index: [mytable.i,mytable.s]\n" + 8198 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8199 " │ └─ columns: [i]\n" + 8200 " └─ IndexedTableAccess(othertable)\n" + 8201 " ├─ index: [othertable.i2]\n" + 8202 " ├─ filters: [{[NULL, ∞)}]\n" + 8203 " └─ columns: [s2 i2]\n" + 8204 "", 8205 ExpectedAnalysis: "Project\n" + 8206 " ├─ columns: [othertable.s2, othertable.i2, mytable.i]\n" + 8207 " └─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=1)\n" + 8208 " ├─ cmp: (mytable.i = othertable.i2)\n" + 8209 " ├─ IndexedTableAccess(mytable)\n" + 8210 " │ ├─ index: [mytable.i,mytable.s]\n" + 8211 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8212 " │ └─ columns: [i]\n" + 8213 " └─ IndexedTableAccess(othertable)\n" + 8214 " ├─ index: [othertable.i2]\n" + 8215 " ├─ filters: [{[NULL, ∞)}]\n" + 8216 " └─ columns: [s2 i2]\n" + 8217 "", 8218 }, 8219 { 8220 Query: `SELECT i, i2, s2 FROM othertable JOIN mytable ON i = i2`, 8221 ExpectedPlan: "Project\n" + 8222 " ├─ columns: [mytable.i:2!null, othertable.i2:1!null, othertable.s2:0!null]\n" + 8223 " └─ MergeJoin\n" + 8224 " ├─ cmp: Eq\n" + 8225 " │ ├─ othertable.i2:1!null\n" + 8226 " │ └─ mytable.i:2!null\n" + 8227 " ├─ IndexedTableAccess(othertable)\n" + 8228 " │ ├─ index: [othertable.i2]\n" + 8229 " │ ├─ static: [{[NULL, ∞)}]\n" + 8230 " │ ├─ colSet: (1,2)\n" + 8231 " │ ├─ tableId: 1\n" + 8232 " │ └─ Table\n" + 8233 " │ ├─ name: othertable\n" + 8234 " │ └─ columns: [s2 i2]\n" + 8235 " └─ IndexedTableAccess(mytable)\n" + 8236 " ├─ index: [mytable.i,mytable.s]\n" + 8237 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 8238 " ├─ colSet: (3,4)\n" + 8239 " ├─ tableId: 2\n" + 8240 " └─ Table\n" + 8241 " ├─ name: mytable\n" + 8242 " └─ columns: [i]\n" + 8243 "", 8244 ExpectedEstimates: "Project\n" + 8245 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 8246 " └─ MergeJoin (estimated cost=6.090 rows=3)\n" + 8247 " ├─ cmp: (othertable.i2 = mytable.i)\n" + 8248 " ├─ IndexedTableAccess(othertable)\n" + 8249 " │ ├─ index: [othertable.i2]\n" + 8250 " │ ├─ filters: [{[NULL, ∞)}]\n" + 8251 " │ └─ columns: [s2 i2]\n" + 8252 " └─ IndexedTableAccess(mytable)\n" + 8253 " ├─ index: [mytable.i,mytable.s]\n" + 8254 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8255 " └─ columns: [i]\n" + 8256 "", 8257 ExpectedAnalysis: "Project\n" + 8258 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 8259 " └─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=1)\n" + 8260 " ├─ cmp: (othertable.i2 = mytable.i)\n" + 8261 " ├─ IndexedTableAccess(othertable)\n" + 8262 " │ ├─ index: [othertable.i2]\n" + 8263 " │ ├─ filters: [{[NULL, ∞)}]\n" + 8264 " │ └─ columns: [s2 i2]\n" + 8265 " └─ IndexedTableAccess(mytable)\n" + 8266 " ├─ index: [mytable.i,mytable.s]\n" + 8267 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8268 " └─ columns: [i]\n" + 8269 "", 8270 }, 8271 { 8272 Query: `SELECT s2, i2, i FROM othertable JOIN mytable ON i = i2`, 8273 ExpectedPlan: "MergeJoin\n" + 8274 " ├─ cmp: Eq\n" + 8275 " │ ├─ othertable.i2:1!null\n" + 8276 " │ └─ mytable.i:2!null\n" + 8277 " ├─ IndexedTableAccess(othertable)\n" + 8278 " │ ├─ index: [othertable.i2]\n" + 8279 " │ ├─ static: [{[NULL, ∞)}]\n" + 8280 " │ ├─ colSet: (1,2)\n" + 8281 " │ ├─ tableId: 1\n" + 8282 " │ └─ Table\n" + 8283 " │ ├─ name: othertable\n" + 8284 " │ └─ columns: [s2 i2]\n" + 8285 " └─ IndexedTableAccess(mytable)\n" + 8286 " ├─ index: [mytable.i,mytable.s]\n" + 8287 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 8288 " ├─ colSet: (3,4)\n" + 8289 " ├─ tableId: 2\n" + 8290 " └─ Table\n" + 8291 " ├─ name: mytable\n" + 8292 " └─ columns: [i]\n" + 8293 "", 8294 ExpectedEstimates: "MergeJoin (estimated cost=6.090 rows=3)\n" + 8295 " ├─ cmp: (othertable.i2 = mytable.i)\n" + 8296 " ├─ IndexedTableAccess(othertable)\n" + 8297 " │ ├─ index: [othertable.i2]\n" + 8298 " │ ├─ filters: [{[NULL, ∞)}]\n" + 8299 " │ └─ columns: [s2 i2]\n" + 8300 " └─ IndexedTableAccess(mytable)\n" + 8301 " ├─ index: [mytable.i,mytable.s]\n" + 8302 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8303 " └─ columns: [i]\n" + 8304 "", 8305 ExpectedAnalysis: "MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=1)\n" + 8306 " ├─ cmp: (othertable.i2 = mytable.i)\n" + 8307 " ├─ IndexedTableAccess(othertable)\n" + 8308 " │ ├─ index: [othertable.i2]\n" + 8309 " │ ├─ filters: [{[NULL, ∞)}]\n" + 8310 " │ └─ columns: [s2 i2]\n" + 8311 " └─ IndexedTableAccess(mytable)\n" + 8312 " ├─ index: [mytable.i,mytable.s]\n" + 8313 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8314 " └─ columns: [i]\n" + 8315 "", 8316 }, 8317 { 8318 Query: `SELECT s2, i2, i FROM othertable JOIN mytable ON i = i2`, 8319 ExpectedPlan: "MergeJoin\n" + 8320 " ├─ cmp: Eq\n" + 8321 " │ ├─ othertable.i2:1!null\n" + 8322 " │ └─ mytable.i:2!null\n" + 8323 " ├─ IndexedTableAccess(othertable)\n" + 8324 " │ ├─ index: [othertable.i2]\n" + 8325 " │ ├─ static: [{[NULL, ∞)}]\n" + 8326 " │ ├─ colSet: (1,2)\n" + 8327 " │ ├─ tableId: 1\n" + 8328 " │ └─ Table\n" + 8329 " │ ├─ name: othertable\n" + 8330 " │ └─ columns: [s2 i2]\n" + 8331 " └─ IndexedTableAccess(mytable)\n" + 8332 " ├─ index: [mytable.i,mytable.s]\n" + 8333 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 8334 " ├─ colSet: (3,4)\n" + 8335 " ├─ tableId: 2\n" + 8336 " └─ Table\n" + 8337 " ├─ name: mytable\n" + 8338 " └─ columns: [i]\n" + 8339 "", 8340 ExpectedEstimates: "MergeJoin (estimated cost=6.090 rows=3)\n" + 8341 " ├─ cmp: (othertable.i2 = mytable.i)\n" + 8342 " ├─ IndexedTableAccess(othertable)\n" + 8343 " │ ├─ index: [othertable.i2]\n" + 8344 " │ ├─ filters: [{[NULL, ∞)}]\n" + 8345 " │ └─ columns: [s2 i2]\n" + 8346 " └─ IndexedTableAccess(mytable)\n" + 8347 " ├─ index: [mytable.i,mytable.s]\n" + 8348 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8349 " └─ columns: [i]\n" + 8350 "", 8351 ExpectedAnalysis: "MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=1)\n" + 8352 " ├─ cmp: (othertable.i2 = mytable.i)\n" + 8353 " ├─ IndexedTableAccess(othertable)\n" + 8354 " │ ├─ index: [othertable.i2]\n" + 8355 " │ ├─ filters: [{[NULL, ∞)}]\n" + 8356 " │ └─ columns: [s2 i2]\n" + 8357 " └─ IndexedTableAccess(mytable)\n" + 8358 " ├─ index: [mytable.i,mytable.s]\n" + 8359 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8360 " └─ columns: [i]\n" + 8361 "", 8362 }, 8363 { 8364 Query: `SELECT s2, i2, i FROM othertable JOIN mytable ON i = i2 LIMIT 1`, 8365 ExpectedPlan: "Limit(1)\n" + 8366 " └─ MergeJoin\n" + 8367 " ├─ cmp: Eq\n" + 8368 " │ ├─ othertable.i2:1!null\n" + 8369 " │ └─ mytable.i:2!null\n" + 8370 " ├─ IndexedTableAccess(othertable)\n" + 8371 " │ ├─ index: [othertable.i2]\n" + 8372 " │ ├─ static: [{[NULL, ∞)}]\n" + 8373 " │ ├─ colSet: (1,2)\n" + 8374 " │ ├─ tableId: 1\n" + 8375 " │ └─ Table\n" + 8376 " │ ├─ name: othertable\n" + 8377 " │ └─ columns: [s2 i2]\n" + 8378 " └─ IndexedTableAccess(mytable)\n" + 8379 " ├─ index: [mytable.i,mytable.s]\n" + 8380 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 8381 " ├─ colSet: (3,4)\n" + 8382 " ├─ tableId: 2\n" + 8383 " └─ Table\n" + 8384 " ├─ name: mytable\n" + 8385 " └─ columns: [i]\n" + 8386 "", 8387 ExpectedEstimates: "Limit(1)\n" + 8388 " └─ MergeJoin\n" + 8389 " ├─ cmp: (othertable.i2 = mytable.i)\n" + 8390 " ├─ IndexedTableAccess(othertable)\n" + 8391 " │ ├─ index: [othertable.i2]\n" + 8392 " │ ├─ filters: [{[NULL, ∞)}]\n" + 8393 " │ └─ columns: [s2 i2]\n" + 8394 " └─ IndexedTableAccess(mytable)\n" + 8395 " ├─ index: [mytable.i,mytable.s]\n" + 8396 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8397 " └─ columns: [i]\n" + 8398 "", 8399 ExpectedAnalysis: "Limit(1)\n" + 8400 " └─ MergeJoin\n" + 8401 " ├─ cmp: (othertable.i2 = mytable.i)\n" + 8402 " ├─ IndexedTableAccess(othertable)\n" + 8403 " │ ├─ index: [othertable.i2]\n" + 8404 " │ ├─ filters: [{[NULL, ∞)}]\n" + 8405 " │ └─ columns: [s2 i2]\n" + 8406 " └─ IndexedTableAccess(mytable)\n" + 8407 " ├─ index: [mytable.i,mytable.s]\n" + 8408 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8409 " └─ columns: [i]\n" + 8410 "", 8411 }, 8412 { 8413 Query: `SELECT i, i2, s2 FROM mytable INNER JOIN othertable ON i2 = i`, 8414 ExpectedPlan: "Project\n" + 8415 " ├─ columns: [mytable.i:0!null, othertable.i2:2!null, othertable.s2:1!null]\n" + 8416 " └─ MergeJoin\n" + 8417 " ├─ cmp: Eq\n" + 8418 " │ ├─ mytable.i:0!null\n" + 8419 " │ └─ othertable.i2:2!null\n" + 8420 " ├─ IndexedTableAccess(mytable)\n" + 8421 " │ ├─ index: [mytable.i,mytable.s]\n" + 8422 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 8423 " │ ├─ colSet: (1,2)\n" + 8424 " │ ├─ tableId: 1\n" + 8425 " │ └─ Table\n" + 8426 " │ ├─ name: mytable\n" + 8427 " │ └─ columns: [i]\n" + 8428 " └─ IndexedTableAccess(othertable)\n" + 8429 " ├─ index: [othertable.i2]\n" + 8430 " ├─ static: [{[NULL, ∞)}]\n" + 8431 " ├─ colSet: (3,4)\n" + 8432 " ├─ tableId: 2\n" + 8433 " └─ Table\n" + 8434 " ├─ name: othertable\n" + 8435 " └─ columns: [s2 i2]\n" + 8436 "", 8437 ExpectedEstimates: "Project\n" + 8438 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 8439 " └─ MergeJoin (estimated cost=6.090 rows=3)\n" + 8440 " ├─ cmp: (mytable.i = othertable.i2)\n" + 8441 " ├─ IndexedTableAccess(mytable)\n" + 8442 " │ ├─ index: [mytable.i,mytable.s]\n" + 8443 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8444 " │ └─ columns: [i]\n" + 8445 " └─ IndexedTableAccess(othertable)\n" + 8446 " ├─ index: [othertable.i2]\n" + 8447 " ├─ filters: [{[NULL, ∞)}]\n" + 8448 " └─ columns: [s2 i2]\n" + 8449 "", 8450 ExpectedAnalysis: "Project\n" + 8451 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 8452 " └─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=1)\n" + 8453 " ├─ cmp: (mytable.i = othertable.i2)\n" + 8454 " ├─ IndexedTableAccess(mytable)\n" + 8455 " │ ├─ index: [mytable.i,mytable.s]\n" + 8456 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8457 " │ └─ columns: [i]\n" + 8458 " └─ IndexedTableAccess(othertable)\n" + 8459 " ├─ index: [othertable.i2]\n" + 8460 " ├─ filters: [{[NULL, ∞)}]\n" + 8461 " └─ columns: [s2 i2]\n" + 8462 "", 8463 }, 8464 { 8465 Query: `SELECT s2, i2, i FROM mytable INNER JOIN othertable ON i2 = i`, 8466 ExpectedPlan: "Project\n" + 8467 " ├─ columns: [othertable.s2:1!null, othertable.i2:2!null, mytable.i:0!null]\n" + 8468 " └─ MergeJoin\n" + 8469 " ├─ cmp: Eq\n" + 8470 " │ ├─ mytable.i:0!null\n" + 8471 " │ └─ othertable.i2:2!null\n" + 8472 " ├─ IndexedTableAccess(mytable)\n" + 8473 " │ ├─ index: [mytable.i,mytable.s]\n" + 8474 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 8475 " │ ├─ colSet: (1,2)\n" + 8476 " │ ├─ tableId: 1\n" + 8477 " │ └─ Table\n" + 8478 " │ ├─ name: mytable\n" + 8479 " │ └─ columns: [i]\n" + 8480 " └─ IndexedTableAccess(othertable)\n" + 8481 " ├─ index: [othertable.i2]\n" + 8482 " ├─ static: [{[NULL, ∞)}]\n" + 8483 " ├─ colSet: (3,4)\n" + 8484 " ├─ tableId: 2\n" + 8485 " └─ Table\n" + 8486 " ├─ name: othertable\n" + 8487 " └─ columns: [s2 i2]\n" + 8488 "", 8489 ExpectedEstimates: "Project\n" + 8490 " ├─ columns: [othertable.s2, othertable.i2, mytable.i]\n" + 8491 " └─ MergeJoin (estimated cost=6.090 rows=3)\n" + 8492 " ├─ cmp: (mytable.i = othertable.i2)\n" + 8493 " ├─ IndexedTableAccess(mytable)\n" + 8494 " │ ├─ index: [mytable.i,mytable.s]\n" + 8495 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8496 " │ └─ columns: [i]\n" + 8497 " └─ IndexedTableAccess(othertable)\n" + 8498 " ├─ index: [othertable.i2]\n" + 8499 " ├─ filters: [{[NULL, ∞)}]\n" + 8500 " └─ columns: [s2 i2]\n" + 8501 "", 8502 ExpectedAnalysis: "Project\n" + 8503 " ├─ columns: [othertable.s2, othertable.i2, mytable.i]\n" + 8504 " └─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=1)\n" + 8505 " ├─ cmp: (mytable.i = othertable.i2)\n" + 8506 " ├─ IndexedTableAccess(mytable)\n" + 8507 " │ ├─ index: [mytable.i,mytable.s]\n" + 8508 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8509 " │ └─ columns: [i]\n" + 8510 " └─ IndexedTableAccess(othertable)\n" + 8511 " ├─ index: [othertable.i2]\n" + 8512 " ├─ filters: [{[NULL, ∞)}]\n" + 8513 " └─ columns: [s2 i2]\n" + 8514 "", 8515 }, 8516 { 8517 Query: `SELECT * FROM MYTABLE JOIN OTHERTABLE ON i = i2 AND NOT (s2 <=> s)`, 8518 ExpectedPlan: "MergeJoin\n" + 8519 " ├─ cmp: Eq\n" + 8520 " │ ├─ mytable.i:0!null\n" + 8521 " │ └─ othertable.i2:3!null\n" + 8522 " ├─ sel: NOT\n" + 8523 " │ └─ (othertable.s2:2!null <=> mytable.s:1!null)\n" + 8524 " ├─ IndexedTableAccess(mytable)\n" + 8525 " │ ├─ index: [mytable.i,mytable.s]\n" + 8526 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 8527 " │ ├─ colSet: (1,2)\n" + 8528 " │ ├─ tableId: 1\n" + 8529 " │ └─ Table\n" + 8530 " │ ├─ name: mytable\n" + 8531 " │ └─ columns: [i s]\n" + 8532 " └─ IndexedTableAccess(othertable)\n" + 8533 " ├─ index: [othertable.i2]\n" + 8534 " ├─ static: [{[NULL, ∞)}]\n" + 8535 " ├─ colSet: (3,4)\n" + 8536 " ├─ tableId: 2\n" + 8537 " └─ Table\n" + 8538 " ├─ name: othertable\n" + 8539 " └─ columns: [s2 i2]\n" + 8540 "", 8541 ExpectedEstimates: "MergeJoin (estimated cost=6.090 rows=3)\n" + 8542 " ├─ cmp: (mytable.i = othertable.i2)\n" + 8543 " ├─ sel: (NOT((othertable.s2 <=> mytable.s)))\n" + 8544 " ├─ IndexedTableAccess(mytable)\n" + 8545 " │ ├─ index: [mytable.i,mytable.s]\n" + 8546 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8547 " │ └─ columns: [i s]\n" + 8548 " └─ IndexedTableAccess(othertable)\n" + 8549 " ├─ index: [othertable.i2]\n" + 8550 " ├─ filters: [{[NULL, ∞)}]\n" + 8551 " └─ columns: [s2 i2]\n" + 8552 "", 8553 ExpectedAnalysis: "MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=1)\n" + 8554 " ├─ cmp: (mytable.i = othertable.i2)\n" + 8555 " ├─ sel: (NOT((othertable.s2 <=> mytable.s)))\n" + 8556 " ├─ IndexedTableAccess(mytable)\n" + 8557 " │ ├─ index: [mytable.i,mytable.s]\n" + 8558 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8559 " │ └─ columns: [i s]\n" + 8560 " └─ IndexedTableAccess(othertable)\n" + 8561 " ├─ index: [othertable.i2]\n" + 8562 " ├─ filters: [{[NULL, ∞)}]\n" + 8563 " └─ columns: [s2 i2]\n" + 8564 "", 8565 }, 8566 { 8567 Query: `SELECT * FROM MYTABLE JOIN OTHERTABLE ON i = i2 AND NOT (s2 = s)`, 8568 ExpectedPlan: "MergeJoin\n" + 8569 " ├─ cmp: Eq\n" + 8570 " │ ├─ mytable.i:0!null\n" + 8571 " │ └─ othertable.i2:3!null\n" + 8572 " ├─ sel: NOT\n" + 8573 " │ └─ Eq\n" + 8574 " │ ├─ othertable.s2:2!null\n" + 8575 " │ └─ mytable.s:1!null\n" + 8576 " ├─ IndexedTableAccess(mytable)\n" + 8577 " │ ├─ index: [mytable.i,mytable.s]\n" + 8578 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 8579 " │ ├─ colSet: (1,2)\n" + 8580 " │ ├─ tableId: 1\n" + 8581 " │ └─ Table\n" + 8582 " │ ├─ name: mytable\n" + 8583 " │ └─ columns: [i s]\n" + 8584 " └─ IndexedTableAccess(othertable)\n" + 8585 " ├─ index: [othertable.i2]\n" + 8586 " ├─ static: [{[NULL, ∞)}]\n" + 8587 " ├─ colSet: (3,4)\n" + 8588 " ├─ tableId: 2\n" + 8589 " └─ Table\n" + 8590 " ├─ name: othertable\n" + 8591 " └─ columns: [s2 i2]\n" + 8592 "", 8593 ExpectedEstimates: "MergeJoin (estimated cost=6.090 rows=3)\n" + 8594 " ├─ cmp: (mytable.i = othertable.i2)\n" + 8595 " ├─ sel: (NOT((othertable.s2 = mytable.s)))\n" + 8596 " ├─ IndexedTableAccess(mytable)\n" + 8597 " │ ├─ index: [mytable.i,mytable.s]\n" + 8598 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8599 " │ └─ columns: [i s]\n" + 8600 " └─ IndexedTableAccess(othertable)\n" + 8601 " ├─ index: [othertable.i2]\n" + 8602 " ├─ filters: [{[NULL, ∞)}]\n" + 8603 " └─ columns: [s2 i2]\n" + 8604 "", 8605 ExpectedAnalysis: "MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=1)\n" + 8606 " ├─ cmp: (mytable.i = othertable.i2)\n" + 8607 " ├─ sel: (NOT((othertable.s2 = mytable.s)))\n" + 8608 " ├─ IndexedTableAccess(mytable)\n" + 8609 " │ ├─ index: [mytable.i,mytable.s]\n" + 8610 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8611 " │ └─ columns: [i s]\n" + 8612 " └─ IndexedTableAccess(othertable)\n" + 8613 " ├─ index: [othertable.i2]\n" + 8614 " ├─ filters: [{[NULL, ∞)}]\n" + 8615 " └─ columns: [s2 i2]\n" + 8616 "", 8617 }, 8618 { 8619 Query: `SELECT * FROM MYTABLE JOIN OTHERTABLE ON i = i2 AND CONCAT(s, s2) IS NOT NULL`, 8620 ExpectedPlan: "MergeJoin\n" + 8621 " ├─ cmp: Eq\n" + 8622 " │ ├─ mytable.i:0!null\n" + 8623 " │ └─ othertable.i2:3!null\n" + 8624 " ├─ sel: NOT\n" + 8625 " │ └─ concat(mytable.s:1!null,othertable.s2:2!null) IS NULL\n" + 8626 " ├─ IndexedTableAccess(mytable)\n" + 8627 " │ ├─ index: [mytable.i,mytable.s]\n" + 8628 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 8629 " │ ├─ colSet: (1,2)\n" + 8630 " │ ├─ tableId: 1\n" + 8631 " │ └─ Table\n" + 8632 " │ ├─ name: mytable\n" + 8633 " │ └─ columns: [i s]\n" + 8634 " └─ IndexedTableAccess(othertable)\n" + 8635 " ├─ index: [othertable.i2]\n" + 8636 " ├─ static: [{[NULL, ∞)}]\n" + 8637 " ├─ colSet: (3,4)\n" + 8638 " ├─ tableId: 2\n" + 8639 " └─ Table\n" + 8640 " ├─ name: othertable\n" + 8641 " └─ columns: [s2 i2]\n" + 8642 "", 8643 ExpectedEstimates: "MergeJoin (estimated cost=6.090 rows=3)\n" + 8644 " ├─ cmp: (mytable.i = othertable.i2)\n" + 8645 " ├─ sel: (NOT(concat(mytable.s,othertable.s2) IS NULL))\n" + 8646 " ├─ IndexedTableAccess(mytable)\n" + 8647 " │ ├─ index: [mytable.i,mytable.s]\n" + 8648 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8649 " │ └─ columns: [i s]\n" + 8650 " └─ IndexedTableAccess(othertable)\n" + 8651 " ├─ index: [othertable.i2]\n" + 8652 " ├─ filters: [{[NULL, ∞)}]\n" + 8653 " └─ columns: [s2 i2]\n" + 8654 "", 8655 ExpectedAnalysis: "MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=1)\n" + 8656 " ├─ cmp: (mytable.i = othertable.i2)\n" + 8657 " ├─ sel: (NOT(concat(mytable.s,othertable.s2) IS NULL))\n" + 8658 " ├─ IndexedTableAccess(mytable)\n" + 8659 " │ ├─ index: [mytable.i,mytable.s]\n" + 8660 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8661 " │ └─ columns: [i s]\n" + 8662 " └─ IndexedTableAccess(othertable)\n" + 8663 " ├─ index: [othertable.i2]\n" + 8664 " ├─ filters: [{[NULL, ∞)}]\n" + 8665 " └─ columns: [s2 i2]\n" + 8666 "", 8667 }, 8668 { 8669 Query: `SELECT * FROM MYTABLE JOIN OTHERTABLE ON i = i2 AND s > s2`, 8670 ExpectedPlan: "MergeJoin\n" + 8671 " ├─ cmp: Eq\n" + 8672 " │ ├─ mytable.i:0!null\n" + 8673 " │ └─ othertable.i2:3!null\n" + 8674 " ├─ sel: GreaterThan\n" + 8675 " │ ├─ mytable.s:1!null\n" + 8676 " │ └─ othertable.s2:2!null\n" + 8677 " ├─ IndexedTableAccess(mytable)\n" + 8678 " │ ├─ index: [mytable.i,mytable.s]\n" + 8679 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 8680 " │ ├─ colSet: (1,2)\n" + 8681 " │ ├─ tableId: 1\n" + 8682 " │ └─ Table\n" + 8683 " │ ├─ name: mytable\n" + 8684 " │ └─ columns: [i s]\n" + 8685 " └─ IndexedTableAccess(othertable)\n" + 8686 " ├─ index: [othertable.i2]\n" + 8687 " ├─ static: [{[NULL, ∞)}]\n" + 8688 " ├─ colSet: (3,4)\n" + 8689 " ├─ tableId: 2\n" + 8690 " └─ Table\n" + 8691 " ├─ name: othertable\n" + 8692 " └─ columns: [s2 i2]\n" + 8693 "", 8694 ExpectedEstimates: "MergeJoin (estimated cost=6.090 rows=3)\n" + 8695 " ├─ cmp: (mytable.i = othertable.i2)\n" + 8696 " ├─ sel: (mytable.s > othertable.s2)\n" + 8697 " ├─ IndexedTableAccess(mytable)\n" + 8698 " │ ├─ index: [mytable.i,mytable.s]\n" + 8699 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8700 " │ └─ columns: [i s]\n" + 8701 " └─ IndexedTableAccess(othertable)\n" + 8702 " ├─ index: [othertable.i2]\n" + 8703 " ├─ filters: [{[NULL, ∞)}]\n" + 8704 " └─ columns: [s2 i2]\n" + 8705 "", 8706 ExpectedAnalysis: "MergeJoin (estimated cost=6.090 rows=3) (actual rows=2 loops=1)\n" + 8707 " ├─ cmp: (mytable.i = othertable.i2)\n" + 8708 " ├─ sel: (mytable.s > othertable.s2)\n" + 8709 " ├─ IndexedTableAccess(mytable)\n" + 8710 " │ ├─ index: [mytable.i,mytable.s]\n" + 8711 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8712 " │ └─ columns: [i s]\n" + 8713 " └─ IndexedTableAccess(othertable)\n" + 8714 " ├─ index: [othertable.i2]\n" + 8715 " ├─ filters: [{[NULL, ∞)}]\n" + 8716 " └─ columns: [s2 i2]\n" + 8717 "", 8718 }, 8719 { 8720 Query: `SELECT * FROM MYTABLE JOIN OTHERTABLE ON i = i2 AND NOT(s > s2)`, 8721 ExpectedPlan: "MergeJoin\n" + 8722 " ├─ cmp: Eq\n" + 8723 " │ ├─ mytable.i:0!null\n" + 8724 " │ └─ othertable.i2:3!null\n" + 8725 " ├─ sel: LessThanOrEqual\n" + 8726 " │ ├─ mytable.s:1!null\n" + 8727 " │ └─ othertable.s2:2!null\n" + 8728 " ├─ IndexedTableAccess(mytable)\n" + 8729 " │ ├─ index: [mytable.i,mytable.s]\n" + 8730 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 8731 " │ ├─ colSet: (1,2)\n" + 8732 " │ ├─ tableId: 1\n" + 8733 " │ └─ Table\n" + 8734 " │ ├─ name: mytable\n" + 8735 " │ └─ columns: [i s]\n" + 8736 " └─ IndexedTableAccess(othertable)\n" + 8737 " ├─ index: [othertable.i2]\n" + 8738 " ├─ static: [{[NULL, ∞)}]\n" + 8739 " ├─ colSet: (3,4)\n" + 8740 " ├─ tableId: 2\n" + 8741 " └─ Table\n" + 8742 " ├─ name: othertable\n" + 8743 " └─ columns: [s2 i2]\n" + 8744 "", 8745 ExpectedEstimates: "MergeJoin (estimated cost=6.090 rows=3)\n" + 8746 " ├─ cmp: (mytable.i = othertable.i2)\n" + 8747 " ├─ sel: (mytable.s <= othertable.s2)\n" + 8748 " ├─ IndexedTableAccess(mytable)\n" + 8749 " │ ├─ index: [mytable.i,mytable.s]\n" + 8750 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8751 " │ └─ columns: [i s]\n" + 8752 " └─ IndexedTableAccess(othertable)\n" + 8753 " ├─ index: [othertable.i2]\n" + 8754 " ├─ filters: [{[NULL, ∞)}]\n" + 8755 " └─ columns: [s2 i2]\n" + 8756 "", 8757 ExpectedAnalysis: "MergeJoin (estimated cost=6.090 rows=3) (actual rows=1 loops=1)\n" + 8758 " ├─ cmp: (mytable.i = othertable.i2)\n" + 8759 " ├─ sel: (mytable.s <= othertable.s2)\n" + 8760 " ├─ IndexedTableAccess(mytable)\n" + 8761 " │ ├─ index: [mytable.i,mytable.s]\n" + 8762 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 8763 " │ └─ columns: [i s]\n" + 8764 " └─ IndexedTableAccess(othertable)\n" + 8765 " ├─ index: [othertable.i2]\n" + 8766 " ├─ filters: [{[NULL, ∞)}]\n" + 8767 " └─ columns: [s2 i2]\n" + 8768 "", 8769 }, 8770 { 8771 Query: `SELECT /*+ JOIN_ORDER(mytable, othertable) */ s2, i2, i FROM mytable INNER JOIN (SELECT * FROM othertable) othertable ON i2 = i`, 8772 ExpectedPlan: "Project\n" + 8773 " ├─ columns: [othertable.s2:1!null, othertable.i2:2!null, mytable.i:0!null]\n" + 8774 " └─ InnerJoin\n" + 8775 " ├─ Eq\n" + 8776 " │ ├─ othertable.i2:2!null\n" + 8777 " │ └─ mytable.i:0!null\n" + 8778 " ├─ ProcessTable\n" + 8779 " │ └─ Table\n" + 8780 " │ ├─ name: mytable\n" + 8781 " │ └─ columns: [i]\n" + 8782 " └─ SubqueryAlias\n" + 8783 " ├─ name: othertable\n" + 8784 " ├─ outerVisibility: false\n" + 8785 " ├─ isLateral: false\n" + 8786 " ├─ cacheable: true\n" + 8787 " ├─ colSet: (5,6)\n" + 8788 " ├─ tableId: 3\n" + 8789 " └─ Table\n" + 8790 " ├─ name: othertable\n" + 8791 " ├─ columns: [s2 i2]\n" + 8792 " ├─ colSet: (3,4)\n" + 8793 " └─ tableId: 2\n" + 8794 "", 8795 ExpectedEstimates: "Project\n" + 8796 " ├─ columns: [othertable.s2, othertable.i2, mytable.i]\n" + 8797 " └─ InnerJoin (estimated cost=304.000 rows=100)\n" + 8798 " ├─ (othertable.i2 = mytable.i)\n" + 8799 " ├─ Table\n" + 8800 " │ ├─ name: mytable\n" + 8801 " │ └─ columns: [i]\n" + 8802 " └─ SubqueryAlias\n" + 8803 " ├─ name: othertable\n" + 8804 " ├─ outerVisibility: false\n" + 8805 " ├─ isLateral: false\n" + 8806 " ├─ cacheable: true\n" + 8807 " └─ Table\n" + 8808 " ├─ name: othertable\n" + 8809 " └─ columns: [s2 i2]\n" + 8810 "", 8811 ExpectedAnalysis: "Project\n" + 8812 " ├─ columns: [othertable.s2, othertable.i2, mytable.i]\n" + 8813 " └─ InnerJoin (estimated cost=304.000 rows=100) (actual rows=3 loops=1)\n" + 8814 " ├─ (othertable.i2 = mytable.i)\n" + 8815 " ├─ Table\n" + 8816 " │ ├─ name: mytable\n" + 8817 " │ └─ columns: [i]\n" + 8818 " └─ SubqueryAlias\n" + 8819 " ├─ name: othertable\n" + 8820 " ├─ outerVisibility: false\n" + 8821 " ├─ isLateral: false\n" + 8822 " ├─ cacheable: true\n" + 8823 " └─ Table\n" + 8824 " ├─ name: othertable\n" + 8825 " └─ columns: [s2 i2]\n" + 8826 "", 8827 }, 8828 { 8829 Query: `SELECT s2, i2, i FROM mytable LEFT JOIN (SELECT * FROM othertable) othertable ON i2 = i`, 8830 ExpectedPlan: "Project\n" + 8831 " ├─ columns: [othertable.s2:1!null, othertable.i2:2!null, mytable.i:0!null]\n" + 8832 " └─ LeftOuterJoin\n" + 8833 " ├─ Eq\n" + 8834 " │ ├─ othertable.i2:2!null\n" + 8835 " │ └─ mytable.i:0!null\n" + 8836 " ├─ ProcessTable\n" + 8837 " │ └─ Table\n" + 8838 " │ ├─ name: mytable\n" + 8839 " │ └─ columns: [i]\n" + 8840 " └─ SubqueryAlias\n" + 8841 " ├─ name: othertable\n" + 8842 " ├─ outerVisibility: false\n" + 8843 " ├─ isLateral: false\n" + 8844 " ├─ cacheable: true\n" + 8845 " ├─ colSet: (5,6)\n" + 8846 " ├─ tableId: 3\n" + 8847 " └─ Table\n" + 8848 " ├─ name: othertable\n" + 8849 " ├─ columns: [s2 i2]\n" + 8850 " ├─ colSet: (3,4)\n" + 8851 " └─ tableId: 2\n" + 8852 "", 8853 ExpectedEstimates: "Project\n" + 8854 " ├─ columns: [othertable.s2, othertable.i2, mytable.i]\n" + 8855 " └─ LeftOuterJoin (estimated cost=302.000 rows=3)\n" + 8856 " ├─ (othertable.i2 = mytable.i)\n" + 8857 " ├─ Table\n" + 8858 " │ ├─ name: mytable\n" + 8859 " │ └─ columns: [i]\n" + 8860 " └─ SubqueryAlias\n" + 8861 " ├─ name: othertable\n" + 8862 " ├─ outerVisibility: false\n" + 8863 " ├─ isLateral: false\n" + 8864 " ├─ cacheable: true\n" + 8865 " └─ Table\n" + 8866 " ├─ name: othertable\n" + 8867 " └─ columns: [s2 i2]\n" + 8868 "", 8869 ExpectedAnalysis: "Project\n" + 8870 " ├─ columns: [othertable.s2, othertable.i2, mytable.i]\n" + 8871 " └─ LeftOuterJoin (estimated cost=302.000 rows=3) (actual rows=3 loops=1)\n" + 8872 " ├─ (othertable.i2 = mytable.i)\n" + 8873 " ├─ Table\n" + 8874 " │ ├─ name: mytable\n" + 8875 " │ └─ columns: [i]\n" + 8876 " └─ SubqueryAlias\n" + 8877 " ├─ name: othertable\n" + 8878 " ├─ outerVisibility: false\n" + 8879 " ├─ isLateral: false\n" + 8880 " ├─ cacheable: true\n" + 8881 " └─ Table\n" + 8882 " ├─ name: othertable\n" + 8883 " └─ columns: [s2 i2]\n" + 8884 "", 8885 }, 8886 { 8887 Query: `SELECT s2, i2, i FROM (SELECT * FROM mytable) mytable RIGHT JOIN (SELECT * FROM othertable) othertable ON i2 = i`, 8888 ExpectedPlan: "Project\n" + 8889 " ├─ columns: [othertable.s2:0!null, othertable.i2:1!null, mytable.i:2!null]\n" + 8890 " └─ LeftOuterHashJoin\n" + 8891 " ├─ Eq\n" + 8892 " │ ├─ othertable.i2:1!null\n" + 8893 " │ └─ mytable.i:2!null\n" + 8894 " ├─ SubqueryAlias\n" + 8895 " │ ├─ name: othertable\n" + 8896 " │ ├─ outerVisibility: false\n" + 8897 " │ ├─ isLateral: false\n" + 8898 " │ ├─ cacheable: true\n" + 8899 " │ ├─ colSet: (7,8)\n" + 8900 " │ ├─ tableId: 4\n" + 8901 " │ └─ Table\n" + 8902 " │ ├─ name: othertable\n" + 8903 " │ ├─ columns: [s2 i2]\n" + 8904 " │ ├─ colSet: (5,6)\n" + 8905 " │ └─ tableId: 3\n" + 8906 " └─ HashLookup\n" + 8907 " ├─ left-key: TUPLE(othertable.i2:1!null)\n" + 8908 " ├─ right-key: TUPLE(mytable.i:0!null)\n" + 8909 " └─ SubqueryAlias\n" + 8910 " ├─ name: mytable\n" + 8911 " ├─ outerVisibility: false\n" + 8912 " ├─ isLateral: false\n" + 8913 " ├─ cacheable: true\n" + 8914 " ├─ colSet: (3,4)\n" + 8915 " ├─ tableId: 2\n" + 8916 " └─ Table\n" + 8917 " ├─ name: mytable\n" + 8918 " ├─ columns: [i s]\n" + 8919 " ├─ colSet: (1,2)\n" + 8920 " └─ tableId: 1\n" + 8921 "", 8922 ExpectedEstimates: "Project\n" + 8923 " ├─ columns: [othertable.s2, othertable.i2, mytable.i]\n" + 8924 " └─ LeftOuterHashJoin (estimated cost=402.250 rows=125)\n" + 8925 " ├─ (othertable.i2 = mytable.i)\n" + 8926 " ├─ SubqueryAlias\n" + 8927 " │ ├─ name: othertable\n" + 8928 " │ ├─ outerVisibility: false\n" + 8929 " │ ├─ isLateral: false\n" + 8930 " │ ├─ cacheable: true\n" + 8931 " │ └─ Table\n" + 8932 " │ ├─ name: othertable\n" + 8933 " │ └─ columns: [s2 i2]\n" + 8934 " └─ HashLookup\n" + 8935 " ├─ left-key: (othertable.i2)\n" + 8936 " ├─ right-key: (mytable.i)\n" + 8937 " └─ SubqueryAlias\n" + 8938 " ├─ name: mytable\n" + 8939 " ├─ outerVisibility: false\n" + 8940 " ├─ isLateral: false\n" + 8941 " ├─ cacheable: true\n" + 8942 " └─ Table\n" + 8943 " ├─ name: mytable\n" + 8944 " └─ columns: [i s]\n" + 8945 "", 8946 ExpectedAnalysis: "Project\n" + 8947 " ├─ columns: [othertable.s2, othertable.i2, mytable.i]\n" + 8948 " └─ LeftOuterHashJoin (estimated cost=402.250 rows=125) (actual rows=3 loops=1)\n" + 8949 " ├─ (othertable.i2 = mytable.i)\n" + 8950 " ├─ SubqueryAlias\n" + 8951 " │ ├─ name: othertable\n" + 8952 " │ ├─ outerVisibility: false\n" + 8953 " │ ├─ isLateral: false\n" + 8954 " │ ├─ cacheable: true\n" + 8955 " │ └─ Table\n" + 8956 " │ ├─ name: othertable\n" + 8957 " │ └─ columns: [s2 i2]\n" + 8958 " └─ HashLookup\n" + 8959 " ├─ left-key: (othertable.i2)\n" + 8960 " ├─ right-key: (mytable.i)\n" + 8961 " └─ SubqueryAlias\n" + 8962 " ├─ name: mytable\n" + 8963 " ├─ outerVisibility: false\n" + 8964 " ├─ isLateral: false\n" + 8965 " ├─ cacheable: true\n" + 8966 " └─ Table\n" + 8967 " ├─ name: mytable\n" + 8968 " └─ columns: [i s]\n" + 8969 "", 8970 }, 8971 { 8972 Query: `SELECT a.* FROM mytable a WHERE a.s is not null`, 8973 ExpectedPlan: "TableAlias(a)\n" + 8974 " └─ IndexedTableAccess(mytable)\n" + 8975 " ├─ index: [mytable.s,mytable.i]\n" + 8976 " ├─ static: [{(NULL, ∞), [NULL, ∞)}]\n" + 8977 " ├─ colSet: (1,2)\n" + 8978 " ├─ tableId: 1\n" + 8979 " └─ Table\n" + 8980 " ├─ name: mytable\n" + 8981 " └─ columns: [i s]\n" + 8982 "", 8983 ExpectedEstimates: "TableAlias(a)\n" + 8984 " └─ IndexedTableAccess(mytable)\n" + 8985 " ├─ index: [mytable.s,mytable.i]\n" + 8986 " ├─ filters: [{(NULL, ∞), [NULL, ∞)}]\n" + 8987 " └─ columns: [i s]\n" + 8988 "", 8989 ExpectedAnalysis: "TableAlias(a)\n" + 8990 " └─ IndexedTableAccess(mytable)\n" + 8991 " ├─ index: [mytable.s,mytable.i]\n" + 8992 " ├─ filters: [{(NULL, ∞), [NULL, ∞)}]\n" + 8993 " └─ columns: [i s]\n" + 8994 "", 8995 }, 8996 { 8997 Query: `SELECT a.* FROM mytable a inner join mytable b on (a.i = b.s) WHERE a.s is not null`, 8998 ExpectedPlan: "Project\n" + 8999 " ├─ columns: [a.i:0!null, a.s:1!null]\n" + 9000 " └─ LookupJoin\n" + 9001 " ├─ TableAlias(a)\n" + 9002 " │ └─ IndexedTableAccess(mytable)\n" + 9003 " │ ├─ index: [mytable.s,mytable.i]\n" + 9004 " │ ├─ static: [{(NULL, ∞), [NULL, ∞)}]\n" + 9005 " │ ├─ colSet: (1,2)\n" + 9006 " │ ├─ tableId: 1\n" + 9007 " │ └─ Table\n" + 9008 " │ ├─ name: mytable\n" + 9009 " │ └─ columns: [i s]\n" + 9010 " └─ TableAlias(b)\n" + 9011 " └─ IndexedTableAccess(mytable)\n" + 9012 " ├─ index: [mytable.s]\n" + 9013 " ├─ keys: [a.i:0!null]\n" + 9014 " ├─ colSet: (3,4)\n" + 9015 " ├─ tableId: 2\n" + 9016 " └─ Table\n" + 9017 " ├─ name: mytable\n" + 9018 " └─ columns: [s]\n" + 9019 "", 9020 ExpectedEstimates: "Project\n" + 9021 " ├─ columns: [a.i, a.s]\n" + 9022 " └─ LookupJoin (estimated cost=3.300 rows=1)\n" + 9023 " ├─ TableAlias(a)\n" + 9024 " │ └─ IndexedTableAccess(mytable)\n" + 9025 " │ ├─ index: [mytable.s,mytable.i]\n" + 9026 " │ ├─ filters: [{(NULL, ∞), [NULL, ∞)}]\n" + 9027 " │ └─ columns: [i s]\n" + 9028 " └─ TableAlias(b)\n" + 9029 " └─ IndexedTableAccess(mytable)\n" + 9030 " ├─ index: [mytable.s]\n" + 9031 " ├─ columns: [s]\n" + 9032 " └─ keys: a.i\n" + 9033 "", 9034 ExpectedAnalysis: "Project\n" + 9035 " ├─ columns: [a.i, a.s]\n" + 9036 " └─ LookupJoin (estimated cost=3.300 rows=1) (actual rows=0 loops=1)\n" + 9037 " ├─ TableAlias(a)\n" + 9038 " │ └─ IndexedTableAccess(mytable)\n" + 9039 " │ ├─ index: [mytable.s,mytable.i]\n" + 9040 " │ ├─ filters: [{(NULL, ∞), [NULL, ∞)}]\n" + 9041 " │ └─ columns: [i s]\n" + 9042 " └─ TableAlias(b)\n" + 9043 " └─ IndexedTableAccess(mytable)\n" + 9044 " ├─ index: [mytable.s]\n" + 9045 " ├─ columns: [s]\n" + 9046 " └─ keys: a.i\n" + 9047 "", 9048 }, 9049 { 9050 Query: `SELECT /*+ JOIN_ORDER(b, a) */ a.* FROM mytable a inner join mytable b on (a.i = b.s) WHERE a.s is not null`, 9051 ExpectedPlan: "Project\n" + 9052 " ├─ columns: [a.i:1!null, a.s:2!null]\n" + 9053 " └─ InnerJoin\n" + 9054 " ├─ Eq\n" + 9055 " │ ├─ a.i:1!null\n" + 9056 " │ └─ b.s:0!null\n" + 9057 " ├─ TableAlias(b)\n" + 9058 " │ └─ ProcessTable\n" + 9059 " │ └─ Table\n" + 9060 " │ ├─ name: mytable\n" + 9061 " │ └─ columns: [s]\n" + 9062 " └─ TableAlias(a)\n" + 9063 " └─ IndexedTableAccess(mytable)\n" + 9064 " ├─ index: [mytable.s,mytable.i]\n" + 9065 " ├─ static: [{(NULL, ∞), [NULL, ∞)}]\n" + 9066 " ├─ colSet: (1,2)\n" + 9067 " ├─ tableId: 1\n" + 9068 " └─ Table\n" + 9069 " ├─ name: mytable\n" + 9070 " └─ columns: [i s]\n" + 9071 "", 9072 ExpectedEstimates: "Project\n" + 9073 " ├─ columns: [a.i, a.s]\n" + 9074 " └─ InnerJoin (estimated cost=4.030 rows=1)\n" + 9075 " ├─ (a.i = b.s)\n" + 9076 " ├─ TableAlias(b)\n" + 9077 " │ └─ Table\n" + 9078 " │ ├─ name: mytable\n" + 9079 " │ └─ columns: [s]\n" + 9080 " └─ TableAlias(a)\n" + 9081 " └─ IndexedTableAccess(mytable)\n" + 9082 " ├─ index: [mytable.s,mytable.i]\n" + 9083 " ├─ filters: [{(NULL, ∞), [NULL, ∞)}]\n" + 9084 " └─ columns: [i s]\n" + 9085 "", 9086 ExpectedAnalysis: "Project\n" + 9087 " ├─ columns: [a.i, a.s]\n" + 9088 " └─ InnerJoin (estimated cost=4.030 rows=1) (actual rows=0 loops=1)\n" + 9089 " ├─ (a.i = b.s)\n" + 9090 " ├─ TableAlias(b)\n" + 9091 " │ └─ Table\n" + 9092 " │ ├─ name: mytable\n" + 9093 " │ └─ columns: [s]\n" + 9094 " └─ TableAlias(a)\n" + 9095 " └─ IndexedTableAccess(mytable)\n" + 9096 " ├─ index: [mytable.s,mytable.i]\n" + 9097 " ├─ filters: [{(NULL, ∞), [NULL, ∞)}]\n" + 9098 " └─ columns: [i s]\n" + 9099 "", 9100 }, 9101 { 9102 Query: `SELECT a.* FROM mytable a inner join mytable b on (a.i = b.s) WHERE a.s not in ('1', '2', '3', '4')`, 9103 ExpectedPlan: "Project\n" + 9104 " ├─ columns: [a.i:0!null, a.s:1!null]\n" + 9105 " └─ LookupJoin\n" + 9106 " ├─ Filter\n" + 9107 " │ ├─ NOT\n" + 9108 " │ │ └─ HashIn\n" + 9109 " │ │ ├─ a.s:1!null\n" + 9110 " │ │ └─ TUPLE(1 (longtext), 2 (longtext), 3 (longtext), 4 (longtext))\n" + 9111 " │ └─ TableAlias(a)\n" + 9112 " │ └─ IndexedTableAccess(mytable)\n" + 9113 " │ ├─ index: [mytable.s,mytable.i]\n" + 9114 " │ ├─ static: [{(NULL, 1), [NULL, ∞)}, {(1, 2), [NULL, ∞)}, {(2, 3), [NULL, ∞)}, {(3, 4), [NULL, ∞)}, {(4, ∞), [NULL, ∞)}]\n" + 9115 " │ ├─ colSet: (1,2)\n" + 9116 " │ ├─ tableId: 1\n" + 9117 " │ └─ Table\n" + 9118 " │ ├─ name: mytable\n" + 9119 " │ └─ columns: [i s]\n" + 9120 " └─ TableAlias(b)\n" + 9121 " └─ IndexedTableAccess(mytable)\n" + 9122 " ├─ index: [mytable.s]\n" + 9123 " ├─ keys: [a.i:0!null]\n" + 9124 " ├─ colSet: (3,4)\n" + 9125 " ├─ tableId: 2\n" + 9126 " └─ Table\n" + 9127 " ├─ name: mytable\n" + 9128 " └─ columns: [s]\n" + 9129 "", 9130 ExpectedEstimates: "Project\n" + 9131 " ├─ columns: [a.i, a.s]\n" + 9132 " └─ LookupJoin (estimated cost=3.300 rows=0)\n" + 9133 " ├─ Filter\n" + 9134 " │ ├─ (NOT((a.s HASH IN ('1', '2', '3', '4'))))\n" + 9135 " │ └─ TableAlias(a)\n" + 9136 " │ └─ IndexedTableAccess(mytable)\n" + 9137 " │ ├─ index: [mytable.s,mytable.i]\n" + 9138 " │ ├─ filters: [{(NULL, 1), [NULL, ∞)}, {(1, 2), [NULL, ∞)}, {(2, 3), [NULL, ∞)}, {(3, 4), [NULL, ∞)}, {(4, ∞), [NULL, ∞)}]\n" + 9139 " │ └─ columns: [i s]\n" + 9140 " └─ TableAlias(b)\n" + 9141 " └─ IndexedTableAccess(mytable)\n" + 9142 " ├─ index: [mytable.s]\n" + 9143 " ├─ columns: [s]\n" + 9144 " └─ keys: a.i\n" + 9145 "", 9146 ExpectedAnalysis: "Project\n" + 9147 " ├─ columns: [a.i, a.s]\n" + 9148 " └─ LookupJoin (estimated cost=3.300 rows=0) (actual rows=0 loops=1)\n" + 9149 " ├─ Filter\n" + 9150 " │ ├─ (NOT((a.s HASH IN ('1', '2', '3', '4'))))\n" + 9151 " │ └─ TableAlias(a)\n" + 9152 " │ └─ IndexedTableAccess(mytable)\n" + 9153 " │ ├─ index: [mytable.s,mytable.i]\n" + 9154 " │ ├─ filters: [{(NULL, 1), [NULL, ∞)}, {(1, 2), [NULL, ∞)}, {(2, 3), [NULL, ∞)}, {(3, 4), [NULL, ∞)}, {(4, ∞), [NULL, ∞)}]\n" + 9155 " │ └─ columns: [i s]\n" + 9156 " └─ TableAlias(b)\n" + 9157 " └─ IndexedTableAccess(mytable)\n" + 9158 " ├─ index: [mytable.s]\n" + 9159 " ├─ columns: [s]\n" + 9160 " └─ keys: a.i\n" + 9161 "", 9162 }, 9163 { 9164 Query: `SELECT a.* FROM mytable a inner join mytable b on (a.i = b.s) WHERE a.i in (1, 2, 3, 4)`, 9165 ExpectedPlan: "Project\n" + 9166 " ├─ columns: [a.i:0!null, a.s:1!null]\n" + 9167 " └─ MergeJoin\n" + 9168 " ├─ cmp: Eq\n" + 9169 " │ ├─ a.i:0!null\n" + 9170 " │ └─ b.s:2!null\n" + 9171 " ├─ Filter\n" + 9172 " │ ├─ HashIn\n" + 9173 " │ │ ├─ a.i:0!null\n" + 9174 " │ │ └─ TUPLE(1 (tinyint), 2 (tinyint), 3 (tinyint), 4 (tinyint))\n" + 9175 " │ └─ TableAlias(a)\n" + 9176 " │ └─ IndexedTableAccess(mytable)\n" + 9177 " │ ├─ index: [mytable.i,mytable.s]\n" + 9178 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 9179 " │ ├─ colSet: (1,2)\n" + 9180 " │ ├─ tableId: 1\n" + 9181 " │ └─ Table\n" + 9182 " │ ├─ name: mytable\n" + 9183 " │ └─ columns: [i s]\n" + 9184 " └─ TableAlias(b)\n" + 9185 " └─ IndexedTableAccess(mytable)\n" + 9186 " ├─ index: [mytable.s]\n" + 9187 " ├─ static: [{[NULL, ∞)}]\n" + 9188 " ├─ colSet: (3,4)\n" + 9189 " ├─ tableId: 2\n" + 9190 " └─ Table\n" + 9191 " ├─ name: mytable\n" + 9192 " └─ columns: [s]\n" + 9193 "", 9194 ExpectedEstimates: "Project\n" + 9195 " ├─ columns: [a.i, a.s]\n" + 9196 " └─ MergeJoin (estimated cost=5.070 rows=2)\n" + 9197 " ├─ cmp: (a.i = b.s)\n" + 9198 " ├─ Filter\n" + 9199 " │ ├─ (a.i HASH IN (1, 2, 3, 4))\n" + 9200 " │ └─ TableAlias(a)\n" + 9201 " │ └─ IndexedTableAccess(mytable)\n" + 9202 " │ ├─ index: [mytable.i,mytable.s]\n" + 9203 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 9204 " │ └─ columns: [i s]\n" + 9205 " └─ TableAlias(b)\n" + 9206 " └─ IndexedTableAccess(mytable)\n" + 9207 " ├─ index: [mytable.s]\n" + 9208 " ├─ filters: [{[NULL, ∞)}]\n" + 9209 " └─ columns: [s]\n" + 9210 "", 9211 ExpectedAnalysis: "Project\n" + 9212 " ├─ columns: [a.i, a.s]\n" + 9213 " └─ MergeJoin (estimated cost=5.070 rows=2) (actual rows=0 loops=1)\n" + 9214 " ├─ cmp: (a.i = b.s)\n" + 9215 " ├─ Filter\n" + 9216 " │ ├─ (a.i HASH IN (1, 2, 3, 4))\n" + 9217 " │ └─ TableAlias(a)\n" + 9218 " │ └─ IndexedTableAccess(mytable)\n" + 9219 " │ ├─ index: [mytable.i,mytable.s]\n" + 9220 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 9221 " │ └─ columns: [i s]\n" + 9222 " └─ TableAlias(b)\n" + 9223 " └─ IndexedTableAccess(mytable)\n" + 9224 " ├─ index: [mytable.s]\n" + 9225 " ├─ filters: [{[NULL, ∞)}]\n" + 9226 " └─ columns: [s]\n" + 9227 "", 9228 }, 9229 { 9230 Query: `SELECT * FROM mytable WHERE i in (1, 2, 3, 4)`, 9231 ExpectedPlan: "Filter\n" + 9232 " ├─ HashIn\n" + 9233 " │ ├─ mytable.i:0!null\n" + 9234 " │ └─ TUPLE(1 (tinyint), 2 (tinyint), 3 (tinyint), 4 (tinyint))\n" + 9235 " └─ IndexedTableAccess(mytable)\n" + 9236 " ├─ index: [mytable.i]\n" + 9237 " ├─ static: [{[1, 1]}, {[2, 2]}, {[3, 3]}, {[4, 4]}]\n" + 9238 " ├─ colSet: (1,2)\n" + 9239 " ├─ tableId: 1\n" + 9240 " └─ Table\n" + 9241 " ├─ name: mytable\n" + 9242 " └─ columns: [i s]\n" + 9243 "", 9244 ExpectedEstimates: "Filter\n" + 9245 " ├─ (mytable.i HASH IN (1, 2, 3, 4))\n" + 9246 " └─ IndexedTableAccess(mytable)\n" + 9247 " ├─ index: [mytable.i]\n" + 9248 " ├─ filters: [{[1, 1]}, {[2, 2]}, {[3, 3]}, {[4, 4]}]\n" + 9249 " └─ columns: [i s]\n" + 9250 "", 9251 ExpectedAnalysis: "Filter\n" + 9252 " ├─ (mytable.i HASH IN (1, 2, 3, 4))\n" + 9253 " └─ IndexedTableAccess(mytable)\n" + 9254 " ├─ index: [mytable.i]\n" + 9255 " ├─ filters: [{[1, 1]}, {[2, 2]}, {[3, 3]}, {[4, 4]}]\n" + 9256 " └─ columns: [i s]\n" + 9257 "", 9258 }, 9259 { 9260 Query: `SELECT * FROM mytable WHERE i in (1, 1)`, 9261 ExpectedPlan: "Filter\n" + 9262 " ├─ HashIn\n" + 9263 " │ ├─ mytable.i:0!null\n" + 9264 " │ └─ TUPLE(1 (tinyint), 1 (tinyint))\n" + 9265 " └─ IndexedTableAccess(mytable)\n" + 9266 " ├─ index: [mytable.i]\n" + 9267 " ├─ static: [{[1, 1]}]\n" + 9268 " ├─ colSet: (1,2)\n" + 9269 " ├─ tableId: 1\n" + 9270 " └─ Table\n" + 9271 " ├─ name: mytable\n" + 9272 " └─ columns: [i s]\n" + 9273 "", 9274 ExpectedEstimates: "Filter\n" + 9275 " ├─ (mytable.i HASH IN (1, 1))\n" + 9276 " └─ IndexedTableAccess(mytable)\n" + 9277 " ├─ index: [mytable.i]\n" + 9278 " ├─ filters: [{[1, 1]}]\n" + 9279 " └─ columns: [i s]\n" + 9280 "", 9281 ExpectedAnalysis: "Filter\n" + 9282 " ├─ (mytable.i HASH IN (1, 1))\n" + 9283 " └─ IndexedTableAccess(mytable)\n" + 9284 " ├─ index: [mytable.i]\n" + 9285 " ├─ filters: [{[1, 1]}]\n" + 9286 " └─ columns: [i s]\n" + 9287 "", 9288 }, 9289 { 9290 Query: `SELECT * FROM mytable WHERE i in (CAST(NULL AS SIGNED), 2, 3, 4)`, 9291 ExpectedPlan: "Filter\n" + 9292 " ├─ HashIn\n" + 9293 " │ ├─ mytable.i:0!null\n" + 9294 " │ └─ TUPLE(NULL (bigint), 2 (tinyint), 3 (tinyint), 4 (tinyint))\n" + 9295 " └─ IndexedTableAccess(mytable)\n" + 9296 " ├─ index: [mytable.i]\n" + 9297 " ├─ static: [{[2, 2]}, {[3, 3]}, {[4, 4]}]\n" + 9298 " ├─ colSet: (1,2)\n" + 9299 " ├─ tableId: 1\n" + 9300 " └─ Table\n" + 9301 " ├─ name: mytable\n" + 9302 " └─ columns: [i s]\n" + 9303 "", 9304 ExpectedEstimates: "Filter\n" + 9305 " ├─ (mytable.i HASH IN (NULL, 2, 3, 4))\n" + 9306 " └─ IndexedTableAccess(mytable)\n" + 9307 " ├─ index: [mytable.i]\n" + 9308 " ├─ filters: [{[2, 2]}, {[3, 3]}, {[4, 4]}]\n" + 9309 " └─ columns: [i s]\n" + 9310 "", 9311 ExpectedAnalysis: "Filter\n" + 9312 " ├─ (mytable.i HASH IN (NULL, 2, 3, 4))\n" + 9313 " └─ IndexedTableAccess(mytable)\n" + 9314 " ├─ index: [mytable.i]\n" + 9315 " ├─ filters: [{[2, 2]}, {[3, 3]}, {[4, 4]}]\n" + 9316 " └─ columns: [i s]\n" + 9317 "", 9318 }, 9319 { 9320 Query: `SELECT * FROM mytable WHERE i in (1+2)`, 9321 ExpectedPlan: "IndexedTableAccess(mytable)\n" + 9322 " ├─ index: [mytable.i]\n" + 9323 " ├─ static: [{[3, 3]}]\n" + 9324 " ├─ colSet: (1,2)\n" + 9325 " ├─ tableId: 1\n" + 9326 " └─ Table\n" + 9327 " ├─ name: mytable\n" + 9328 " └─ columns: [i s]\n" + 9329 "", 9330 ExpectedEstimates: "IndexedTableAccess(mytable)\n" + 9331 " ├─ index: [mytable.i]\n" + 9332 " ├─ filters: [{[3, 3]}]\n" + 9333 " └─ columns: [i s]\n" + 9334 "", 9335 ExpectedAnalysis: "IndexedTableAccess(mytable)\n" + 9336 " ├─ index: [mytable.i]\n" + 9337 " ├─ filters: [{[3, 3]}]\n" + 9338 " └─ columns: [i s]\n" + 9339 "", 9340 }, 9341 { 9342 Query: `SELECT * from mytable where upper(s) IN ('FIRST ROW', 'SECOND ROW')`, 9343 ExpectedPlan: "Filter\n" + 9344 " ├─ HashIn\n" + 9345 " │ ├─ upper(mytable.s)\n" + 9346 " │ └─ TUPLE(FIRST ROW (longtext), SECOND ROW (longtext))\n" + 9347 " └─ ProcessTable\n" + 9348 " └─ Table\n" + 9349 " ├─ name: mytable\n" + 9350 " └─ columns: [i s]\n" + 9351 "", 9352 ExpectedEstimates: "Filter\n" + 9353 " ├─ (upper(mytable.s) HASH IN ('FIRST ROW', 'SECOND ROW'))\n" + 9354 " └─ Table\n" + 9355 " ├─ name: mytable\n" + 9356 " └─ columns: [i s]\n" + 9357 "", 9358 ExpectedAnalysis: "Filter\n" + 9359 " ├─ (upper(mytable.s) HASH IN ('FIRST ROW', 'SECOND ROW'))\n" + 9360 " └─ Table\n" + 9361 " ├─ name: mytable\n" + 9362 " └─ columns: [i s]\n" + 9363 "", 9364 }, 9365 { 9366 Query: `SELECT * from mytable where cast(i as CHAR) IN ('a', 'b')`, 9367 ExpectedPlan: "Filter\n" + 9368 " ├─ HashIn\n" + 9369 " │ ├─ convert\n" + 9370 " │ │ ├─ type: char\n" + 9371 " │ │ └─ mytable.i:0!null\n" + 9372 " │ └─ TUPLE(a (longtext), b (longtext))\n" + 9373 " └─ ProcessTable\n" + 9374 " └─ Table\n" + 9375 " ├─ name: mytable\n" + 9376 " └─ columns: [i s]\n" + 9377 "", 9378 ExpectedEstimates: "Filter\n" + 9379 " ├─ (convert(mytable.i, char) HASH IN ('a', 'b'))\n" + 9380 " └─ Table\n" + 9381 " ├─ name: mytable\n" + 9382 " └─ columns: [i s]\n" + 9383 "", 9384 ExpectedAnalysis: "Filter\n" + 9385 " ├─ (convert(mytable.i, char) HASH IN ('a', 'b'))\n" + 9386 " └─ Table\n" + 9387 " ├─ name: mytable\n" + 9388 " └─ columns: [i s]\n" + 9389 "", 9390 }, 9391 { 9392 Query: `SELECT * from mytable where cast(i as CHAR) IN ('1', '2')`, 9393 ExpectedPlan: "Filter\n" + 9394 " ├─ HashIn\n" + 9395 " │ ├─ convert\n" + 9396 " │ │ ├─ type: char\n" + 9397 " │ │ └─ mytable.i:0!null\n" + 9398 " │ └─ TUPLE(1 (longtext), 2 (longtext))\n" + 9399 " └─ ProcessTable\n" + 9400 " └─ Table\n" + 9401 " ├─ name: mytable\n" + 9402 " └─ columns: [i s]\n" + 9403 "", 9404 ExpectedEstimates: "Filter\n" + 9405 " ├─ (convert(mytable.i, char) HASH IN ('1', '2'))\n" + 9406 " └─ Table\n" + 9407 " ├─ name: mytable\n" + 9408 " └─ columns: [i s]\n" + 9409 "", 9410 ExpectedAnalysis: "Filter\n" + 9411 " ├─ (convert(mytable.i, char) HASH IN ('1', '2'))\n" + 9412 " └─ Table\n" + 9413 " ├─ name: mytable\n" + 9414 " └─ columns: [i s]\n" + 9415 "", 9416 }, 9417 { 9418 Query: `SELECT * from mytable where (i > 2) IN (true)`, 9419 ExpectedPlan: "Filter\n" + 9420 " ├─ HashIn\n" + 9421 " │ ├─ GreaterThan\n" + 9422 " │ │ ├─ mytable.i:0!null\n" + 9423 " │ │ └─ 2 (tinyint)\n" + 9424 " │ └─ TUPLE(true (tinyint(1)))\n" + 9425 " └─ ProcessTable\n" + 9426 " └─ Table\n" + 9427 " ├─ name: mytable\n" + 9428 " └─ columns: [i s]\n" + 9429 "", 9430 ExpectedEstimates: "Filter\n" + 9431 " ├─ ((mytable.i > 2) HASH IN (true))\n" + 9432 " └─ Table\n" + 9433 " ├─ name: mytable\n" + 9434 " └─ columns: [i s]\n" + 9435 "", 9436 ExpectedAnalysis: "Filter\n" + 9437 " ├─ ((mytable.i > 2) HASH IN (true))\n" + 9438 " └─ Table\n" + 9439 " ├─ name: mytable\n" + 9440 " └─ columns: [i s]\n" + 9441 "", 9442 }, 9443 { 9444 Query: `SELECT * from mytable where (i + 6) IN (7, 8)`, 9445 ExpectedPlan: "Filter\n" + 9446 " ├─ HashIn\n" + 9447 " │ ├─ (mytable.i:0!null + 6 (tinyint))\n" + 9448 " │ └─ TUPLE(7 (tinyint), 8 (tinyint))\n" + 9449 " └─ ProcessTable\n" + 9450 " └─ Table\n" + 9451 " ├─ name: mytable\n" + 9452 " └─ columns: [i s]\n" + 9453 "", 9454 ExpectedEstimates: "Filter\n" + 9455 " ├─ ((mytable.i + 6) HASH IN (7, 8))\n" + 9456 " └─ Table\n" + 9457 " ├─ name: mytable\n" + 9458 " └─ columns: [i s]\n" + 9459 "", 9460 ExpectedAnalysis: "Filter\n" + 9461 " ├─ ((mytable.i + 6) HASH IN (7, 8))\n" + 9462 " └─ Table\n" + 9463 " ├─ name: mytable\n" + 9464 " └─ columns: [i s]\n" + 9465 "", 9466 }, 9467 { 9468 Query: `SELECT * from mytable where (i + 40) IN (7, 8)`, 9469 ExpectedPlan: "Filter\n" + 9470 " ├─ HashIn\n" + 9471 " │ ├─ (mytable.i:0!null + 40 (tinyint))\n" + 9472 " │ └─ TUPLE(7 (tinyint), 8 (tinyint))\n" + 9473 " └─ ProcessTable\n" + 9474 " └─ Table\n" + 9475 " ├─ name: mytable\n" + 9476 " └─ columns: [i s]\n" + 9477 "", 9478 ExpectedEstimates: "Filter\n" + 9479 " ├─ ((mytable.i + 40) HASH IN (7, 8))\n" + 9480 " └─ Table\n" + 9481 " ├─ name: mytable\n" + 9482 " └─ columns: [i s]\n" + 9483 "", 9484 ExpectedAnalysis: "Filter\n" + 9485 " ├─ ((mytable.i + 40) HASH IN (7, 8))\n" + 9486 " └─ Table\n" + 9487 " ├─ name: mytable\n" + 9488 " └─ columns: [i s]\n" + 9489 "", 9490 }, 9491 { 9492 Query: `SELECT * from mytable where (i = 1 | false) IN (true)`, 9493 ExpectedPlan: "Filter\n" + 9494 " ├─ HashIn\n" + 9495 " │ ├─ Eq\n" + 9496 " │ │ ├─ mytable.i:0!null\n" + 9497 " │ │ └─ 1 (bigint)\n" + 9498 " │ └─ TUPLE(true (tinyint(1)))\n" + 9499 " └─ ProcessTable\n" + 9500 " └─ Table\n" + 9501 " ├─ name: mytable\n" + 9502 " └─ columns: [i s]\n" + 9503 "", 9504 ExpectedEstimates: "Filter\n" + 9505 " ├─ ((mytable.i = 1) HASH IN (true))\n" + 9506 " └─ Table\n" + 9507 " ├─ name: mytable\n" + 9508 " └─ columns: [i s]\n" + 9509 "", 9510 ExpectedAnalysis: "Filter\n" + 9511 " ├─ ((mytable.i = 1) HASH IN (true))\n" + 9512 " └─ Table\n" + 9513 " ├─ name: mytable\n" + 9514 " └─ columns: [i s]\n" + 9515 "", 9516 }, 9517 { 9518 Query: `SELECT * from mytable where (i = 1 & false) IN (true)`, 9519 ExpectedPlan: "Filter\n" + 9520 " ├─ HashIn\n" + 9521 " │ ├─ Eq\n" + 9522 " │ │ ├─ mytable.i:0!null\n" + 9523 " │ │ └─ 0 (bigint)\n" + 9524 " │ └─ TUPLE(true (tinyint(1)))\n" + 9525 " └─ ProcessTable\n" + 9526 " └─ Table\n" + 9527 " ├─ name: mytable\n" + 9528 " └─ columns: [i s]\n" + 9529 "", 9530 ExpectedEstimates: "Filter\n" + 9531 " ├─ ((mytable.i = 0) HASH IN (true))\n" + 9532 " └─ Table\n" + 9533 " ├─ name: mytable\n" + 9534 " └─ columns: [i s]\n" + 9535 "", 9536 ExpectedAnalysis: "Filter\n" + 9537 " ├─ ((mytable.i = 0) HASH IN (true))\n" + 9538 " └─ Table\n" + 9539 " ├─ name: mytable\n" + 9540 " └─ columns: [i s]\n" + 9541 "", 9542 }, 9543 { 9544 Query: `SELECT * FROM mytable WHERE i in (2*i)`, 9545 ExpectedPlan: "Filter\n" + 9546 " ├─ IN\n" + 9547 " │ ├─ left: mytable.i:0!null\n" + 9548 " │ └─ right: TUPLE((2 (tinyint) * mytable.i:0!null))\n" + 9549 " └─ ProcessTable\n" + 9550 " └─ Table\n" + 9551 " ├─ name: mytable\n" + 9552 " └─ columns: [i s]\n" + 9553 "", 9554 ExpectedEstimates: "Filter\n" + 9555 " ├─ (mytable.i IN ((2 * mytable.i)))\n" + 9556 " └─ Table\n" + 9557 " ├─ name: mytable\n" + 9558 " └─ columns: [i s]\n" + 9559 "", 9560 ExpectedAnalysis: "Filter\n" + 9561 " ├─ (mytable.i IN ((2 * mytable.i)))\n" + 9562 " └─ Table\n" + 9563 " ├─ name: mytable\n" + 9564 " └─ columns: [i s]\n" + 9565 "", 9566 }, 9567 { 9568 Query: `SELECT * FROM mytable WHERE i in (i)`, 9569 ExpectedPlan: "Filter\n" + 9570 " ├─ IN\n" + 9571 " │ ├─ left: mytable.i:0!null\n" + 9572 " │ └─ right: TUPLE(mytable.i:0!null)\n" + 9573 " └─ ProcessTable\n" + 9574 " └─ Table\n" + 9575 " ├─ name: mytable\n" + 9576 " └─ columns: [i s]\n" + 9577 "", 9578 ExpectedEstimates: "Filter\n" + 9579 " ├─ (mytable.i IN (mytable.i))\n" + 9580 " └─ Table\n" + 9581 " ├─ name: mytable\n" + 9582 " └─ columns: [i s]\n" + 9583 "", 9584 ExpectedAnalysis: "Filter\n" + 9585 " ├─ (mytable.i IN (mytable.i))\n" + 9586 " └─ Table\n" + 9587 " ├─ name: mytable\n" + 9588 " └─ columns: [i s]\n" + 9589 "", 9590 }, 9591 { 9592 Query: `SELECT * from mytable WHERE 4 IN (i + 2)`, 9593 ExpectedPlan: "Filter\n" + 9594 " ├─ IN\n" + 9595 " │ ├─ left: 4 (tinyint)\n" + 9596 " │ └─ right: TUPLE((mytable.i:0!null + 2 (tinyint)))\n" + 9597 " └─ ProcessTable\n" + 9598 " └─ Table\n" + 9599 " ├─ name: mytable\n" + 9600 " └─ columns: [i s]\n" + 9601 "", 9602 ExpectedEstimates: "Filter\n" + 9603 " ├─ (4 IN ((mytable.i + 2)))\n" + 9604 " └─ Table\n" + 9605 " ├─ name: mytable\n" + 9606 " └─ columns: [i s]\n" + 9607 "", 9608 ExpectedAnalysis: "Filter\n" + 9609 " ├─ (4 IN ((mytable.i + 2)))\n" + 9610 " └─ Table\n" + 9611 " ├─ name: mytable\n" + 9612 " └─ columns: [i s]\n" + 9613 "", 9614 }, 9615 { 9616 Query: `SELECT * from mytable WHERE s IN (cast('first row' AS CHAR))`, 9617 ExpectedPlan: "Filter\n" + 9618 " ├─ HashIn\n" + 9619 " │ ├─ mytable.s:1!null\n" + 9620 " │ └─ TUPLE(first row (longtext))\n" + 9621 " └─ IndexedTableAccess(mytable)\n" + 9622 " ├─ index: [mytable.s]\n" + 9623 " ├─ static: [{[first row, first row]}]\n" + 9624 " ├─ colSet: (1,2)\n" + 9625 " ├─ tableId: 1\n" + 9626 " └─ Table\n" + 9627 " ├─ name: mytable\n" + 9628 " └─ columns: [i s]\n" + 9629 "", 9630 ExpectedEstimates: "Filter\n" + 9631 " ├─ (mytable.s HASH IN ('first row'))\n" + 9632 " └─ IndexedTableAccess(mytable)\n" + 9633 " ├─ index: [mytable.s]\n" + 9634 " ├─ filters: [{[first row, first row]}]\n" + 9635 " └─ columns: [i s]\n" + 9636 "", 9637 ExpectedAnalysis: "Filter\n" + 9638 " ├─ (mytable.s HASH IN ('first row'))\n" + 9639 " └─ IndexedTableAccess(mytable)\n" + 9640 " ├─ index: [mytable.s]\n" + 9641 " ├─ filters: [{[first row, first row]}]\n" + 9642 " └─ columns: [i s]\n" + 9643 "", 9644 }, 9645 { 9646 Query: `SELECT * from mytable WHERE s IN (lower('SECOND ROW'), 'FIRST ROW')`, 9647 ExpectedPlan: "Filter\n" + 9648 " ├─ HashIn\n" + 9649 " │ ├─ mytable.s:1!null\n" + 9650 " │ └─ TUPLE(second row (longtext), FIRST ROW (longtext))\n" + 9651 " └─ IndexedTableAccess(mytable)\n" + 9652 " ├─ index: [mytable.s]\n" + 9653 " ├─ static: [{[FIRST ROW, FIRST ROW]}, {[second row, second row]}]\n" + 9654 " ├─ colSet: (1,2)\n" + 9655 " ├─ tableId: 1\n" + 9656 " └─ Table\n" + 9657 " ├─ name: mytable\n" + 9658 " └─ columns: [i s]\n" + 9659 "", 9660 ExpectedEstimates: "Filter\n" + 9661 " ├─ (mytable.s HASH IN ('second row', 'FIRST ROW'))\n" + 9662 " └─ IndexedTableAccess(mytable)\n" + 9663 " ├─ index: [mytable.s]\n" + 9664 " ├─ filters: [{[FIRST ROW, FIRST ROW]}, {[second row, second row]}]\n" + 9665 " └─ columns: [i s]\n" + 9666 "", 9667 ExpectedAnalysis: "Filter\n" + 9668 " ├─ (mytable.s HASH IN ('second row', 'FIRST ROW'))\n" + 9669 " └─ IndexedTableAccess(mytable)\n" + 9670 " ├─ index: [mytable.s]\n" + 9671 " ├─ filters: [{[FIRST ROW, FIRST ROW]}, {[second row, second row]}]\n" + 9672 " └─ columns: [i s]\n" + 9673 "", 9674 }, 9675 { 9676 Query: `SELECT * from mytable where true IN (i > 3)`, 9677 ExpectedPlan: "Filter\n" + 9678 " ├─ IN\n" + 9679 " │ ├─ left: true (tinyint(1))\n" + 9680 " │ └─ right: TUPLE(GreaterThan\n" + 9681 " │ ├─ mytable.i:0!null\n" + 9682 " │ └─ 3 (tinyint)\n" + 9683 " │ )\n" + 9684 " └─ ProcessTable\n" + 9685 " └─ Table\n" + 9686 " ├─ name: mytable\n" + 9687 " └─ columns: [i s]\n" + 9688 "", 9689 ExpectedEstimates: "Filter\n" + 9690 " ├─ (true IN ((mytable.i > 3)))\n" + 9691 " └─ Table\n" + 9692 " ├─ name: mytable\n" + 9693 " └─ columns: [i s]\n" + 9694 "", 9695 ExpectedAnalysis: "Filter\n" + 9696 " ├─ (true IN ((mytable.i > 3)))\n" + 9697 " └─ Table\n" + 9698 " ├─ name: mytable\n" + 9699 " └─ columns: [i s]\n" + 9700 "", 9701 }, 9702 { 9703 Query: `SELECT a.* FROM mytable a, mytable b where a.i = b.i`, 9704 ExpectedPlan: "Project\n" + 9705 " ├─ columns: [a.i:0!null, a.s:1!null]\n" + 9706 " └─ MergeJoin\n" + 9707 " ├─ cmp: Eq\n" + 9708 " │ ├─ a.i:0!null\n" + 9709 " │ └─ b.i:2!null\n" + 9710 " ├─ TableAlias(a)\n" + 9711 " │ └─ IndexedTableAccess(mytable)\n" + 9712 " │ ├─ index: [mytable.i,mytable.s]\n" + 9713 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 9714 " │ ├─ colSet: (1,2)\n" + 9715 " │ ├─ tableId: 1\n" + 9716 " │ └─ Table\n" + 9717 " │ ├─ name: mytable\n" + 9718 " │ └─ columns: [i s]\n" + 9719 " └─ TableAlias(b)\n" + 9720 " └─ IndexedTableAccess(mytable)\n" + 9721 " ├─ index: [mytable.i]\n" + 9722 " ├─ static: [{[NULL, ∞)}]\n" + 9723 " ├─ colSet: (3,4)\n" + 9724 " ├─ tableId: 2\n" + 9725 " └─ Table\n" + 9726 " ├─ name: mytable\n" + 9727 " └─ columns: [i]\n" + 9728 "", 9729 ExpectedEstimates: "Project\n" + 9730 " ├─ columns: [a.i, a.s]\n" + 9731 " └─ MergeJoin (estimated cost=6.090 rows=3)\n" + 9732 " ├─ cmp: (a.i = b.i)\n" + 9733 " ├─ TableAlias(a)\n" + 9734 " │ └─ IndexedTableAccess(mytable)\n" + 9735 " │ ├─ index: [mytable.i,mytable.s]\n" + 9736 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 9737 " │ └─ columns: [i s]\n" + 9738 " └─ TableAlias(b)\n" + 9739 " └─ IndexedTableAccess(mytable)\n" + 9740 " ├─ index: [mytable.i]\n" + 9741 " ├─ filters: [{[NULL, ∞)}]\n" + 9742 " └─ columns: [i]\n" + 9743 "", 9744 ExpectedAnalysis: "Project\n" + 9745 " ├─ columns: [a.i, a.s]\n" + 9746 " └─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=1)\n" + 9747 " ├─ cmp: (a.i = b.i)\n" + 9748 " ├─ TableAlias(a)\n" + 9749 " │ └─ IndexedTableAccess(mytable)\n" + 9750 " │ ├─ index: [mytable.i,mytable.s]\n" + 9751 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 9752 " │ └─ columns: [i s]\n" + 9753 " └─ TableAlias(b)\n" + 9754 " └─ IndexedTableAccess(mytable)\n" + 9755 " ├─ index: [mytable.i]\n" + 9756 " ├─ filters: [{[NULL, ∞)}]\n" + 9757 " └─ columns: [i]\n" + 9758 "", 9759 }, 9760 { 9761 Query: `SELECT a.* FROM mytable a, mytable b where a.s = b.i OR a.i = 1`, 9762 ExpectedPlan: "Project\n" + 9763 " ├─ columns: [a.i:1!null, a.s:2!null]\n" + 9764 " └─ LookupJoin\n" + 9765 " ├─ Or\n" + 9766 " │ ├─ Eq\n" + 9767 " │ │ ├─ a.s:2!null\n" + 9768 " │ │ └─ b.i:0!null\n" + 9769 " │ └─ Eq\n" + 9770 " │ ├─ a.i:1!null\n" + 9771 " │ └─ 1 (tinyint)\n" + 9772 " ├─ TableAlias(b)\n" + 9773 " │ └─ ProcessTable\n" + 9774 " │ └─ Table\n" + 9775 " │ ├─ name: mytable\n" + 9776 " │ └─ columns: [i]\n" + 9777 " └─ TableAlias(a)\n" + 9778 " └─ Concat\n" + 9779 " ├─ TableAlias(a)\n" + 9780 " │ └─ IndexedTableAccess(mytable)\n" + 9781 " │ ├─ index: [mytable.i]\n" + 9782 " │ ├─ keys: [1 (tinyint)]\n" + 9783 " │ ├─ colSet: (1,2)\n" + 9784 " │ ├─ tableId: 1\n" + 9785 " │ └─ Table\n" + 9786 " │ ├─ name: mytable\n" + 9787 " │ └─ columns: [i s]\n" + 9788 " └─ TableAlias(a)\n" + 9789 " └─ IndexedTableAccess(mytable)\n" + 9790 " ├─ index: [mytable.s,mytable.i]\n" + 9791 " ├─ keys: [b.i:0!null]\n" + 9792 " ├─ colSet: (1,2)\n" + 9793 " ├─ tableId: 1\n" + 9794 " └─ Table\n" + 9795 " ├─ name: mytable\n" + 9796 " └─ columns: [i s]\n" + 9797 "", 9798 ExpectedEstimates: "Project\n" + 9799 " ├─ columns: [a.i, a.s]\n" + 9800 " └─ LookupJoin (estimated cost=-2.705 rows=3)\n" + 9801 " ├─ ((a.s = b.i) OR (a.i = 1))\n" + 9802 " ├─ TableAlias(b)\n" + 9803 " │ └─ Table\n" + 9804 " │ ├─ name: mytable\n" + 9805 " │ └─ columns: [i]\n" + 9806 " └─ TableAlias(a)\n" + 9807 " └─ Concat\n" + 9808 " ├─ TableAlias(a)\n" + 9809 " │ └─ IndexedTableAccess(mytable)\n" + 9810 " │ ├─ index: [mytable.i]\n" + 9811 " │ ├─ columns: [i s]\n" + 9812 " │ └─ keys: 1\n" + 9813 " └─ TableAlias(a)\n" + 9814 " └─ IndexedTableAccess(mytable)\n" + 9815 " ├─ index: [mytable.s,mytable.i]\n" + 9816 " ├─ columns: [i s]\n" + 9817 " └─ keys: b.i\n" + 9818 "", 9819 ExpectedAnalysis: "Project\n" + 9820 " ├─ columns: [a.i, a.s]\n" + 9821 " └─ LookupJoin (estimated cost=-2.705 rows=3) (actual rows=3 loops=1)\n" + 9822 " ├─ ((a.s = b.i) OR (a.i = 1))\n" + 9823 " ├─ TableAlias(b)\n" + 9824 " │ └─ Table\n" + 9825 " │ ├─ name: mytable\n" + 9826 " │ └─ columns: [i]\n" + 9827 " └─ TableAlias(a)\n" + 9828 " └─ Concat\n" + 9829 " ├─ TableAlias(a)\n" + 9830 " │ └─ IndexedTableAccess(mytable)\n" + 9831 " │ ├─ index: [mytable.i]\n" + 9832 " │ ├─ columns: [i s]\n" + 9833 " │ └─ keys: 1\n" + 9834 " └─ TableAlias(a)\n" + 9835 " └─ IndexedTableAccess(mytable)\n" + 9836 " ├─ index: [mytable.s,mytable.i]\n" + 9837 " ├─ columns: [i s]\n" + 9838 " └─ keys: b.i\n" + 9839 "", 9840 }, 9841 { 9842 Query: `SELECT a.* FROM mytable a, mytable b where NOT(a.i = b.s OR a.s = b.i)`, 9843 ExpectedPlan: "Project\n" + 9844 " ├─ columns: [a.i:2!null, a.s:3!null]\n" + 9845 " └─ InnerJoin\n" + 9846 " ├─ AND\n" + 9847 " │ ├─ NOT\n" + 9848 " │ │ └─ Eq\n" + 9849 " │ │ ├─ a.i:2!null\n" + 9850 " │ │ └─ b.s:1!null\n" + 9851 " │ └─ NOT\n" + 9852 " │ └─ Eq\n" + 9853 " │ ├─ a.s:3!null\n" + 9854 " │ └─ b.i:0!null\n" + 9855 " ├─ TableAlias(b)\n" + 9856 " │ └─ ProcessTable\n" + 9857 " │ └─ Table\n" + 9858 " │ ├─ name: mytable\n" + 9859 " │ └─ columns: [i s]\n" + 9860 " └─ TableAlias(a)\n" + 9861 " └─ Table\n" + 9862 " ├─ name: mytable\n" + 9863 " ├─ columns: [i s]\n" + 9864 " ├─ colSet: (1,2)\n" + 9865 " └─ tableId: 1\n" + 9866 "", 9867 ExpectedEstimates: "Project\n" + 9868 " ├─ columns: [a.i, a.s]\n" + 9869 " └─ InnerJoin (estimated cost=10.090 rows=3)\n" + 9870 " ├─ ((NOT((a.i = b.s))) AND (NOT((a.s = b.i))))\n" + 9871 " ├─ TableAlias(b)\n" + 9872 " │ └─ Table\n" + 9873 " │ ├─ name: mytable\n" + 9874 " │ └─ columns: [i s]\n" + 9875 " └─ TableAlias(a)\n" + 9876 " └─ Table\n" + 9877 " ├─ name: mytable\n" + 9878 " └─ columns: [i s]\n" + 9879 "", 9880 ExpectedAnalysis: "Project\n" + 9881 " ├─ columns: [a.i, a.s]\n" + 9882 " └─ InnerJoin (estimated cost=10.090 rows=3) (actual rows=9 loops=1)\n" + 9883 " ├─ ((NOT((a.i = b.s))) AND (NOT((a.s = b.i))))\n" + 9884 " ├─ TableAlias(b)\n" + 9885 " │ └─ Table\n" + 9886 " │ ├─ name: mytable\n" + 9887 " │ └─ columns: [i s]\n" + 9888 " └─ TableAlias(a)\n" + 9889 " └─ Table\n" + 9890 " ├─ name: mytable\n" + 9891 " └─ columns: [i s]\n" + 9892 "", 9893 }, 9894 { 9895 Query: `SELECT a.* FROM mytable a, mytable b where a.i = b.s OR a.s = b.i IS FALSE`, 9896 ExpectedPlan: "Project\n" + 9897 " ├─ columns: [a.i:2!null, a.s:3!null]\n" + 9898 " └─ InnerJoin\n" + 9899 " ├─ Or\n" + 9900 " │ ├─ Eq\n" + 9901 " │ │ ├─ a.i:2!null\n" + 9902 " │ │ └─ b.s:1!null\n" + 9903 " │ └─ (a.s = b.i) IS FALSE\n" + 9904 " ├─ TableAlias(b)\n" + 9905 " │ └─ ProcessTable\n" + 9906 " │ └─ Table\n" + 9907 " │ ├─ name: mytable\n" + 9908 " │ └─ columns: [i s]\n" + 9909 " └─ TableAlias(a)\n" + 9910 " └─ Table\n" + 9911 " ├─ name: mytable\n" + 9912 " ├─ columns: [i s]\n" + 9913 " ├─ colSet: (1,2)\n" + 9914 " └─ tableId: 1\n" + 9915 "", 9916 ExpectedEstimates: "Project\n" + 9917 " ├─ columns: [a.i, a.s]\n" + 9918 " └─ InnerJoin (estimated cost=10.090 rows=3)\n" + 9919 " ├─ ((a.i = b.s) OR (a.s = b.i) IS FALSE)\n" + 9920 " ├─ TableAlias(b)\n" + 9921 " │ └─ Table\n" + 9922 " │ ├─ name: mytable\n" + 9923 " │ └─ columns: [i s]\n" + 9924 " └─ TableAlias(a)\n" + 9925 " └─ Table\n" + 9926 " ├─ name: mytable\n" + 9927 " └─ columns: [i s]\n" + 9928 "", 9929 ExpectedAnalysis: "Project\n" + 9930 " ├─ columns: [a.i, a.s]\n" + 9931 " └─ InnerJoin (estimated cost=10.090 rows=3) (actual rows=9 loops=1)\n" + 9932 " ├─ ((a.i = b.s) OR (a.s = b.i) IS FALSE)\n" + 9933 " ├─ TableAlias(b)\n" + 9934 " │ └─ Table\n" + 9935 " │ ├─ name: mytable\n" + 9936 " │ └─ columns: [i s]\n" + 9937 " └─ TableAlias(a)\n" + 9938 " └─ Table\n" + 9939 " ├─ name: mytable\n" + 9940 " └─ columns: [i s]\n" + 9941 "", 9942 }, 9943 { 9944 Query: `SELECT a.* FROM mytable a, mytable b where a.i >= b.i`, 9945 ExpectedPlan: "Project\n" + 9946 " ├─ columns: [a.i:1!null, a.s:2!null]\n" + 9947 " └─ InnerJoin\n" + 9948 " ├─ GreaterThanOrEqual\n" + 9949 " │ ├─ a.i:1!null\n" + 9950 " │ └─ b.i:0!null\n" + 9951 " ├─ TableAlias(b)\n" + 9952 " │ └─ ProcessTable\n" + 9953 " │ └─ Table\n" + 9954 " │ ├─ name: mytable\n" + 9955 " │ └─ columns: [i]\n" + 9956 " └─ TableAlias(a)\n" + 9957 " └─ Table\n" + 9958 " ├─ name: mytable\n" + 9959 " ├─ columns: [i s]\n" + 9960 " ├─ colSet: (1,2)\n" + 9961 " └─ tableId: 1\n" + 9962 "", 9963 ExpectedEstimates: "Project\n" + 9964 " ├─ columns: [a.i, a.s]\n" + 9965 " └─ InnerJoin (estimated cost=10.090 rows=3)\n" + 9966 " ├─ (a.i >= b.i)\n" + 9967 " ├─ TableAlias(b)\n" + 9968 " │ └─ Table\n" + 9969 " │ ├─ name: mytable\n" + 9970 " │ └─ columns: [i]\n" + 9971 " └─ TableAlias(a)\n" + 9972 " └─ Table\n" + 9973 " ├─ name: mytable\n" + 9974 " └─ columns: [i s]\n" + 9975 "", 9976 ExpectedAnalysis: "Project\n" + 9977 " ├─ columns: [a.i, a.s]\n" + 9978 " └─ InnerJoin (estimated cost=10.090 rows=3) (actual rows=6 loops=1)\n" + 9979 " ├─ (a.i >= b.i)\n" + 9980 " ├─ TableAlias(b)\n" + 9981 " │ └─ Table\n" + 9982 " │ ├─ name: mytable\n" + 9983 " │ └─ columns: [i]\n" + 9984 " └─ TableAlias(a)\n" + 9985 " └─ Table\n" + 9986 " ├─ name: mytable\n" + 9987 " └─ columns: [i s]\n" + 9988 "", 9989 }, 9990 { 9991 Query: `SELECT a.* FROM mytable a, mytable b where a.i = a.s`, 9992 ExpectedPlan: "CrossJoin\n" + 9993 " ├─ TableAlias(b)\n" + 9994 " │ └─ ProcessTable\n" + 9995 " │ └─ Table\n" + 9996 " │ ├─ name: mytable\n" + 9997 " │ └─ columns: []\n" + 9998 " └─ Filter\n" + 9999 " ├─ Eq\n" + 10000 " │ ├─ a.i:0!null\n" + 10001 " │ └─ a.s:1!null\n" + 10002 " └─ TableAlias(a)\n" + 10003 " └─ Table\n" + 10004 " ├─ name: mytable\n" + 10005 " ├─ columns: [i s]\n" + 10006 " ├─ colSet: (1,2)\n" + 10007 " └─ tableId: 1\n" + 10008 "", 10009 ExpectedEstimates: "CrossJoin (estimated cost=7.060 rows=2)\n" + 10010 " ├─ TableAlias(b)\n" + 10011 " │ └─ Table\n" + 10012 " │ ├─ name: mytable\n" + 10013 " │ └─ columns: []\n" + 10014 " └─ Filter\n" + 10015 " ├─ (a.i = a.s)\n" + 10016 " └─ TableAlias(a)\n" + 10017 " └─ Table\n" + 10018 " ├─ name: mytable\n" + 10019 " └─ columns: [i s]\n" + 10020 "", 10021 ExpectedAnalysis: "CrossJoin (estimated cost=7.060 rows=2) (actual rows=0 loops=1)\n" + 10022 " ├─ TableAlias(b)\n" + 10023 " │ └─ Table\n" + 10024 " │ ├─ name: mytable\n" + 10025 " │ └─ columns: []\n" + 10026 " └─ Filter\n" + 10027 " ├─ (a.i = a.s)\n" + 10028 " └─ TableAlias(a)\n" + 10029 " └─ Table\n" + 10030 " ├─ name: mytable\n" + 10031 " └─ columns: [i s]\n" + 10032 "", 10033 }, 10034 { 10035 Query: `SELECT a.* FROM mytable a, mytable b where a.i in (2, 432, 7)`, 10036 ExpectedPlan: "CrossJoin\n" + 10037 " ├─ TableAlias(b)\n" + 10038 " │ └─ ProcessTable\n" + 10039 " │ └─ Table\n" + 10040 " │ ├─ name: mytable\n" + 10041 " │ └─ columns: []\n" + 10042 " └─ Filter\n" + 10043 " ├─ HashIn\n" + 10044 " │ ├─ a.i:0!null\n" + 10045 " │ └─ TUPLE(2 (tinyint), 432 (smallint), 7 (tinyint))\n" + 10046 " └─ TableAlias(a)\n" + 10047 " └─ IndexedTableAccess(mytable)\n" + 10048 " ├─ index: [mytable.i]\n" + 10049 " ├─ static: [{[2, 2]}, {[7, 7]}, {[432, 432]}]\n" + 10050 " ├─ colSet: (1,2)\n" + 10051 " ├─ tableId: 1\n" + 10052 " └─ Table\n" + 10053 " ├─ name: mytable\n" + 10054 " └─ columns: [i s]\n" + 10055 "", 10056 ExpectedEstimates: "CrossJoin (estimated cost=7.060 rows=2)\n" + 10057 " ├─ TableAlias(b)\n" + 10058 " │ └─ Table\n" + 10059 " │ ├─ name: mytable\n" + 10060 " │ └─ columns: []\n" + 10061 " └─ Filter\n" + 10062 " ├─ (a.i HASH IN (2, 432, 7))\n" + 10063 " └─ TableAlias(a)\n" + 10064 " └─ IndexedTableAccess(mytable)\n" + 10065 " ├─ index: [mytable.i]\n" + 10066 " ├─ filters: [{[2, 2]}, {[7, 7]}, {[432, 432]}]\n" + 10067 " └─ columns: [i s]\n" + 10068 "", 10069 ExpectedAnalysis: "CrossJoin (estimated cost=7.060 rows=2) (actual rows=3 loops=1)\n" + 10070 " ├─ TableAlias(b)\n" + 10071 " │ └─ Table\n" + 10072 " │ ├─ name: mytable\n" + 10073 " │ └─ columns: []\n" + 10074 " └─ Filter\n" + 10075 " ├─ (a.i HASH IN (2, 432, 7))\n" + 10076 " └─ TableAlias(a)\n" + 10077 " └─ IndexedTableAccess(mytable)\n" + 10078 " ├─ index: [mytable.i]\n" + 10079 " ├─ filters: [{[2, 2]}, {[7, 7]}, {[432, 432]}]\n" + 10080 " └─ columns: [i s]\n" + 10081 "", 10082 }, 10083 { 10084 Query: `SELECT a.* FROM mytable a, mytable b, mytable c, mytable d where a.i = b.i AND b.i = c.i AND c.i = d.i AND c.i = 2`, 10085 ExpectedPlan: "Project\n" + 10086 " ├─ columns: [a.i:0!null, a.s:1!null]\n" + 10087 " └─ InnerJoin\n" + 10088 " ├─ AND\n" + 10089 " │ ├─ AND\n" + 10090 " │ │ ├─ AND\n" + 10091 " │ │ │ ├─ Eq\n" + 10092 " │ │ │ │ ├─ a.i:0!null\n" + 10093 " │ │ │ │ └─ b.i:3!null\n" + 10094 " │ │ │ └─ Eq\n" + 10095 " │ │ │ ├─ c.i:4!null\n" + 10096 " │ │ │ └─ d.i:2!null\n" + 10097 " │ │ └─ Eq\n" + 10098 " │ │ ├─ a.i:0!null\n" + 10099 " │ │ └─ c.i:4!null\n" + 10100 " │ └─ Eq\n" + 10101 " │ ├─ b.i:3!null\n" + 10102 " │ └─ d.i:2!null\n" + 10103 " ├─ MergeJoin\n" + 10104 " │ ├─ cmp: Eq\n" + 10105 " │ │ ├─ a.i:0!null\n" + 10106 " │ │ └─ d.i:2!null\n" + 10107 " │ ├─ TableAlias(a)\n" + 10108 " │ │ └─ IndexedTableAccess(mytable)\n" + 10109 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 10110 " │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 10111 " │ │ ├─ colSet: (1,2)\n" + 10112 " │ │ ├─ tableId: 1\n" + 10113 " │ │ └─ Table\n" + 10114 " │ │ ├─ name: mytable\n" + 10115 " │ │ └─ columns: [i s]\n" + 10116 " │ └─ TableAlias(d)\n" + 10117 " │ └─ IndexedTableAccess(mytable)\n" + 10118 " │ ├─ index: [mytable.i]\n" + 10119 " │ ├─ static: [{[NULL, ∞)}]\n" + 10120 " │ ├─ colSet: (7,8)\n" + 10121 " │ ├─ tableId: 4\n" + 10122 " │ └─ Table\n" + 10123 " │ ├─ name: mytable\n" + 10124 " │ └─ columns: [i]\n" + 10125 " └─ MergeJoin\n" + 10126 " ├─ cmp: Eq\n" + 10127 " │ ├─ b.i:3!null\n" + 10128 " │ └─ c.i:4!null\n" + 10129 " ├─ TableAlias(b)\n" + 10130 " │ └─ IndexedTableAccess(mytable)\n" + 10131 " │ ├─ index: [mytable.i,mytable.s]\n" + 10132 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 10133 " │ ├─ colSet: (3,4)\n" + 10134 " │ ├─ tableId: 2\n" + 10135 " │ └─ Table\n" + 10136 " │ ├─ name: mytable\n" + 10137 " │ └─ columns: [i]\n" + 10138 " └─ Filter\n" + 10139 " ├─ Eq\n" + 10140 " │ ├─ c.i:0!null\n" + 10141 " │ └─ 2 (tinyint)\n" + 10142 " └─ TableAlias(c)\n" + 10143 " └─ IndexedTableAccess(mytable)\n" + 10144 " ├─ index: [mytable.i]\n" + 10145 " ├─ static: [{[2, 2]}]\n" + 10146 " ├─ colSet: (5,6)\n" + 10147 " ├─ tableId: 3\n" + 10148 " └─ Table\n" + 10149 " ├─ name: mytable\n" + 10150 " └─ columns: [i]\n" + 10151 "", 10152 ExpectedEstimates: "Project\n" + 10153 " ├─ columns: [a.i, a.s]\n" + 10154 " └─ InnerJoin (estimated cost=10.090 rows=3)\n" + 10155 " ├─ ((((a.i = b.i) AND (c.i = d.i)) AND (a.i = c.i)) AND (b.i = d.i))\n" + 10156 " ├─ MergeJoin (estimated cost=6.090 rows=3)\n" + 10157 " │ ├─ cmp: (a.i = d.i)\n" + 10158 " │ ├─ TableAlias(a)\n" + 10159 " │ │ └─ IndexedTableAccess(mytable)\n" + 10160 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 10161 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 10162 " │ │ └─ columns: [i s]\n" + 10163 " │ └─ TableAlias(d)\n" + 10164 " │ └─ IndexedTableAccess(mytable)\n" + 10165 " │ ├─ index: [mytable.i]\n" + 10166 " │ ├─ filters: [{[NULL, ∞)}]\n" + 10167 " │ └─ columns: [i]\n" + 10168 " └─ MergeJoin (estimated cost=6.090 rows=3)\n" + 10169 " ├─ cmp: (b.i = c.i)\n" + 10170 " ├─ TableAlias(b)\n" + 10171 " │ └─ IndexedTableAccess(mytable)\n" + 10172 " │ ├─ index: [mytable.i,mytable.s]\n" + 10173 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 10174 " │ └─ columns: [i]\n" + 10175 " └─ Filter\n" + 10176 " ├─ (c.i = 2)\n" + 10177 " └─ TableAlias(c)\n" + 10178 " └─ IndexedTableAccess(mytable)\n" + 10179 " ├─ index: [mytable.i]\n" + 10180 " ├─ filters: [{[2, 2]}]\n" + 10181 " └─ columns: [i]\n" + 10182 "", 10183 ExpectedAnalysis: "Project\n" + 10184 " ├─ columns: [a.i, a.s]\n" + 10185 " └─ InnerJoin (estimated cost=10.090 rows=3) (actual rows=1 loops=1)\n" + 10186 " ├─ ((((a.i = b.i) AND (c.i = d.i)) AND (a.i = c.i)) AND (b.i = d.i))\n" + 10187 " ├─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=1)\n" + 10188 " │ ├─ cmp: (a.i = d.i)\n" + 10189 " │ ├─ TableAlias(a)\n" + 10190 " │ │ └─ IndexedTableAccess(mytable)\n" + 10191 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 10192 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 10193 " │ │ └─ columns: [i s]\n" + 10194 " │ └─ TableAlias(d)\n" + 10195 " │ └─ IndexedTableAccess(mytable)\n" + 10196 " │ ├─ index: [mytable.i]\n" + 10197 " │ ├─ filters: [{[NULL, ∞)}]\n" + 10198 " │ └─ columns: [i]\n" + 10199 " └─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=1 loops=3)\n" + 10200 " ├─ cmp: (b.i = c.i)\n" + 10201 " ├─ TableAlias(b)\n" + 10202 " │ └─ IndexedTableAccess(mytable)\n" + 10203 " │ ├─ index: [mytable.i,mytable.s]\n" + 10204 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 10205 " │ └─ columns: [i]\n" + 10206 " └─ Filter\n" + 10207 " ├─ (c.i = 2)\n" + 10208 " └─ TableAlias(c)\n" + 10209 " └─ IndexedTableAccess(mytable)\n" + 10210 " ├─ index: [mytable.i]\n" + 10211 " ├─ filters: [{[2, 2]}]\n" + 10212 " └─ columns: [i]\n" + 10213 "", 10214 }, 10215 { 10216 Query: `SELECT a.* FROM mytable a, mytable b, mytable c, mytable d where a.i = b.i AND b.i = c.i AND (c.i = d.s OR c.i = 2)`, 10217 ExpectedPlan: "Project\n" + 10218 " ├─ columns: [a.i:2!null, a.s:3!null]\n" + 10219 " └─ InnerJoin\n" + 10220 " ├─ AND\n" + 10221 " │ ├─ Eq\n" + 10222 " │ │ ├─ b.i:4!null\n" + 10223 " │ │ └─ c.i:1!null\n" + 10224 " │ └─ Eq\n" + 10225 " │ ├─ a.i:2!null\n" + 10226 " │ └─ c.i:1!null\n" + 10227 " ├─ LookupJoin\n" + 10228 " │ ├─ Or\n" + 10229 " │ │ ├─ Eq\n" + 10230 " │ │ │ ├─ c.i:1!null\n" + 10231 " │ │ │ └─ d.s:0!null\n" + 10232 " │ │ └─ Eq\n" + 10233 " │ │ ├─ c.i:1!null\n" + 10234 " │ │ └─ 2 (tinyint)\n" + 10235 " │ ├─ TableAlias(d)\n" + 10236 " │ │ └─ ProcessTable\n" + 10237 " │ │ └─ Table\n" + 10238 " │ │ ├─ name: mytable\n" + 10239 " │ │ └─ columns: [s]\n" + 10240 " │ └─ TableAlias(c)\n" + 10241 " │ └─ Concat\n" + 10242 " │ ├─ TableAlias(c)\n" + 10243 " │ │ └─ IndexedTableAccess(mytable)\n" + 10244 " │ │ ├─ index: [mytable.i]\n" + 10245 " │ │ ├─ keys: [2 (tinyint)]\n" + 10246 " │ │ ├─ colSet: (5,6)\n" + 10247 " │ │ ├─ tableId: 3\n" + 10248 " │ │ └─ Table\n" + 10249 " │ │ ├─ name: mytable\n" + 10250 " │ │ └─ columns: [i]\n" + 10251 " │ └─ TableAlias(c)\n" + 10252 " │ └─ IndexedTableAccess(mytable)\n" + 10253 " │ ├─ index: [mytable.i]\n" + 10254 " │ ├─ keys: [d.s:0!null]\n" + 10255 " │ ├─ colSet: (5,6)\n" + 10256 " │ ├─ tableId: 3\n" + 10257 " │ └─ Table\n" + 10258 " │ ├─ name: mytable\n" + 10259 " │ └─ columns: [i]\n" + 10260 " └─ MergeJoin\n" + 10261 " ├─ cmp: Eq\n" + 10262 " │ ├─ a.i:2!null\n" + 10263 " │ └─ b.i:4!null\n" + 10264 " ├─ TableAlias(a)\n" + 10265 " │ └─ IndexedTableAccess(mytable)\n" + 10266 " │ ├─ index: [mytable.i,mytable.s]\n" + 10267 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 10268 " │ ├─ colSet: (1,2)\n" + 10269 " │ ├─ tableId: 1\n" + 10270 " │ └─ Table\n" + 10271 " │ ├─ name: mytable\n" + 10272 " │ └─ columns: [i s]\n" + 10273 " └─ TableAlias(b)\n" + 10274 " └─ IndexedTableAccess(mytable)\n" + 10275 " ├─ index: [mytable.i]\n" + 10276 " ├─ static: [{[NULL, ∞)}]\n" + 10277 " ├─ colSet: (3,4)\n" + 10278 " ├─ tableId: 2\n" + 10279 " └─ Table\n" + 10280 " ├─ name: mytable\n" + 10281 " └─ columns: [i]\n" + 10282 "", 10283 ExpectedEstimates: "Project\n" + 10284 " ├─ columns: [a.i, a.s]\n" + 10285 " └─ InnerJoin (estimated cost=10.090 rows=3)\n" + 10286 " ├─ ((b.i = c.i) AND (a.i = c.i))\n" + 10287 " ├─ LookupJoin (estimated cost=-2.705 rows=3)\n" + 10288 " │ ├─ ((c.i = d.s) OR (c.i = 2))\n" + 10289 " │ ├─ TableAlias(d)\n" + 10290 " │ │ └─ Table\n" + 10291 " │ │ ├─ name: mytable\n" + 10292 " │ │ └─ columns: [s]\n" + 10293 " │ └─ TableAlias(c)\n" + 10294 " │ └─ Concat\n" + 10295 " │ ├─ TableAlias(c)\n" + 10296 " │ │ └─ IndexedTableAccess(mytable)\n" + 10297 " │ │ ├─ index: [mytable.i]\n" + 10298 " │ │ ├─ columns: [i]\n" + 10299 " │ │ └─ keys: 2\n" + 10300 " │ └─ TableAlias(c)\n" + 10301 " │ └─ IndexedTableAccess(mytable)\n" + 10302 " │ ├─ index: [mytable.i]\n" + 10303 " │ ├─ columns: [i]\n" + 10304 " │ └─ keys: d.s\n" + 10305 " └─ MergeJoin (estimated cost=6.090 rows=3)\n" + 10306 " ├─ cmp: (a.i = b.i)\n" + 10307 " ├─ TableAlias(a)\n" + 10308 " │ └─ IndexedTableAccess(mytable)\n" + 10309 " │ ├─ index: [mytable.i,mytable.s]\n" + 10310 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 10311 " │ └─ columns: [i s]\n" + 10312 " └─ TableAlias(b)\n" + 10313 " └─ IndexedTableAccess(mytable)\n" + 10314 " ├─ index: [mytable.i]\n" + 10315 " ├─ filters: [{[NULL, ∞)}]\n" + 10316 " └─ columns: [i]\n" + 10317 "", 10318 ExpectedAnalysis: "Project\n" + 10319 " ├─ columns: [a.i, a.s]\n" + 10320 " └─ InnerJoin (estimated cost=10.090 rows=3) (actual rows=3 loops=1)\n" + 10321 " ├─ ((b.i = c.i) AND (a.i = c.i))\n" + 10322 " ├─ LookupJoin (estimated cost=-2.705 rows=3) (actual rows=3 loops=1)\n" + 10323 " │ ├─ ((c.i = d.s) OR (c.i = 2))\n" + 10324 " │ ├─ TableAlias(d)\n" + 10325 " │ │ └─ Table\n" + 10326 " │ │ ├─ name: mytable\n" + 10327 " │ │ └─ columns: [s]\n" + 10328 " │ └─ TableAlias(c)\n" + 10329 " │ └─ Concat\n" + 10330 " │ ├─ TableAlias(c)\n" + 10331 " │ │ └─ IndexedTableAccess(mytable)\n" + 10332 " │ │ ├─ index: [mytable.i]\n" + 10333 " │ │ ├─ columns: [i]\n" + 10334 " │ │ └─ keys: 2\n" + 10335 " │ └─ TableAlias(c)\n" + 10336 " │ └─ IndexedTableAccess(mytable)\n" + 10337 " │ ├─ index: [mytable.i]\n" + 10338 " │ ├─ columns: [i]\n" + 10339 " │ └─ keys: d.s\n" + 10340 " └─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=3)\n" + 10341 " ├─ cmp: (a.i = b.i)\n" + 10342 " ├─ TableAlias(a)\n" + 10343 " │ └─ IndexedTableAccess(mytable)\n" + 10344 " │ ├─ index: [mytable.i,mytable.s]\n" + 10345 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 10346 " │ └─ columns: [i s]\n" + 10347 " └─ TableAlias(b)\n" + 10348 " └─ IndexedTableAccess(mytable)\n" + 10349 " ├─ index: [mytable.i]\n" + 10350 " ├─ filters: [{[NULL, ∞)}]\n" + 10351 " └─ columns: [i]\n" + 10352 "", 10353 }, 10354 { 10355 Query: `SELECT a.* FROM mytable a, mytable b, mytable c, mytable d where a.i = b.i AND b.i = c.i`, 10356 ExpectedPlan: "Project\n" + 10357 " ├─ columns: [a.i:0!null, a.s:1!null]\n" + 10358 " └─ CrossJoin\n" + 10359 " ├─ TableAlias(d)\n" + 10360 " │ └─ ProcessTable\n" + 10361 " │ └─ Table\n" + 10362 " │ ├─ name: mytable\n" + 10363 " │ └─ columns: []\n" + 10364 " └─ LookupJoin\n" + 10365 " ├─ MergeJoin\n" + 10366 " │ ├─ cmp: Eq\n" + 10367 " │ │ ├─ a.i:0!null\n" + 10368 " │ │ └─ b.i:2!null\n" + 10369 " │ ├─ TableAlias(a)\n" + 10370 " │ │ └─ IndexedTableAccess(mytable)\n" + 10371 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 10372 " │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 10373 " │ │ ├─ colSet: (1,2)\n" + 10374 " │ │ ├─ tableId: 1\n" + 10375 " │ │ └─ Table\n" + 10376 " │ │ ├─ name: mytable\n" + 10377 " │ │ └─ columns: [i s]\n" + 10378 " │ └─ TableAlias(b)\n" + 10379 " │ └─ IndexedTableAccess(mytable)\n" + 10380 " │ ├─ index: [mytable.i]\n" + 10381 " │ ├─ static: [{[NULL, ∞)}]\n" + 10382 " │ ├─ colSet: (3,4)\n" + 10383 " │ ├─ tableId: 2\n" + 10384 " │ └─ Table\n" + 10385 " │ ├─ name: mytable\n" + 10386 " │ └─ columns: [i]\n" + 10387 " └─ TableAlias(c)\n" + 10388 " └─ IndexedTableAccess(mytable)\n" + 10389 " ├─ index: [mytable.i]\n" + 10390 " ├─ keys: [b.i:2!null]\n" + 10391 " ├─ colSet: (5,6)\n" + 10392 " ├─ tableId: 3\n" + 10393 " └─ Table\n" + 10394 " ├─ name: mytable\n" + 10395 " └─ columns: [i]\n" + 10396 "", 10397 ExpectedEstimates: "Project\n" + 10398 " ├─ columns: [a.i, a.s]\n" + 10399 " └─ CrossJoin (estimated cost=10.090 rows=3)\n" + 10400 " ├─ TableAlias(d)\n" + 10401 " │ └─ Table\n" + 10402 " │ ├─ name: mytable\n" + 10403 " │ └─ columns: []\n" + 10404 " └─ LookupJoin (estimated cost=9.900 rows=3)\n" + 10405 " ├─ MergeJoin (estimated cost=6.090 rows=3)\n" + 10406 " │ ├─ cmp: (a.i = b.i)\n" + 10407 " │ ├─ TableAlias(a)\n" + 10408 " │ │ └─ IndexedTableAccess(mytable)\n" + 10409 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 10410 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 10411 " │ │ └─ columns: [i s]\n" + 10412 " │ └─ TableAlias(b)\n" + 10413 " │ └─ IndexedTableAccess(mytable)\n" + 10414 " │ ├─ index: [mytable.i]\n" + 10415 " │ ├─ filters: [{[NULL, ∞)}]\n" + 10416 " │ └─ columns: [i]\n" + 10417 " └─ TableAlias(c)\n" + 10418 " └─ IndexedTableAccess(mytable)\n" + 10419 " ├─ index: [mytable.i]\n" + 10420 " ├─ columns: [i]\n" + 10421 " └─ keys: b.i\n" + 10422 "", 10423 ExpectedAnalysis: "Project\n" + 10424 " ├─ columns: [a.i, a.s]\n" + 10425 " └─ CrossJoin (estimated cost=10.090 rows=3) (actual rows=9 loops=1)\n" + 10426 " ├─ TableAlias(d)\n" + 10427 " │ └─ Table\n" + 10428 " │ ├─ name: mytable\n" + 10429 " │ └─ columns: []\n" + 10430 " └─ LookupJoin (estimated cost=9.900 rows=3) (actual rows=3 loops=3)\n" + 10431 " ├─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=3)\n" + 10432 " │ ├─ cmp: (a.i = b.i)\n" + 10433 " │ ├─ TableAlias(a)\n" + 10434 " │ │ └─ IndexedTableAccess(mytable)\n" + 10435 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 10436 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 10437 " │ │ └─ columns: [i s]\n" + 10438 " │ └─ TableAlias(b)\n" + 10439 " │ └─ IndexedTableAccess(mytable)\n" + 10440 " │ ├─ index: [mytable.i]\n" + 10441 " │ ├─ filters: [{[NULL, ∞)}]\n" + 10442 " │ └─ columns: [i]\n" + 10443 " └─ TableAlias(c)\n" + 10444 " └─ IndexedTableAccess(mytable)\n" + 10445 " ├─ index: [mytable.i]\n" + 10446 " ├─ columns: [i]\n" + 10447 " └─ keys: b.i\n" + 10448 "", 10449 }, 10450 { 10451 Query: `SELECT a.* FROM mytable a CROSS JOIN mytable b where a.i = b.i`, 10452 ExpectedPlan: "Project\n" + 10453 " ├─ columns: [a.i:0!null, a.s:1!null]\n" + 10454 " └─ MergeJoin\n" + 10455 " ├─ cmp: Eq\n" + 10456 " │ ├─ a.i:0!null\n" + 10457 " │ └─ b.i:2!null\n" + 10458 " ├─ TableAlias(a)\n" + 10459 " │ └─ IndexedTableAccess(mytable)\n" + 10460 " │ ├─ index: [mytable.i,mytable.s]\n" + 10461 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 10462 " │ ├─ colSet: (1,2)\n" + 10463 " │ ├─ tableId: 1\n" + 10464 " │ └─ Table\n" + 10465 " │ ├─ name: mytable\n" + 10466 " │ └─ columns: [i s]\n" + 10467 " └─ TableAlias(b)\n" + 10468 " └─ IndexedTableAccess(mytable)\n" + 10469 " ├─ index: [mytable.i]\n" + 10470 " ├─ static: [{[NULL, ∞)}]\n" + 10471 " ├─ colSet: (3,4)\n" + 10472 " ├─ tableId: 2\n" + 10473 " └─ Table\n" + 10474 " ├─ name: mytable\n" + 10475 " └─ columns: [i]\n" + 10476 "", 10477 ExpectedEstimates: "Project\n" + 10478 " ├─ columns: [a.i, a.s]\n" + 10479 " └─ MergeJoin (estimated cost=6.090 rows=3)\n" + 10480 " ├─ cmp: (a.i = b.i)\n" + 10481 " ├─ TableAlias(a)\n" + 10482 " │ └─ IndexedTableAccess(mytable)\n" + 10483 " │ ├─ index: [mytable.i,mytable.s]\n" + 10484 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 10485 " │ └─ columns: [i s]\n" + 10486 " └─ TableAlias(b)\n" + 10487 " └─ IndexedTableAccess(mytable)\n" + 10488 " ├─ index: [mytable.i]\n" + 10489 " ├─ filters: [{[NULL, ∞)}]\n" + 10490 " └─ columns: [i]\n" + 10491 "", 10492 ExpectedAnalysis: "Project\n" + 10493 " ├─ columns: [a.i, a.s]\n" + 10494 " └─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=1)\n" + 10495 " ├─ cmp: (a.i = b.i)\n" + 10496 " ├─ TableAlias(a)\n" + 10497 " │ └─ IndexedTableAccess(mytable)\n" + 10498 " │ ├─ index: [mytable.i,mytable.s]\n" + 10499 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 10500 " │ └─ columns: [i s]\n" + 10501 " └─ TableAlias(b)\n" + 10502 " └─ IndexedTableAccess(mytable)\n" + 10503 " ├─ index: [mytable.i]\n" + 10504 " ├─ filters: [{[NULL, ∞)}]\n" + 10505 " └─ columns: [i]\n" + 10506 "", 10507 }, 10508 { 10509 Query: `SELECT a.* FROM mytable a CROSS JOIN mytable b where a.i = b.i OR a.i = b.s`, 10510 ExpectedPlan: "Project\n" + 10511 " ├─ columns: [a.i:0!null, a.s:1!null]\n" + 10512 " └─ LookupJoin\n" + 10513 " ├─ Or\n" + 10514 " │ ├─ Eq\n" + 10515 " │ │ ├─ a.i:0!null\n" + 10516 " │ │ └─ b.i:2!null\n" + 10517 " │ └─ Eq\n" + 10518 " │ ├─ a.i:0!null\n" + 10519 " │ └─ b.s:3!null\n" + 10520 " ├─ TableAlias(a)\n" + 10521 " │ └─ ProcessTable\n" + 10522 " │ └─ Table\n" + 10523 " │ ├─ name: mytable\n" + 10524 " │ └─ columns: [i s]\n" + 10525 " └─ TableAlias(b)\n" + 10526 " └─ Concat\n" + 10527 " ├─ TableAlias(b)\n" + 10528 " │ └─ IndexedTableAccess(mytable)\n" + 10529 " │ ├─ index: [mytable.s,mytable.i]\n" + 10530 " │ ├─ keys: [a.i:0!null]\n" + 10531 " │ ├─ colSet: (3,4)\n" + 10532 " │ ├─ tableId: 2\n" + 10533 " │ └─ Table\n" + 10534 " │ ├─ name: mytable\n" + 10535 " │ └─ columns: [i s]\n" + 10536 " └─ TableAlias(b)\n" + 10537 " └─ IndexedTableAccess(mytable)\n" + 10538 " ├─ index: [mytable.i]\n" + 10539 " ├─ keys: [a.i:0!null]\n" + 10540 " ├─ colSet: (3,4)\n" + 10541 " ├─ tableId: 2\n" + 10542 " └─ Table\n" + 10543 " ├─ name: mytable\n" + 10544 " └─ columns: [i s]\n" + 10545 "", 10546 ExpectedEstimates: "Project\n" + 10547 " ├─ columns: [a.i, a.s]\n" + 10548 " └─ LookupJoin (estimated cost=-2.705 rows=3)\n" + 10549 " ├─ ((a.i = b.i) OR (a.i = b.s))\n" + 10550 " ├─ TableAlias(a)\n" + 10551 " │ └─ Table\n" + 10552 " │ ├─ name: mytable\n" + 10553 " │ └─ columns: [i s]\n" + 10554 " └─ TableAlias(b)\n" + 10555 " └─ Concat\n" + 10556 " ├─ TableAlias(b)\n" + 10557 " │ └─ IndexedTableAccess(mytable)\n" + 10558 " │ ├─ index: [mytable.s,mytable.i]\n" + 10559 " │ ├─ columns: [i s]\n" + 10560 " │ └─ keys: a.i\n" + 10561 " └─ TableAlias(b)\n" + 10562 " └─ IndexedTableAccess(mytable)\n" + 10563 " ├─ index: [mytable.i]\n" + 10564 " ├─ columns: [i s]\n" + 10565 " └─ keys: a.i\n" + 10566 "", 10567 ExpectedAnalysis: "Project\n" + 10568 " ├─ columns: [a.i, a.s]\n" + 10569 " └─ LookupJoin (estimated cost=-2.705 rows=3) (actual rows=3 loops=1)\n" + 10570 " ├─ ((a.i = b.i) OR (a.i = b.s))\n" + 10571 " ├─ TableAlias(a)\n" + 10572 " │ └─ Table\n" + 10573 " │ ├─ name: mytable\n" + 10574 " │ └─ columns: [i s]\n" + 10575 " └─ TableAlias(b)\n" + 10576 " └─ Concat\n" + 10577 " ├─ TableAlias(b)\n" + 10578 " │ └─ IndexedTableAccess(mytable)\n" + 10579 " │ ├─ index: [mytable.s,mytable.i]\n" + 10580 " │ ├─ columns: [i s]\n" + 10581 " │ └─ keys: a.i\n" + 10582 " └─ TableAlias(b)\n" + 10583 " └─ IndexedTableAccess(mytable)\n" + 10584 " ├─ index: [mytable.i]\n" + 10585 " ├─ columns: [i s]\n" + 10586 " └─ keys: a.i\n" + 10587 "", 10588 }, 10589 { 10590 Query: `SELECT a.* FROM mytable a CROSS JOIN mytable b where NOT(a.i = b.s OR a.s = b.i)`, 10591 ExpectedPlan: "Project\n" + 10592 " ├─ columns: [a.i:2!null, a.s:3!null]\n" + 10593 " └─ InnerJoin\n" + 10594 " ├─ AND\n" + 10595 " │ ├─ NOT\n" + 10596 " │ │ └─ Eq\n" + 10597 " │ │ ├─ a.i:2!null\n" + 10598 " │ │ └─ b.s:1!null\n" + 10599 " │ └─ NOT\n" + 10600 " │ └─ Eq\n" + 10601 " │ ├─ a.s:3!null\n" + 10602 " │ └─ b.i:0!null\n" + 10603 " ├─ TableAlias(b)\n" + 10604 " │ └─ ProcessTable\n" + 10605 " │ └─ Table\n" + 10606 " │ ├─ name: mytable\n" + 10607 " │ └─ columns: [i s]\n" + 10608 " └─ TableAlias(a)\n" + 10609 " └─ Table\n" + 10610 " ├─ name: mytable\n" + 10611 " ├─ columns: [i s]\n" + 10612 " ├─ colSet: (1,2)\n" + 10613 " └─ tableId: 1\n" + 10614 "", 10615 ExpectedEstimates: "Project\n" + 10616 " ├─ columns: [a.i, a.s]\n" + 10617 " └─ InnerJoin (estimated cost=10.090 rows=3)\n" + 10618 " ├─ ((NOT((a.i = b.s))) AND (NOT((a.s = b.i))))\n" + 10619 " ├─ TableAlias(b)\n" + 10620 " │ └─ Table\n" + 10621 " │ ├─ name: mytable\n" + 10622 " │ └─ columns: [i s]\n" + 10623 " └─ TableAlias(a)\n" + 10624 " └─ Table\n" + 10625 " ├─ name: mytable\n" + 10626 " └─ columns: [i s]\n" + 10627 "", 10628 ExpectedAnalysis: "Project\n" + 10629 " ├─ columns: [a.i, a.s]\n" + 10630 " └─ InnerJoin (estimated cost=10.090 rows=3) (actual rows=9 loops=1)\n" + 10631 " ├─ ((NOT((a.i = b.s))) AND (NOT((a.s = b.i))))\n" + 10632 " ├─ TableAlias(b)\n" + 10633 " │ └─ Table\n" + 10634 " │ ├─ name: mytable\n" + 10635 " │ └─ columns: [i s]\n" + 10636 " └─ TableAlias(a)\n" + 10637 " └─ Table\n" + 10638 " ├─ name: mytable\n" + 10639 " └─ columns: [i s]\n" + 10640 "", 10641 }, 10642 { 10643 Query: `SELECT a.* FROM mytable a CROSS JOIN mytable b where a.i = b.s OR a.s = b.i IS FALSE`, 10644 ExpectedPlan: "Project\n" + 10645 " ├─ columns: [a.i:2!null, a.s:3!null]\n" + 10646 " └─ InnerJoin\n" + 10647 " ├─ Or\n" + 10648 " │ ├─ Eq\n" + 10649 " │ │ ├─ a.i:2!null\n" + 10650 " │ │ └─ b.s:1!null\n" + 10651 " │ └─ (a.s = b.i) IS FALSE\n" + 10652 " ├─ TableAlias(b)\n" + 10653 " │ └─ ProcessTable\n" + 10654 " │ └─ Table\n" + 10655 " │ ├─ name: mytable\n" + 10656 " │ └─ columns: [i s]\n" + 10657 " └─ TableAlias(a)\n" + 10658 " └─ Table\n" + 10659 " ├─ name: mytable\n" + 10660 " ├─ columns: [i s]\n" + 10661 " ├─ colSet: (1,2)\n" + 10662 " └─ tableId: 1\n" + 10663 "", 10664 ExpectedEstimates: "Project\n" + 10665 " ├─ columns: [a.i, a.s]\n" + 10666 " └─ InnerJoin (estimated cost=10.090 rows=3)\n" + 10667 " ├─ ((a.i = b.s) OR (a.s = b.i) IS FALSE)\n" + 10668 " ├─ TableAlias(b)\n" + 10669 " │ └─ Table\n" + 10670 " │ ├─ name: mytable\n" + 10671 " │ └─ columns: [i s]\n" + 10672 " └─ TableAlias(a)\n" + 10673 " └─ Table\n" + 10674 " ├─ name: mytable\n" + 10675 " └─ columns: [i s]\n" + 10676 "", 10677 ExpectedAnalysis: "Project\n" + 10678 " ├─ columns: [a.i, a.s]\n" + 10679 " └─ InnerJoin (estimated cost=10.090 rows=3) (actual rows=9 loops=1)\n" + 10680 " ├─ ((a.i = b.s) OR (a.s = b.i) IS FALSE)\n" + 10681 " ├─ TableAlias(b)\n" + 10682 " │ └─ Table\n" + 10683 " │ ├─ name: mytable\n" + 10684 " │ └─ columns: [i s]\n" + 10685 " └─ TableAlias(a)\n" + 10686 " └─ Table\n" + 10687 " ├─ name: mytable\n" + 10688 " └─ columns: [i s]\n" + 10689 "", 10690 }, 10691 { 10692 Query: `SELECT a.* FROM mytable a CROSS JOIN mytable b where a.i >= b.i`, 10693 ExpectedPlan: "Project\n" + 10694 " ├─ columns: [a.i:1!null, a.s:2!null]\n" + 10695 " └─ InnerJoin\n" + 10696 " ├─ GreaterThanOrEqual\n" + 10697 " │ ├─ a.i:1!null\n" + 10698 " │ └─ b.i:0!null\n" + 10699 " ├─ TableAlias(b)\n" + 10700 " │ └─ ProcessTable\n" + 10701 " │ └─ Table\n" + 10702 " │ ├─ name: mytable\n" + 10703 " │ └─ columns: [i]\n" + 10704 " └─ TableAlias(a)\n" + 10705 " └─ Table\n" + 10706 " ├─ name: mytable\n" + 10707 " ├─ columns: [i s]\n" + 10708 " ├─ colSet: (1,2)\n" + 10709 " └─ tableId: 1\n" + 10710 "", 10711 ExpectedEstimates: "Project\n" + 10712 " ├─ columns: [a.i, a.s]\n" + 10713 " └─ InnerJoin (estimated cost=10.090 rows=3)\n" + 10714 " ├─ (a.i >= b.i)\n" + 10715 " ├─ TableAlias(b)\n" + 10716 " │ └─ Table\n" + 10717 " │ ├─ name: mytable\n" + 10718 " │ └─ columns: [i]\n" + 10719 " └─ TableAlias(a)\n" + 10720 " └─ Table\n" + 10721 " ├─ name: mytable\n" + 10722 " └─ columns: [i s]\n" + 10723 "", 10724 ExpectedAnalysis: "Project\n" + 10725 " ├─ columns: [a.i, a.s]\n" + 10726 " └─ InnerJoin (estimated cost=10.090 rows=3) (actual rows=6 loops=1)\n" + 10727 " ├─ (a.i >= b.i)\n" + 10728 " ├─ TableAlias(b)\n" + 10729 " │ └─ Table\n" + 10730 " │ ├─ name: mytable\n" + 10731 " │ └─ columns: [i]\n" + 10732 " └─ TableAlias(a)\n" + 10733 " └─ Table\n" + 10734 " ├─ name: mytable\n" + 10735 " └─ columns: [i s]\n" + 10736 "", 10737 }, 10738 { 10739 Query: `SELECT a.* FROM mytable a CROSS JOIN mytable b where a.i = a.i`, 10740 ExpectedPlan: "CrossJoin\n" + 10741 " ├─ TableAlias(b)\n" + 10742 " │ └─ ProcessTable\n" + 10743 " │ └─ Table\n" + 10744 " │ ├─ name: mytable\n" + 10745 " │ └─ columns: []\n" + 10746 " └─ Filter\n" + 10747 " ├─ Eq\n" + 10748 " │ ├─ a.i:0!null\n" + 10749 " │ └─ a.i:0!null\n" + 10750 " └─ TableAlias(a)\n" + 10751 " └─ Table\n" + 10752 " ├─ name: mytable\n" + 10753 " ├─ columns: [i s]\n" + 10754 " ├─ colSet: (1,2)\n" + 10755 " └─ tableId: 1\n" + 10756 "", 10757 ExpectedEstimates: "CrossJoin (estimated cost=7.060 rows=2)\n" + 10758 " ├─ TableAlias(b)\n" + 10759 " │ └─ Table\n" + 10760 " │ ├─ name: mytable\n" + 10761 " │ └─ columns: []\n" + 10762 " └─ Filter\n" + 10763 " ├─ (a.i = a.i)\n" + 10764 " └─ TableAlias(a)\n" + 10765 " └─ Table\n" + 10766 " ├─ name: mytable\n" + 10767 " └─ columns: [i s]\n" + 10768 "", 10769 ExpectedAnalysis: "CrossJoin (estimated cost=7.060 rows=2) (actual rows=9 loops=1)\n" + 10770 " ├─ TableAlias(b)\n" + 10771 " │ └─ Table\n" + 10772 " │ ├─ name: mytable\n" + 10773 " │ └─ columns: []\n" + 10774 " └─ Filter\n" + 10775 " ├─ (a.i = a.i)\n" + 10776 " └─ TableAlias(a)\n" + 10777 " └─ Table\n" + 10778 " ├─ name: mytable\n" + 10779 " └─ columns: [i s]\n" + 10780 "", 10781 }, 10782 { 10783 Query: `SELECT a.* FROM mytable a CROSS JOIN mytable b CROSS JOIN mytable c CROSS JOIN mytable d where a.i = b.i AND b.i = c.i AND c.i = d.i AND c.i = 2`, 10784 ExpectedPlan: "Project\n" + 10785 " ├─ columns: [a.i:0!null, a.s:1!null]\n" + 10786 " └─ InnerJoin\n" + 10787 " ├─ AND\n" + 10788 " │ ├─ AND\n" + 10789 " │ │ ├─ AND\n" + 10790 " │ │ │ ├─ Eq\n" + 10791 " │ │ │ │ ├─ a.i:0!null\n" + 10792 " │ │ │ │ └─ b.i:3!null\n" + 10793 " │ │ │ └─ Eq\n" + 10794 " │ │ │ ├─ c.i:4!null\n" + 10795 " │ │ │ └─ d.i:2!null\n" + 10796 " │ │ └─ Eq\n" + 10797 " │ │ ├─ a.i:0!null\n" + 10798 " │ │ └─ c.i:4!null\n" + 10799 " │ └─ Eq\n" + 10800 " │ ├─ b.i:3!null\n" + 10801 " │ └─ d.i:2!null\n" + 10802 " ├─ MergeJoin\n" + 10803 " │ ├─ cmp: Eq\n" + 10804 " │ │ ├─ a.i:0!null\n" + 10805 " │ │ └─ d.i:2!null\n" + 10806 " │ ├─ TableAlias(a)\n" + 10807 " │ │ └─ IndexedTableAccess(mytable)\n" + 10808 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 10809 " │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 10810 " │ │ ├─ colSet: (1,2)\n" + 10811 " │ │ ├─ tableId: 1\n" + 10812 " │ │ └─ Table\n" + 10813 " │ │ ├─ name: mytable\n" + 10814 " │ │ └─ columns: [i s]\n" + 10815 " │ └─ TableAlias(d)\n" + 10816 " │ └─ IndexedTableAccess(mytable)\n" + 10817 " │ ├─ index: [mytable.i]\n" + 10818 " │ ├─ static: [{[NULL, ∞)}]\n" + 10819 " │ ├─ colSet: (7,8)\n" + 10820 " │ ├─ tableId: 4\n" + 10821 " │ └─ Table\n" + 10822 " │ ├─ name: mytable\n" + 10823 " │ └─ columns: [i]\n" + 10824 " └─ MergeJoin\n" + 10825 " ├─ cmp: Eq\n" + 10826 " │ ├─ b.i:3!null\n" + 10827 " │ └─ c.i:4!null\n" + 10828 " ├─ TableAlias(b)\n" + 10829 " │ └─ IndexedTableAccess(mytable)\n" + 10830 " │ ├─ index: [mytable.i,mytable.s]\n" + 10831 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 10832 " │ ├─ colSet: (3,4)\n" + 10833 " │ ├─ tableId: 2\n" + 10834 " │ └─ Table\n" + 10835 " │ ├─ name: mytable\n" + 10836 " │ └─ columns: [i]\n" + 10837 " └─ Filter\n" + 10838 " ├─ Eq\n" + 10839 " │ ├─ c.i:0!null\n" + 10840 " │ └─ 2 (tinyint)\n" + 10841 " └─ TableAlias(c)\n" + 10842 " └─ IndexedTableAccess(mytable)\n" + 10843 " ├─ index: [mytable.i]\n" + 10844 " ├─ static: [{[2, 2]}]\n" + 10845 " ├─ colSet: (5,6)\n" + 10846 " ├─ tableId: 3\n" + 10847 " └─ Table\n" + 10848 " ├─ name: mytable\n" + 10849 " └─ columns: [i]\n" + 10850 "", 10851 ExpectedEstimates: "Project\n" + 10852 " ├─ columns: [a.i, a.s]\n" + 10853 " └─ InnerJoin (estimated cost=10.090 rows=3)\n" + 10854 " ├─ ((((a.i = b.i) AND (c.i = d.i)) AND (a.i = c.i)) AND (b.i = d.i))\n" + 10855 " ├─ MergeJoin (estimated cost=6.090 rows=3)\n" + 10856 " │ ├─ cmp: (a.i = d.i)\n" + 10857 " │ ├─ TableAlias(a)\n" + 10858 " │ │ └─ IndexedTableAccess(mytable)\n" + 10859 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 10860 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 10861 " │ │ └─ columns: [i s]\n" + 10862 " │ └─ TableAlias(d)\n" + 10863 " │ └─ IndexedTableAccess(mytable)\n" + 10864 " │ ├─ index: [mytable.i]\n" + 10865 " │ ├─ filters: [{[NULL, ∞)}]\n" + 10866 " │ └─ columns: [i]\n" + 10867 " └─ MergeJoin (estimated cost=6.090 rows=3)\n" + 10868 " ├─ cmp: (b.i = c.i)\n" + 10869 " ├─ TableAlias(b)\n" + 10870 " │ └─ IndexedTableAccess(mytable)\n" + 10871 " │ ├─ index: [mytable.i,mytable.s]\n" + 10872 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 10873 " │ └─ columns: [i]\n" + 10874 " └─ Filter\n" + 10875 " ├─ (c.i = 2)\n" + 10876 " └─ TableAlias(c)\n" + 10877 " └─ IndexedTableAccess(mytable)\n" + 10878 " ├─ index: [mytable.i]\n" + 10879 " ├─ filters: [{[2, 2]}]\n" + 10880 " └─ columns: [i]\n" + 10881 "", 10882 ExpectedAnalysis: "Project\n" + 10883 " ├─ columns: [a.i, a.s]\n" + 10884 " └─ InnerJoin (estimated cost=10.090 rows=3) (actual rows=1 loops=1)\n" + 10885 " ├─ ((((a.i = b.i) AND (c.i = d.i)) AND (a.i = c.i)) AND (b.i = d.i))\n" + 10886 " ├─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=1)\n" + 10887 " │ ├─ cmp: (a.i = d.i)\n" + 10888 " │ ├─ TableAlias(a)\n" + 10889 " │ │ └─ IndexedTableAccess(mytable)\n" + 10890 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 10891 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 10892 " │ │ └─ columns: [i s]\n" + 10893 " │ └─ TableAlias(d)\n" + 10894 " │ └─ IndexedTableAccess(mytable)\n" + 10895 " │ ├─ index: [mytable.i]\n" + 10896 " │ ├─ filters: [{[NULL, ∞)}]\n" + 10897 " │ └─ columns: [i]\n" + 10898 " └─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=1 loops=3)\n" + 10899 " ├─ cmp: (b.i = c.i)\n" + 10900 " ├─ TableAlias(b)\n" + 10901 " │ └─ IndexedTableAccess(mytable)\n" + 10902 " │ ├─ index: [mytable.i,mytable.s]\n" + 10903 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 10904 " │ └─ columns: [i]\n" + 10905 " └─ Filter\n" + 10906 " ├─ (c.i = 2)\n" + 10907 " └─ TableAlias(c)\n" + 10908 " └─ IndexedTableAccess(mytable)\n" + 10909 " ├─ index: [mytable.i]\n" + 10910 " ├─ filters: [{[2, 2]}]\n" + 10911 " └─ columns: [i]\n" + 10912 "", 10913 }, 10914 { 10915 Query: `SELECT a.* FROM mytable a CROSS JOIN mytable b CROSS JOIN mytable c CROSS JOIN mytable d where a.i = b.i AND b.i = c.i AND (c.i = d.s OR c.i = 2)`, 10916 ExpectedPlan: "Project\n" + 10917 " ├─ columns: [a.i:2!null, a.s:3!null]\n" + 10918 " └─ InnerJoin\n" + 10919 " ├─ AND\n" + 10920 " │ ├─ Eq\n" + 10921 " │ │ ├─ b.i:4!null\n" + 10922 " │ │ └─ c.i:1!null\n" + 10923 " │ └─ Eq\n" + 10924 " │ ├─ a.i:2!null\n" + 10925 " │ └─ c.i:1!null\n" + 10926 " ├─ LookupJoin\n" + 10927 " │ ├─ Or\n" + 10928 " │ │ ├─ Eq\n" + 10929 " │ │ │ ├─ c.i:1!null\n" + 10930 " │ │ │ └─ d.s:0!null\n" + 10931 " │ │ └─ Eq\n" + 10932 " │ │ ├─ c.i:1!null\n" + 10933 " │ │ └─ 2 (tinyint)\n" + 10934 " │ ├─ TableAlias(d)\n" + 10935 " │ │ └─ ProcessTable\n" + 10936 " │ │ └─ Table\n" + 10937 " │ │ ├─ name: mytable\n" + 10938 " │ │ └─ columns: [s]\n" + 10939 " │ └─ TableAlias(c)\n" + 10940 " │ └─ Concat\n" + 10941 " │ ├─ TableAlias(c)\n" + 10942 " │ │ └─ IndexedTableAccess(mytable)\n" + 10943 " │ │ ├─ index: [mytable.i]\n" + 10944 " │ │ ├─ keys: [2 (tinyint)]\n" + 10945 " │ │ ├─ colSet: (5,6)\n" + 10946 " │ │ ├─ tableId: 3\n" + 10947 " │ │ └─ Table\n" + 10948 " │ │ ├─ name: mytable\n" + 10949 " │ │ └─ columns: [i]\n" + 10950 " │ └─ TableAlias(c)\n" + 10951 " │ └─ IndexedTableAccess(mytable)\n" + 10952 " │ ├─ index: [mytable.i]\n" + 10953 " │ ├─ keys: [d.s:0!null]\n" + 10954 " │ ├─ colSet: (5,6)\n" + 10955 " │ ├─ tableId: 3\n" + 10956 " │ └─ Table\n" + 10957 " │ ├─ name: mytable\n" + 10958 " │ └─ columns: [i]\n" + 10959 " └─ MergeJoin\n" + 10960 " ├─ cmp: Eq\n" + 10961 " │ ├─ a.i:2!null\n" + 10962 " │ └─ b.i:4!null\n" + 10963 " ├─ TableAlias(a)\n" + 10964 " │ └─ IndexedTableAccess(mytable)\n" + 10965 " │ ├─ index: [mytable.i,mytable.s]\n" + 10966 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 10967 " │ ├─ colSet: (1,2)\n" + 10968 " │ ├─ tableId: 1\n" + 10969 " │ └─ Table\n" + 10970 " │ ├─ name: mytable\n" + 10971 " │ └─ columns: [i s]\n" + 10972 " └─ TableAlias(b)\n" + 10973 " └─ IndexedTableAccess(mytable)\n" + 10974 " ├─ index: [mytable.i]\n" + 10975 " ├─ static: [{[NULL, ∞)}]\n" + 10976 " ├─ colSet: (3,4)\n" + 10977 " ├─ tableId: 2\n" + 10978 " └─ Table\n" + 10979 " ├─ name: mytable\n" + 10980 " └─ columns: [i]\n" + 10981 "", 10982 ExpectedEstimates: "Project\n" + 10983 " ├─ columns: [a.i, a.s]\n" + 10984 " └─ InnerJoin (estimated cost=10.090 rows=3)\n" + 10985 " ├─ ((b.i = c.i) AND (a.i = c.i))\n" + 10986 " ├─ LookupJoin (estimated cost=-2.705 rows=3)\n" + 10987 " │ ├─ ((c.i = d.s) OR (c.i = 2))\n" + 10988 " │ ├─ TableAlias(d)\n" + 10989 " │ │ └─ Table\n" + 10990 " │ │ ├─ name: mytable\n" + 10991 " │ │ └─ columns: [s]\n" + 10992 " │ └─ TableAlias(c)\n" + 10993 " │ └─ Concat\n" + 10994 " │ ├─ TableAlias(c)\n" + 10995 " │ │ └─ IndexedTableAccess(mytable)\n" + 10996 " │ │ ├─ index: [mytable.i]\n" + 10997 " │ │ ├─ columns: [i]\n" + 10998 " │ │ └─ keys: 2\n" + 10999 " │ └─ TableAlias(c)\n" + 11000 " │ └─ IndexedTableAccess(mytable)\n" + 11001 " │ ├─ index: [mytable.i]\n" + 11002 " │ ├─ columns: [i]\n" + 11003 " │ └─ keys: d.s\n" + 11004 " └─ MergeJoin (estimated cost=6.090 rows=3)\n" + 11005 " ├─ cmp: (a.i = b.i)\n" + 11006 " ├─ TableAlias(a)\n" + 11007 " │ └─ IndexedTableAccess(mytable)\n" + 11008 " │ ├─ index: [mytable.i,mytable.s]\n" + 11009 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 11010 " │ └─ columns: [i s]\n" + 11011 " └─ TableAlias(b)\n" + 11012 " └─ IndexedTableAccess(mytable)\n" + 11013 " ├─ index: [mytable.i]\n" + 11014 " ├─ filters: [{[NULL, ∞)}]\n" + 11015 " └─ columns: [i]\n" + 11016 "", 11017 ExpectedAnalysis: "Project\n" + 11018 " ├─ columns: [a.i, a.s]\n" + 11019 " └─ InnerJoin (estimated cost=10.090 rows=3) (actual rows=3 loops=1)\n" + 11020 " ├─ ((b.i = c.i) AND (a.i = c.i))\n" + 11021 " ├─ LookupJoin (estimated cost=-2.705 rows=3) (actual rows=3 loops=1)\n" + 11022 " │ ├─ ((c.i = d.s) OR (c.i = 2))\n" + 11023 " │ ├─ TableAlias(d)\n" + 11024 " │ │ └─ Table\n" + 11025 " │ │ ├─ name: mytable\n" + 11026 " │ │ └─ columns: [s]\n" + 11027 " │ └─ TableAlias(c)\n" + 11028 " │ └─ Concat\n" + 11029 " │ ├─ TableAlias(c)\n" + 11030 " │ │ └─ IndexedTableAccess(mytable)\n" + 11031 " │ │ ├─ index: [mytable.i]\n" + 11032 " │ │ ├─ columns: [i]\n" + 11033 " │ │ └─ keys: 2\n" + 11034 " │ └─ TableAlias(c)\n" + 11035 " │ └─ IndexedTableAccess(mytable)\n" + 11036 " │ ├─ index: [mytable.i]\n" + 11037 " │ ├─ columns: [i]\n" + 11038 " │ └─ keys: d.s\n" + 11039 " └─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=3)\n" + 11040 " ├─ cmp: (a.i = b.i)\n" + 11041 " ├─ TableAlias(a)\n" + 11042 " │ └─ IndexedTableAccess(mytable)\n" + 11043 " │ ├─ index: [mytable.i,mytable.s]\n" + 11044 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 11045 " │ └─ columns: [i s]\n" + 11046 " └─ TableAlias(b)\n" + 11047 " └─ IndexedTableAccess(mytable)\n" + 11048 " ├─ index: [mytable.i]\n" + 11049 " ├─ filters: [{[NULL, ∞)}]\n" + 11050 " └─ columns: [i]\n" + 11051 "", 11052 }, 11053 { 11054 Query: `SELECT a.* FROM mytable a CROSS JOIN mytable b CROSS JOIN mytable c CROSS JOIN mytable d where a.i = b.i AND b.s = c.s`, 11055 ExpectedPlan: "Project\n" + 11056 " ├─ columns: [a.i:0!null, a.s:1!null]\n" + 11057 " └─ CrossJoin\n" + 11058 " ├─ TableAlias(d)\n" + 11059 " │ └─ ProcessTable\n" + 11060 " │ └─ Table\n" + 11061 " │ ├─ name: mytable\n" + 11062 " │ └─ columns: []\n" + 11063 " └─ LookupJoin\n" + 11064 " ├─ MergeJoin\n" + 11065 " │ ├─ cmp: Eq\n" + 11066 " │ │ ├─ a.i:0!null\n" + 11067 " │ │ └─ b.i:2!null\n" + 11068 " │ ├─ TableAlias(a)\n" + 11069 " │ │ └─ IndexedTableAccess(mytable)\n" + 11070 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 11071 " │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 11072 " │ │ ├─ colSet: (1,2)\n" + 11073 " │ │ ├─ tableId: 1\n" + 11074 " │ │ └─ Table\n" + 11075 " │ │ ├─ name: mytable\n" + 11076 " │ │ └─ columns: [i s]\n" + 11077 " │ └─ TableAlias(b)\n" + 11078 " │ └─ IndexedTableAccess(mytable)\n" + 11079 " │ ├─ index: [mytable.i]\n" + 11080 " │ ├─ static: [{[NULL, ∞)}]\n" + 11081 " │ ├─ colSet: (3,4)\n" + 11082 " │ ├─ tableId: 2\n" + 11083 " │ └─ Table\n" + 11084 " │ ├─ name: mytable\n" + 11085 " │ └─ columns: [i s]\n" + 11086 " └─ TableAlias(c)\n" + 11087 " └─ IndexedTableAccess(mytable)\n" + 11088 " ├─ index: [mytable.s]\n" + 11089 " ├─ keys: [b.s:3!null]\n" + 11090 " ├─ colSet: (5,6)\n" + 11091 " ├─ tableId: 3\n" + 11092 " └─ Table\n" + 11093 " ├─ name: mytable\n" + 11094 " └─ columns: [s]\n" + 11095 "", 11096 ExpectedEstimates: "Project\n" + 11097 " ├─ columns: [a.i, a.s]\n" + 11098 " └─ CrossJoin (estimated cost=10.090 rows=3)\n" + 11099 " ├─ TableAlias(d)\n" + 11100 " │ └─ Table\n" + 11101 " │ ├─ name: mytable\n" + 11102 " │ └─ columns: []\n" + 11103 " └─ LookupJoin (estimated cost=9.900 rows=3)\n" + 11104 " ├─ MergeJoin (estimated cost=6.090 rows=3)\n" + 11105 " │ ├─ cmp: (a.i = b.i)\n" + 11106 " │ ├─ TableAlias(a)\n" + 11107 " │ │ └─ IndexedTableAccess(mytable)\n" + 11108 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 11109 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 11110 " │ │ └─ columns: [i s]\n" + 11111 " │ └─ TableAlias(b)\n" + 11112 " │ └─ IndexedTableAccess(mytable)\n" + 11113 " │ ├─ index: [mytable.i]\n" + 11114 " │ ├─ filters: [{[NULL, ∞)}]\n" + 11115 " │ └─ columns: [i s]\n" + 11116 " └─ TableAlias(c)\n" + 11117 " └─ IndexedTableAccess(mytable)\n" + 11118 " ├─ index: [mytable.s]\n" + 11119 " ├─ columns: [s]\n" + 11120 " └─ keys: b.s\n" + 11121 "", 11122 ExpectedAnalysis: "Project\n" + 11123 " ├─ columns: [a.i, a.s]\n" + 11124 " └─ CrossJoin (estimated cost=10.090 rows=3) (actual rows=9 loops=1)\n" + 11125 " ├─ TableAlias(d)\n" + 11126 " │ └─ Table\n" + 11127 " │ ├─ name: mytable\n" + 11128 " │ └─ columns: []\n" + 11129 " └─ LookupJoin (estimated cost=9.900 rows=3) (actual rows=3 loops=3)\n" + 11130 " ├─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=3)\n" + 11131 " │ ├─ cmp: (a.i = b.i)\n" + 11132 " │ ├─ TableAlias(a)\n" + 11133 " │ │ └─ IndexedTableAccess(mytable)\n" + 11134 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 11135 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 11136 " │ │ └─ columns: [i s]\n" + 11137 " │ └─ TableAlias(b)\n" + 11138 " │ └─ IndexedTableAccess(mytable)\n" + 11139 " │ ├─ index: [mytable.i]\n" + 11140 " │ ├─ filters: [{[NULL, ∞)}]\n" + 11141 " │ └─ columns: [i s]\n" + 11142 " └─ TableAlias(c)\n" + 11143 " └─ IndexedTableAccess(mytable)\n" + 11144 " ├─ index: [mytable.s]\n" + 11145 " ├─ columns: [s]\n" + 11146 " └─ keys: b.s\n" + 11147 "", 11148 }, 11149 { 11150 Query: `SELECT a.* FROM mytable a inner join mytable b on (a.i = b.s) WHERE a.i BETWEEN 10 AND 20`, 11151 ExpectedPlan: "Project\n" + 11152 " ├─ columns: [a.i:0!null, a.s:1!null]\n" + 11153 " └─ LookupJoin\n" + 11154 " ├─ TableAlias(a)\n" + 11155 " │ └─ IndexedTableAccess(mytable)\n" + 11156 " │ ├─ index: [mytable.i]\n" + 11157 " │ ├─ static: [{[10, 20]}]\n" + 11158 " │ ├─ colSet: (1,2)\n" + 11159 " │ ├─ tableId: 1\n" + 11160 " │ └─ Table\n" + 11161 " │ ├─ name: mytable\n" + 11162 " │ └─ columns: [i s]\n" + 11163 " └─ TableAlias(b)\n" + 11164 " └─ IndexedTableAccess(mytable)\n" + 11165 " ├─ index: [mytable.s]\n" + 11166 " ├─ keys: [a.i:0!null]\n" + 11167 " ├─ colSet: (3,4)\n" + 11168 " ├─ tableId: 2\n" + 11169 " └─ Table\n" + 11170 " ├─ name: mytable\n" + 11171 " └─ columns: [s]\n" + 11172 "", 11173 ExpectedEstimates: "Project\n" + 11174 " ├─ columns: [a.i, a.s]\n" + 11175 " └─ LookupJoin (estimated cost=3.300 rows=1)\n" + 11176 " ├─ TableAlias(a)\n" + 11177 " │ └─ IndexedTableAccess(mytable)\n" + 11178 " │ ├─ index: [mytable.i]\n" + 11179 " │ ├─ filters: [{[10, 20]}]\n" + 11180 " │ └─ columns: [i s]\n" + 11181 " └─ TableAlias(b)\n" + 11182 " └─ IndexedTableAccess(mytable)\n" + 11183 " ├─ index: [mytable.s]\n" + 11184 " ├─ columns: [s]\n" + 11185 " └─ keys: a.i\n" + 11186 "", 11187 ExpectedAnalysis: "Project\n" + 11188 " ├─ columns: [a.i, a.s]\n" + 11189 " └─ LookupJoin (estimated cost=3.300 rows=1) (actual rows=0 loops=1)\n" + 11190 " ├─ TableAlias(a)\n" + 11191 " │ └─ IndexedTableAccess(mytable)\n" + 11192 " │ ├─ index: [mytable.i]\n" + 11193 " │ ├─ filters: [{[10, 20]}]\n" + 11194 " │ └─ columns: [i s]\n" + 11195 " └─ TableAlias(b)\n" + 11196 " └─ IndexedTableAccess(mytable)\n" + 11197 " ├─ index: [mytable.s]\n" + 11198 " ├─ columns: [s]\n" + 11199 " └─ keys: a.i\n" + 11200 "", 11201 }, 11202 { 11203 Query: `SELECT lefttable.i, righttable.s 11204 FROM (SELECT * FROM mytable) lefttable 11205 JOIN (SELECT * FROM mytable) righttable 11206 ON lefttable.i = righttable.i AND righttable.s = lefttable.s 11207 ORDER BY lefttable.i ASC`, 11208 ExpectedPlan: "Project\n" + 11209 " ├─ columns: [lefttable.i:0!null, righttable.s:3!null]\n" + 11210 " └─ Sort(lefttable.i:0!null ASC nullsFirst)\n" + 11211 " └─ HashJoin\n" + 11212 " ├─ AND\n" + 11213 " │ ├─ Eq\n" + 11214 " │ │ ├─ lefttable.i:0!null\n" + 11215 " │ │ └─ righttable.i:2!null\n" + 11216 " │ └─ Eq\n" + 11217 " │ ├─ righttable.s:3!null\n" + 11218 " │ └─ lefttable.s:1!null\n" + 11219 " ├─ SubqueryAlias\n" + 11220 " │ ├─ name: lefttable\n" + 11221 " │ ├─ outerVisibility: false\n" + 11222 " │ ├─ isLateral: false\n" + 11223 " │ ├─ cacheable: true\n" + 11224 " │ ├─ colSet: (3,4)\n" + 11225 " │ ├─ tableId: 2\n" + 11226 " │ └─ Table\n" + 11227 " │ ├─ name: mytable\n" + 11228 " │ ├─ columns: [i s]\n" + 11229 " │ ├─ colSet: (1,2)\n" + 11230 " │ └─ tableId: 1\n" + 11231 " └─ HashLookup\n" + 11232 " ├─ left-key: TUPLE(lefttable.i:0!null, lefttable.s:1!null)\n" + 11233 " ├─ right-key: TUPLE(righttable.i:0!null, righttable.s:1!null)\n" + 11234 " └─ SubqueryAlias\n" + 11235 " ├─ name: righttable\n" + 11236 " ├─ outerVisibility: false\n" + 11237 " ├─ isLateral: false\n" + 11238 " ├─ cacheable: true\n" + 11239 " ├─ colSet: (7,8)\n" + 11240 " ├─ tableId: 4\n" + 11241 " └─ Table\n" + 11242 " ├─ name: mytable\n" + 11243 " ├─ columns: [i s]\n" + 11244 " ├─ colSet: (5,6)\n" + 11245 " └─ tableId: 3\n" + 11246 "", 11247 ExpectedEstimates: "Project\n" + 11248 " ├─ columns: [lefttable.i, righttable.s]\n" + 11249 " └─ Sort(lefttable.i ASC)\n" + 11250 " └─ HashJoin\n" + 11251 " ├─ ((lefttable.i = righttable.i) AND (righttable.s = lefttable.s))\n" + 11252 " ├─ SubqueryAlias\n" + 11253 " │ ├─ name: lefttable\n" + 11254 " │ ├─ outerVisibility: false\n" + 11255 " │ ├─ isLateral: false\n" + 11256 " │ ├─ cacheable: true\n" + 11257 " │ └─ Table\n" + 11258 " │ ├─ name: mytable\n" + 11259 " │ └─ columns: [i s]\n" + 11260 " └─ HashLookup\n" + 11261 " ├─ left-key: (lefttable.i, lefttable.s)\n" + 11262 " ├─ right-key: (righttable.i, righttable.s)\n" + 11263 " └─ SubqueryAlias\n" + 11264 " ├─ name: righttable\n" + 11265 " ├─ outerVisibility: false\n" + 11266 " ├─ isLateral: false\n" + 11267 " ├─ cacheable: true\n" + 11268 " └─ Table\n" + 11269 " ├─ name: mytable\n" + 11270 " └─ columns: [i s]\n" + 11271 "", 11272 ExpectedAnalysis: "Project\n" + 11273 " ├─ columns: [lefttable.i, righttable.s]\n" + 11274 " └─ Sort(lefttable.i ASC)\n" + 11275 " └─ HashJoin\n" + 11276 " ├─ ((lefttable.i = righttable.i) AND (righttable.s = lefttable.s))\n" + 11277 " ├─ SubqueryAlias\n" + 11278 " │ ├─ name: lefttable\n" + 11279 " │ ├─ outerVisibility: false\n" + 11280 " │ ├─ isLateral: false\n" + 11281 " │ ├─ cacheable: true\n" + 11282 " │ └─ Table\n" + 11283 " │ ├─ name: mytable\n" + 11284 " │ └─ columns: [i s]\n" + 11285 " └─ HashLookup\n" + 11286 " ├─ left-key: (lefttable.i, lefttable.s)\n" + 11287 " ├─ right-key: (righttable.i, righttable.s)\n" + 11288 " └─ SubqueryAlias\n" + 11289 " ├─ name: righttable\n" + 11290 " ├─ outerVisibility: false\n" + 11291 " ├─ isLateral: false\n" + 11292 " ├─ cacheable: true\n" + 11293 " └─ Table\n" + 11294 " ├─ name: mytable\n" + 11295 " └─ columns: [i s]\n" + 11296 "", 11297 }, 11298 { 11299 Query: `SELECT s2, i2, i FROM mytable RIGHT JOIN (SELECT * FROM othertable) othertable ON i2 = i`, 11300 ExpectedPlan: "Project\n" + 11301 " ├─ columns: [othertable.s2:0!null, othertable.i2:1!null, mytable.i:2!null]\n" + 11302 " └─ LeftOuterHashJoin\n" + 11303 " ├─ Eq\n" + 11304 " │ ├─ othertable.i2:1!null\n" + 11305 " │ └─ mytable.i:2!null\n" + 11306 " ├─ SubqueryAlias\n" + 11307 " │ ├─ name: othertable\n" + 11308 " │ ├─ outerVisibility: false\n" + 11309 " │ ├─ isLateral: false\n" + 11310 " │ ├─ cacheable: true\n" + 11311 " │ ├─ colSet: (5,6)\n" + 11312 " │ ├─ tableId: 3\n" + 11313 " │ └─ Table\n" + 11314 " │ ├─ name: othertable\n" + 11315 " │ ├─ columns: [s2 i2]\n" + 11316 " │ ├─ colSet: (3,4)\n" + 11317 " │ └─ tableId: 2\n" + 11318 " └─ HashLookup\n" + 11319 " ├─ left-key: TUPLE(othertable.i2:1!null)\n" + 11320 " ├─ right-key: TUPLE(mytable.i:0!null)\n" + 11321 " └─ ProcessTable\n" + 11322 " └─ Table\n" + 11323 " ├─ name: mytable\n" + 11324 " └─ columns: [i]\n" + 11325 "", 11326 ExpectedEstimates: "Project\n" + 11327 " ├─ columns: [othertable.s2, othertable.i2, mytable.i]\n" + 11328 " └─ LeftOuterHashJoin (estimated cost=110.030 rows=3)\n" + 11329 " ├─ (othertable.i2 = mytable.i)\n" + 11330 " ├─ SubqueryAlias\n" + 11331 " │ ├─ name: othertable\n" + 11332 " │ ├─ outerVisibility: false\n" + 11333 " │ ├─ isLateral: false\n" + 11334 " │ ├─ cacheable: true\n" + 11335 " │ └─ Table\n" + 11336 " │ ├─ name: othertable\n" + 11337 " │ └─ columns: [s2 i2]\n" + 11338 " └─ HashLookup\n" + 11339 " ├─ left-key: (othertable.i2)\n" + 11340 " ├─ right-key: (mytable.i)\n" + 11341 " └─ Table\n" + 11342 " ├─ name: mytable\n" + 11343 " └─ columns: [i]\n" + 11344 "", 11345 ExpectedAnalysis: "Project\n" + 11346 " ├─ columns: [othertable.s2, othertable.i2, mytable.i]\n" + 11347 " └─ LeftOuterHashJoin (estimated cost=110.030 rows=3) (actual rows=3 loops=1)\n" + 11348 " ├─ (othertable.i2 = mytable.i)\n" + 11349 " ├─ SubqueryAlias\n" + 11350 " │ ├─ name: othertable\n" + 11351 " │ ├─ outerVisibility: false\n" + 11352 " │ ├─ isLateral: false\n" + 11353 " │ ├─ cacheable: true\n" + 11354 " │ └─ Table\n" + 11355 " │ ├─ name: othertable\n" + 11356 " │ └─ columns: [s2 i2]\n" + 11357 " └─ HashLookup\n" + 11358 " ├─ left-key: (othertable.i2)\n" + 11359 " ├─ right-key: (mytable.i)\n" + 11360 " └─ Table\n" + 11361 " ├─ name: mytable\n" + 11362 " └─ columns: [i]\n" + 11363 "", 11364 }, 11365 { 11366 Query: `SELECT s2, i2, i FROM mytable INNER JOIN (SELECT * FROM othertable) othertable ON i2 = i`, 11367 ExpectedPlan: "HashJoin\n" + 11368 " ├─ Eq\n" + 11369 " │ ├─ othertable.i2:1!null\n" + 11370 " │ └─ mytable.i:2!null\n" + 11371 " ├─ SubqueryAlias\n" + 11372 " │ ├─ name: othertable\n" + 11373 " │ ├─ outerVisibility: false\n" + 11374 " │ ├─ isLateral: false\n" + 11375 " │ ├─ cacheable: true\n" + 11376 " │ ├─ colSet: (5,6)\n" + 11377 " │ ├─ tableId: 3\n" + 11378 " │ └─ Table\n" + 11379 " │ ├─ name: othertable\n" + 11380 " │ ├─ columns: [s2 i2]\n" + 11381 " │ ├─ colSet: (3,4)\n" + 11382 " │ └─ tableId: 2\n" + 11383 " └─ HashLookup\n" + 11384 " ├─ left-key: TUPLE(othertable.i2:1!null)\n" + 11385 " ├─ right-key: TUPLE(mytable.i:0!null)\n" + 11386 " └─ ProcessTable\n" + 11387 " └─ Table\n" + 11388 " ├─ name: mytable\n" + 11389 " └─ columns: [i]\n" + 11390 "", 11391 ExpectedEstimates: "HashJoin (estimated cost=111.000 rows=100)\n" + 11392 " ├─ (othertable.i2 = mytable.i)\n" + 11393 " ├─ SubqueryAlias\n" + 11394 " │ ├─ name: othertable\n" + 11395 " │ ├─ outerVisibility: false\n" + 11396 " │ ├─ isLateral: false\n" + 11397 " │ ├─ cacheable: true\n" + 11398 " │ └─ Table\n" + 11399 " │ ├─ name: othertable\n" + 11400 " │ └─ columns: [s2 i2]\n" + 11401 " └─ HashLookup\n" + 11402 " ├─ left-key: (othertable.i2)\n" + 11403 " ├─ right-key: (mytable.i)\n" + 11404 " └─ Table\n" + 11405 " ├─ name: mytable\n" + 11406 " └─ columns: [i]\n" + 11407 "", 11408 ExpectedAnalysis: "HashJoin (estimated cost=111.000 rows=100) (actual rows=3 loops=1)\n" + 11409 " ├─ (othertable.i2 = mytable.i)\n" + 11410 " ├─ SubqueryAlias\n" + 11411 " │ ├─ name: othertable\n" + 11412 " │ ├─ outerVisibility: false\n" + 11413 " │ ├─ isLateral: false\n" + 11414 " │ ├─ cacheable: true\n" + 11415 " │ └─ Table\n" + 11416 " │ ├─ name: othertable\n" + 11417 " │ └─ columns: [s2 i2]\n" + 11418 " └─ HashLookup\n" + 11419 " ├─ left-key: (othertable.i2)\n" + 11420 " ├─ right-key: (mytable.i)\n" + 11421 " └─ Table\n" + 11422 " ├─ name: mytable\n" + 11423 " └─ columns: [i]\n" + 11424 "", 11425 }, 11426 { 11427 Query: `SELECT * FROM (SELECT * FROM othertable) othertable_alias WHERE s2 = 'a'`, 11428 ExpectedPlan: "SubqueryAlias\n" + 11429 " ├─ name: othertable_alias\n" + 11430 " ├─ outerVisibility: false\n" + 11431 " ├─ isLateral: false\n" + 11432 " ├─ cacheable: true\n" + 11433 " ├─ colSet: (3,4)\n" + 11434 " ├─ tableId: 2\n" + 11435 " └─ Filter\n" + 11436 " ├─ Eq\n" + 11437 " │ ├─ othertable.s2:0!null\n" + 11438 " │ └─ a (longtext)\n" + 11439 " └─ IndexedTableAccess(othertable)\n" + 11440 " ├─ index: [othertable.s2]\n" + 11441 " ├─ static: [{[a, a]}]\n" + 11442 " ├─ colSet: (1,2)\n" + 11443 " ├─ tableId: 1\n" + 11444 " └─ Table\n" + 11445 " ├─ name: othertable\n" + 11446 " └─ columns: [s2 i2]\n" + 11447 "", 11448 ExpectedEstimates: "SubqueryAlias\n" + 11449 " ├─ name: othertable_alias\n" + 11450 " ├─ outerVisibility: false\n" + 11451 " ├─ isLateral: false\n" + 11452 " ├─ cacheable: true\n" + 11453 " └─ Filter\n" + 11454 " ├─ (othertable.s2 = 'a')\n" + 11455 " └─ IndexedTableAccess(othertable)\n" + 11456 " ├─ index: [othertable.s2]\n" + 11457 " ├─ filters: [{[a, a]}]\n" + 11458 " └─ columns: [s2 i2]\n" + 11459 "", 11460 ExpectedAnalysis: "SubqueryAlias\n" + 11461 " ├─ name: othertable_alias\n" + 11462 " ├─ outerVisibility: false\n" + 11463 " ├─ isLateral: false\n" + 11464 " ├─ cacheable: true\n" + 11465 " └─ Filter\n" + 11466 " ├─ (othertable.s2 = 'a')\n" + 11467 " └─ IndexedTableAccess(othertable)\n" + 11468 " ├─ index: [othertable.s2]\n" + 11469 " ├─ filters: [{[a, a]}]\n" + 11470 " └─ columns: [s2 i2]\n" + 11471 "", 11472 }, 11473 { 11474 Query: `SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM othertable) othertable_one) othertable_two) othertable_three WHERE s2 = 'a'`, 11475 ExpectedPlan: "SubqueryAlias\n" + 11476 " ├─ name: othertable_three\n" + 11477 " ├─ outerVisibility: false\n" + 11478 " ├─ isLateral: false\n" + 11479 " ├─ cacheable: true\n" + 11480 " ├─ colSet: (7,8)\n" + 11481 " ├─ tableId: 4\n" + 11482 " └─ SubqueryAlias\n" + 11483 " ├─ name: othertable_two\n" + 11484 " ├─ outerVisibility: false\n" + 11485 " ├─ isLateral: false\n" + 11486 " ├─ cacheable: true\n" + 11487 " ├─ colSet: (5,6)\n" + 11488 " ├─ tableId: 3\n" + 11489 " └─ SubqueryAlias\n" + 11490 " ├─ name: othertable_one\n" + 11491 " ├─ outerVisibility: false\n" + 11492 " ├─ isLateral: false\n" + 11493 " ├─ cacheable: true\n" + 11494 " ├─ colSet: (3,4)\n" + 11495 " ├─ tableId: 2\n" + 11496 " └─ Filter\n" + 11497 " ├─ Eq\n" + 11498 " │ ├─ othertable.s2:0!null\n" + 11499 " │ └─ a (longtext)\n" + 11500 " └─ IndexedTableAccess(othertable)\n" + 11501 " ├─ index: [othertable.s2]\n" + 11502 " ├─ static: [{[a, a]}]\n" + 11503 " ├─ colSet: (1,2)\n" + 11504 " ├─ tableId: 1\n" + 11505 " └─ Table\n" + 11506 " ├─ name: othertable\n" + 11507 " └─ columns: [s2 i2]\n" + 11508 "", 11509 ExpectedEstimates: "SubqueryAlias\n" + 11510 " ├─ name: othertable_three\n" + 11511 " ├─ outerVisibility: false\n" + 11512 " ├─ isLateral: false\n" + 11513 " ├─ cacheable: true\n" + 11514 " └─ SubqueryAlias\n" + 11515 " ├─ name: othertable_two\n" + 11516 " ├─ outerVisibility: false\n" + 11517 " ├─ isLateral: false\n" + 11518 " ├─ cacheable: true\n" + 11519 " └─ SubqueryAlias\n" + 11520 " ├─ name: othertable_one\n" + 11521 " ├─ outerVisibility: false\n" + 11522 " ├─ isLateral: false\n" + 11523 " ├─ cacheable: true\n" + 11524 " └─ Filter\n" + 11525 " ├─ (othertable.s2 = 'a')\n" + 11526 " └─ IndexedTableAccess(othertable)\n" + 11527 " ├─ index: [othertable.s2]\n" + 11528 " ├─ filters: [{[a, a]}]\n" + 11529 " └─ columns: [s2 i2]\n" + 11530 "", 11531 ExpectedAnalysis: "SubqueryAlias\n" + 11532 " ├─ name: othertable_three\n" + 11533 " ├─ outerVisibility: false\n" + 11534 " ├─ isLateral: false\n" + 11535 " ├─ cacheable: true\n" + 11536 " └─ SubqueryAlias\n" + 11537 " ├─ name: othertable_two\n" + 11538 " ├─ outerVisibility: false\n" + 11539 " ├─ isLateral: false\n" + 11540 " ├─ cacheable: true\n" + 11541 " └─ SubqueryAlias\n" + 11542 " ├─ name: othertable_one\n" + 11543 " ├─ outerVisibility: false\n" + 11544 " ├─ isLateral: false\n" + 11545 " ├─ cacheable: true\n" + 11546 " └─ Filter\n" + 11547 " ├─ (othertable.s2 = 'a')\n" + 11548 " └─ IndexedTableAccess(othertable)\n" + 11549 " ├─ index: [othertable.s2]\n" + 11550 " ├─ filters: [{[a, a]}]\n" + 11551 " └─ columns: [s2 i2]\n" + 11552 "", 11553 }, 11554 { 11555 Query: `SELECT othertable.s2, othertable.i2, mytable.i FROM mytable INNER JOIN (SELECT * FROM othertable) othertable ON othertable.i2 = mytable.i WHERE othertable.s2 > 'a'`, 11556 ExpectedPlan: "HashJoin\n" + 11557 " ├─ Eq\n" + 11558 " │ ├─ othertable.i2:1!null\n" + 11559 " │ └─ mytable.i:2!null\n" + 11560 " ├─ SubqueryAlias\n" + 11561 " │ ├─ name: othertable\n" + 11562 " │ ├─ outerVisibility: false\n" + 11563 " │ ├─ isLateral: false\n" + 11564 " │ ├─ cacheable: true\n" + 11565 " │ ├─ colSet: (5,6)\n" + 11566 " │ ├─ tableId: 3\n" + 11567 " │ └─ Filter\n" + 11568 " │ ├─ GreaterThan\n" + 11569 " │ │ ├─ othertable.s2:0!null\n" + 11570 " │ │ └─ a (longtext)\n" + 11571 " │ └─ IndexedTableAccess(othertable)\n" + 11572 " │ ├─ index: [othertable.s2]\n" + 11573 " │ ├─ static: [{(a, ∞)}]\n" + 11574 " │ ├─ colSet: (3,4)\n" + 11575 " │ ├─ tableId: 2\n" + 11576 " │ └─ Table\n" + 11577 " │ ├─ name: othertable\n" + 11578 " │ └─ columns: [s2 i2]\n" + 11579 " └─ HashLookup\n" + 11580 " ├─ left-key: TUPLE(othertable.i2:1!null)\n" + 11581 " ├─ right-key: TUPLE(mytable.i:0!null)\n" + 11582 " └─ ProcessTable\n" + 11583 " └─ Table\n" + 11584 " ├─ name: mytable\n" + 11585 " └─ columns: [i]\n" + 11586 "", 11587 ExpectedEstimates: "HashJoin (estimated cost=111.000 rows=100)\n" + 11588 " ├─ (othertable.i2 = mytable.i)\n" + 11589 " ├─ SubqueryAlias\n" + 11590 " │ ├─ name: othertable\n" + 11591 " │ ├─ outerVisibility: false\n" + 11592 " │ ├─ isLateral: false\n" + 11593 " │ ├─ cacheable: true\n" + 11594 " │ └─ Filter\n" + 11595 " │ ├─ (othertable.s2 > 'a')\n" + 11596 " │ └─ IndexedTableAccess(othertable)\n" + 11597 " │ ├─ index: [othertable.s2]\n" + 11598 " │ ├─ filters: [{(a, ∞)}]\n" + 11599 " │ └─ columns: [s2 i2]\n" + 11600 " └─ HashLookup\n" + 11601 " ├─ left-key: (othertable.i2)\n" + 11602 " ├─ right-key: (mytable.i)\n" + 11603 " └─ Table\n" + 11604 " ├─ name: mytable\n" + 11605 " └─ columns: [i]\n" + 11606 "", 11607 ExpectedAnalysis: "HashJoin (estimated cost=111.000 rows=100) (actual rows=3 loops=1)\n" + 11608 " ├─ (othertable.i2 = mytable.i)\n" + 11609 " ├─ SubqueryAlias\n" + 11610 " │ ├─ name: othertable\n" + 11611 " │ ├─ outerVisibility: false\n" + 11612 " │ ├─ isLateral: false\n" + 11613 " │ ├─ cacheable: true\n" + 11614 " │ └─ Filter\n" + 11615 " │ ├─ (othertable.s2 > 'a')\n" + 11616 " │ └─ IndexedTableAccess(othertable)\n" + 11617 " │ ├─ index: [othertable.s2]\n" + 11618 " │ ├─ filters: [{(a, ∞)}]\n" + 11619 " │ └─ columns: [s2 i2]\n" + 11620 " └─ HashLookup\n" + 11621 " ├─ left-key: (othertable.i2)\n" + 11622 " ├─ right-key: (mytable.i)\n" + 11623 " └─ Table\n" + 11624 " ├─ name: mytable\n" + 11625 " └─ columns: [i]\n" + 11626 "", 11627 }, 11628 { 11629 Query: `SELECT mytable.i, mytable.s FROM mytable WHERE mytable.i = (SELECT i2 FROM othertable LIMIT 1)`, 11630 ExpectedPlan: "SemiJoin\n" + 11631 " ├─ Eq\n" + 11632 " │ ├─ mytable.i:0!null\n" + 11633 " │ └─ othertable.i2:2!null\n" + 11634 " ├─ ProcessTable\n" + 11635 " │ └─ Table\n" + 11636 " │ ├─ name: mytable\n" + 11637 " │ └─ columns: [i s]\n" + 11638 " └─ Limit(1)\n" + 11639 " └─ Project\n" + 11640 " ├─ columns: [othertable.i2:1!null]\n" + 11641 " └─ ProcessTable\n" + 11642 " └─ Table\n" + 11643 " ├─ name: othertable\n" + 11644 " └─ columns: [s2 i2]\n" + 11645 "", 11646 ExpectedEstimates: "SemiJoin (estimated cost=7.545 rows=3)\n" + 11647 " ├─ (mytable.i = othertable.i2)\n" + 11648 " ├─ Table\n" + 11649 " │ └─ name: mytable\n" + 11650 " └─ Limit(1)\n" + 11651 " └─ Project\n" + 11652 " ├─ columns: [othertable.i2]\n" + 11653 " └─ Table\n" + 11654 " └─ name: othertable\n" + 11655 "", 11656 ExpectedAnalysis: "SemiJoin (estimated cost=7.545 rows=3) (actual rows=1 loops=1)\n" + 11657 " ├─ (mytable.i = othertable.i2)\n" + 11658 " ├─ Table\n" + 11659 " │ └─ name: mytable\n" + 11660 " └─ Limit(1)\n" + 11661 " └─ Project\n" + 11662 " ├─ columns: [othertable.i2]\n" + 11663 " └─ Table\n" + 11664 " └─ name: othertable\n" + 11665 "", 11666 }, 11667 { 11668 Query: `SELECT mytable.i, mytable.s FROM mytable WHERE mytable.i IN (SELECT i2 FROM othertable)`, 11669 ExpectedPlan: "SemiJoin\n" + 11670 " ├─ Eq\n" + 11671 " │ ├─ mytable.i:0!null\n" + 11672 " │ └─ othertable.i2:2!null\n" + 11673 " ├─ ProcessTable\n" + 11674 " │ └─ Table\n" + 11675 " │ ├─ name: mytable\n" + 11676 " │ └─ columns: [i s]\n" + 11677 " └─ Project\n" + 11678 " ├─ columns: [othertable.i2:1!null]\n" + 11679 " └─ ProcessTable\n" + 11680 " └─ Table\n" + 11681 " ├─ name: othertable\n" + 11682 " └─ columns: [s2 i2]\n" + 11683 "", 11684 ExpectedEstimates: "SemiJoin (estimated cost=7.545 rows=3)\n" + 11685 " ├─ (mytable.i = othertable.i2)\n" + 11686 " ├─ Table\n" + 11687 " │ └─ name: mytable\n" + 11688 " └─ Project\n" + 11689 " ├─ columns: [othertable.i2]\n" + 11690 " └─ Table\n" + 11691 " └─ name: othertable\n" + 11692 "", 11693 ExpectedAnalysis: "SemiJoin (estimated cost=7.545 rows=3) (actual rows=3 loops=1)\n" + 11694 " ├─ (mytable.i = othertable.i2)\n" + 11695 " ├─ Table\n" + 11696 " │ └─ name: mytable\n" + 11697 " └─ Project\n" + 11698 " ├─ columns: [othertable.i2]\n" + 11699 " └─ Table\n" + 11700 " └─ name: othertable\n" + 11701 "", 11702 }, 11703 { 11704 Query: `SELECT mytable.i, mytable.s FROM mytable WHERE mytable.i IN (SELECT i2 FROM othertable WHERE mytable.i = othertable.i2)`, 11705 ExpectedPlan: "Filter\n" + 11706 " ├─ InSubquery\n" + 11707 " │ ├─ left: mytable.i:0!null\n" + 11708 " │ └─ right: Subquery\n" + 11709 " │ ├─ cacheable: false\n" + 11710 " │ ├─ alias-string: select i2 from othertable where mytable.i = othertable.i2\n" + 11711 " │ └─ Filter\n" + 11712 " │ ├─ Eq\n" + 11713 " │ │ ├─ mytable.i:0!null\n" + 11714 " │ │ └─ othertable.i2:2!null\n" + 11715 " │ └─ IndexedTableAccess(othertable)\n" + 11716 " │ ├─ index: [othertable.i2]\n" + 11717 " │ ├─ keys: [mytable.i:0!null]\n" + 11718 " │ ├─ colSet: (3,4)\n" + 11719 " │ ├─ tableId: 2\n" + 11720 " │ └─ Table\n" + 11721 " │ ├─ name: othertable\n" + 11722 " │ └─ columns: [i2]\n" + 11723 " └─ ProcessTable\n" + 11724 " └─ Table\n" + 11725 " ├─ name: mytable\n" + 11726 " └─ columns: [i s]\n" + 11727 "", 11728 ExpectedEstimates: "Filter\n" + 11729 " ├─ InSubquery\n" + 11730 " │ ├─ left: mytable.i\n" + 11731 " │ └─ right: Subquery\n" + 11732 " │ ├─ cacheable: false\n" + 11733 " │ └─ Filter\n" + 11734 " │ ├─ (mytable.i = othertable.i2)\n" + 11735 " │ └─ IndexedTableAccess(othertable)\n" + 11736 " │ ├─ index: [othertable.i2]\n" + 11737 " │ ├─ columns: [i2]\n" + 11738 " │ └─ keys: mytable.i\n" + 11739 " └─ Table\n" + 11740 " └─ name: mytable\n" + 11741 "", 11742 ExpectedAnalysis: "Filter\n" + 11743 " ├─ InSubquery\n" + 11744 " │ ├─ left: mytable.i\n" + 11745 " │ └─ right: Subquery\n" + 11746 " │ ├─ cacheable: false\n" + 11747 " │ └─ Filter\n" + 11748 " │ ├─ (mytable.i = othertable.i2)\n" + 11749 " │ └─ IndexedTableAccess(othertable)\n" + 11750 " │ ├─ index: [othertable.i2]\n" + 11751 " │ ├─ columns: [i2]\n" + 11752 " │ └─ keys: mytable.i\n" + 11753 " └─ Table\n" + 11754 " └─ name: mytable\n" + 11755 "", 11756 }, 11757 { 11758 Query: `SELECT * FROM mytable mt INNER JOIN othertable ot ON mt.i = ot.i2 AND mt.i > 2`, 11759 ExpectedPlan: "LookupJoin\n" + 11760 " ├─ TableAlias(mt)\n" + 11761 " │ └─ IndexedTableAccess(mytable)\n" + 11762 " │ ├─ index: [mytable.i]\n" + 11763 " │ ├─ static: [{(2, ∞)}]\n" + 11764 " │ ├─ colSet: (1,2)\n" + 11765 " │ ├─ tableId: 1\n" + 11766 " │ └─ Table\n" + 11767 " │ ├─ name: mytable\n" + 11768 " │ └─ columns: [i s]\n" + 11769 " └─ TableAlias(ot)\n" + 11770 " └─ IndexedTableAccess(othertable)\n" + 11771 " ├─ index: [othertable.i2]\n" + 11772 " ├─ keys: [mt.i:0!null]\n" + 11773 " ├─ colSet: (3,4)\n" + 11774 " ├─ tableId: 2\n" + 11775 " └─ Table\n" + 11776 " ├─ name: othertable\n" + 11777 " └─ columns: [s2 i2]\n" + 11778 "", 11779 ExpectedEstimates: "LookupJoin (estimated cost=3.300 rows=1)\n" + 11780 " ├─ TableAlias(mt)\n" + 11781 " │ └─ IndexedTableAccess(mytable)\n" + 11782 " │ ├─ index: [mytable.i]\n" + 11783 " │ ├─ filters: [{(2, ∞)}]\n" + 11784 " │ └─ columns: [i s]\n" + 11785 " └─ TableAlias(ot)\n" + 11786 " └─ IndexedTableAccess(othertable)\n" + 11787 " ├─ index: [othertable.i2]\n" + 11788 " ├─ columns: [s2 i2]\n" + 11789 " └─ keys: mt.i\n" + 11790 "", 11791 ExpectedAnalysis: "LookupJoin (estimated cost=3.300 rows=1) (actual rows=1 loops=1)\n" + 11792 " ├─ TableAlias(mt)\n" + 11793 " │ └─ IndexedTableAccess(mytable)\n" + 11794 " │ ├─ index: [mytable.i]\n" + 11795 " │ ├─ filters: [{(2, ∞)}]\n" + 11796 " │ └─ columns: [i s]\n" + 11797 " └─ TableAlias(ot)\n" + 11798 " └─ IndexedTableAccess(othertable)\n" + 11799 " ├─ index: [othertable.i2]\n" + 11800 " ├─ columns: [s2 i2]\n" + 11801 " └─ keys: mt.i\n" + 11802 "", 11803 }, 11804 { 11805 Query: `SELECT /*+ JOIN_ORDER(mt, o) */ * FROM mytable mt INNER JOIN one_pk o ON mt.i = o.pk AND mt.s = o.c2`, 11806 ExpectedPlan: "MergeJoin\n" + 11807 " ├─ cmp: Eq\n" + 11808 " │ ├─ mt.i:0!null\n" + 11809 " │ └─ o.pk:2!null\n" + 11810 " ├─ sel: Eq\n" + 11811 " │ ├─ mt.s:1!null\n" + 11812 " │ └─ o.c2:4\n" + 11813 " ├─ TableAlias(mt)\n" + 11814 " │ └─ IndexedTableAccess(mytable)\n" + 11815 " │ ├─ index: [mytable.i,mytable.s]\n" + 11816 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 11817 " │ ├─ colSet: (1,2)\n" + 11818 " │ ├─ tableId: 1\n" + 11819 " │ └─ Table\n" + 11820 " │ ├─ name: mytable\n" + 11821 " │ └─ columns: [i s]\n" + 11822 " └─ TableAlias(o)\n" + 11823 " └─ IndexedTableAccess(one_pk)\n" + 11824 " ├─ index: [one_pk.pk]\n" + 11825 " ├─ static: [{[NULL, ∞)}]\n" + 11826 " ├─ colSet: (3-8)\n" + 11827 " ├─ tableId: 2\n" + 11828 " └─ Table\n" + 11829 " ├─ name: one_pk\n" + 11830 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 11831 "", 11832 ExpectedEstimates: "MergeJoin (estimated cost=7.100 rows=3)\n" + 11833 " ├─ cmp: (mt.i = o.pk)\n" + 11834 " ├─ sel: (mt.s = o.c2)\n" + 11835 " ├─ TableAlias(mt)\n" + 11836 " │ └─ IndexedTableAccess(mytable)\n" + 11837 " │ ├─ index: [mytable.i,mytable.s]\n" + 11838 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 11839 " │ └─ columns: [i s]\n" + 11840 " └─ TableAlias(o)\n" + 11841 " └─ IndexedTableAccess(one_pk)\n" + 11842 " ├─ index: [one_pk.pk]\n" + 11843 " ├─ filters: [{[NULL, ∞)}]\n" + 11844 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 11845 "", 11846 ExpectedAnalysis: "MergeJoin (estimated cost=7.100 rows=3) (actual rows=0 loops=1)\n" + 11847 " ├─ cmp: (mt.i = o.pk)\n" + 11848 " ├─ sel: (mt.s = o.c2)\n" + 11849 " ├─ TableAlias(mt)\n" + 11850 " │ └─ IndexedTableAccess(mytable)\n" + 11851 " │ ├─ index: [mytable.i,mytable.s]\n" + 11852 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 11853 " │ └─ columns: [i s]\n" + 11854 " └─ TableAlias(o)\n" + 11855 " └─ IndexedTableAccess(one_pk)\n" + 11856 " ├─ index: [one_pk.pk]\n" + 11857 " ├─ filters: [{[NULL, ∞)}]\n" + 11858 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 11859 "", 11860 }, 11861 { 11862 Query: `SELECT i, i2, s2 FROM mytable RIGHT JOIN othertable ON i = i2 - 1`, 11863 ExpectedPlan: "Project\n" + 11864 " ├─ columns: [mytable.i:2!null, othertable.i2:1!null, othertable.s2:0!null]\n" + 11865 " └─ LeftOuterJoin\n" + 11866 " ├─ Eq\n" + 11867 " │ ├─ mytable.i:2!null\n" + 11868 " │ └─ (othertable.i2:1!null - 1 (tinyint))\n" + 11869 " ├─ ProcessTable\n" + 11870 " │ └─ Table\n" + 11871 " │ ├─ name: othertable\n" + 11872 " │ └─ columns: [s2 i2]\n" + 11873 " └─ ProcessTable\n" + 11874 " └─ Table\n" + 11875 " ├─ name: mytable\n" + 11876 " └─ columns: [i]\n" + 11877 "", 11878 ExpectedEstimates: "Project\n" + 11879 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 11880 " └─ LeftOuterJoin (estimated cost=8.090 rows=3)\n" + 11881 " ├─ (mytable.i = (othertable.i2 - 1))\n" + 11882 " ├─ Table\n" + 11883 " │ ├─ name: othertable\n" + 11884 " │ └─ columns: [s2 i2]\n" + 11885 " └─ Table\n" + 11886 " ├─ name: mytable\n" + 11887 " └─ columns: [i]\n" + 11888 "", 11889 ExpectedAnalysis: "Project\n" + 11890 " ├─ columns: [mytable.i, othertable.i2, othertable.s2]\n" + 11891 " └─ LeftOuterJoin (estimated cost=8.090 rows=3) (actual rows=3 loops=1)\n" + 11892 " ├─ (mytable.i = (othertable.i2 - 1))\n" + 11893 " ├─ Table\n" + 11894 " │ ├─ name: othertable\n" + 11895 " │ └─ columns: [s2 i2]\n" + 11896 " └─ Table\n" + 11897 " ├─ name: mytable\n" + 11898 " └─ columns: [i]\n" + 11899 "", 11900 }, 11901 { 11902 Query: `SELECT * FROM tabletest, mytable mt INNER JOIN othertable ot ON mt.i = ot.i2`, 11903 ExpectedPlan: "Project\n" + 11904 " ├─ columns: [tabletest.i:4!null, tabletest.s:5!null, mt.i:0!null, mt.s:1!null, ot.s2:2!null, ot.i2:3!null]\n" + 11905 " └─ CrossJoin\n" + 11906 " ├─ MergeJoin\n" + 11907 " │ ├─ cmp: Eq\n" + 11908 " │ │ ├─ mt.i:0!null\n" + 11909 " │ │ └─ ot.i2:3!null\n" + 11910 " │ ├─ TableAlias(mt)\n" + 11911 " │ │ └─ IndexedTableAccess(mytable)\n" + 11912 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 11913 " │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 11914 " │ │ ├─ colSet: (3,4)\n" + 11915 " │ │ ├─ tableId: 2\n" + 11916 " │ │ └─ Table\n" + 11917 " │ │ ├─ name: mytable\n" + 11918 " │ │ └─ columns: [i s]\n" + 11919 " │ └─ TableAlias(ot)\n" + 11920 " │ └─ IndexedTableAccess(othertable)\n" + 11921 " │ ├─ index: [othertable.i2]\n" + 11922 " │ ├─ static: [{[NULL, ∞)}]\n" + 11923 " │ ├─ colSet: (5,6)\n" + 11924 " │ ├─ tableId: 3\n" + 11925 " │ └─ Table\n" + 11926 " │ ├─ name: othertable\n" + 11927 " │ └─ columns: [s2 i2]\n" + 11928 " └─ ProcessTable\n" + 11929 " └─ Table\n" + 11930 " ├─ name: tabletest\n" + 11931 " └─ columns: [i s]\n" + 11932 "", 11933 ExpectedEstimates: "Project\n" + 11934 " ├─ columns: [tabletest.i, tabletest.s, mt.i, mt.s, ot.s2, ot.i2]\n" + 11935 " └─ CrossJoin (estimated cost=10.090 rows=3)\n" + 11936 " ├─ MergeJoin (estimated cost=6.090 rows=3)\n" + 11937 " │ ├─ cmp: (mt.i = ot.i2)\n" + 11938 " │ ├─ TableAlias(mt)\n" + 11939 " │ │ └─ IndexedTableAccess(mytable)\n" + 11940 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 11941 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 11942 " │ │ └─ columns: [i s]\n" + 11943 " │ └─ TableAlias(ot)\n" + 11944 " │ └─ IndexedTableAccess(othertable)\n" + 11945 " │ ├─ index: [othertable.i2]\n" + 11946 " │ ├─ filters: [{[NULL, ∞)}]\n" + 11947 " │ └─ columns: [s2 i2]\n" + 11948 " └─ Table\n" + 11949 " ├─ name: tabletest\n" + 11950 " └─ columns: [i s]\n" + 11951 "", 11952 ExpectedAnalysis: "Project\n" + 11953 " ├─ columns: [tabletest.i, tabletest.s, mt.i, mt.s, ot.s2, ot.i2]\n" + 11954 " └─ CrossJoin (estimated cost=10.090 rows=3) (actual rows=9 loops=1)\n" + 11955 " ├─ MergeJoin (estimated cost=6.090 rows=3) (actual rows=3 loops=1)\n" + 11956 " │ ├─ cmp: (mt.i = ot.i2)\n" + 11957 " │ ├─ TableAlias(mt)\n" + 11958 " │ │ └─ IndexedTableAccess(mytable)\n" + 11959 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 11960 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 11961 " │ │ └─ columns: [i s]\n" + 11962 " │ └─ TableAlias(ot)\n" + 11963 " │ └─ IndexedTableAccess(othertable)\n" + 11964 " │ ├─ index: [othertable.i2]\n" + 11965 " │ ├─ filters: [{[NULL, ∞)}]\n" + 11966 " │ └─ columns: [s2 i2]\n" + 11967 " └─ Table\n" + 11968 " ├─ name: tabletest\n" + 11969 " └─ columns: [i s]\n" + 11970 "", 11971 }, 11972 { 11973 Query: `SELECT t1.timestamp FROM reservedWordsTable t1 JOIN reservedWordsTable t2 ON t1.TIMESTAMP = t2.tImEstamp`, 11974 ExpectedPlan: "Project\n" + 11975 " ├─ columns: [t1.timestamp:1!null]\n" + 11976 " └─ InnerJoin\n" + 11977 " ├─ Eq\n" + 11978 " │ ├─ t1.TIMESTAMP:1!null\n" + 11979 " │ └─ t2.tImEstamp:0!null\n" + 11980 " ├─ TableAlias(t2)\n" + 11981 " │ └─ ProcessTable\n" + 11982 " │ └─ Table\n" + 11983 " │ ├─ name: reservedWordsTable\n" + 11984 " │ └─ columns: [timestamp]\n" + 11985 " └─ TableAlias(t1)\n" + 11986 " └─ Table\n" + 11987 " ├─ name: reservedWordsTable\n" + 11988 " ├─ columns: [timestamp]\n" + 11989 " ├─ colSet: (1-4)\n" + 11990 " └─ tableId: 1\n" + 11991 "", 11992 ExpectedEstimates: "Project\n" + 11993 " ├─ columns: [t1.timestamp]\n" + 11994 " └─ InnerJoin (estimated cost=2.010 rows=1)\n" + 11995 " ├─ (t1.TIMESTAMP = t2.tImEstamp)\n" + 11996 " ├─ TableAlias(t2)\n" + 11997 " │ └─ Table\n" + 11998 " │ ├─ name: reservedWordsTable\n" + 11999 " │ └─ columns: [timestamp]\n" + 12000 " └─ TableAlias(t1)\n" + 12001 " └─ Table\n" + 12002 " ├─ name: reservedWordsTable\n" + 12003 " └─ columns: [timestamp]\n" + 12004 "", 12005 ExpectedAnalysis: "Project\n" + 12006 " ├─ columns: [t1.timestamp]\n" + 12007 " └─ InnerJoin (estimated cost=2.010 rows=1) (actual rows=1 loops=1)\n" + 12008 " ├─ (t1.TIMESTAMP = t2.tImEstamp)\n" + 12009 " ├─ TableAlias(t2)\n" + 12010 " │ └─ Table\n" + 12011 " │ ├─ name: reservedWordsTable\n" + 12012 " │ └─ columns: [timestamp]\n" + 12013 " └─ TableAlias(t1)\n" + 12014 " └─ Table\n" + 12015 " ├─ name: reservedWordsTable\n" + 12016 " └─ columns: [timestamp]\n" + 12017 "", 12018 }, 12019 { 12020 Query: `SELECT pk,pk1,pk2 FROM one_pk JOIN two_pk ON one_pk.pk=two_pk.pk1 AND one_pk.pk=two_pk.pk2`, 12021 ExpectedPlan: "MergeJoin\n" + 12022 " ├─ cmp: Eq\n" + 12023 " │ ├─ one_pk.pk:0!null\n" + 12024 " │ └─ two_pk.pk1:1!null\n" + 12025 " ├─ sel: Eq\n" + 12026 " │ ├─ one_pk.pk:0!null\n" + 12027 " │ └─ two_pk.pk2:2!null\n" + 12028 " ├─ IndexedTableAccess(one_pk)\n" + 12029 " │ ├─ index: [one_pk.pk]\n" + 12030 " │ ├─ static: [{[NULL, ∞)}]\n" + 12031 " │ ├─ colSet: (1-6)\n" + 12032 " │ ├─ tableId: 1\n" + 12033 " │ └─ Table\n" + 12034 " │ ├─ name: one_pk\n" + 12035 " │ └─ columns: [pk]\n" + 12036 " └─ IndexedTableAccess(two_pk)\n" + 12037 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 12038 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 12039 " ├─ colSet: (7-13)\n" + 12040 " ├─ tableId: 2\n" + 12041 " └─ Table\n" + 12042 " ├─ name: two_pk\n" + 12043 " └─ columns: [pk1 pk2]\n" + 12044 "", 12045 ExpectedEstimates: "MergeJoin (estimated cost=8.120 rows=4)\n" + 12046 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 12047 " ├─ sel: (one_pk.pk = two_pk.pk2)\n" + 12048 " ├─ IndexedTableAccess(one_pk)\n" + 12049 " │ ├─ index: [one_pk.pk]\n" + 12050 " │ ├─ filters: [{[NULL, ∞)}]\n" + 12051 " │ └─ columns: [pk]\n" + 12052 " └─ IndexedTableAccess(two_pk)\n" + 12053 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 12054 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 12055 " └─ columns: [pk1 pk2]\n" + 12056 "", 12057 ExpectedAnalysis: "MergeJoin (estimated cost=8.120 rows=4) (actual rows=2 loops=1)\n" + 12058 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 12059 " ├─ sel: (one_pk.pk = two_pk.pk2)\n" + 12060 " ├─ IndexedTableAccess(one_pk)\n" + 12061 " │ ├─ index: [one_pk.pk]\n" + 12062 " │ ├─ filters: [{[NULL, ∞)}]\n" + 12063 " │ └─ columns: [pk]\n" + 12064 " └─ IndexedTableAccess(two_pk)\n" + 12065 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 12066 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 12067 " └─ columns: [pk1 pk2]\n" + 12068 "", 12069 }, 12070 { 12071 Query: `SELECT pk,pk1,pk2 FROM one_pk JOIN two_pk ON one_pk.pk=two_pk.pk1 AND one_pk.pk=two_pk.pk2 OR one_pk.c2 = two_pk.c3`, 12072 ExpectedPlan: "Project\n" + 12073 " ├─ columns: [one_pk.pk:3!null, two_pk.pk1:0!null, two_pk.pk2:1!null]\n" + 12074 " └─ InnerJoin\n" + 12075 " ├─ Or\n" + 12076 " │ ├─ AND\n" + 12077 " │ │ ├─ Eq\n" + 12078 " │ │ │ ├─ one_pk.pk:3!null\n" + 12079 " │ │ │ └─ two_pk.pk1:0!null\n" + 12080 " │ │ └─ Eq\n" + 12081 " │ │ ├─ one_pk.pk:3!null\n" + 12082 " │ │ └─ two_pk.pk2:1!null\n" + 12083 " │ └─ Eq\n" + 12084 " │ ├─ one_pk.c2:4\n" + 12085 " │ └─ two_pk.c3:2!null\n" + 12086 " ├─ ProcessTable\n" + 12087 " │ └─ Table\n" + 12088 " │ ├─ name: two_pk\n" + 12089 " │ └─ columns: [pk1 pk2 c3]\n" + 12090 " └─ ProcessTable\n" + 12091 " └─ Table\n" + 12092 " ├─ name: one_pk\n" + 12093 " └─ columns: [pk c2]\n" + 12094 "", 12095 ExpectedEstimates: "Project\n" + 12096 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 12097 " └─ InnerJoin (estimated cost=17.160 rows=5)\n" + 12098 " ├─ (((one_pk.pk = two_pk.pk1) AND (one_pk.pk = two_pk.pk2)) OR (one_pk.c2 = two_pk.c3))\n" + 12099 " ├─ Table\n" + 12100 " │ ├─ name: two_pk\n" + 12101 " │ └─ columns: [pk1 pk2 c3]\n" + 12102 " └─ Table\n" + 12103 " ├─ name: one_pk\n" + 12104 " └─ columns: [pk c2]\n" + 12105 "", 12106 ExpectedAnalysis: "Project\n" + 12107 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 12108 " └─ InnerJoin (estimated cost=17.160 rows=5) (actual rows=2 loops=1)\n" + 12109 " ├─ (((one_pk.pk = two_pk.pk1) AND (one_pk.pk = two_pk.pk2)) OR (one_pk.c2 = two_pk.c3))\n" + 12110 " ├─ Table\n" + 12111 " │ ├─ name: two_pk\n" + 12112 " │ └─ columns: [pk1 pk2 c3]\n" + 12113 " └─ Table\n" + 12114 " ├─ name: one_pk\n" + 12115 " └─ columns: [pk c2]\n" + 12116 "", 12117 }, 12118 { 12119 Query: `SELECT pk,pk1,pk2 FROM one_pk opk JOIN two_pk tpk ON opk.pk=tpk.pk1 AND opk.pk=tpk.pk2`, 12120 ExpectedPlan: "MergeJoin\n" + 12121 " ├─ cmp: Eq\n" + 12122 " │ ├─ opk.pk:0!null\n" + 12123 " │ └─ tpk.pk1:1!null\n" + 12124 " ├─ sel: Eq\n" + 12125 " │ ├─ opk.pk:0!null\n" + 12126 " │ └─ tpk.pk2:2!null\n" + 12127 " ├─ TableAlias(opk)\n" + 12128 " │ └─ IndexedTableAccess(one_pk)\n" + 12129 " │ ├─ index: [one_pk.pk]\n" + 12130 " │ ├─ static: [{[NULL, ∞)}]\n" + 12131 " │ ├─ colSet: (1-6)\n" + 12132 " │ ├─ tableId: 1\n" + 12133 " │ └─ Table\n" + 12134 " │ ├─ name: one_pk\n" + 12135 " │ └─ columns: [pk]\n" + 12136 " └─ TableAlias(tpk)\n" + 12137 " └─ IndexedTableAccess(two_pk)\n" + 12138 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 12139 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 12140 " ├─ colSet: (7-13)\n" + 12141 " ├─ tableId: 2\n" + 12142 " └─ Table\n" + 12143 " ├─ name: two_pk\n" + 12144 " └─ columns: [pk1 pk2]\n" + 12145 "", 12146 ExpectedEstimates: "MergeJoin (estimated cost=8.120 rows=4)\n" + 12147 " ├─ cmp: (opk.pk = tpk.pk1)\n" + 12148 " ├─ sel: (opk.pk = tpk.pk2)\n" + 12149 " ├─ TableAlias(opk)\n" + 12150 " │ └─ IndexedTableAccess(one_pk)\n" + 12151 " │ ├─ index: [one_pk.pk]\n" + 12152 " │ ├─ filters: [{[NULL, ∞)}]\n" + 12153 " │ └─ columns: [pk]\n" + 12154 " └─ TableAlias(tpk)\n" + 12155 " └─ IndexedTableAccess(two_pk)\n" + 12156 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 12157 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 12158 " └─ columns: [pk1 pk2]\n" + 12159 "", 12160 ExpectedAnalysis: "MergeJoin (estimated cost=8.120 rows=4) (actual rows=2 loops=1)\n" + 12161 " ├─ cmp: (opk.pk = tpk.pk1)\n" + 12162 " ├─ sel: (opk.pk = tpk.pk2)\n" + 12163 " ├─ TableAlias(opk)\n" + 12164 " │ └─ IndexedTableAccess(one_pk)\n" + 12165 " │ ├─ index: [one_pk.pk]\n" + 12166 " │ ├─ filters: [{[NULL, ∞)}]\n" + 12167 " │ └─ columns: [pk]\n" + 12168 " └─ TableAlias(tpk)\n" + 12169 " └─ IndexedTableAccess(two_pk)\n" + 12170 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 12171 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 12172 " └─ columns: [pk1 pk2]\n" + 12173 "", 12174 }, 12175 { 12176 Query: `SELECT pk,pk1,pk2 FROM one_pk JOIN two_pk ON one_pk.pk=two_pk.pk1 AND one_pk.pk=two_pk.pk2`, 12177 ExpectedPlan: "MergeJoin\n" + 12178 " ├─ cmp: Eq\n" + 12179 " │ ├─ one_pk.pk:0!null\n" + 12180 " │ └─ two_pk.pk1:1!null\n" + 12181 " ├─ sel: Eq\n" + 12182 " │ ├─ one_pk.pk:0!null\n" + 12183 " │ └─ two_pk.pk2:2!null\n" + 12184 " ├─ IndexedTableAccess(one_pk)\n" + 12185 " │ ├─ index: [one_pk.pk]\n" + 12186 " │ ├─ static: [{[NULL, ∞)}]\n" + 12187 " │ ├─ colSet: (1-6)\n" + 12188 " │ ├─ tableId: 1\n" + 12189 " │ └─ Table\n" + 12190 " │ ├─ name: one_pk\n" + 12191 " │ └─ columns: [pk]\n" + 12192 " └─ IndexedTableAccess(two_pk)\n" + 12193 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 12194 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 12195 " ├─ colSet: (7-13)\n" + 12196 " ├─ tableId: 2\n" + 12197 " └─ Table\n" + 12198 " ├─ name: two_pk\n" + 12199 " └─ columns: [pk1 pk2]\n" + 12200 "", 12201 ExpectedEstimates: "MergeJoin (estimated cost=8.120 rows=4)\n" + 12202 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 12203 " ├─ sel: (one_pk.pk = two_pk.pk2)\n" + 12204 " ├─ IndexedTableAccess(one_pk)\n" + 12205 " │ ├─ index: [one_pk.pk]\n" + 12206 " │ ├─ filters: [{[NULL, ∞)}]\n" + 12207 " │ └─ columns: [pk]\n" + 12208 " └─ IndexedTableAccess(two_pk)\n" + 12209 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 12210 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 12211 " └─ columns: [pk1 pk2]\n" + 12212 "", 12213 ExpectedAnalysis: "MergeJoin (estimated cost=8.120 rows=4) (actual rows=2 loops=1)\n" + 12214 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 12215 " ├─ sel: (one_pk.pk = two_pk.pk2)\n" + 12216 " ├─ IndexedTableAccess(one_pk)\n" + 12217 " │ ├─ index: [one_pk.pk]\n" + 12218 " │ ├─ filters: [{[NULL, ∞)}]\n" + 12219 " │ └─ columns: [pk]\n" + 12220 " └─ IndexedTableAccess(two_pk)\n" + 12221 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 12222 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 12223 " └─ columns: [pk1 pk2]\n" + 12224 "", 12225 }, 12226 { 12227 Query: `SELECT pk,pk1,pk2 FROM one_pk LEFT JOIN two_pk ON one_pk.pk <=> two_pk.pk1 AND one_pk.pk = two_pk.pk2`, 12228 ExpectedPlan: "Project\n" + 12229 " ├─ columns: [one_pk.pk:0!null, two_pk.pk1:1!null, two_pk.pk2:2!null]\n" + 12230 " └─ LeftOuterJoin\n" + 12231 " ├─ AND\n" + 12232 " │ ├─ (one_pk.pk:0!null <=> two_pk.pk1:1!null)\n" + 12233 " │ └─ Eq\n" + 12234 " │ ├─ one_pk.pk:0!null\n" + 12235 " │ └─ two_pk.pk2:2!null\n" + 12236 " ├─ ProcessTable\n" + 12237 " │ └─ Table\n" + 12238 " │ ├─ name: one_pk\n" + 12239 " │ └─ columns: [pk]\n" + 12240 " └─ ProcessTable\n" + 12241 " └─ Table\n" + 12242 " ├─ name: two_pk\n" + 12243 " └─ columns: [pk1 pk2]\n" + 12244 "", 12245 ExpectedEstimates: "Project\n" + 12246 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 12247 " └─ LeftOuterJoin (estimated cost=15.160 rows=5)\n" + 12248 " ├─ ((one_pk.pk <=> two_pk.pk1) AND (one_pk.pk = two_pk.pk2))\n" + 12249 " ├─ Table\n" + 12250 " │ ├─ name: one_pk\n" + 12251 " │ └─ columns: [pk]\n" + 12252 " └─ Table\n" + 12253 " ├─ name: two_pk\n" + 12254 " └─ columns: [pk1 pk2]\n" + 12255 "", 12256 ExpectedAnalysis: "Project\n" + 12257 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 12258 " └─ LeftOuterJoin (estimated cost=15.160 rows=5) (actual rows=4 loops=1)\n" + 12259 " ├─ ((one_pk.pk <=> two_pk.pk1) AND (one_pk.pk = two_pk.pk2))\n" + 12260 " ├─ Table\n" + 12261 " │ ├─ name: one_pk\n" + 12262 " │ └─ columns: [pk]\n" + 12263 " └─ Table\n" + 12264 " ├─ name: two_pk\n" + 12265 " └─ columns: [pk1 pk2]\n" + 12266 "", 12267 }, 12268 { 12269 Query: `SELECT pk,pk1,pk2 FROM one_pk LEFT JOIN two_pk ON one_pk.pk = two_pk.pk1 AND one_pk.pk <=> two_pk.pk2`, 12270 ExpectedPlan: "Project\n" + 12271 " ├─ columns: [one_pk.pk:0!null, two_pk.pk1:1!null, two_pk.pk2:2!null]\n" + 12272 " └─ LeftOuterMergeJoin\n" + 12273 " ├─ cmp: Eq\n" + 12274 " │ ├─ one_pk.pk:0!null\n" + 12275 " │ └─ two_pk.pk1:1!null\n" + 12276 " ├─ sel: (one_pk.pk:0!null <=> two_pk.pk2:2!null)\n" + 12277 " ├─ IndexedTableAccess(one_pk)\n" + 12278 " │ ├─ index: [one_pk.pk]\n" + 12279 " │ ├─ static: [{[NULL, ∞)}]\n" + 12280 " │ ├─ colSet: (1-6)\n" + 12281 " │ ├─ tableId: 1\n" + 12282 " │ └─ Table\n" + 12283 " │ ├─ name: one_pk\n" + 12284 " │ └─ columns: [pk]\n" + 12285 " └─ IndexedTableAccess(two_pk)\n" + 12286 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 12287 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 12288 " ├─ colSet: (7-13)\n" + 12289 " ├─ tableId: 2\n" + 12290 " └─ Table\n" + 12291 " ├─ name: two_pk\n" + 12292 " └─ columns: [pk1 pk2]\n" + 12293 "", 12294 ExpectedEstimates: "Project\n" + 12295 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 12296 " └─ LeftOuterMergeJoin (estimated cost=8.160 rows=5)\n" + 12297 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 12298 " ├─ sel: (one_pk.pk <=> two_pk.pk2)\n" + 12299 " ├─ IndexedTableAccess(one_pk)\n" + 12300 " │ ├─ index: [one_pk.pk]\n" + 12301 " │ ├─ filters: [{[NULL, ∞)}]\n" + 12302 " │ └─ columns: [pk]\n" + 12303 " └─ IndexedTableAccess(two_pk)\n" + 12304 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 12305 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 12306 " └─ columns: [pk1 pk2]\n" + 12307 "", 12308 ExpectedAnalysis: "Project\n" + 12309 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 12310 " └─ LeftOuterMergeJoin (estimated cost=8.160 rows=5) (actual rows=4 loops=1)\n" + 12311 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 12312 " ├─ sel: (one_pk.pk <=> two_pk.pk2)\n" + 12313 " ├─ IndexedTableAccess(one_pk)\n" + 12314 " │ ├─ index: [one_pk.pk]\n" + 12315 " │ ├─ filters: [{[NULL, ∞)}]\n" + 12316 " │ └─ columns: [pk]\n" + 12317 " └─ IndexedTableAccess(two_pk)\n" + 12318 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 12319 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 12320 " └─ columns: [pk1 pk2]\n" + 12321 "", 12322 }, 12323 { 12324 Query: `SELECT pk,pk1,pk2 FROM one_pk LEFT JOIN two_pk ON one_pk.pk <=> two_pk.pk1 AND one_pk.pk <=> two_pk.pk2`, 12325 ExpectedPlan: "Project\n" + 12326 " ├─ columns: [one_pk.pk:0!null, two_pk.pk1:1!null, two_pk.pk2:2!null]\n" + 12327 " └─ LeftOuterJoin\n" + 12328 " ├─ AND\n" + 12329 " │ ├─ (one_pk.pk:0!null <=> two_pk.pk1:1!null)\n" + 12330 " │ └─ (one_pk.pk:0!null <=> two_pk.pk2:2!null)\n" + 12331 " ├─ ProcessTable\n" + 12332 " │ └─ Table\n" + 12333 " │ ├─ name: one_pk\n" + 12334 " │ └─ columns: [pk]\n" + 12335 " └─ ProcessTable\n" + 12336 " └─ Table\n" + 12337 " ├─ name: two_pk\n" + 12338 " └─ columns: [pk1 pk2]\n" + 12339 "", 12340 ExpectedEstimates: "Project\n" + 12341 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 12342 " └─ LeftOuterJoin (estimated cost=15.160 rows=5)\n" + 12343 " ├─ ((one_pk.pk <=> two_pk.pk1) AND (one_pk.pk <=> two_pk.pk2))\n" + 12344 " ├─ Table\n" + 12345 " │ ├─ name: one_pk\n" + 12346 " │ └─ columns: [pk]\n" + 12347 " └─ Table\n" + 12348 " ├─ name: two_pk\n" + 12349 " └─ columns: [pk1 pk2]\n" + 12350 "", 12351 ExpectedAnalysis: "Project\n" + 12352 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 12353 " └─ LeftOuterJoin (estimated cost=15.160 rows=5) (actual rows=4 loops=1)\n" + 12354 " ├─ ((one_pk.pk <=> two_pk.pk1) AND (one_pk.pk <=> two_pk.pk2))\n" + 12355 " ├─ Table\n" + 12356 " │ ├─ name: one_pk\n" + 12357 " │ └─ columns: [pk]\n" + 12358 " └─ Table\n" + 12359 " ├─ name: two_pk\n" + 12360 " └─ columns: [pk1 pk2]\n" + 12361 "", 12362 }, 12363 { 12364 Query: `SELECT pk,pk1,pk2 FROM one_pk RIGHT JOIN two_pk ON one_pk.pk=two_pk.pk1 AND one_pk.pk=two_pk.pk2`, 12365 ExpectedPlan: "Project\n" + 12366 " ├─ columns: [one_pk.pk:2!null, two_pk.pk1:0!null, two_pk.pk2:1!null]\n" + 12367 " └─ LeftOuterMergeJoin\n" + 12368 " ├─ cmp: Eq\n" + 12369 " │ ├─ TUPLE(two_pk.pk1:0!null, two_pk.pk2:1!null)\n" + 12370 " │ └─ TUPLE(one_pk.pk:2!null, one_pk.pk:2!null)\n" + 12371 " ├─ IndexedTableAccess(two_pk)\n" + 12372 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 12373 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 12374 " │ ├─ colSet: (7-13)\n" + 12375 " │ ├─ tableId: 2\n" + 12376 " │ └─ Table\n" + 12377 " │ ├─ name: two_pk\n" + 12378 " │ └─ columns: [pk1 pk2]\n" + 12379 " └─ IndexedTableAccess(one_pk)\n" + 12380 " ├─ index: [one_pk.pk]\n" + 12381 " ├─ static: [{[NULL, ∞)}]\n" + 12382 " ├─ colSet: (1-6)\n" + 12383 " ├─ tableId: 1\n" + 12384 " └─ Table\n" + 12385 " ├─ name: one_pk\n" + 12386 " └─ columns: [pk]\n" + 12387 "", 12388 ExpectedEstimates: "Project\n" + 12389 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 12390 " └─ LeftOuterMergeJoin (estimated cost=8.150 rows=5)\n" + 12391 " ├─ cmp: ((two_pk.pk1, two_pk.pk2) = (one_pk.pk, one_pk.pk))\n" + 12392 " ├─ IndexedTableAccess(two_pk)\n" + 12393 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 12394 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 12395 " │ └─ columns: [pk1 pk2]\n" + 12396 " └─ IndexedTableAccess(one_pk)\n" + 12397 " ├─ index: [one_pk.pk]\n" + 12398 " ├─ filters: [{[NULL, ∞)}]\n" + 12399 " └─ columns: [pk]\n" + 12400 "", 12401 ExpectedAnalysis: "Project\n" + 12402 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 12403 " └─ LeftOuterMergeJoin (estimated cost=8.150 rows=5) (actual rows=4 loops=1)\n" + 12404 " ├─ cmp: ((two_pk.pk1, two_pk.pk2) = (one_pk.pk, one_pk.pk))\n" + 12405 " ├─ IndexedTableAccess(two_pk)\n" + 12406 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 12407 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 12408 " │ └─ columns: [pk1 pk2]\n" + 12409 " └─ IndexedTableAccess(one_pk)\n" + 12410 " ├─ index: [one_pk.pk]\n" + 12411 " ├─ filters: [{[NULL, ∞)}]\n" + 12412 " └─ columns: [pk]\n" + 12413 "", 12414 }, 12415 { 12416 Query: `SELECT * FROM (SELECT * FROM othertable) othertable_alias WHERE othertable_alias.i2 = 1`, 12417 ExpectedPlan: "SubqueryAlias\n" + 12418 " ├─ name: othertable_alias\n" + 12419 " ├─ outerVisibility: false\n" + 12420 " ├─ isLateral: false\n" + 12421 " ├─ cacheable: true\n" + 12422 " ├─ colSet: (3,4)\n" + 12423 " ├─ tableId: 2\n" + 12424 " └─ IndexedTableAccess(othertable)\n" + 12425 " ├─ index: [othertable.i2]\n" + 12426 " ├─ static: [{[1, 1]}]\n" + 12427 " ├─ colSet: (1,2)\n" + 12428 " ├─ tableId: 1\n" + 12429 " └─ Table\n" + 12430 " ├─ name: othertable\n" + 12431 " └─ columns: [s2 i2]\n" + 12432 "", 12433 ExpectedEstimates: "SubqueryAlias\n" + 12434 " ├─ name: othertable_alias\n" + 12435 " ├─ outerVisibility: false\n" + 12436 " ├─ isLateral: false\n" + 12437 " ├─ cacheable: true\n" + 12438 " └─ IndexedTableAccess(othertable)\n" + 12439 " ├─ index: [othertable.i2]\n" + 12440 " ├─ filters: [{[1, 1]}]\n" + 12441 " └─ columns: [s2 i2]\n" + 12442 "", 12443 ExpectedAnalysis: "SubqueryAlias\n" + 12444 " ├─ name: othertable_alias\n" + 12445 " ├─ outerVisibility: false\n" + 12446 " ├─ isLateral: false\n" + 12447 " ├─ cacheable: true\n" + 12448 " └─ IndexedTableAccess(othertable)\n" + 12449 " ├─ index: [othertable.i2]\n" + 12450 " ├─ filters: [{[1, 1]}]\n" + 12451 " └─ columns: [s2 i2]\n" + 12452 "", 12453 }, 12454 { 12455 Query: `SELECT * FROM (SELECT * FROM othertable WHERE i2 = 1) othertable_alias WHERE othertable_alias.i2 = 1`, 12456 ExpectedPlan: "SubqueryAlias\n" + 12457 " ├─ name: othertable_alias\n" + 12458 " ├─ outerVisibility: false\n" + 12459 " ├─ isLateral: false\n" + 12460 " ├─ cacheable: true\n" + 12461 " ├─ colSet: (3,4)\n" + 12462 " ├─ tableId: 2\n" + 12463 " └─ IndexedTableAccess(othertable)\n" + 12464 " ├─ index: [othertable.i2]\n" + 12465 " ├─ static: [{[1, 1]}]\n" + 12466 " ├─ colSet: (1,2)\n" + 12467 " ├─ tableId: 1\n" + 12468 " └─ Table\n" + 12469 " ├─ name: othertable\n" + 12470 " └─ columns: [s2 i2]\n" + 12471 "", 12472 ExpectedEstimates: "SubqueryAlias\n" + 12473 " ├─ name: othertable_alias\n" + 12474 " ├─ outerVisibility: false\n" + 12475 " ├─ isLateral: false\n" + 12476 " ├─ cacheable: true\n" + 12477 " └─ IndexedTableAccess(othertable)\n" + 12478 " ├─ index: [othertable.i2]\n" + 12479 " ├─ filters: [{[1, 1]}]\n" + 12480 " └─ columns: [s2 i2]\n" + 12481 "", 12482 ExpectedAnalysis: "SubqueryAlias\n" + 12483 " ├─ name: othertable_alias\n" + 12484 " ├─ outerVisibility: false\n" + 12485 " ├─ isLateral: false\n" + 12486 " ├─ cacheable: true\n" + 12487 " └─ IndexedTableAccess(othertable)\n" + 12488 " ├─ index: [othertable.i2]\n" + 12489 " ├─ filters: [{[1, 1]}]\n" + 12490 " └─ columns: [s2 i2]\n" + 12491 "", 12492 }, 12493 { 12494 Query: `SELECT * FROM datetime_table ORDER BY date_col ASC`, 12495 ExpectedPlan: "IndexedTableAccess(datetime_table)\n" + 12496 " ├─ index: [datetime_table.date_col]\n" + 12497 " ├─ static: [{[NULL, ∞)}]\n" + 12498 " ├─ colSet: (1-5)\n" + 12499 " ├─ tableId: 1\n" + 12500 " └─ Table\n" + 12501 " ├─ name: datetime_table\n" + 12502 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12503 "", 12504 ExpectedEstimates: "IndexedTableAccess(datetime_table)\n" + 12505 " ├─ index: [datetime_table.date_col]\n" + 12506 " ├─ filters: [{[NULL, ∞)}]\n" + 12507 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12508 "", 12509 ExpectedAnalysis: "IndexedTableAccess(datetime_table)\n" + 12510 " ├─ index: [datetime_table.date_col]\n" + 12511 " ├─ filters: [{[NULL, ∞)}]\n" + 12512 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12513 "", 12514 }, 12515 { 12516 Query: `SELECT * FROM datetime_table ORDER BY date_col ASC LIMIT 100`, 12517 ExpectedPlan: "Limit(100)\n" + 12518 " └─ IndexedTableAccess(datetime_table)\n" + 12519 " ├─ index: [datetime_table.date_col]\n" + 12520 " ├─ static: [{[NULL, ∞)}]\n" + 12521 " ├─ colSet: (1-5)\n" + 12522 " ├─ tableId: 1\n" + 12523 " └─ Table\n" + 12524 " ├─ name: datetime_table\n" + 12525 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12526 "", 12527 ExpectedEstimates: "Limit(100)\n" + 12528 " └─ IndexedTableAccess(datetime_table)\n" + 12529 " ├─ index: [datetime_table.date_col]\n" + 12530 " ├─ filters: [{[NULL, ∞)}]\n" + 12531 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12532 "", 12533 ExpectedAnalysis: "Limit(100)\n" + 12534 " └─ IndexedTableAccess(datetime_table)\n" + 12535 " ├─ index: [datetime_table.date_col]\n" + 12536 " ├─ filters: [{[NULL, ∞)}]\n" + 12537 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12538 "", 12539 }, 12540 { 12541 Query: `SELECT * FROM datetime_table ORDER BY date_col ASC LIMIT 100 OFFSET 100`, 12542 ExpectedPlan: "Limit(100)\n" + 12543 " └─ Offset(100)\n" + 12544 " └─ IndexedTableAccess(datetime_table)\n" + 12545 " ├─ index: [datetime_table.date_col]\n" + 12546 " ├─ filters: [{[NULL, ∞)}]\n" + 12547 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12548 "", 12549 ExpectedEstimates: "Limit(100)\n" + 12550 " └─ Offset(100)\n" + 12551 " └─ IndexedTableAccess(datetime_table)\n" + 12552 " ├─ index: [datetime_table.date_col]\n" + 12553 " ├─ filters: [{[NULL, ∞)}]\n" + 12554 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12555 "", 12556 ExpectedAnalysis: "Limit(100)\n" + 12557 " └─ Offset(100)\n" + 12558 " └─ IndexedTableAccess(datetime_table)\n" + 12559 " ├─ index: [datetime_table.date_col]\n" + 12560 " ├─ filters: [{[NULL, ∞)}]\n" + 12561 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12562 "", 12563 }, 12564 { 12565 Query: `SELECT * FROM datetime_table where date_col = '2020-01-01'`, 12566 ExpectedPlan: "Filter\n" + 12567 " ├─ Eq\n" + 12568 " │ ├─ datetime_table.date_col:1\n" + 12569 " │ └─ 2020-01-01 (longtext)\n" + 12570 " └─ IndexedTableAccess(datetime_table)\n" + 12571 " ├─ index: [datetime_table.date_col]\n" + 12572 " ├─ static: [{[2020-01-01 00:00:00 +0000 UTC, 2020-01-01 00:00:00 +0000 UTC]}]\n" + 12573 " ├─ colSet: (1-5)\n" + 12574 " ├─ tableId: 1\n" + 12575 " └─ Table\n" + 12576 " ├─ name: datetime_table\n" + 12577 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12578 "", 12579 ExpectedEstimates: "Filter\n" + 12580 " ├─ (datetime_table.date_col = '2020-01-01')\n" + 12581 " └─ IndexedTableAccess(datetime_table)\n" + 12582 " ├─ index: [datetime_table.date_col]\n" + 12583 " ├─ filters: [{[2020-01-01 00:00:00 +0000 UTC, 2020-01-01 00:00:00 +0000 UTC]}]\n" + 12584 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12585 "", 12586 ExpectedAnalysis: "Filter\n" + 12587 " ├─ (datetime_table.date_col = '2020-01-01')\n" + 12588 " └─ IndexedTableAccess(datetime_table)\n" + 12589 " ├─ index: [datetime_table.date_col]\n" + 12590 " ├─ filters: [{[2020-01-01 00:00:00 +0000 UTC, 2020-01-01 00:00:00 +0000 UTC]}]\n" + 12591 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12592 "", 12593 }, 12594 { 12595 Query: `SELECT * FROM datetime_table where date_col > '2020-01-01'`, 12596 ExpectedPlan: "Filter\n" + 12597 " ├─ GreaterThan\n" + 12598 " │ ├─ datetime_table.date_col:1\n" + 12599 " │ └─ 2020-01-01 (longtext)\n" + 12600 " └─ IndexedTableAccess(datetime_table)\n" + 12601 " ├─ index: [datetime_table.date_col]\n" + 12602 " ├─ static: [{(2020-01-01 00:00:00 +0000 UTC, ∞)}]\n" + 12603 " ├─ colSet: (1-5)\n" + 12604 " ├─ tableId: 1\n" + 12605 " └─ Table\n" + 12606 " ├─ name: datetime_table\n" + 12607 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12608 "", 12609 ExpectedEstimates: "Filter\n" + 12610 " ├─ (datetime_table.date_col > '2020-01-01')\n" + 12611 " └─ IndexedTableAccess(datetime_table)\n" + 12612 " ├─ index: [datetime_table.date_col]\n" + 12613 " ├─ filters: [{(2020-01-01 00:00:00 +0000 UTC, ∞)}]\n" + 12614 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12615 "", 12616 ExpectedAnalysis: "Filter\n" + 12617 " ├─ (datetime_table.date_col > '2020-01-01')\n" + 12618 " └─ IndexedTableAccess(datetime_table)\n" + 12619 " ├─ index: [datetime_table.date_col]\n" + 12620 " ├─ filters: [{(2020-01-01 00:00:00 +0000 UTC, ∞)}]\n" + 12621 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12622 "", 12623 }, 12624 { 12625 Query: `SELECT * FROM datetime_table where datetime_col = '2020-01-01'`, 12626 ExpectedPlan: "Filter\n" + 12627 " ├─ Eq\n" + 12628 " │ ├─ datetime_table.datetime_col:2\n" + 12629 " │ └─ 2020-01-01 (longtext)\n" + 12630 " └─ IndexedTableAccess(datetime_table)\n" + 12631 " ├─ index: [datetime_table.datetime_col]\n" + 12632 " ├─ static: [{[2020-01-01 00:00:00 +0000 UTC, 2020-01-01 00:00:00 +0000 UTC]}]\n" + 12633 " ├─ colSet: (1-5)\n" + 12634 " ├─ tableId: 1\n" + 12635 " └─ Table\n" + 12636 " ├─ name: datetime_table\n" + 12637 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12638 "", 12639 ExpectedEstimates: "Filter\n" + 12640 " ├─ (datetime_table.datetime_col = '2020-01-01')\n" + 12641 " └─ IndexedTableAccess(datetime_table)\n" + 12642 " ├─ index: [datetime_table.datetime_col]\n" + 12643 " ├─ filters: [{[2020-01-01 00:00:00 +0000 UTC, 2020-01-01 00:00:00 +0000 UTC]}]\n" + 12644 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12645 "", 12646 ExpectedAnalysis: "Filter\n" + 12647 " ├─ (datetime_table.datetime_col = '2020-01-01')\n" + 12648 " └─ IndexedTableAccess(datetime_table)\n" + 12649 " ├─ index: [datetime_table.datetime_col]\n" + 12650 " ├─ filters: [{[2020-01-01 00:00:00 +0000 UTC, 2020-01-01 00:00:00 +0000 UTC]}]\n" + 12651 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12652 "", 12653 }, 12654 { 12655 Query: `SELECT * FROM datetime_table where datetime_col > '2020-01-01'`, 12656 ExpectedPlan: "Filter\n" + 12657 " ├─ GreaterThan\n" + 12658 " │ ├─ datetime_table.datetime_col:2\n" + 12659 " │ └─ 2020-01-01 (longtext)\n" + 12660 " └─ IndexedTableAccess(datetime_table)\n" + 12661 " ├─ index: [datetime_table.datetime_col]\n" + 12662 " ├─ static: [{(2020-01-01 00:00:00 +0000 UTC, ∞)}]\n" + 12663 " ├─ colSet: (1-5)\n" + 12664 " ├─ tableId: 1\n" + 12665 " └─ Table\n" + 12666 " ├─ name: datetime_table\n" + 12667 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12668 "", 12669 ExpectedEstimates: "Filter\n" + 12670 " ├─ (datetime_table.datetime_col > '2020-01-01')\n" + 12671 " └─ IndexedTableAccess(datetime_table)\n" + 12672 " ├─ index: [datetime_table.datetime_col]\n" + 12673 " ├─ filters: [{(2020-01-01 00:00:00 +0000 UTC, ∞)}]\n" + 12674 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12675 "", 12676 ExpectedAnalysis: "Filter\n" + 12677 " ├─ (datetime_table.datetime_col > '2020-01-01')\n" + 12678 " └─ IndexedTableAccess(datetime_table)\n" + 12679 " ├─ index: [datetime_table.datetime_col]\n" + 12680 " ├─ filters: [{(2020-01-01 00:00:00 +0000 UTC, ∞)}]\n" + 12681 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12682 "", 12683 }, 12684 { 12685 Query: `SELECT * FROM datetime_table where timestamp_col = '2020-01-01'`, 12686 ExpectedPlan: "Filter\n" + 12687 " ├─ Eq\n" + 12688 " │ ├─ datetime_table.timestamp_col:3\n" + 12689 " │ └─ 2020-01-01 (longtext)\n" + 12690 " └─ IndexedTableAccess(datetime_table)\n" + 12691 " ├─ index: [datetime_table.timestamp_col]\n" + 12692 " ├─ static: [{[2020-01-01 00:00:00 +0000 UTC, 2020-01-01 00:00:00 +0000 UTC]}]\n" + 12693 " ├─ colSet: (1-5)\n" + 12694 " ├─ tableId: 1\n" + 12695 " └─ Table\n" + 12696 " ├─ name: datetime_table\n" + 12697 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12698 "", 12699 ExpectedEstimates: "Filter\n" + 12700 " ├─ (datetime_table.timestamp_col = '2020-01-01')\n" + 12701 " └─ IndexedTableAccess(datetime_table)\n" + 12702 " ├─ index: [datetime_table.timestamp_col]\n" + 12703 " ├─ filters: [{[2020-01-01 00:00:00 +0000 UTC, 2020-01-01 00:00:00 +0000 UTC]}]\n" + 12704 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12705 "", 12706 ExpectedAnalysis: "Filter\n" + 12707 " ├─ (datetime_table.timestamp_col = '2020-01-01')\n" + 12708 " └─ IndexedTableAccess(datetime_table)\n" + 12709 " ├─ index: [datetime_table.timestamp_col]\n" + 12710 " ├─ filters: [{[2020-01-01 00:00:00 +0000 UTC, 2020-01-01 00:00:00 +0000 UTC]}]\n" + 12711 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12712 "", 12713 }, 12714 { 12715 Query: `SELECT * FROM datetime_table where timestamp_col > '2020-01-01'`, 12716 ExpectedPlan: "Filter\n" + 12717 " ├─ GreaterThan\n" + 12718 " │ ├─ datetime_table.timestamp_col:3\n" + 12719 " │ └─ 2020-01-01 (longtext)\n" + 12720 " └─ IndexedTableAccess(datetime_table)\n" + 12721 " ├─ index: [datetime_table.timestamp_col]\n" + 12722 " ├─ static: [{(2020-01-01 00:00:00 +0000 UTC, ∞)}]\n" + 12723 " ├─ colSet: (1-5)\n" + 12724 " ├─ tableId: 1\n" + 12725 " └─ Table\n" + 12726 " ├─ name: datetime_table\n" + 12727 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12728 "", 12729 ExpectedEstimates: "Filter\n" + 12730 " ├─ (datetime_table.timestamp_col > '2020-01-01')\n" + 12731 " └─ IndexedTableAccess(datetime_table)\n" + 12732 " ├─ index: [datetime_table.timestamp_col]\n" + 12733 " ├─ filters: [{(2020-01-01 00:00:00 +0000 UTC, ∞)}]\n" + 12734 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12735 "", 12736 ExpectedAnalysis: "Filter\n" + 12737 " ├─ (datetime_table.timestamp_col > '2020-01-01')\n" + 12738 " └─ IndexedTableAccess(datetime_table)\n" + 12739 " ├─ index: [datetime_table.timestamp_col]\n" + 12740 " ├─ filters: [{(2020-01-01 00:00:00 +0000 UTC, ∞)}]\n" + 12741 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12742 "", 12743 }, 12744 { 12745 Query: `SELECT * FROM datetime_table dt1 join datetime_table dt2 on dt1.timestamp_col = dt2.timestamp_col`, 12746 ExpectedPlan: "MergeJoin\n" + 12747 " ├─ cmp: Eq\n" + 12748 " │ ├─ dt1.timestamp_col:3\n" + 12749 " │ └─ dt2.timestamp_col:8\n" + 12750 " ├─ TableAlias(dt1)\n" + 12751 " │ └─ IndexedTableAccess(datetime_table)\n" + 12752 " │ ├─ index: [datetime_table.timestamp_col]\n" + 12753 " │ ├─ static: [{[NULL, ∞)}]\n" + 12754 " │ ├─ colSet: (1-5)\n" + 12755 " │ ├─ tableId: 1\n" + 12756 " │ └─ Table\n" + 12757 " │ ├─ name: datetime_table\n" + 12758 " │ └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12759 " └─ TableAlias(dt2)\n" + 12760 " └─ IndexedTableAccess(datetime_table)\n" + 12761 " ├─ index: [datetime_table.timestamp_col]\n" + 12762 " ├─ static: [{[NULL, ∞)}]\n" + 12763 " ├─ colSet: (6-10)\n" + 12764 " ├─ tableId: 2\n" + 12765 " └─ Table\n" + 12766 " ├─ name: datetime_table\n" + 12767 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12768 "", 12769 ExpectedEstimates: "MergeJoin (estimated cost=6.120 rows=3)\n" + 12770 " ├─ cmp: (dt1.timestamp_col = dt2.timestamp_col)\n" + 12771 " ├─ TableAlias(dt1)\n" + 12772 " │ └─ IndexedTableAccess(datetime_table)\n" + 12773 " │ ├─ index: [datetime_table.timestamp_col]\n" + 12774 " │ ├─ filters: [{[NULL, ∞)}]\n" + 12775 " │ └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12776 " └─ TableAlias(dt2)\n" + 12777 " └─ IndexedTableAccess(datetime_table)\n" + 12778 " ├─ index: [datetime_table.timestamp_col]\n" + 12779 " ├─ filters: [{[NULL, ∞)}]\n" + 12780 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12781 "", 12782 ExpectedAnalysis: "MergeJoin (estimated cost=6.120 rows=3) (actual rows=3 loops=1)\n" + 12783 " ├─ cmp: (dt1.timestamp_col = dt2.timestamp_col)\n" + 12784 " ├─ TableAlias(dt1)\n" + 12785 " │ └─ IndexedTableAccess(datetime_table)\n" + 12786 " │ ├─ index: [datetime_table.timestamp_col]\n" + 12787 " │ ├─ filters: [{[NULL, ∞)}]\n" + 12788 " │ └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12789 " └─ TableAlias(dt2)\n" + 12790 " └─ IndexedTableAccess(datetime_table)\n" + 12791 " ├─ index: [datetime_table.timestamp_col]\n" + 12792 " ├─ filters: [{[NULL, ∞)}]\n" + 12793 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12794 "", 12795 }, 12796 { 12797 Query: `SELECT * FROM datetime_table dt1 join datetime_table dt2 on dt1.date_col = dt2.timestamp_col`, 12798 ExpectedPlan: "MergeJoin\n" + 12799 " ├─ cmp: Eq\n" + 12800 " │ ├─ dt1.date_col:1\n" + 12801 " │ └─ dt2.timestamp_col:8\n" + 12802 " ├─ TableAlias(dt1)\n" + 12803 " │ └─ IndexedTableAccess(datetime_table)\n" + 12804 " │ ├─ index: [datetime_table.date_col]\n" + 12805 " │ ├─ static: [{[NULL, ∞)}]\n" + 12806 " │ ├─ colSet: (1-5)\n" + 12807 " │ ├─ tableId: 1\n" + 12808 " │ └─ Table\n" + 12809 " │ ├─ name: datetime_table\n" + 12810 " │ └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12811 " └─ TableAlias(dt2)\n" + 12812 " └─ IndexedTableAccess(datetime_table)\n" + 12813 " ├─ index: [datetime_table.timestamp_col]\n" + 12814 " ├─ static: [{[NULL, ∞)}]\n" + 12815 " ├─ colSet: (6-10)\n" + 12816 " ├─ tableId: 2\n" + 12817 " └─ Table\n" + 12818 " ├─ name: datetime_table\n" + 12819 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12820 "", 12821 ExpectedEstimates: "MergeJoin (estimated cost=6.120 rows=3)\n" + 12822 " ├─ cmp: (dt1.date_col = dt2.timestamp_col)\n" + 12823 " ├─ TableAlias(dt1)\n" + 12824 " │ └─ IndexedTableAccess(datetime_table)\n" + 12825 " │ ├─ index: [datetime_table.date_col]\n" + 12826 " │ ├─ filters: [{[NULL, ∞)}]\n" + 12827 " │ └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12828 " └─ TableAlias(dt2)\n" + 12829 " └─ IndexedTableAccess(datetime_table)\n" + 12830 " ├─ index: [datetime_table.timestamp_col]\n" + 12831 " ├─ filters: [{[NULL, ∞)}]\n" + 12832 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12833 "", 12834 ExpectedAnalysis: "MergeJoin (estimated cost=6.120 rows=3) (actual rows=0 loops=1)\n" + 12835 " ├─ cmp: (dt1.date_col = dt2.timestamp_col)\n" + 12836 " ├─ TableAlias(dt1)\n" + 12837 " │ └─ IndexedTableAccess(datetime_table)\n" + 12838 " │ ├─ index: [datetime_table.date_col]\n" + 12839 " │ ├─ filters: [{[NULL, ∞)}]\n" + 12840 " │ └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12841 " └─ TableAlias(dt2)\n" + 12842 " └─ IndexedTableAccess(datetime_table)\n" + 12843 " ├─ index: [datetime_table.timestamp_col]\n" + 12844 " ├─ filters: [{[NULL, ∞)}]\n" + 12845 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12846 "", 12847 }, 12848 { 12849 Query: `SELECT * FROM datetime_table dt1 join datetime_table dt2 on dt1.datetime_col = dt2.timestamp_col`, 12850 ExpectedPlan: "MergeJoin\n" + 12851 " ├─ cmp: Eq\n" + 12852 " │ ├─ dt1.datetime_col:2\n" + 12853 " │ └─ dt2.timestamp_col:8\n" + 12854 " ├─ TableAlias(dt1)\n" + 12855 " │ └─ IndexedTableAccess(datetime_table)\n" + 12856 " │ ├─ index: [datetime_table.datetime_col]\n" + 12857 " │ ├─ static: [{[NULL, ∞)}]\n" + 12858 " │ ├─ colSet: (1-5)\n" + 12859 " │ ├─ tableId: 1\n" + 12860 " │ └─ Table\n" + 12861 " │ ├─ name: datetime_table\n" + 12862 " │ └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12863 " └─ TableAlias(dt2)\n" + 12864 " └─ IndexedTableAccess(datetime_table)\n" + 12865 " ├─ index: [datetime_table.timestamp_col]\n" + 12866 " ├─ static: [{[NULL, ∞)}]\n" + 12867 " ├─ colSet: (6-10)\n" + 12868 " ├─ tableId: 2\n" + 12869 " └─ Table\n" + 12870 " ├─ name: datetime_table\n" + 12871 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12872 "", 12873 ExpectedEstimates: "MergeJoin (estimated cost=6.120 rows=3)\n" + 12874 " ├─ cmp: (dt1.datetime_col = dt2.timestamp_col)\n" + 12875 " ├─ TableAlias(dt1)\n" + 12876 " │ └─ IndexedTableAccess(datetime_table)\n" + 12877 " │ ├─ index: [datetime_table.datetime_col]\n" + 12878 " │ ├─ filters: [{[NULL, ∞)}]\n" + 12879 " │ └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12880 " └─ TableAlias(dt2)\n" + 12881 " └─ IndexedTableAccess(datetime_table)\n" + 12882 " ├─ index: [datetime_table.timestamp_col]\n" + 12883 " ├─ filters: [{[NULL, ∞)}]\n" + 12884 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12885 "", 12886 ExpectedAnalysis: "MergeJoin (estimated cost=6.120 rows=3) (actual rows=0 loops=1)\n" + 12887 " ├─ cmp: (dt1.datetime_col = dt2.timestamp_col)\n" + 12888 " ├─ TableAlias(dt1)\n" + 12889 " │ └─ IndexedTableAccess(datetime_table)\n" + 12890 " │ ├─ index: [datetime_table.datetime_col]\n" + 12891 " │ ├─ filters: [{[NULL, ∞)}]\n" + 12892 " │ └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12893 " └─ TableAlias(dt2)\n" + 12894 " └─ IndexedTableAccess(datetime_table)\n" + 12895 " ├─ index: [datetime_table.timestamp_col]\n" + 12896 " ├─ filters: [{[NULL, ∞)}]\n" + 12897 " └─ columns: [i date_col datetime_col timestamp_col time_col]\n" + 12898 "", 12899 }, 12900 { 12901 Query: `SELECT dt1.i FROM datetime_table dt1 12902 join datetime_table dt2 on dt1.date_col = date(date_sub(dt2.timestamp_col, interval 2 day)) 12903 order by 1`, 12904 ExpectedPlan: "Project\n" + 12905 " ├─ columns: [dt1.i:1!null]\n" + 12906 " └─ Sort(dt1.i:1!null ASC nullsFirst)\n" + 12907 " └─ InnerJoin\n" + 12908 " ├─ Eq\n" + 12909 " │ ├─ dt1.date_col:2\n" + 12910 " │ └─ DATE(date_sub(dt2.timestamp_col,INTERVAL 2 DAY))\n" + 12911 " ├─ TableAlias(dt2)\n" + 12912 " │ └─ ProcessTable\n" + 12913 " │ └─ Table\n" + 12914 " │ ├─ name: datetime_table\n" + 12915 " │ └─ columns: [timestamp_col]\n" + 12916 " └─ TableAlias(dt1)\n" + 12917 " └─ Table\n" + 12918 " ├─ name: datetime_table\n" + 12919 " ├─ columns: [i date_col]\n" + 12920 " ├─ colSet: (1-5)\n" + 12921 " └─ tableId: 1\n" + 12922 "", 12923 ExpectedEstimates: "Project\n" + 12924 " ├─ columns: [dt1.i]\n" + 12925 " └─ Sort(dt1.i ASC)\n" + 12926 " └─ InnerJoin\n" + 12927 " ├─ (dt1.date_col = DATE(date_sub(dt2.timestamp_col,INTERVAL 2 DAY)))\n" + 12928 " ├─ TableAlias(dt2)\n" + 12929 " │ └─ Table\n" + 12930 " │ ├─ name: datetime_table\n" + 12931 " │ └─ columns: [timestamp_col]\n" + 12932 " └─ TableAlias(dt1)\n" + 12933 " └─ Table\n" + 12934 " ├─ name: datetime_table\n" + 12935 " └─ columns: [i date_col]\n" + 12936 "", 12937 ExpectedAnalysis: "Project\n" + 12938 " ├─ columns: [dt1.i]\n" + 12939 " └─ Sort(dt1.i ASC)\n" + 12940 " └─ InnerJoin\n" + 12941 " ├─ (dt1.date_col = DATE(date_sub(dt2.timestamp_col,INTERVAL 2 DAY)))\n" + 12942 " ├─ TableAlias(dt2)\n" + 12943 " │ └─ Table\n" + 12944 " │ ├─ name: datetime_table\n" + 12945 " │ └─ columns: [timestamp_col]\n" + 12946 " └─ TableAlias(dt1)\n" + 12947 " └─ Table\n" + 12948 " ├─ name: datetime_table\n" + 12949 " └─ columns: [i date_col]\n" + 12950 "", 12951 }, 12952 { 12953 Query: `SELECT dt1.i FROM datetime_table dt1 12954 join datetime_table dt2 on dt1.date_col = date(date_sub(dt2.timestamp_col, interval 2 day)) 12955 order by 1 limit 3 offset 0`, 12956 ExpectedPlan: "Limit(3)\n" + 12957 " └─ Project\n" + 12958 " ├─ columns: [dt1.i:1!null]\n" + 12959 " └─ Sort(dt1.i:1!null ASC nullsFirst)\n" + 12960 " └─ InnerJoin\n" + 12961 " ├─ Eq\n" + 12962 " │ ├─ dt1.date_col:2\n" + 12963 " │ └─ DATE(date_sub(dt2.timestamp_col,INTERVAL 2 DAY))\n" + 12964 " ├─ TableAlias(dt2)\n" + 12965 " │ └─ ProcessTable\n" + 12966 " │ └─ Table\n" + 12967 " │ ├─ name: datetime_table\n" + 12968 " │ └─ columns: [timestamp_col]\n" + 12969 " └─ TableAlias(dt1)\n" + 12970 " └─ Table\n" + 12971 " ├─ name: datetime_table\n" + 12972 " ├─ columns: [i date_col]\n" + 12973 " ├─ colSet: (1-5)\n" + 12974 " └─ tableId: 1\n" + 12975 "", 12976 ExpectedEstimates: "Limit(3)\n" + 12977 " └─ Project\n" + 12978 " ├─ columns: [dt1.i]\n" + 12979 " └─ Sort(dt1.i ASC)\n" + 12980 " └─ InnerJoin\n" + 12981 " ├─ (dt1.date_col = DATE(date_sub(dt2.timestamp_col,INTERVAL 2 DAY)))\n" + 12982 " ├─ TableAlias(dt2)\n" + 12983 " │ └─ Table\n" + 12984 " │ ├─ name: datetime_table\n" + 12985 " │ └─ columns: [timestamp_col]\n" + 12986 " └─ TableAlias(dt1)\n" + 12987 " └─ Table\n" + 12988 " ├─ name: datetime_table\n" + 12989 " └─ columns: [i date_col]\n" + 12990 "", 12991 ExpectedAnalysis: "Limit(3)\n" + 12992 " └─ Project\n" + 12993 " ├─ columns: [dt1.i]\n" + 12994 " └─ Sort(dt1.i ASC)\n" + 12995 " └─ InnerJoin\n" + 12996 " ├─ (dt1.date_col = DATE(date_sub(dt2.timestamp_col,INTERVAL 2 DAY)))\n" + 12997 " ├─ TableAlias(dt2)\n" + 12998 " │ └─ Table\n" + 12999 " │ ├─ name: datetime_table\n" + 13000 " │ └─ columns: [timestamp_col]\n" + 13001 " └─ TableAlias(dt1)\n" + 13002 " └─ Table\n" + 13003 " ├─ name: datetime_table\n" + 13004 " └─ columns: [i date_col]\n" + 13005 "", 13006 }, 13007 { 13008 Query: `SELECT dt1.i FROM datetime_table dt1 13009 join datetime_table dt2 on dt1.date_col = date(date_sub(dt2.timestamp_col, interval 2 day)) 13010 order by 1 limit 3`, 13011 ExpectedPlan: "Limit(3)\n" + 13012 " └─ Project\n" + 13013 " ├─ columns: [dt1.i:1!null]\n" + 13014 " └─ Sort(dt1.i:1!null ASC nullsFirst)\n" + 13015 " └─ InnerJoin\n" + 13016 " ├─ Eq\n" + 13017 " │ ├─ dt1.date_col:2\n" + 13018 " │ └─ DATE(date_sub(dt2.timestamp_col,INTERVAL 2 DAY))\n" + 13019 " ├─ TableAlias(dt2)\n" + 13020 " │ └─ ProcessTable\n" + 13021 " │ └─ Table\n" + 13022 " │ ├─ name: datetime_table\n" + 13023 " │ └─ columns: [timestamp_col]\n" + 13024 " └─ TableAlias(dt1)\n" + 13025 " └─ Table\n" + 13026 " ├─ name: datetime_table\n" + 13027 " ├─ columns: [i date_col]\n" + 13028 " ├─ colSet: (1-5)\n" + 13029 " └─ tableId: 1\n" + 13030 "", 13031 ExpectedEstimates: "Limit(3)\n" + 13032 " └─ Project\n" + 13033 " ├─ columns: [dt1.i]\n" + 13034 " └─ Sort(dt1.i ASC)\n" + 13035 " └─ InnerJoin\n" + 13036 " ├─ (dt1.date_col = DATE(date_sub(dt2.timestamp_col,INTERVAL 2 DAY)))\n" + 13037 " ├─ TableAlias(dt2)\n" + 13038 " │ └─ Table\n" + 13039 " │ ├─ name: datetime_table\n" + 13040 " │ └─ columns: [timestamp_col]\n" + 13041 " └─ TableAlias(dt1)\n" + 13042 " └─ Table\n" + 13043 " ├─ name: datetime_table\n" + 13044 " └─ columns: [i date_col]\n" + 13045 "", 13046 ExpectedAnalysis: "Limit(3)\n" + 13047 " └─ Project\n" + 13048 " ├─ columns: [dt1.i]\n" + 13049 " └─ Sort(dt1.i ASC)\n" + 13050 " └─ InnerJoin\n" + 13051 " ├─ (dt1.date_col = DATE(date_sub(dt2.timestamp_col,INTERVAL 2 DAY)))\n" + 13052 " ├─ TableAlias(dt2)\n" + 13053 " │ └─ Table\n" + 13054 " │ ├─ name: datetime_table\n" + 13055 " │ └─ columns: [timestamp_col]\n" + 13056 " └─ TableAlias(dt1)\n" + 13057 " └─ Table\n" + 13058 " ├─ name: datetime_table\n" + 13059 " └─ columns: [i date_col]\n" + 13060 "", 13061 }, 13062 { 13063 Query: `SELECT pk FROM one_pk 13064 JOIN two_pk tpk ON one_pk.pk=tpk.pk1 AND one_pk.pk=tpk.pk2 13065 JOIN two_pk tpk2 ON tpk2.pk1=TPK.pk2 AND TPK2.pk2=tpk.pk1`, 13066 ExpectedPlan: "Project\n" + 13067 " ├─ columns: [one_pk.pk:0!null]\n" + 13068 " └─ LookupJoin\n" + 13069 " ├─ MergeJoin\n" + 13070 " │ ├─ cmp: Eq\n" + 13071 " │ │ ├─ one_pk.pk:0!null\n" + 13072 " │ │ └─ tpk.pk1:1!null\n" + 13073 " │ ├─ sel: Eq\n" + 13074 " │ │ ├─ one_pk.pk:0!null\n" + 13075 " │ │ └─ tpk.pk2:2!null\n" + 13076 " │ ├─ IndexedTableAccess(one_pk)\n" + 13077 " │ │ ├─ index: [one_pk.pk]\n" + 13078 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 13079 " │ │ ├─ colSet: (1-6)\n" + 13080 " │ │ ├─ tableId: 1\n" + 13081 " │ │ └─ Table\n" + 13082 " │ │ ├─ name: one_pk\n" + 13083 " │ │ └─ columns: [pk]\n" + 13084 " │ └─ TableAlias(tpk)\n" + 13085 " │ └─ IndexedTableAccess(two_pk)\n" + 13086 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13087 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 13088 " │ ├─ colSet: (7-13)\n" + 13089 " │ ├─ tableId: 2\n" + 13090 " │ └─ Table\n" + 13091 " │ ├─ name: two_pk\n" + 13092 " │ └─ columns: [pk1 pk2]\n" + 13093 " └─ TableAlias(tpk2)\n" + 13094 " └─ IndexedTableAccess(two_pk)\n" + 13095 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13096 " ├─ keys: [tpk.pk2:2!null tpk.pk1:1!null]\n" + 13097 " ├─ colSet: (14-20)\n" + 13098 " ├─ tableId: 3\n" + 13099 " └─ Table\n" + 13100 " ├─ name: two_pk\n" + 13101 " └─ columns: [pk1 pk2]\n" + 13102 "", 13103 ExpectedEstimates: "Project\n" + 13104 " ├─ columns: [one_pk.pk]\n" + 13105 " └─ LookupJoin (estimated cost=13.200 rows=4)\n" + 13106 " ├─ MergeJoin (estimated cost=8.120 rows=4)\n" + 13107 " │ ├─ cmp: (one_pk.pk = tpk.pk1)\n" + 13108 " │ ├─ sel: (one_pk.pk = tpk.pk2)\n" + 13109 " │ ├─ IndexedTableAccess(one_pk)\n" + 13110 " │ │ ├─ index: [one_pk.pk]\n" + 13111 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 13112 " │ │ └─ columns: [pk]\n" + 13113 " │ └─ TableAlias(tpk)\n" + 13114 " │ └─ IndexedTableAccess(two_pk)\n" + 13115 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13116 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13117 " │ └─ columns: [pk1 pk2]\n" + 13118 " └─ TableAlias(tpk2)\n" + 13119 " └─ IndexedTableAccess(two_pk)\n" + 13120 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13121 " ├─ columns: [pk1 pk2]\n" + 13122 " └─ keys: tpk.pk2, tpk.pk1\n" + 13123 "", 13124 ExpectedAnalysis: "Project\n" + 13125 " ├─ columns: [one_pk.pk]\n" + 13126 " └─ LookupJoin (estimated cost=13.200 rows=4) (actual rows=2 loops=1)\n" + 13127 " ├─ MergeJoin (estimated cost=8.120 rows=4) (actual rows=2 loops=1)\n" + 13128 " │ ├─ cmp: (one_pk.pk = tpk.pk1)\n" + 13129 " │ ├─ sel: (one_pk.pk = tpk.pk2)\n" + 13130 " │ ├─ IndexedTableAccess(one_pk)\n" + 13131 " │ │ ├─ index: [one_pk.pk]\n" + 13132 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 13133 " │ │ └─ columns: [pk]\n" + 13134 " │ └─ TableAlias(tpk)\n" + 13135 " │ └─ IndexedTableAccess(two_pk)\n" + 13136 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13137 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13138 " │ └─ columns: [pk1 pk2]\n" + 13139 " └─ TableAlias(tpk2)\n" + 13140 " └─ IndexedTableAccess(two_pk)\n" + 13141 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13142 " ├─ columns: [pk1 pk2]\n" + 13143 " └─ keys: tpk.pk2, tpk.pk1\n" + 13144 "", 13145 }, 13146 { 13147 Query: `SELECT /* JOIN_ORDER(tpk, one_pk, tpk2) */ 13148 pk FROM one_pk 13149 JOIN two_pk tpk ON one_pk.pk=tpk.pk1 AND one_pk.pk=tpk.pk2 13150 JOIN two_pk tpk2 ON tpk2.pk1=TPK.pk2 AND TPK2.pk2=tpk.pk1`, 13151 ExpectedPlan: "Project\n" + 13152 " ├─ columns: [one_pk.pk:0!null]\n" + 13153 " └─ LookupJoin\n" + 13154 " ├─ MergeJoin\n" + 13155 " │ ├─ cmp: Eq\n" + 13156 " │ │ ├─ one_pk.pk:0!null\n" + 13157 " │ │ └─ tpk.pk1:1!null\n" + 13158 " │ ├─ sel: Eq\n" + 13159 " │ │ ├─ one_pk.pk:0!null\n" + 13160 " │ │ └─ tpk.pk2:2!null\n" + 13161 " │ ├─ IndexedTableAccess(one_pk)\n" + 13162 " │ │ ├─ index: [one_pk.pk]\n" + 13163 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 13164 " │ │ ├─ colSet: (1-6)\n" + 13165 " │ │ ├─ tableId: 1\n" + 13166 " │ │ └─ Table\n" + 13167 " │ │ ├─ name: one_pk\n" + 13168 " │ │ └─ columns: [pk]\n" + 13169 " │ └─ TableAlias(tpk)\n" + 13170 " │ └─ IndexedTableAccess(two_pk)\n" + 13171 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13172 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 13173 " │ ├─ colSet: (7-13)\n" + 13174 " │ ├─ tableId: 2\n" + 13175 " │ └─ Table\n" + 13176 " │ ├─ name: two_pk\n" + 13177 " │ └─ columns: [pk1 pk2]\n" + 13178 " └─ TableAlias(tpk2)\n" + 13179 " └─ IndexedTableAccess(two_pk)\n" + 13180 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13181 " ├─ keys: [tpk.pk2:2!null tpk.pk1:1!null]\n" + 13182 " ├─ colSet: (14-20)\n" + 13183 " ├─ tableId: 3\n" + 13184 " └─ Table\n" + 13185 " ├─ name: two_pk\n" + 13186 " └─ columns: [pk1 pk2]\n" + 13187 "", 13188 ExpectedEstimates: "Project\n" + 13189 " ├─ columns: [one_pk.pk]\n" + 13190 " └─ LookupJoin (estimated cost=13.200 rows=4)\n" + 13191 " ├─ MergeJoin (estimated cost=8.120 rows=4)\n" + 13192 " │ ├─ cmp: (one_pk.pk = tpk.pk1)\n" + 13193 " │ ├─ sel: (one_pk.pk = tpk.pk2)\n" + 13194 " │ ├─ IndexedTableAccess(one_pk)\n" + 13195 " │ │ ├─ index: [one_pk.pk]\n" + 13196 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 13197 " │ │ └─ columns: [pk]\n" + 13198 " │ └─ TableAlias(tpk)\n" + 13199 " │ └─ IndexedTableAccess(two_pk)\n" + 13200 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13201 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13202 " │ └─ columns: [pk1 pk2]\n" + 13203 " └─ TableAlias(tpk2)\n" + 13204 " └─ IndexedTableAccess(two_pk)\n" + 13205 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13206 " ├─ columns: [pk1 pk2]\n" + 13207 " └─ keys: tpk.pk2, tpk.pk1\n" + 13208 "", 13209 ExpectedAnalysis: "Project\n" + 13210 " ├─ columns: [one_pk.pk]\n" + 13211 " └─ LookupJoin (estimated cost=13.200 rows=4) (actual rows=2 loops=1)\n" + 13212 " ├─ MergeJoin (estimated cost=8.120 rows=4) (actual rows=2 loops=1)\n" + 13213 " │ ├─ cmp: (one_pk.pk = tpk.pk1)\n" + 13214 " │ ├─ sel: (one_pk.pk = tpk.pk2)\n" + 13215 " │ ├─ IndexedTableAccess(one_pk)\n" + 13216 " │ │ ├─ index: [one_pk.pk]\n" + 13217 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 13218 " │ │ └─ columns: [pk]\n" + 13219 " │ └─ TableAlias(tpk)\n" + 13220 " │ └─ IndexedTableAccess(two_pk)\n" + 13221 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13222 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13223 " │ └─ columns: [pk1 pk2]\n" + 13224 " └─ TableAlias(tpk2)\n" + 13225 " └─ IndexedTableAccess(two_pk)\n" + 13226 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13227 " ├─ columns: [pk1 pk2]\n" + 13228 " └─ keys: tpk.pk2, tpk.pk1\n" + 13229 "", 13230 }, 13231 { 13232 Query: `SELECT /* JOIN_ORDER(tpk, one_pk, tpk2) */ 13233 pk FROM one_pk 13234 JOIN two_pk tpk ON one_pk.pk=tpk.pk1 AND one_pk.pk=tpk.pk2 13235 LEFT JOIN two_pk tpk2 ON tpk2.pk1=TPK.pk2 AND TPK2.pk2=tpk.pk1`, 13236 ExpectedPlan: "Project\n" + 13237 " ├─ columns: [one_pk.pk:0!null]\n" + 13238 " └─ LeftOuterJoin\n" + 13239 " ├─ AND\n" + 13240 " │ ├─ Eq\n" + 13241 " │ │ ├─ tpk2.pk1:3!null\n" + 13242 " │ │ └─ tpk.pk2:2!null\n" + 13243 " │ └─ Eq\n" + 13244 " │ ├─ tpk2.pk2:4!null\n" + 13245 " │ └─ tpk.pk1:1!null\n" + 13246 " ├─ MergeJoin\n" + 13247 " │ ├─ cmp: Eq\n" + 13248 " │ │ ├─ one_pk.pk:0!null\n" + 13249 " │ │ └─ tpk.pk1:1!null\n" + 13250 " │ ├─ sel: Eq\n" + 13251 " │ │ ├─ one_pk.pk:0!null\n" + 13252 " │ │ └─ tpk.pk2:2!null\n" + 13253 " │ ├─ IndexedTableAccess(one_pk)\n" + 13254 " │ │ ├─ index: [one_pk.pk]\n" + 13255 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 13256 " │ │ ├─ colSet: (1-6)\n" + 13257 " │ │ ├─ tableId: 1\n" + 13258 " │ │ └─ Table\n" + 13259 " │ │ ├─ name: one_pk\n" + 13260 " │ │ └─ columns: [pk]\n" + 13261 " │ └─ TableAlias(tpk)\n" + 13262 " │ └─ IndexedTableAccess(two_pk)\n" + 13263 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13264 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 13265 " │ ├─ colSet: (7-13)\n" + 13266 " │ ├─ tableId: 2\n" + 13267 " │ └─ Table\n" + 13268 " │ ├─ name: two_pk\n" + 13269 " │ └─ columns: [pk1 pk2]\n" + 13270 " └─ TableAlias(tpk2)\n" + 13271 " └─ ProcessTable\n" + 13272 " └─ Table\n" + 13273 " ├─ name: two_pk\n" + 13274 " └─ columns: [pk1 pk2]\n" + 13275 "", 13276 ExpectedEstimates: "Project\n" + 13277 " ├─ columns: [one_pk.pk]\n" + 13278 " └─ LeftOuterJoin (estimated cost=15.160 rows=5)\n" + 13279 " ├─ ((tpk2.pk1 = tpk.pk2) AND (tpk2.pk2 = tpk.pk1))\n" + 13280 " ├─ MergeJoin (estimated cost=8.120 rows=4)\n" + 13281 " │ ├─ cmp: (one_pk.pk = tpk.pk1)\n" + 13282 " │ ├─ sel: (one_pk.pk = tpk.pk2)\n" + 13283 " │ ├─ IndexedTableAccess(one_pk)\n" + 13284 " │ │ ├─ index: [one_pk.pk]\n" + 13285 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 13286 " │ │ └─ columns: [pk]\n" + 13287 " │ └─ TableAlias(tpk)\n" + 13288 " │ └─ IndexedTableAccess(two_pk)\n" + 13289 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13290 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13291 " │ └─ columns: [pk1 pk2]\n" + 13292 " └─ TableAlias(tpk2)\n" + 13293 " └─ Table\n" + 13294 " ├─ name: two_pk\n" + 13295 " └─ columns: [pk1 pk2]\n" + 13296 "", 13297 ExpectedAnalysis: "Project\n" + 13298 " ├─ columns: [one_pk.pk]\n" + 13299 " └─ LeftOuterJoin (estimated cost=15.160 rows=5) (actual rows=2 loops=1)\n" + 13300 " ├─ ((tpk2.pk1 = tpk.pk2) AND (tpk2.pk2 = tpk.pk1))\n" + 13301 " ├─ MergeJoin (estimated cost=8.120 rows=4) (actual rows=2 loops=1)\n" + 13302 " │ ├─ cmp: (one_pk.pk = tpk.pk1)\n" + 13303 " │ ├─ sel: (one_pk.pk = tpk.pk2)\n" + 13304 " │ ├─ IndexedTableAccess(one_pk)\n" + 13305 " │ │ ├─ index: [one_pk.pk]\n" + 13306 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 13307 " │ │ └─ columns: [pk]\n" + 13308 " │ └─ TableAlias(tpk)\n" + 13309 " │ └─ IndexedTableAccess(two_pk)\n" + 13310 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13311 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13312 " │ └─ columns: [pk1 pk2]\n" + 13313 " └─ TableAlias(tpk2)\n" + 13314 " └─ Table\n" + 13315 " ├─ name: two_pk\n" + 13316 " └─ columns: [pk1 pk2]\n" + 13317 "", 13318 }, 13319 { 13320 Query: `SELECT pk,tpk.pk1,tpk2.pk1,tpk.pk2,tpk2.pk2 FROM one_pk 13321 JOIN two_pk tpk ON pk=tpk.pk1 AND pk-1=tpk.pk2 13322 JOIN two_pk tpk2 ON pk-1=TPK2.pk1 AND pk=tpk2.pk2 13323 ORDER BY 1`, 13324 ExpectedPlan: "Project\n" + 13325 " ├─ columns: [one_pk.pk:0!null, tpk.pk1:1!null, tpk2.pk1:3!null, tpk.pk2:2!null, tpk2.pk2:4!null]\n" + 13326 " └─ Sort(one_pk.pk:0!null ASC nullsFirst)\n" + 13327 " └─ HashJoin\n" + 13328 " ├─ AND\n" + 13329 " │ ├─ Eq\n" + 13330 " │ │ ├─ (one_pk.pk:0!null - 1 (tinyint))\n" + 13331 " │ │ └─ tpk2.pk1:3!null\n" + 13332 " │ └─ Eq\n" + 13333 " │ ├─ one_pk.pk:0!null\n" + 13334 " │ └─ tpk2.pk2:4!null\n" + 13335 " ├─ MergeJoin\n" + 13336 " │ ├─ cmp: Eq\n" + 13337 " │ │ ├─ one_pk.pk:0!null\n" + 13338 " │ │ └─ tpk.pk1:1!null\n" + 13339 " │ ├─ sel: Eq\n" + 13340 " │ │ ├─ (one_pk.pk:0!null - 1 (tinyint))\n" + 13341 " │ │ └─ tpk.pk2:2!null\n" + 13342 " │ ├─ IndexedTableAccess(one_pk)\n" + 13343 " │ │ ├─ index: [one_pk.pk]\n" + 13344 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 13345 " │ │ ├─ colSet: (1-6)\n" + 13346 " │ │ ├─ tableId: 1\n" + 13347 " │ │ └─ Table\n" + 13348 " │ │ ├─ name: one_pk\n" + 13349 " │ │ └─ columns: [pk]\n" + 13350 " │ └─ TableAlias(tpk)\n" + 13351 " │ └─ IndexedTableAccess(two_pk)\n" + 13352 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13353 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 13354 " │ ├─ colSet: (7-13)\n" + 13355 " │ ├─ tableId: 2\n" + 13356 " │ └─ Table\n" + 13357 " │ ├─ name: two_pk\n" + 13358 " │ └─ columns: [pk1 pk2]\n" + 13359 " └─ HashLookup\n" + 13360 " ├─ left-key: TUPLE((one_pk.pk:0!null - 1 (tinyint)), one_pk.pk:0!null)\n" + 13361 " ├─ right-key: TUPLE(tpk2.pk1:0!null, tpk2.pk2:1!null)\n" + 13362 " └─ TableAlias(tpk2)\n" + 13363 " └─ ProcessTable\n" + 13364 " └─ Table\n" + 13365 " ├─ name: two_pk\n" + 13366 " └─ columns: [pk1 pk2]\n" + 13367 "", 13368 ExpectedEstimates: "Project\n" + 13369 " ├─ columns: [one_pk.pk, tpk.pk1, tpk2.pk1, tpk.pk2, tpk2.pk2]\n" + 13370 " └─ Sort(one_pk.pk ASC)\n" + 13371 " └─ HashJoin\n" + 13372 " ├─ (((one_pk.pk - 1) = tpk2.pk1) AND (one_pk.pk = tpk2.pk2))\n" + 13373 " ├─ MergeJoin\n" + 13374 " │ ├─ cmp: (one_pk.pk = tpk.pk1)\n" + 13375 " │ ├─ sel: ((one_pk.pk - 1) = tpk.pk2)\n" + 13376 " │ ├─ IndexedTableAccess(one_pk)\n" + 13377 " │ │ ├─ index: [one_pk.pk]\n" + 13378 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 13379 " │ │ └─ columns: [pk]\n" + 13380 " │ └─ TableAlias(tpk)\n" + 13381 " │ └─ IndexedTableAccess(two_pk)\n" + 13382 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13383 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13384 " │ └─ columns: [pk1 pk2]\n" + 13385 " └─ HashLookup\n" + 13386 " ├─ left-key: ((one_pk.pk - 1), one_pk.pk)\n" + 13387 " ├─ right-key: (tpk2.pk1, tpk2.pk2)\n" + 13388 " └─ TableAlias(tpk2)\n" + 13389 " └─ Table\n" + 13390 " ├─ name: two_pk\n" + 13391 " └─ columns: [pk1 pk2]\n" + 13392 "", 13393 ExpectedAnalysis: "Project\n" + 13394 " ├─ columns: [one_pk.pk, tpk.pk1, tpk2.pk1, tpk.pk2, tpk2.pk2]\n" + 13395 " └─ Sort(one_pk.pk ASC)\n" + 13396 " └─ HashJoin\n" + 13397 " ├─ (((one_pk.pk - 1) = tpk2.pk1) AND (one_pk.pk = tpk2.pk2))\n" + 13398 " ├─ MergeJoin\n" + 13399 " │ ├─ cmp: (one_pk.pk = tpk.pk1)\n" + 13400 " │ ├─ sel: ((one_pk.pk - 1) = tpk.pk2)\n" + 13401 " │ ├─ IndexedTableAccess(one_pk)\n" + 13402 " │ │ ├─ index: [one_pk.pk]\n" + 13403 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 13404 " │ │ └─ columns: [pk]\n" + 13405 " │ └─ TableAlias(tpk)\n" + 13406 " │ └─ IndexedTableAccess(two_pk)\n" + 13407 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13408 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13409 " │ └─ columns: [pk1 pk2]\n" + 13410 " └─ HashLookup\n" + 13411 " ├─ left-key: ((one_pk.pk - 1), one_pk.pk)\n" + 13412 " ├─ right-key: (tpk2.pk1, tpk2.pk2)\n" + 13413 " └─ TableAlias(tpk2)\n" + 13414 " └─ Table\n" + 13415 " ├─ name: two_pk\n" + 13416 " └─ columns: [pk1 pk2]\n" + 13417 "", 13418 }, 13419 { 13420 Query: `SELECT pk FROM one_pk 13421 LEFT JOIN two_pk tpk ON one_pk.pk=tpk.pk1 AND one_pk.pk=tpk.pk2 13422 LEFT JOIN two_pk tpk2 ON tpk2.pk1=TPK.pk2 AND TPK2.pk2=tpk.pk1`, 13423 ExpectedPlan: "Project\n" + 13424 " ├─ columns: [one_pk.pk:0!null]\n" + 13425 " └─ LeftOuterHashJoin\n" + 13426 " ├─ AND\n" + 13427 " │ ├─ Eq\n" + 13428 " │ │ ├─ tpk2.pk1:3!null\n" + 13429 " │ │ └─ tpk.pk2:2!null\n" + 13430 " │ └─ Eq\n" + 13431 " │ ├─ tpk2.pk2:4!null\n" + 13432 " │ └─ tpk.pk1:1!null\n" + 13433 " ├─ LeftOuterMergeJoin\n" + 13434 " │ ├─ cmp: Eq\n" + 13435 " │ │ ├─ one_pk.pk:0!null\n" + 13436 " │ │ └─ tpk.pk1:1!null\n" + 13437 " │ ├─ sel: Eq\n" + 13438 " │ │ ├─ one_pk.pk:0!null\n" + 13439 " │ │ └─ tpk.pk2:2!null\n" + 13440 " │ ├─ IndexedTableAccess(one_pk)\n" + 13441 " │ │ ├─ index: [one_pk.pk]\n" + 13442 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 13443 " │ │ ├─ colSet: (1-6)\n" + 13444 " │ │ ├─ tableId: 1\n" + 13445 " │ │ └─ Table\n" + 13446 " │ │ ├─ name: one_pk\n" + 13447 " │ │ └─ columns: [pk]\n" + 13448 " │ └─ TableAlias(tpk)\n" + 13449 " │ └─ IndexedTableAccess(two_pk)\n" + 13450 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13451 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 13452 " │ ├─ colSet: (7-13)\n" + 13453 " │ ├─ tableId: 2\n" + 13454 " │ └─ Table\n" + 13455 " │ ├─ name: two_pk\n" + 13456 " │ └─ columns: [pk1 pk2]\n" + 13457 " └─ HashLookup\n" + 13458 " ├─ left-key: TUPLE(tpk.pk2:2!null, tpk.pk1:1!null)\n" + 13459 " ├─ right-key: TUPLE(tpk2.pk1:0!null, tpk2.pk2:1!null)\n" + 13460 " └─ TableAlias(tpk2)\n" + 13461 " └─ ProcessTable\n" + 13462 " └─ Table\n" + 13463 " ├─ name: two_pk\n" + 13464 " └─ columns: [pk1 pk2]\n" + 13465 "", 13466 ExpectedEstimates: "Project\n" + 13467 " ├─ columns: [one_pk.pk]\n" + 13468 " └─ LeftOuterHashJoin (estimated cost=17.100 rows=5)\n" + 13469 " ├─ ((tpk2.pk1 = tpk.pk2) AND (tpk2.pk2 = tpk.pk1))\n" + 13470 " ├─ LeftOuterMergeJoin (estimated cost=8.160 rows=5)\n" + 13471 " │ ├─ cmp: (one_pk.pk = tpk.pk1)\n" + 13472 " │ ├─ sel: (one_pk.pk = tpk.pk2)\n" + 13473 " │ ├─ IndexedTableAccess(one_pk)\n" + 13474 " │ │ ├─ index: [one_pk.pk]\n" + 13475 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 13476 " │ │ └─ columns: [pk]\n" + 13477 " │ └─ TableAlias(tpk)\n" + 13478 " │ └─ IndexedTableAccess(two_pk)\n" + 13479 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13480 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13481 " │ └─ columns: [pk1 pk2]\n" + 13482 " └─ HashLookup\n" + 13483 " ├─ left-key: (tpk.pk2, tpk.pk1)\n" + 13484 " ├─ right-key: (tpk2.pk1, tpk2.pk2)\n" + 13485 " └─ TableAlias(tpk2)\n" + 13486 " └─ Table\n" + 13487 " ├─ name: two_pk\n" + 13488 " └─ columns: [pk1 pk2]\n" + 13489 "", 13490 ExpectedAnalysis: "Project\n" + 13491 " ├─ columns: [one_pk.pk]\n" + 13492 " └─ LeftOuterHashJoin (estimated cost=17.100 rows=5) (actual rows=4 loops=1)\n" + 13493 " ├─ ((tpk2.pk1 = tpk.pk2) AND (tpk2.pk2 = tpk.pk1))\n" + 13494 " ├─ LeftOuterMergeJoin (estimated cost=8.160 rows=5) (actual rows=4 loops=1)\n" + 13495 " │ ├─ cmp: (one_pk.pk = tpk.pk1)\n" + 13496 " │ ├─ sel: (one_pk.pk = tpk.pk2)\n" + 13497 " │ ├─ IndexedTableAccess(one_pk)\n" + 13498 " │ │ ├─ index: [one_pk.pk]\n" + 13499 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 13500 " │ │ └─ columns: [pk]\n" + 13501 " │ └─ TableAlias(tpk)\n" + 13502 " │ └─ IndexedTableAccess(two_pk)\n" + 13503 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13504 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13505 " │ └─ columns: [pk1 pk2]\n" + 13506 " └─ HashLookup\n" + 13507 " ├─ left-key: (tpk.pk2, tpk.pk1)\n" + 13508 " ├─ right-key: (tpk2.pk1, tpk2.pk2)\n" + 13509 " └─ TableAlias(tpk2)\n" + 13510 " └─ Table\n" + 13511 " ├─ name: two_pk\n" + 13512 " └─ columns: [pk1 pk2]\n" + 13513 "", 13514 }, 13515 { 13516 Query: `SELECT pk FROM one_pk 13517 LEFT JOIN two_pk tpk ON one_pk.pk=tpk.pk1 AND one_pk.pk=tpk.pk2 13518 JOIN two_pk tpk2 ON tpk2.pk1=TPK.pk2 AND TPK2.pk2=tpk.pk1`, 13519 ExpectedPlan: "Project\n" + 13520 " ├─ columns: [one_pk.pk:0!null]\n" + 13521 " └─ LookupJoin\n" + 13522 " ├─ LeftOuterMergeJoin\n" + 13523 " │ ├─ cmp: Eq\n" + 13524 " │ │ ├─ one_pk.pk:0!null\n" + 13525 " │ │ └─ tpk.pk1:1!null\n" + 13526 " │ ├─ sel: Eq\n" + 13527 " │ │ ├─ one_pk.pk:0!null\n" + 13528 " │ │ └─ tpk.pk2:2!null\n" + 13529 " │ ├─ IndexedTableAccess(one_pk)\n" + 13530 " │ │ ├─ index: [one_pk.pk]\n" + 13531 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 13532 " │ │ ├─ colSet: (1-6)\n" + 13533 " │ │ ├─ tableId: 1\n" + 13534 " │ │ └─ Table\n" + 13535 " │ │ ├─ name: one_pk\n" + 13536 " │ │ └─ columns: [pk]\n" + 13537 " │ └─ TableAlias(tpk)\n" + 13538 " │ └─ IndexedTableAccess(two_pk)\n" + 13539 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13540 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 13541 " │ ├─ colSet: (7-13)\n" + 13542 " │ ├─ tableId: 2\n" + 13543 " │ └─ Table\n" + 13544 " │ ├─ name: two_pk\n" + 13545 " │ └─ columns: [pk1 pk2]\n" + 13546 " └─ TableAlias(tpk2)\n" + 13547 " └─ IndexedTableAccess(two_pk)\n" + 13548 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13549 " ├─ keys: [tpk.pk2:2!null tpk.pk1:1!null]\n" + 13550 " ├─ colSet: (14-20)\n" + 13551 " ├─ tableId: 3\n" + 13552 " └─ Table\n" + 13553 " ├─ name: two_pk\n" + 13554 " └─ columns: [pk1 pk2]\n" + 13555 "", 13556 ExpectedEstimates: "Project\n" + 13557 " ├─ columns: [one_pk.pk]\n" + 13558 " └─ LookupJoin (estimated cost=16.500 rows=5)\n" + 13559 " ├─ LeftOuterMergeJoin (estimated cost=8.160 rows=5)\n" + 13560 " │ ├─ cmp: (one_pk.pk = tpk.pk1)\n" + 13561 " │ ├─ sel: (one_pk.pk = tpk.pk2)\n" + 13562 " │ ├─ IndexedTableAccess(one_pk)\n" + 13563 " │ │ ├─ index: [one_pk.pk]\n" + 13564 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 13565 " │ │ └─ columns: [pk]\n" + 13566 " │ └─ TableAlias(tpk)\n" + 13567 " │ └─ IndexedTableAccess(two_pk)\n" + 13568 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13569 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13570 " │ └─ columns: [pk1 pk2]\n" + 13571 " └─ TableAlias(tpk2)\n" + 13572 " └─ IndexedTableAccess(two_pk)\n" + 13573 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13574 " ├─ columns: [pk1 pk2]\n" + 13575 " └─ keys: tpk.pk2, tpk.pk1\n" + 13576 "", 13577 ExpectedAnalysis: "Project\n" + 13578 " ├─ columns: [one_pk.pk]\n" + 13579 " └─ LookupJoin (estimated cost=16.500 rows=5) (actual rows=2 loops=1)\n" + 13580 " ├─ LeftOuterMergeJoin (estimated cost=8.160 rows=5) (actual rows=4 loops=1)\n" + 13581 " │ ├─ cmp: (one_pk.pk = tpk.pk1)\n" + 13582 " │ ├─ sel: (one_pk.pk = tpk.pk2)\n" + 13583 " │ ├─ IndexedTableAccess(one_pk)\n" + 13584 " │ │ ├─ index: [one_pk.pk]\n" + 13585 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 13586 " │ │ └─ columns: [pk]\n" + 13587 " │ └─ TableAlias(tpk)\n" + 13588 " │ └─ IndexedTableAccess(two_pk)\n" + 13589 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13590 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13591 " │ └─ columns: [pk1 pk2]\n" + 13592 " └─ TableAlias(tpk2)\n" + 13593 " └─ IndexedTableAccess(two_pk)\n" + 13594 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13595 " ├─ columns: [pk1 pk2]\n" + 13596 " └─ keys: tpk.pk2, tpk.pk1\n" + 13597 "", 13598 }, 13599 { 13600 Query: `SELECT pk FROM one_pk 13601 JOIN two_pk tpk ON one_pk.pk=tpk.pk1 AND one_pk.pk=tpk.pk2 13602 LEFT JOIN two_pk tpk2 ON tpk2.pk1=TPK.pk2 AND TPK2.pk2=tpk.pk1`, 13603 ExpectedPlan: "Project\n" + 13604 " ├─ columns: [one_pk.pk:0!null]\n" + 13605 " └─ LeftOuterJoin\n" + 13606 " ├─ AND\n" + 13607 " │ ├─ Eq\n" + 13608 " │ │ ├─ tpk2.pk1:3!null\n" + 13609 " │ │ └─ tpk.pk2:2!null\n" + 13610 " │ └─ Eq\n" + 13611 " │ ├─ tpk2.pk2:4!null\n" + 13612 " │ └─ tpk.pk1:1!null\n" + 13613 " ├─ MergeJoin\n" + 13614 " │ ├─ cmp: Eq\n" + 13615 " │ │ ├─ one_pk.pk:0!null\n" + 13616 " │ │ └─ tpk.pk1:1!null\n" + 13617 " │ ├─ sel: Eq\n" + 13618 " │ │ ├─ one_pk.pk:0!null\n" + 13619 " │ │ └─ tpk.pk2:2!null\n" + 13620 " │ ├─ IndexedTableAccess(one_pk)\n" + 13621 " │ │ ├─ index: [one_pk.pk]\n" + 13622 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 13623 " │ │ ├─ colSet: (1-6)\n" + 13624 " │ │ ├─ tableId: 1\n" + 13625 " │ │ └─ Table\n" + 13626 " │ │ ├─ name: one_pk\n" + 13627 " │ │ └─ columns: [pk]\n" + 13628 " │ └─ TableAlias(tpk)\n" + 13629 " │ └─ IndexedTableAccess(two_pk)\n" + 13630 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13631 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 13632 " │ ├─ colSet: (7-13)\n" + 13633 " │ ├─ tableId: 2\n" + 13634 " │ └─ Table\n" + 13635 " │ ├─ name: two_pk\n" + 13636 " │ └─ columns: [pk1 pk2]\n" + 13637 " └─ TableAlias(tpk2)\n" + 13638 " └─ ProcessTable\n" + 13639 " └─ Table\n" + 13640 " ├─ name: two_pk\n" + 13641 " └─ columns: [pk1 pk2]\n" + 13642 "", 13643 ExpectedEstimates: "Project\n" + 13644 " ├─ columns: [one_pk.pk]\n" + 13645 " └─ LeftOuterJoin (estimated cost=15.160 rows=5)\n" + 13646 " ├─ ((tpk2.pk1 = tpk.pk2) AND (tpk2.pk2 = tpk.pk1))\n" + 13647 " ├─ MergeJoin (estimated cost=8.120 rows=4)\n" + 13648 " │ ├─ cmp: (one_pk.pk = tpk.pk1)\n" + 13649 " │ ├─ sel: (one_pk.pk = tpk.pk2)\n" + 13650 " │ ├─ IndexedTableAccess(one_pk)\n" + 13651 " │ │ ├─ index: [one_pk.pk]\n" + 13652 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 13653 " │ │ └─ columns: [pk]\n" + 13654 " │ └─ TableAlias(tpk)\n" + 13655 " │ └─ IndexedTableAccess(two_pk)\n" + 13656 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13657 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13658 " │ └─ columns: [pk1 pk2]\n" + 13659 " └─ TableAlias(tpk2)\n" + 13660 " └─ Table\n" + 13661 " ├─ name: two_pk\n" + 13662 " └─ columns: [pk1 pk2]\n" + 13663 "", 13664 ExpectedAnalysis: "Project\n" + 13665 " ├─ columns: [one_pk.pk]\n" + 13666 " └─ LeftOuterJoin (estimated cost=15.160 rows=5) (actual rows=2 loops=1)\n" + 13667 " ├─ ((tpk2.pk1 = tpk.pk2) AND (tpk2.pk2 = tpk.pk1))\n" + 13668 " ├─ MergeJoin (estimated cost=8.120 rows=4) (actual rows=2 loops=1)\n" + 13669 " │ ├─ cmp: (one_pk.pk = tpk.pk1)\n" + 13670 " │ ├─ sel: (one_pk.pk = tpk.pk2)\n" + 13671 " │ ├─ IndexedTableAccess(one_pk)\n" + 13672 " │ │ ├─ index: [one_pk.pk]\n" + 13673 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 13674 " │ │ └─ columns: [pk]\n" + 13675 " │ └─ TableAlias(tpk)\n" + 13676 " │ └─ IndexedTableAccess(two_pk)\n" + 13677 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13678 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13679 " │ └─ columns: [pk1 pk2]\n" + 13680 " └─ TableAlias(tpk2)\n" + 13681 " └─ Table\n" + 13682 " ├─ name: two_pk\n" + 13683 " └─ columns: [pk1 pk2]\n" + 13684 "", 13685 }, 13686 { 13687 Query: `SELECT pk FROM one_pk 13688 RIGHT JOIN two_pk tpk ON one_pk.pk=tpk.pk1 AND one_pk.pk=tpk.pk2 13689 RIGHT JOIN two_pk tpk2 ON tpk.pk1=TPk2.pk2 AND tpk.pk2=TPK2.pk1`, 13690 ExpectedPlan: "Project\n" + 13691 " ├─ columns: [one_pk.pk:4!null]\n" + 13692 " └─ LeftOuterHashJoin\n" + 13693 " ├─ AND\n" + 13694 " │ ├─ Eq\n" + 13695 " │ │ ├─ tpk.pk1:2!null\n" + 13696 " │ │ └─ tpk2.pk2:1!null\n" + 13697 " │ └─ Eq\n" + 13698 " │ ├─ tpk.pk2:3!null\n" + 13699 " │ └─ tpk2.pk1:0!null\n" + 13700 " ├─ TableAlias(tpk2)\n" + 13701 " │ └─ ProcessTable\n" + 13702 " │ └─ Table\n" + 13703 " │ ├─ name: two_pk\n" + 13704 " │ └─ columns: [pk1 pk2]\n" + 13705 " └─ HashLookup\n" + 13706 " ├─ left-key: TUPLE(tpk2.pk2:1!null, tpk2.pk1:0!null)\n" + 13707 " ├─ right-key: TUPLE(tpk.pk1:0!null, tpk.pk2:1!null)\n" + 13708 " └─ LeftOuterMergeJoin\n" + 13709 " ├─ cmp: Eq\n" + 13710 " │ ├─ TUPLE(tpk.pk1:2!null, tpk.pk2:3!null)\n" + 13711 " │ └─ TUPLE(one_pk.pk:4!null, one_pk.pk:4!null)\n" + 13712 " ├─ TableAlias(tpk)\n" + 13713 " │ └─ IndexedTableAccess(two_pk)\n" + 13714 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13715 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 13716 " │ ├─ colSet: (7-13)\n" + 13717 " │ ├─ tableId: 2\n" + 13718 " │ └─ Table\n" + 13719 " │ ├─ name: two_pk\n" + 13720 " │ └─ columns: [pk1 pk2]\n" + 13721 " └─ IndexedTableAccess(one_pk)\n" + 13722 " ├─ index: [one_pk.pk]\n" + 13723 " ├─ static: [{[NULL, ∞)}]\n" + 13724 " ├─ colSet: (1-6)\n" + 13725 " ├─ tableId: 1\n" + 13726 " └─ Table\n" + 13727 " ├─ name: one_pk\n" + 13728 " └─ columns: [pk]\n" + 13729 "", 13730 ExpectedEstimates: "Project\n" + 13731 " ├─ columns: [one_pk.pk]\n" + 13732 " └─ LeftOuterHashJoin (estimated cost=19.090 rows=5)\n" + 13733 " ├─ ((tpk.pk1 = tpk2.pk2) AND (tpk.pk2 = tpk2.pk1))\n" + 13734 " ├─ TableAlias(tpk2)\n" + 13735 " │ └─ Table\n" + 13736 " │ ├─ name: two_pk\n" + 13737 " │ └─ columns: [pk1 pk2]\n" + 13738 " └─ HashLookup\n" + 13739 " ├─ left-key: (tpk2.pk2, tpk2.pk1)\n" + 13740 " ├─ right-key: (tpk.pk1, tpk.pk2)\n" + 13741 " └─ LeftOuterMergeJoin\n" + 13742 " ├─ cmp: ((tpk.pk1, tpk.pk2) = (one_pk.pk, one_pk.pk))\n" + 13743 " ├─ TableAlias(tpk)\n" + 13744 " │ └─ IndexedTableAccess(two_pk)\n" + 13745 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13746 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13747 " │ └─ columns: [pk1 pk2]\n" + 13748 " └─ IndexedTableAccess(one_pk)\n" + 13749 " ├─ index: [one_pk.pk]\n" + 13750 " ├─ filters: [{[NULL, ∞)}]\n" + 13751 " └─ columns: [pk]\n" + 13752 "", 13753 ExpectedAnalysis: "Project\n" + 13754 " ├─ columns: [one_pk.pk]\n" + 13755 " └─ LeftOuterHashJoin (estimated cost=19.090 rows=5) (actual rows=4 loops=1)\n" + 13756 " ├─ ((tpk.pk1 = tpk2.pk2) AND (tpk.pk2 = tpk2.pk1))\n" + 13757 " ├─ TableAlias(tpk2)\n" + 13758 " │ └─ Table\n" + 13759 " │ ├─ name: two_pk\n" + 13760 " │ └─ columns: [pk1 pk2]\n" + 13761 " └─ HashLookup\n" + 13762 " ├─ left-key: (tpk2.pk2, tpk2.pk1)\n" + 13763 " ├─ right-key: (tpk.pk1, tpk.pk2)\n" + 13764 " └─ LeftOuterMergeJoin\n" + 13765 " ├─ cmp: ((tpk.pk1, tpk.pk2) = (one_pk.pk, one_pk.pk))\n" + 13766 " ├─ TableAlias(tpk)\n" + 13767 " │ └─ IndexedTableAccess(two_pk)\n" + 13768 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13769 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13770 " │ └─ columns: [pk1 pk2]\n" + 13771 " └─ IndexedTableAccess(one_pk)\n" + 13772 " ├─ index: [one_pk.pk]\n" + 13773 " ├─ filters: [{[NULL, ∞)}]\n" + 13774 " └─ columns: [pk]\n" + 13775 "", 13776 }, 13777 { 13778 Query: `SELECT i,pk1,pk2 FROM mytable JOIN two_pk ON i-1=pk1 AND i-2=pk2`, 13779 ExpectedPlan: "Project\n" + 13780 " ├─ columns: [mytable.i:2!null, two_pk.pk1:0!null, two_pk.pk2:1!null]\n" + 13781 " └─ HashJoin\n" + 13782 " ├─ AND\n" + 13783 " │ ├─ Eq\n" + 13784 " │ │ ├─ (mytable.i:2!null - 1 (tinyint))\n" + 13785 " │ │ └─ two_pk.pk1:0!null\n" + 13786 " │ └─ Eq\n" + 13787 " │ ├─ (mytable.i:2!null - 2 (tinyint))\n" + 13788 " │ └─ two_pk.pk2:1!null\n" + 13789 " ├─ ProcessTable\n" + 13790 " │ └─ Table\n" + 13791 " │ ├─ name: two_pk\n" + 13792 " │ └─ columns: [pk1 pk2]\n" + 13793 " └─ HashLookup\n" + 13794 " ├─ left-key: TUPLE(two_pk.pk1:0!null, two_pk.pk2:1!null)\n" + 13795 " ├─ right-key: TUPLE((mytable.i:0!null - 1 (tinyint)), (mytable.i:0!null - 2 (tinyint)))\n" + 13796 " └─ ProcessTable\n" + 13797 " └─ Table\n" + 13798 " ├─ name: mytable\n" + 13799 " └─ columns: [i]\n" + 13800 "", 13801 ExpectedEstimates: "Project\n" + 13802 " ├─ columns: [mytable.i, two_pk.pk1, two_pk.pk2]\n" + 13803 " └─ HashJoin (estimated cost=13.070 rows=3)\n" + 13804 " ├─ (((mytable.i - 1) = two_pk.pk1) AND ((mytable.i - 2) = two_pk.pk2))\n" + 13805 " ├─ Table\n" + 13806 " │ ├─ name: two_pk\n" + 13807 " │ └─ columns: [pk1 pk2]\n" + 13808 " └─ HashLookup\n" + 13809 " ├─ left-key: (two_pk.pk1, two_pk.pk2)\n" + 13810 " ├─ right-key: ((mytable.i - 1), (mytable.i - 2))\n" + 13811 " └─ Table\n" + 13812 " ├─ name: mytable\n" + 13813 " └─ columns: [i]\n" + 13814 "", 13815 ExpectedAnalysis: "Project\n" + 13816 " ├─ columns: [mytable.i, two_pk.pk1, two_pk.pk2]\n" + 13817 " └─ HashJoin (estimated cost=13.070 rows=3) (actual rows=1 loops=1)\n" + 13818 " ├─ (((mytable.i - 1) = two_pk.pk1) AND ((mytable.i - 2) = two_pk.pk2))\n" + 13819 " ├─ Table\n" + 13820 " │ ├─ name: two_pk\n" + 13821 " │ └─ columns: [pk1 pk2]\n" + 13822 " └─ HashLookup\n" + 13823 " ├─ left-key: (two_pk.pk1, two_pk.pk2)\n" + 13824 " ├─ right-key: ((mytable.i - 1), (mytable.i - 2))\n" + 13825 " └─ Table\n" + 13826 " ├─ name: mytable\n" + 13827 " └─ columns: [i]\n" + 13828 "", 13829 }, 13830 { 13831 Query: `SELECT pk,pk1,pk2 FROM one_pk LEFT JOIN two_pk ON pk=pk1`, 13832 ExpectedPlan: "Project\n" + 13833 " ├─ columns: [one_pk.pk:0!null, two_pk.pk1:1!null, two_pk.pk2:2!null]\n" + 13834 " └─ LeftOuterMergeJoin\n" + 13835 " ├─ cmp: Eq\n" + 13836 " │ ├─ one_pk.pk:0!null\n" + 13837 " │ └─ two_pk.pk1:1!null\n" + 13838 " ├─ IndexedTableAccess(one_pk)\n" + 13839 " │ ├─ index: [one_pk.pk]\n" + 13840 " │ ├─ static: [{[NULL, ∞)}]\n" + 13841 " │ ├─ colSet: (1-6)\n" + 13842 " │ ├─ tableId: 1\n" + 13843 " │ └─ Table\n" + 13844 " │ ├─ name: one_pk\n" + 13845 " │ └─ columns: [pk]\n" + 13846 " └─ IndexedTableAccess(two_pk)\n" + 13847 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13848 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 13849 " ├─ colSet: (7-13)\n" + 13850 " ├─ tableId: 2\n" + 13851 " └─ Table\n" + 13852 " ├─ name: two_pk\n" + 13853 " └─ columns: [pk1 pk2]\n" + 13854 "", 13855 ExpectedEstimates: "Project\n" + 13856 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 13857 " └─ LeftOuterMergeJoin (estimated cost=8.160 rows=5)\n" + 13858 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 13859 " ├─ IndexedTableAccess(one_pk)\n" + 13860 " │ ├─ index: [one_pk.pk]\n" + 13861 " │ ├─ filters: [{[NULL, ∞)}]\n" + 13862 " │ └─ columns: [pk]\n" + 13863 " └─ IndexedTableAccess(two_pk)\n" + 13864 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13865 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13866 " └─ columns: [pk1 pk2]\n" + 13867 "", 13868 ExpectedAnalysis: "Project\n" + 13869 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 13870 " └─ LeftOuterMergeJoin (estimated cost=8.160 rows=5) (actual rows=6 loops=1)\n" + 13871 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 13872 " ├─ IndexedTableAccess(one_pk)\n" + 13873 " │ ├─ index: [one_pk.pk]\n" + 13874 " │ ├─ filters: [{[NULL, ∞)}]\n" + 13875 " │ └─ columns: [pk]\n" + 13876 " └─ IndexedTableAccess(two_pk)\n" + 13877 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 13878 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 13879 " └─ columns: [pk1 pk2]\n" + 13880 "", 13881 }, 13882 { 13883 Query: `SELECT pk,i,f FROM one_pk LEFT JOIN niltable ON pk=i`, 13884 ExpectedPlan: "Project\n" + 13885 " ├─ columns: [one_pk.pk:0!null, niltable.i:1!null, niltable.f:2]\n" + 13886 " └─ LeftOuterMergeJoin\n" + 13887 " ├─ cmp: Eq\n" + 13888 " │ ├─ one_pk.pk:0!null\n" + 13889 " │ └─ niltable.i:1!null\n" + 13890 " ├─ IndexedTableAccess(one_pk)\n" + 13891 " │ ├─ index: [one_pk.pk]\n" + 13892 " │ ├─ static: [{[NULL, ∞)}]\n" + 13893 " │ ├─ colSet: (1-6)\n" + 13894 " │ ├─ tableId: 1\n" + 13895 " │ └─ Table\n" + 13896 " │ ├─ name: one_pk\n" + 13897 " │ └─ columns: [pk]\n" + 13898 " └─ IndexedTableAccess(niltable)\n" + 13899 " ├─ index: [niltable.i]\n" + 13900 " ├─ static: [{[NULL, ∞)}]\n" + 13901 " ├─ colSet: (7-10)\n" + 13902 " ├─ tableId: 2\n" + 13903 " └─ Table\n" + 13904 " ├─ name: niltable\n" + 13905 " └─ columns: [i f]\n" + 13906 "", 13907 ExpectedEstimates: "Project\n" + 13908 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 13909 " └─ LeftOuterMergeJoin (estimated cost=10.180 rows=5)\n" + 13910 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 13911 " ├─ IndexedTableAccess(one_pk)\n" + 13912 " │ ├─ index: [one_pk.pk]\n" + 13913 " │ ├─ filters: [{[NULL, ∞)}]\n" + 13914 " │ └─ columns: [pk]\n" + 13915 " └─ IndexedTableAccess(niltable)\n" + 13916 " ├─ index: [niltable.i]\n" + 13917 " ├─ filters: [{[NULL, ∞)}]\n" + 13918 " └─ columns: [i f]\n" + 13919 "", 13920 ExpectedAnalysis: "Project\n" + 13921 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 13922 " └─ LeftOuterMergeJoin (estimated cost=10.180 rows=5) (actual rows=4 loops=1)\n" + 13923 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 13924 " ├─ IndexedTableAccess(one_pk)\n" + 13925 " │ ├─ index: [one_pk.pk]\n" + 13926 " │ ├─ filters: [{[NULL, ∞)}]\n" + 13927 " │ └─ columns: [pk]\n" + 13928 " └─ IndexedTableAccess(niltable)\n" + 13929 " ├─ index: [niltable.i]\n" + 13930 " ├─ filters: [{[NULL, ∞)}]\n" + 13931 " └─ columns: [i f]\n" + 13932 "", 13933 }, 13934 { 13935 Query: `SELECT pk,i,f FROM one_pk RIGHT JOIN niltable ON pk=i`, 13936 ExpectedPlan: "Project\n" + 13937 " ├─ columns: [one_pk.pk:2!null, niltable.i:0!null, niltable.f:1]\n" + 13938 " └─ LeftOuterMergeJoin\n" + 13939 " ├─ cmp: Eq\n" + 13940 " │ ├─ niltable.i:0!null\n" + 13941 " │ └─ one_pk.pk:2!null\n" + 13942 " ├─ IndexedTableAccess(niltable)\n" + 13943 " │ ├─ index: [niltable.i]\n" + 13944 " │ ├─ static: [{[NULL, ∞)}]\n" + 13945 " │ ├─ colSet: (7-10)\n" + 13946 " │ ├─ tableId: 2\n" + 13947 " │ └─ Table\n" + 13948 " │ ├─ name: niltable\n" + 13949 " │ └─ columns: [i f]\n" + 13950 " └─ IndexedTableAccess(one_pk)\n" + 13951 " ├─ index: [one_pk.pk]\n" + 13952 " ├─ static: [{[NULL, ∞)}]\n" + 13953 " ├─ colSet: (1-6)\n" + 13954 " ├─ tableId: 1\n" + 13955 " └─ Table\n" + 13956 " ├─ name: one_pk\n" + 13957 " └─ columns: [pk]\n" + 13958 "", 13959 ExpectedEstimates: "Project\n" + 13960 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 13961 " └─ LeftOuterMergeJoin (estimated cost=10.180 rows=5)\n" + 13962 " ├─ cmp: (niltable.i = one_pk.pk)\n" + 13963 " ├─ IndexedTableAccess(niltable)\n" + 13964 " │ ├─ index: [niltable.i]\n" + 13965 " │ ├─ filters: [{[NULL, ∞)}]\n" + 13966 " │ └─ columns: [i f]\n" + 13967 " └─ IndexedTableAccess(one_pk)\n" + 13968 " ├─ index: [one_pk.pk]\n" + 13969 " ├─ filters: [{[NULL, ∞)}]\n" + 13970 " └─ columns: [pk]\n" + 13971 "", 13972 ExpectedAnalysis: "Project\n" + 13973 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 13974 " └─ LeftOuterMergeJoin (estimated cost=10.180 rows=5) (actual rows=6 loops=1)\n" + 13975 " ├─ cmp: (niltable.i = one_pk.pk)\n" + 13976 " ├─ IndexedTableAccess(niltable)\n" + 13977 " │ ├─ index: [niltable.i]\n" + 13978 " │ ├─ filters: [{[NULL, ∞)}]\n" + 13979 " │ └─ columns: [i f]\n" + 13980 " └─ IndexedTableAccess(one_pk)\n" + 13981 " ├─ index: [one_pk.pk]\n" + 13982 " ├─ filters: [{[NULL, ∞)}]\n" + 13983 " └─ columns: [pk]\n" + 13984 "", 13985 }, 13986 { 13987 Query: `SELECT pk,nt.i,nt2.i FROM one_pk 13988 RIGHT JOIN niltable nt ON pk=nt.i 13989 RIGHT JOIN niltable nt2 ON pk=nt2.i + 1`, 13990 ExpectedPlan: "Project\n" + 13991 " ├─ columns: [one_pk.pk:2!null, nt.i:1!null, nt2.i:0!null]\n" + 13992 " └─ LeftOuterHashJoin\n" + 13993 " ├─ Eq\n" + 13994 " │ ├─ one_pk.pk:2!null\n" + 13995 " │ └─ (nt2.i:0!null + 1 (tinyint))\n" + 13996 " ├─ TableAlias(nt2)\n" + 13997 " │ └─ ProcessTable\n" + 13998 " │ └─ Table\n" + 13999 " │ ├─ name: niltable\n" + 14000 " │ └─ columns: [i]\n" + 14001 " └─ HashLookup\n" + 14002 " ├─ left-key: TUPLE((nt2.i:0!null + 1 (tinyint)))\n" + 14003 " ├─ right-key: TUPLE(one_pk.pk:1!null)\n" + 14004 " └─ LeftOuterMergeJoin\n" + 14005 " ├─ cmp: Eq\n" + 14006 " │ ├─ nt.i:1!null\n" + 14007 " │ └─ one_pk.pk:2!null\n" + 14008 " ├─ TableAlias(nt)\n" + 14009 " │ └─ IndexedTableAccess(niltable)\n" + 14010 " │ ├─ index: [niltable.i]\n" + 14011 " │ ├─ static: [{[NULL, ∞)}]\n" + 14012 " │ ├─ colSet: (7-10)\n" + 14013 " │ ├─ tableId: 2\n" + 14014 " │ └─ Table\n" + 14015 " │ ├─ name: niltable\n" + 14016 " │ └─ columns: [i]\n" + 14017 " └─ IndexedTableAccess(one_pk)\n" + 14018 " ├─ index: [one_pk.pk]\n" + 14019 " ├─ static: [{[NULL, ∞)}]\n" + 14020 " ├─ colSet: (1-6)\n" + 14021 " ├─ tableId: 1\n" + 14022 " └─ Table\n" + 14023 " ├─ name: one_pk\n" + 14024 " └─ columns: [pk]\n" + 14025 "", 14026 ExpectedEstimates: "Project\n" + 14027 " ├─ columns: [one_pk.pk, nt.i, nt2.i]\n" + 14028 " └─ LeftOuterHashJoin (estimated cost=21.120 rows=6)\n" + 14029 " ├─ (one_pk.pk = (nt2.i + 1))\n" + 14030 " ├─ TableAlias(nt2)\n" + 14031 " │ └─ Table\n" + 14032 " │ ├─ name: niltable\n" + 14033 " │ └─ columns: [i]\n" + 14034 " └─ HashLookup\n" + 14035 " ├─ left-key: ((nt2.i + 1))\n" + 14036 " ├─ right-key: (one_pk.pk)\n" + 14037 " └─ LeftOuterMergeJoin\n" + 14038 " ├─ cmp: (nt.i = one_pk.pk)\n" + 14039 " ├─ TableAlias(nt)\n" + 14040 " │ └─ IndexedTableAccess(niltable)\n" + 14041 " │ ├─ index: [niltable.i]\n" + 14042 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14043 " │ └─ columns: [i]\n" + 14044 " └─ IndexedTableAccess(one_pk)\n" + 14045 " ├─ index: [one_pk.pk]\n" + 14046 " ├─ filters: [{[NULL, ∞)}]\n" + 14047 " └─ columns: [pk]\n" + 14048 "", 14049 ExpectedAnalysis: "Project\n" + 14050 " ├─ columns: [one_pk.pk, nt.i, nt2.i]\n" + 14051 " └─ LeftOuterHashJoin (estimated cost=21.120 rows=6) (actual rows=6 loops=1)\n" + 14052 " ├─ (one_pk.pk = (nt2.i + 1))\n" + 14053 " ├─ TableAlias(nt2)\n" + 14054 " │ └─ Table\n" + 14055 " │ ├─ name: niltable\n" + 14056 " │ └─ columns: [i]\n" + 14057 " └─ HashLookup\n" + 14058 " ├─ left-key: ((nt2.i + 1))\n" + 14059 " ├─ right-key: (one_pk.pk)\n" + 14060 " └─ LeftOuterMergeJoin\n" + 14061 " ├─ cmp: (nt.i = one_pk.pk)\n" + 14062 " ├─ TableAlias(nt)\n" + 14063 " │ └─ IndexedTableAccess(niltable)\n" + 14064 " │ ├─ index: [niltable.i]\n" + 14065 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14066 " │ └─ columns: [i]\n" + 14067 " └─ IndexedTableAccess(one_pk)\n" + 14068 " ├─ index: [one_pk.pk]\n" + 14069 " ├─ filters: [{[NULL, ∞)}]\n" + 14070 " └─ columns: [pk]\n" + 14071 "", 14072 }, 14073 { 14074 Query: `SELECT pk,i,f FROM one_pk LEFT JOIN niltable ON pk=i AND f IS NOT NULL`, 14075 ExpectedPlan: "Project\n" + 14076 " ├─ columns: [one_pk.pk:0!null, niltable.i:1!null, niltable.f:2]\n" + 14077 " └─ LeftOuterMergeJoin\n" + 14078 " ├─ cmp: Eq\n" + 14079 " │ ├─ one_pk.pk:0!null\n" + 14080 " │ └─ niltable.i:1!null\n" + 14081 " ├─ sel: NOT\n" + 14082 " │ └─ niltable.f:2 IS NULL\n" + 14083 " ├─ IndexedTableAccess(one_pk)\n" + 14084 " │ ├─ index: [one_pk.pk]\n" + 14085 " │ ├─ static: [{[NULL, ∞)}]\n" + 14086 " │ ├─ colSet: (1-6)\n" + 14087 " │ ├─ tableId: 1\n" + 14088 " │ └─ Table\n" + 14089 " │ ├─ name: one_pk\n" + 14090 " │ └─ columns: [pk]\n" + 14091 " └─ IndexedTableAccess(niltable)\n" + 14092 " ├─ index: [niltable.i]\n" + 14093 " ├─ static: [{[NULL, ∞)}]\n" + 14094 " ├─ colSet: (7-10)\n" + 14095 " ├─ tableId: 2\n" + 14096 " └─ Table\n" + 14097 " ├─ name: niltable\n" + 14098 " └─ columns: [i f]\n" + 14099 "", 14100 ExpectedEstimates: "Project\n" + 14101 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14102 " └─ LeftOuterMergeJoin (estimated cost=10.180 rows=5)\n" + 14103 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 14104 " ├─ sel: (NOT(niltable.f IS NULL))\n" + 14105 " ├─ IndexedTableAccess(one_pk)\n" + 14106 " │ ├─ index: [one_pk.pk]\n" + 14107 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14108 " │ └─ columns: [pk]\n" + 14109 " └─ IndexedTableAccess(niltable)\n" + 14110 " ├─ index: [niltable.i]\n" + 14111 " ├─ filters: [{[NULL, ∞)}]\n" + 14112 " └─ columns: [i f]\n" + 14113 "", 14114 ExpectedAnalysis: "Project\n" + 14115 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14116 " └─ LeftOuterMergeJoin (estimated cost=10.180 rows=5) (actual rows=4 loops=1)\n" + 14117 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 14118 " ├─ sel: (NOT(niltable.f IS NULL))\n" + 14119 " ├─ IndexedTableAccess(one_pk)\n" + 14120 " │ ├─ index: [one_pk.pk]\n" + 14121 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14122 " │ └─ columns: [pk]\n" + 14123 " └─ IndexedTableAccess(niltable)\n" + 14124 " ├─ index: [niltable.i]\n" + 14125 " ├─ filters: [{[NULL, ∞)}]\n" + 14126 " └─ columns: [i f]\n" + 14127 "", 14128 }, 14129 { 14130 Query: `SELECT pk,i,f FROM one_pk RIGHT JOIN niltable ON pk=i and pk > 0`, 14131 ExpectedPlan: "Project\n" + 14132 " ├─ columns: [one_pk.pk:2!null, niltable.i:0!null, niltable.f:1]\n" + 14133 " └─ LeftOuterMergeJoin\n" + 14134 " ├─ cmp: Eq\n" + 14135 " │ ├─ niltable.i:0!null\n" + 14136 " │ └─ one_pk.pk:2!null\n" + 14137 " ├─ sel: GreaterThan\n" + 14138 " │ ├─ one_pk.pk:2!null\n" + 14139 " │ └─ 0 (tinyint)\n" + 14140 " ├─ IndexedTableAccess(niltable)\n" + 14141 " │ ├─ index: [niltable.i]\n" + 14142 " │ ├─ static: [{[NULL, ∞)}]\n" + 14143 " │ ├─ colSet: (7-10)\n" + 14144 " │ ├─ tableId: 2\n" + 14145 " │ └─ Table\n" + 14146 " │ ├─ name: niltable\n" + 14147 " │ └─ columns: [i f]\n" + 14148 " └─ IndexedTableAccess(one_pk)\n" + 14149 " ├─ index: [one_pk.pk]\n" + 14150 " ├─ static: [{[NULL, ∞)}]\n" + 14151 " ├─ colSet: (1-6)\n" + 14152 " ├─ tableId: 1\n" + 14153 " └─ Table\n" + 14154 " ├─ name: one_pk\n" + 14155 " └─ columns: [pk]\n" + 14156 "", 14157 ExpectedEstimates: "Project\n" + 14158 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14159 " └─ LeftOuterMergeJoin (estimated cost=10.180 rows=5)\n" + 14160 " ├─ cmp: (niltable.i = one_pk.pk)\n" + 14161 " ├─ sel: (one_pk.pk > 0)\n" + 14162 " ├─ IndexedTableAccess(niltable)\n" + 14163 " │ ├─ index: [niltable.i]\n" + 14164 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14165 " │ └─ columns: [i f]\n" + 14166 " └─ IndexedTableAccess(one_pk)\n" + 14167 " ├─ index: [one_pk.pk]\n" + 14168 " ├─ filters: [{[NULL, ∞)}]\n" + 14169 " └─ columns: [pk]\n" + 14170 "", 14171 ExpectedAnalysis: "Project\n" + 14172 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14173 " └─ LeftOuterMergeJoin (estimated cost=10.180 rows=5) (actual rows=6 loops=1)\n" + 14174 " ├─ cmp: (niltable.i = one_pk.pk)\n" + 14175 " ├─ sel: (one_pk.pk > 0)\n" + 14176 " ├─ IndexedTableAccess(niltable)\n" + 14177 " │ ├─ index: [niltable.i]\n" + 14178 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14179 " │ └─ columns: [i f]\n" + 14180 " └─ IndexedTableAccess(one_pk)\n" + 14181 " ├─ index: [one_pk.pk]\n" + 14182 " ├─ filters: [{[NULL, ∞)}]\n" + 14183 " └─ columns: [pk]\n" + 14184 "", 14185 }, 14186 { 14187 Query: `SELECT pk,i,f FROM one_pk LEFT JOIN niltable ON pk=i WHERE f IS NOT NULL`, 14188 ExpectedPlan: "Project\n" + 14189 " ├─ columns: [one_pk.pk:0!null, niltable.i:1!null, niltable.f:2]\n" + 14190 " └─ Filter\n" + 14191 " ├─ NOT\n" + 14192 " │ └─ niltable.f:2 IS NULL\n" + 14193 " └─ LeftOuterMergeJoin\n" + 14194 " ├─ cmp: Eq\n" + 14195 " │ ├─ one_pk.pk:0!null\n" + 14196 " │ └─ niltable.i:1!null\n" + 14197 " ├─ IndexedTableAccess(one_pk)\n" + 14198 " │ ├─ index: [one_pk.pk]\n" + 14199 " │ ├─ static: [{[NULL, ∞)}]\n" + 14200 " │ ├─ colSet: (1-6)\n" + 14201 " │ ├─ tableId: 1\n" + 14202 " │ └─ Table\n" + 14203 " │ ├─ name: one_pk\n" + 14204 " │ └─ columns: [pk]\n" + 14205 " └─ IndexedTableAccess(niltable)\n" + 14206 " ├─ index: [niltable.i]\n" + 14207 " ├─ static: [{[NULL, ∞)}]\n" + 14208 " ├─ colSet: (7-10)\n" + 14209 " ├─ tableId: 2\n" + 14210 " └─ Table\n" + 14211 " ├─ name: niltable\n" + 14212 " └─ columns: [i f]\n" + 14213 "", 14214 ExpectedEstimates: "Project\n" + 14215 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14216 " └─ Filter\n" + 14217 " ├─ (NOT(niltable.f IS NULL))\n" + 14218 " └─ LeftOuterMergeJoin (estimated cost=10.180 rows=5)\n" + 14219 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 14220 " ├─ IndexedTableAccess(one_pk)\n" + 14221 " │ ├─ index: [one_pk.pk]\n" + 14222 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14223 " │ └─ columns: [pk]\n" + 14224 " └─ IndexedTableAccess(niltable)\n" + 14225 " ├─ index: [niltable.i]\n" + 14226 " ├─ filters: [{[NULL, ∞)}]\n" + 14227 " └─ columns: [i f]\n" + 14228 "", 14229 ExpectedAnalysis: "Project\n" + 14230 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14231 " └─ Filter\n" + 14232 " ├─ (NOT(niltable.f IS NULL))\n" + 14233 " └─ LeftOuterMergeJoin (estimated cost=10.180 rows=5) (actual rows=4 loops=1)\n" + 14234 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 14235 " ├─ IndexedTableAccess(one_pk)\n" + 14236 " │ ├─ index: [one_pk.pk]\n" + 14237 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14238 " │ └─ columns: [pk]\n" + 14239 " └─ IndexedTableAccess(niltable)\n" + 14240 " ├─ index: [niltable.i]\n" + 14241 " ├─ filters: [{[NULL, ∞)}]\n" + 14242 " └─ columns: [i f]\n" + 14243 "", 14244 }, 14245 { 14246 Query: `SELECT pk,i,f FROM one_pk LEFT JOIN niltable ON pk=i WHERE i2 > 1`, 14247 ExpectedPlan: "Project\n" + 14248 " ├─ columns: [one_pk.pk:0!null, niltable.i:1!null, niltable.f:3]\n" + 14249 " └─ Filter\n" + 14250 " ├─ GreaterThan\n" + 14251 " │ ├─ niltable.i2:2\n" + 14252 " │ └─ 1 (tinyint)\n" + 14253 " └─ LeftOuterMergeJoin\n" + 14254 " ├─ cmp: Eq\n" + 14255 " │ ├─ one_pk.pk:0!null\n" + 14256 " │ └─ niltable.i:1!null\n" + 14257 " ├─ IndexedTableAccess(one_pk)\n" + 14258 " │ ├─ index: [one_pk.pk]\n" + 14259 " │ ├─ static: [{[NULL, ∞)}]\n" + 14260 " │ ├─ colSet: (1-6)\n" + 14261 " │ ├─ tableId: 1\n" + 14262 " │ └─ Table\n" + 14263 " │ ├─ name: one_pk\n" + 14264 " │ └─ columns: [pk]\n" + 14265 " └─ IndexedTableAccess(niltable)\n" + 14266 " ├─ index: [niltable.i]\n" + 14267 " ├─ static: [{[NULL, ∞)}]\n" + 14268 " ├─ colSet: (7-10)\n" + 14269 " ├─ tableId: 2\n" + 14270 " └─ Table\n" + 14271 " ├─ name: niltable\n" + 14272 " └─ columns: [i i2 f]\n" + 14273 "", 14274 ExpectedEstimates: "Project\n" + 14275 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14276 " └─ Filter\n" + 14277 " ├─ (niltable.i2 > 1)\n" + 14278 " └─ LeftOuterMergeJoin (estimated cost=10.180 rows=5)\n" + 14279 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 14280 " ├─ IndexedTableAccess(one_pk)\n" + 14281 " │ ├─ index: [one_pk.pk]\n" + 14282 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14283 " │ └─ columns: [pk]\n" + 14284 " └─ IndexedTableAccess(niltable)\n" + 14285 " ├─ index: [niltable.i]\n" + 14286 " ├─ filters: [{[NULL, ∞)}]\n" + 14287 " └─ columns: [i i2 f]\n" + 14288 "", 14289 ExpectedAnalysis: "Project\n" + 14290 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14291 " └─ Filter\n" + 14292 " ├─ (niltable.i2 > 1)\n" + 14293 " └─ LeftOuterMergeJoin (estimated cost=10.180 rows=5) (actual rows=4 loops=1)\n" + 14294 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 14295 " ├─ IndexedTableAccess(one_pk)\n" + 14296 " │ ├─ index: [one_pk.pk]\n" + 14297 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14298 " │ └─ columns: [pk]\n" + 14299 " └─ IndexedTableAccess(niltable)\n" + 14300 " ├─ index: [niltable.i]\n" + 14301 " ├─ filters: [{[NULL, ∞)}]\n" + 14302 " └─ columns: [i i2 f]\n" + 14303 "", 14304 }, 14305 { 14306 Query: `SELECT pk,i,f FROM one_pk LEFT JOIN niltable ON pk=i WHERE i > 1`, 14307 ExpectedPlan: "Project\n" + 14308 " ├─ columns: [one_pk.pk:0!null, niltable.i:1!null, niltable.f:2]\n" + 14309 " └─ Filter\n" + 14310 " ├─ GreaterThan\n" + 14311 " │ ├─ niltable.i:1!null\n" + 14312 " │ └─ 1 (tinyint)\n" + 14313 " └─ LeftOuterMergeJoin\n" + 14314 " ├─ cmp: Eq\n" + 14315 " │ ├─ one_pk.pk:0!null\n" + 14316 " │ └─ niltable.i:1!null\n" + 14317 " ├─ IndexedTableAccess(one_pk)\n" + 14318 " │ ├─ index: [one_pk.pk]\n" + 14319 " │ ├─ static: [{[NULL, ∞)}]\n" + 14320 " │ ├─ colSet: (1-6)\n" + 14321 " │ ├─ tableId: 1\n" + 14322 " │ └─ Table\n" + 14323 " │ ├─ name: one_pk\n" + 14324 " │ └─ columns: [pk]\n" + 14325 " └─ IndexedTableAccess(niltable)\n" + 14326 " ├─ index: [niltable.i]\n" + 14327 " ├─ static: [{[NULL, ∞)}]\n" + 14328 " ├─ colSet: (7-10)\n" + 14329 " ├─ tableId: 2\n" + 14330 " └─ Table\n" + 14331 " ├─ name: niltable\n" + 14332 " └─ columns: [i f]\n" + 14333 "", 14334 ExpectedEstimates: "Project\n" + 14335 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14336 " └─ Filter\n" + 14337 " ├─ (niltable.i > 1)\n" + 14338 " └─ LeftOuterMergeJoin (estimated cost=10.180 rows=5)\n" + 14339 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 14340 " ├─ IndexedTableAccess(one_pk)\n" + 14341 " │ ├─ index: [one_pk.pk]\n" + 14342 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14343 " │ └─ columns: [pk]\n" + 14344 " └─ IndexedTableAccess(niltable)\n" + 14345 " ├─ index: [niltable.i]\n" + 14346 " ├─ filters: [{[NULL, ∞)}]\n" + 14347 " └─ columns: [i f]\n" + 14348 "", 14349 ExpectedAnalysis: "Project\n" + 14350 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14351 " └─ Filter\n" + 14352 " ├─ (niltable.i > 1)\n" + 14353 " └─ LeftOuterMergeJoin (estimated cost=10.180 rows=5) (actual rows=4 loops=1)\n" + 14354 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 14355 " ├─ IndexedTableAccess(one_pk)\n" + 14356 " │ ├─ index: [one_pk.pk]\n" + 14357 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14358 " │ └─ columns: [pk]\n" + 14359 " └─ IndexedTableAccess(niltable)\n" + 14360 " ├─ index: [niltable.i]\n" + 14361 " ├─ filters: [{[NULL, ∞)}]\n" + 14362 " └─ columns: [i f]\n" + 14363 "", 14364 }, 14365 { 14366 Query: `SELECT pk,i,f FROM one_pk LEFT JOIN niltable ON pk=i WHERE c1 > 10`, 14367 ExpectedPlan: "Project\n" + 14368 " ├─ columns: [one_pk.pk:0!null, niltable.i:2!null, niltable.f:3]\n" + 14369 " └─ LeftOuterMergeJoin\n" + 14370 " ├─ cmp: Eq\n" + 14371 " │ ├─ one_pk.pk:0!null\n" + 14372 " │ └─ niltable.i:2!null\n" + 14373 " ├─ Filter\n" + 14374 " │ ├─ GreaterThan\n" + 14375 " │ │ ├─ one_pk.c1:1\n" + 14376 " │ │ └─ 10 (tinyint)\n" + 14377 " │ └─ IndexedTableAccess(one_pk)\n" + 14378 " │ ├─ index: [one_pk.pk]\n" + 14379 " │ ├─ static: [{[NULL, ∞)}]\n" + 14380 " │ ├─ colSet: (1-6)\n" + 14381 " │ ├─ tableId: 1\n" + 14382 " │ └─ Table\n" + 14383 " │ ├─ name: one_pk\n" + 14384 " │ └─ columns: [pk c1]\n" + 14385 " └─ IndexedTableAccess(niltable)\n" + 14386 " ├─ index: [niltable.i]\n" + 14387 " ├─ static: [{[NULL, ∞)}]\n" + 14388 " ├─ colSet: (7-10)\n" + 14389 " ├─ tableId: 2\n" + 14390 " └─ Table\n" + 14391 " ├─ name: niltable\n" + 14392 " └─ columns: [i f]\n" + 14393 "", 14394 ExpectedEstimates: "Project\n" + 14395 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14396 " └─ LeftOuterMergeJoin (estimated cost=9.150 rows=3)\n" + 14397 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 14398 " ├─ Filter\n" + 14399 " │ ├─ (one_pk.c1 > 10)\n" + 14400 " │ └─ IndexedTableAccess(one_pk)\n" + 14401 " │ ├─ index: [one_pk.pk]\n" + 14402 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14403 " │ └─ columns: [pk c1]\n" + 14404 " └─ IndexedTableAccess(niltable)\n" + 14405 " ├─ index: [niltable.i]\n" + 14406 " ├─ filters: [{[NULL, ∞)}]\n" + 14407 " └─ columns: [i f]\n" + 14408 "", 14409 ExpectedAnalysis: "Project\n" + 14410 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14411 " └─ LeftOuterMergeJoin (estimated cost=9.150 rows=3) (actual rows=2 loops=1)\n" + 14412 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 14413 " ├─ Filter\n" + 14414 " │ ├─ (one_pk.c1 > 10)\n" + 14415 " │ └─ IndexedTableAccess(one_pk)\n" + 14416 " │ ├─ index: [one_pk.pk]\n" + 14417 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14418 " │ └─ columns: [pk c1]\n" + 14419 " └─ IndexedTableAccess(niltable)\n" + 14420 " ├─ index: [niltable.i]\n" + 14421 " ├─ filters: [{[NULL, ∞)}]\n" + 14422 " └─ columns: [i f]\n" + 14423 "", 14424 }, 14425 { 14426 Query: `SELECT pk,i,f FROM one_pk RIGHT JOIN niltable ON pk=i WHERE f IS NOT NULL`, 14427 ExpectedPlan: "Project\n" + 14428 " ├─ columns: [one_pk.pk:2!null, niltable.i:0!null, niltable.f:1]\n" + 14429 " └─ LeftOuterMergeJoin\n" + 14430 " ├─ cmp: Eq\n" + 14431 " │ ├─ niltable.i:0!null\n" + 14432 " │ └─ one_pk.pk:2!null\n" + 14433 " ├─ Filter\n" + 14434 " │ ├─ NOT\n" + 14435 " │ │ └─ niltable.f:1 IS NULL\n" + 14436 " │ └─ IndexedTableAccess(niltable)\n" + 14437 " │ ├─ index: [niltable.i]\n" + 14438 " │ ├─ static: [{[NULL, ∞)}]\n" + 14439 " │ ├─ colSet: (7-10)\n" + 14440 " │ ├─ tableId: 2\n" + 14441 " │ └─ Table\n" + 14442 " │ ├─ name: niltable\n" + 14443 " │ └─ columns: [i f]\n" + 14444 " └─ IndexedTableAccess(one_pk)\n" + 14445 " ├─ index: [one_pk.pk]\n" + 14446 " ├─ static: [{[NULL, ∞)}]\n" + 14447 " ├─ colSet: (1-6)\n" + 14448 " ├─ tableId: 1\n" + 14449 " └─ Table\n" + 14450 " ├─ name: one_pk\n" + 14451 " └─ columns: [pk]\n" + 14452 "", 14453 ExpectedEstimates: "Project\n" + 14454 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14455 " └─ LeftOuterMergeJoin (estimated cost=8.160 rows=5)\n" + 14456 " ├─ cmp: (niltable.i = one_pk.pk)\n" + 14457 " ├─ Filter\n" + 14458 " │ ├─ (NOT(niltable.f IS NULL))\n" + 14459 " │ └─ IndexedTableAccess(niltable)\n" + 14460 " │ ├─ index: [niltable.i]\n" + 14461 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14462 " │ └─ columns: [i f]\n" + 14463 " └─ IndexedTableAccess(one_pk)\n" + 14464 " ├─ index: [one_pk.pk]\n" + 14465 " ├─ filters: [{[NULL, ∞)}]\n" + 14466 " └─ columns: [pk]\n" + 14467 "", 14468 ExpectedAnalysis: "Project\n" + 14469 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14470 " └─ LeftOuterMergeJoin (estimated cost=8.160 rows=5) (actual rows=3 loops=1)\n" + 14471 " ├─ cmp: (niltable.i = one_pk.pk)\n" + 14472 " ├─ Filter\n" + 14473 " │ ├─ (NOT(niltable.f IS NULL))\n" + 14474 " │ └─ IndexedTableAccess(niltable)\n" + 14475 " │ ├─ index: [niltable.i]\n" + 14476 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14477 " │ └─ columns: [i f]\n" + 14478 " └─ IndexedTableAccess(one_pk)\n" + 14479 " ├─ index: [one_pk.pk]\n" + 14480 " ├─ filters: [{[NULL, ∞)}]\n" + 14481 " └─ columns: [pk]\n" + 14482 "", 14483 }, 14484 { 14485 Query: `SELECT pk,i,f FROM one_pk LEFT JOIN niltable ON pk=i WHERE pk > 1`, 14486 ExpectedPlan: "Project\n" + 14487 " ├─ columns: [one_pk.pk:0!null, niltable.i:1!null, niltable.f:2]\n" + 14488 " └─ LeftOuterMergeJoin\n" + 14489 " ├─ cmp: Eq\n" + 14490 " │ ├─ one_pk.pk:0!null\n" + 14491 " │ └─ niltable.i:1!null\n" + 14492 " ├─ Filter\n" + 14493 " │ ├─ GreaterThan\n" + 14494 " │ │ ├─ one_pk.pk:0!null\n" + 14495 " │ │ └─ 1 (tinyint)\n" + 14496 " │ └─ IndexedTableAccess(one_pk)\n" + 14497 " │ ├─ index: [one_pk.pk]\n" + 14498 " │ ├─ static: [{[NULL, ∞)}]\n" + 14499 " │ ├─ colSet: (1-6)\n" + 14500 " │ ├─ tableId: 1\n" + 14501 " │ └─ Table\n" + 14502 " │ ├─ name: one_pk\n" + 14503 " │ └─ columns: [pk]\n" + 14504 " └─ IndexedTableAccess(niltable)\n" + 14505 " ├─ index: [niltable.i]\n" + 14506 " ├─ static: [{[NULL, ∞)}]\n" + 14507 " ├─ colSet: (7-10)\n" + 14508 " ├─ tableId: 2\n" + 14509 " └─ Table\n" + 14510 " ├─ name: niltable\n" + 14511 " └─ columns: [i f]\n" + 14512 "", 14513 ExpectedEstimates: "Project\n" + 14514 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14515 " └─ LeftOuterMergeJoin (estimated cost=10.190 rows=6)\n" + 14516 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 14517 " ├─ Filter\n" + 14518 " │ ├─ (one_pk.pk > 1)\n" + 14519 " │ └─ IndexedTableAccess(one_pk)\n" + 14520 " │ ├─ index: [one_pk.pk]\n" + 14521 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14522 " │ └─ columns: [pk]\n" + 14523 " └─ IndexedTableAccess(niltable)\n" + 14524 " ├─ index: [niltable.i]\n" + 14525 " ├─ filters: [{[NULL, ∞)}]\n" + 14526 " └─ columns: [i f]\n" + 14527 "", 14528 ExpectedAnalysis: "Project\n" + 14529 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14530 " └─ LeftOuterMergeJoin (estimated cost=10.190 rows=6) (actual rows=2 loops=1)\n" + 14531 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 14532 " ├─ Filter\n" + 14533 " │ ├─ (one_pk.pk > 1)\n" + 14534 " │ └─ IndexedTableAccess(one_pk)\n" + 14535 " │ ├─ index: [one_pk.pk]\n" + 14536 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14537 " │ └─ columns: [pk]\n" + 14538 " └─ IndexedTableAccess(niltable)\n" + 14539 " ├─ index: [niltable.i]\n" + 14540 " ├─ filters: [{[NULL, ∞)}]\n" + 14541 " └─ columns: [i f]\n" + 14542 "", 14543 }, 14544 { 14545 Query: `SELECT l.i, r.i2 FROM niltable l INNER JOIN niltable r ON l.i2 <=> r.i2 ORDER BY 1 ASC`, 14546 ExpectedPlan: "Project\n" + 14547 " ├─ columns: [l.i:1!null, r.i2:0]\n" + 14548 " └─ Sort(l.i:1!null ASC nullsFirst)\n" + 14549 " └─ InnerJoin\n" + 14550 " ├─ (l.i2:2 <=> r.i2:0)\n" + 14551 " ├─ TableAlias(r)\n" + 14552 " │ └─ ProcessTable\n" + 14553 " │ └─ Table\n" + 14554 " │ ├─ name: niltable\n" + 14555 " │ └─ columns: [i2]\n" + 14556 " └─ TableAlias(l)\n" + 14557 " └─ Table\n" + 14558 " ├─ name: niltable\n" + 14559 " ├─ columns: [i i2]\n" + 14560 " ├─ colSet: (1-4)\n" + 14561 " └─ tableId: 1\n" + 14562 "", 14563 ExpectedEstimates: "Project\n" + 14564 " ├─ columns: [l.i, r.i2]\n" + 14565 " └─ Sort(l.i ASC)\n" + 14566 " └─ InnerJoin\n" + 14567 " ├─ (l.i2 <=> r.i2)\n" + 14568 " ├─ TableAlias(r)\n" + 14569 " │ └─ Table\n" + 14570 " │ ├─ name: niltable\n" + 14571 " │ └─ columns: [i2]\n" + 14572 " └─ TableAlias(l)\n" + 14573 " └─ Table\n" + 14574 " ├─ name: niltable\n" + 14575 " └─ columns: [i i2]\n" + 14576 "", 14577 ExpectedAnalysis: "Project\n" + 14578 " ├─ columns: [l.i, r.i2]\n" + 14579 " └─ Sort(l.i ASC)\n" + 14580 " └─ InnerJoin\n" + 14581 " ├─ (l.i2 <=> r.i2)\n" + 14582 " ├─ TableAlias(r)\n" + 14583 " │ └─ Table\n" + 14584 " │ ├─ name: niltable\n" + 14585 " │ └─ columns: [i2]\n" + 14586 " └─ TableAlias(l)\n" + 14587 " └─ Table\n" + 14588 " ├─ name: niltable\n" + 14589 " └─ columns: [i i2]\n" + 14590 "", 14591 }, 14592 { 14593 Query: `SELECT pk,i,f FROM one_pk RIGHT JOIN niltable ON pk=i WHERE pk > 0`, 14594 ExpectedPlan: "Project\n" + 14595 " ├─ columns: [one_pk.pk:2!null, niltable.i:0!null, niltable.f:1]\n" + 14596 " └─ Filter\n" + 14597 " ├─ GreaterThan\n" + 14598 " │ ├─ one_pk.pk:2!null\n" + 14599 " │ └─ 0 (tinyint)\n" + 14600 " └─ LeftOuterMergeJoin\n" + 14601 " ├─ cmp: Eq\n" + 14602 " │ ├─ niltable.i:0!null\n" + 14603 " │ └─ one_pk.pk:2!null\n" + 14604 " ├─ IndexedTableAccess(niltable)\n" + 14605 " │ ├─ index: [niltable.i]\n" + 14606 " │ ├─ static: [{[NULL, ∞)}]\n" + 14607 " │ ├─ colSet: (7-10)\n" + 14608 " │ ├─ tableId: 2\n" + 14609 " │ └─ Table\n" + 14610 " │ ├─ name: niltable\n" + 14611 " │ └─ columns: [i f]\n" + 14612 " └─ IndexedTableAccess(one_pk)\n" + 14613 " ├─ index: [one_pk.pk]\n" + 14614 " ├─ static: [{[NULL, ∞)}]\n" + 14615 " ├─ colSet: (1-6)\n" + 14616 " ├─ tableId: 1\n" + 14617 " └─ Table\n" + 14618 " ├─ name: one_pk\n" + 14619 " └─ columns: [pk]\n" + 14620 "", 14621 ExpectedEstimates: "Project\n" + 14622 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14623 " └─ Filter\n" + 14624 " ├─ (one_pk.pk > 0)\n" + 14625 " └─ LeftOuterMergeJoin (estimated cost=10.180 rows=5)\n" + 14626 " ├─ cmp: (niltable.i = one_pk.pk)\n" + 14627 " ├─ IndexedTableAccess(niltable)\n" + 14628 " │ ├─ index: [niltable.i]\n" + 14629 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14630 " │ └─ columns: [i f]\n" + 14631 " └─ IndexedTableAccess(one_pk)\n" + 14632 " ├─ index: [one_pk.pk]\n" + 14633 " ├─ filters: [{[NULL, ∞)}]\n" + 14634 " └─ columns: [pk]\n" + 14635 "", 14636 ExpectedAnalysis: "Project\n" + 14637 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 14638 " └─ Filter\n" + 14639 " ├─ (one_pk.pk > 0)\n" + 14640 " └─ LeftOuterMergeJoin (estimated cost=10.180 rows=5) (actual rows=6 loops=1)\n" + 14641 " ├─ cmp: (niltable.i = one_pk.pk)\n" + 14642 " ├─ IndexedTableAccess(niltable)\n" + 14643 " │ ├─ index: [niltable.i]\n" + 14644 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14645 " │ └─ columns: [i f]\n" + 14646 " └─ IndexedTableAccess(one_pk)\n" + 14647 " ├─ index: [one_pk.pk]\n" + 14648 " ├─ filters: [{[NULL, ∞)}]\n" + 14649 " └─ columns: [pk]\n" + 14650 "", 14651 }, 14652 { 14653 Query: `SELECT pk,pk1,pk2 FROM one_pk JOIN two_pk ON pk=pk1`, 14654 ExpectedPlan: "MergeJoin\n" + 14655 " ├─ cmp: Eq\n" + 14656 " │ ├─ one_pk.pk:0!null\n" + 14657 " │ └─ two_pk.pk1:1!null\n" + 14658 " ├─ IndexedTableAccess(one_pk)\n" + 14659 " │ ├─ index: [one_pk.pk]\n" + 14660 " │ ├─ static: [{[NULL, ∞)}]\n" + 14661 " │ ├─ colSet: (1-6)\n" + 14662 " │ ├─ tableId: 1\n" + 14663 " │ └─ Table\n" + 14664 " │ ├─ name: one_pk\n" + 14665 " │ └─ columns: [pk]\n" + 14666 " └─ IndexedTableAccess(two_pk)\n" + 14667 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14668 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 14669 " ├─ colSet: (7-13)\n" + 14670 " ├─ tableId: 2\n" + 14671 " └─ Table\n" + 14672 " ├─ name: two_pk\n" + 14673 " └─ columns: [pk1 pk2]\n" + 14674 "", 14675 ExpectedEstimates: "MergeJoin (estimated cost=8.120 rows=4)\n" + 14676 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 14677 " ├─ IndexedTableAccess(one_pk)\n" + 14678 " │ ├─ index: [one_pk.pk]\n" + 14679 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14680 " │ └─ columns: [pk]\n" + 14681 " └─ IndexedTableAccess(two_pk)\n" + 14682 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14683 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14684 " └─ columns: [pk1 pk2]\n" + 14685 "", 14686 ExpectedAnalysis: "MergeJoin (estimated cost=8.120 rows=4) (actual rows=4 loops=1)\n" + 14687 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 14688 " ├─ IndexedTableAccess(one_pk)\n" + 14689 " │ ├─ index: [one_pk.pk]\n" + 14690 " │ ├─ filters: [{[NULL, ∞)}]\n" + 14691 " │ └─ columns: [pk]\n" + 14692 " └─ IndexedTableAccess(two_pk)\n" + 14693 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14694 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14695 " └─ columns: [pk1 pk2]\n" + 14696 "", 14697 }, 14698 { 14699 Query: `SELECT /*+ JOIN_ORDER(two_pk, one_pk) */ pk,pk1,pk2 FROM one_pk JOIN two_pk ON pk=pk1`, 14700 ExpectedPlan: "Project\n" + 14701 " ├─ columns: [one_pk.pk:2!null, two_pk.pk1:0!null, two_pk.pk2:1!null]\n" + 14702 " └─ MergeJoin\n" + 14703 " ├─ cmp: Eq\n" + 14704 " │ ├─ two_pk.pk1:0!null\n" + 14705 " │ └─ one_pk.pk:2!null\n" + 14706 " ├─ IndexedTableAccess(two_pk)\n" + 14707 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14708 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 14709 " │ ├─ colSet: (7-13)\n" + 14710 " │ ├─ tableId: 2\n" + 14711 " │ └─ Table\n" + 14712 " │ ├─ name: two_pk\n" + 14713 " │ └─ columns: [pk1 pk2]\n" + 14714 " └─ IndexedTableAccess(one_pk)\n" + 14715 " ├─ index: [one_pk.pk]\n" + 14716 " ├─ static: [{[NULL, ∞)}]\n" + 14717 " ├─ colSet: (1-6)\n" + 14718 " ├─ tableId: 1\n" + 14719 " └─ Table\n" + 14720 " ├─ name: one_pk\n" + 14721 " └─ columns: [pk]\n" + 14722 "", 14723 ExpectedEstimates: "Project\n" + 14724 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 14725 " └─ MergeJoin (estimated cost=8.120 rows=4)\n" + 14726 " ├─ cmp: (two_pk.pk1 = one_pk.pk)\n" + 14727 " ├─ IndexedTableAccess(two_pk)\n" + 14728 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14729 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14730 " │ └─ columns: [pk1 pk2]\n" + 14731 " └─ IndexedTableAccess(one_pk)\n" + 14732 " ├─ index: [one_pk.pk]\n" + 14733 " ├─ filters: [{[NULL, ∞)}]\n" + 14734 " └─ columns: [pk]\n" + 14735 "", 14736 ExpectedAnalysis: "Project\n" + 14737 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 14738 " └─ MergeJoin (estimated cost=8.120 rows=4) (actual rows=4 loops=1)\n" + 14739 " ├─ cmp: (two_pk.pk1 = one_pk.pk)\n" + 14740 " ├─ IndexedTableAccess(two_pk)\n" + 14741 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14742 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14743 " │ └─ columns: [pk1 pk2]\n" + 14744 " └─ IndexedTableAccess(one_pk)\n" + 14745 " ├─ index: [one_pk.pk]\n" + 14746 " ├─ filters: [{[NULL, ∞)}]\n" + 14747 " └─ columns: [pk]\n" + 14748 "", 14749 }, 14750 { 14751 Query: `SELECT a.pk1,a.pk2,b.pk1,b.pk2 FROM two_pk a JOIN two_pk b ON a.pk1=b.pk1 AND a.pk2=b.pk2 ORDER BY 1,2,3`, 14752 ExpectedPlan: "Sort(a.pk1:0!null ASC nullsFirst, a.pk2:1!null ASC nullsFirst, b.pk1:2!null ASC nullsFirst)\n" + 14753 " └─ MergeJoin\n" + 14754 " ├─ cmp: Eq\n" + 14755 " │ ├─ TUPLE(a.pk1:0!null, a.pk2:1!null)\n" + 14756 " │ └─ TUPLE(b.pk1:2!null, b.pk2:3!null)\n" + 14757 " ├─ TableAlias(a)\n" + 14758 " │ └─ IndexedTableAccess(two_pk)\n" + 14759 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14760 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 14761 " │ ├─ colSet: (1-7)\n" + 14762 " │ ├─ tableId: 1\n" + 14763 " │ └─ Table\n" + 14764 " │ ├─ name: two_pk\n" + 14765 " │ └─ columns: [pk1 pk2]\n" + 14766 " └─ TableAlias(b)\n" + 14767 " └─ IndexedTableAccess(two_pk)\n" + 14768 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14769 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 14770 " ├─ colSet: (8-14)\n" + 14771 " ├─ tableId: 2\n" + 14772 " └─ Table\n" + 14773 " ├─ name: two_pk\n" + 14774 " └─ columns: [pk1 pk2]\n" + 14775 "", 14776 ExpectedEstimates: "Sort(a.pk1 ASC, a.pk2 ASC, b.pk1 ASC)\n" + 14777 " └─ MergeJoin\n" + 14778 " ├─ cmp: ((a.pk1, a.pk2) = (b.pk1, b.pk2))\n" + 14779 " ├─ TableAlias(a)\n" + 14780 " │ └─ IndexedTableAccess(two_pk)\n" + 14781 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14782 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14783 " │ └─ columns: [pk1 pk2]\n" + 14784 " └─ TableAlias(b)\n" + 14785 " └─ IndexedTableAccess(two_pk)\n" + 14786 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14787 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14788 " └─ columns: [pk1 pk2]\n" + 14789 "", 14790 ExpectedAnalysis: "Sort(a.pk1 ASC, a.pk2 ASC, b.pk1 ASC)\n" + 14791 " └─ MergeJoin\n" + 14792 " ├─ cmp: ((a.pk1, a.pk2) = (b.pk1, b.pk2))\n" + 14793 " ├─ TableAlias(a)\n" + 14794 " │ └─ IndexedTableAccess(two_pk)\n" + 14795 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14796 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14797 " │ └─ columns: [pk1 pk2]\n" + 14798 " └─ TableAlias(b)\n" + 14799 " └─ IndexedTableAccess(two_pk)\n" + 14800 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14801 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14802 " └─ columns: [pk1 pk2]\n" + 14803 "", 14804 }, 14805 { 14806 Query: `SELECT a.pk1,a.pk2,b.pk1,b.pk2 FROM two_pk a JOIN two_pk b ON a.pk1=b.pk2 AND a.pk2=b.pk1 ORDER BY 1,2,3`, 14807 ExpectedPlan: "Sort(a.pk1:0!null ASC nullsFirst, a.pk2:1!null ASC nullsFirst, b.pk1:2!null ASC nullsFirst)\n" + 14808 " └─ LookupJoin\n" + 14809 " ├─ TableAlias(a)\n" + 14810 " │ └─ ProcessTable\n" + 14811 " │ └─ Table\n" + 14812 " │ ├─ name: two_pk\n" + 14813 " │ └─ columns: [pk1 pk2]\n" + 14814 " └─ TableAlias(b)\n" + 14815 " └─ IndexedTableAccess(two_pk)\n" + 14816 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14817 " ├─ keys: [a.pk2:1!null a.pk1:0!null]\n" + 14818 " ├─ colSet: (8-14)\n" + 14819 " ├─ tableId: 2\n" + 14820 " └─ Table\n" + 14821 " ├─ name: two_pk\n" + 14822 " └─ columns: [pk1 pk2]\n" + 14823 "", 14824 ExpectedEstimates: "Sort(a.pk1 ASC, a.pk2 ASC, b.pk1 ASC)\n" + 14825 " └─ LookupJoin\n" + 14826 " ├─ TableAlias(a)\n" + 14827 " │ └─ Table\n" + 14828 " │ ├─ name: two_pk\n" + 14829 " │ └─ columns: [pk1 pk2]\n" + 14830 " └─ TableAlias(b)\n" + 14831 " └─ IndexedTableAccess(two_pk)\n" + 14832 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14833 " ├─ columns: [pk1 pk2]\n" + 14834 " └─ keys: a.pk2, a.pk1\n" + 14835 "", 14836 ExpectedAnalysis: "Sort(a.pk1 ASC, a.pk2 ASC, b.pk1 ASC)\n" + 14837 " └─ LookupJoin\n" + 14838 " ├─ TableAlias(a)\n" + 14839 " │ └─ Table\n" + 14840 " │ ├─ name: two_pk\n" + 14841 " │ └─ columns: [pk1 pk2]\n" + 14842 " └─ TableAlias(b)\n" + 14843 " └─ IndexedTableAccess(two_pk)\n" + 14844 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14845 " ├─ columns: [pk1 pk2]\n" + 14846 " └─ keys: a.pk2, a.pk1\n" + 14847 "", 14848 }, 14849 { 14850 Query: `SELECT a.pk1,a.pk2,b.pk1,b.pk2 FROM two_pk a JOIN two_pk b ON b.pk1=a.pk1 AND a.pk2=b.pk2 ORDER BY 1,2,3`, 14851 ExpectedPlan: "Sort(a.pk1:0!null ASC nullsFirst, a.pk2:1!null ASC nullsFirst, b.pk1:2!null ASC nullsFirst)\n" + 14852 " └─ MergeJoin\n" + 14853 " ├─ cmp: Eq\n" + 14854 " │ ├─ TUPLE(a.pk1:0!null, a.pk2:1!null)\n" + 14855 " │ └─ TUPLE(b.pk1:2!null, b.pk2:3!null)\n" + 14856 " ├─ TableAlias(a)\n" + 14857 " │ └─ IndexedTableAccess(two_pk)\n" + 14858 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14859 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 14860 " │ ├─ colSet: (1-7)\n" + 14861 " │ ├─ tableId: 1\n" + 14862 " │ └─ Table\n" + 14863 " │ ├─ name: two_pk\n" + 14864 " │ └─ columns: [pk1 pk2]\n" + 14865 " └─ TableAlias(b)\n" + 14866 " └─ IndexedTableAccess(two_pk)\n" + 14867 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14868 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 14869 " ├─ colSet: (8-14)\n" + 14870 " ├─ tableId: 2\n" + 14871 " └─ Table\n" + 14872 " ├─ name: two_pk\n" + 14873 " └─ columns: [pk1 pk2]\n" + 14874 "", 14875 ExpectedEstimates: "Sort(a.pk1 ASC, a.pk2 ASC, b.pk1 ASC)\n" + 14876 " └─ MergeJoin\n" + 14877 " ├─ cmp: ((a.pk1, a.pk2) = (b.pk1, b.pk2))\n" + 14878 " ├─ TableAlias(a)\n" + 14879 " │ └─ IndexedTableAccess(two_pk)\n" + 14880 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14881 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14882 " │ └─ columns: [pk1 pk2]\n" + 14883 " └─ TableAlias(b)\n" + 14884 " └─ IndexedTableAccess(two_pk)\n" + 14885 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14886 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14887 " └─ columns: [pk1 pk2]\n" + 14888 "", 14889 ExpectedAnalysis: "Sort(a.pk1 ASC, a.pk2 ASC, b.pk1 ASC)\n" + 14890 " └─ MergeJoin\n" + 14891 " ├─ cmp: ((a.pk1, a.pk2) = (b.pk1, b.pk2))\n" + 14892 " ├─ TableAlias(a)\n" + 14893 " │ └─ IndexedTableAccess(two_pk)\n" + 14894 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14895 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14896 " │ └─ columns: [pk1 pk2]\n" + 14897 " └─ TableAlias(b)\n" + 14898 " └─ IndexedTableAccess(two_pk)\n" + 14899 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14900 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14901 " └─ columns: [pk1 pk2]\n" + 14902 "", 14903 }, 14904 { 14905 Query: `SELECT a.pk1,a.pk2,b.pk1,b.pk2 FROM two_pk a JOIN two_pk b ON a.pk1+1=b.pk1 AND a.pk2+1=b.pk2 ORDER BY 1,2,3`, 14906 ExpectedPlan: "Sort(a.pk1:0!null ASC nullsFirst, a.pk2:1!null ASC nullsFirst, b.pk1:2!null ASC nullsFirst)\n" + 14907 " └─ MergeJoin\n" + 14908 " ├─ cmp: Eq\n" + 14909 " │ ├─ TUPLE((a.pk1:0!null + 1 (tinyint)), (a.pk2:1!null + 1 (tinyint)))\n" + 14910 " │ └─ TUPLE(b.pk1:2!null, b.pk2:3!null)\n" + 14911 " ├─ TableAlias(a)\n" + 14912 " │ └─ IndexedTableAccess(two_pk)\n" + 14913 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14914 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 14915 " │ ├─ colSet: (1-7)\n" + 14916 " │ ├─ tableId: 1\n" + 14917 " │ └─ Table\n" + 14918 " │ ├─ name: two_pk\n" + 14919 " │ └─ columns: [pk1 pk2]\n" + 14920 " └─ TableAlias(b)\n" + 14921 " └─ IndexedTableAccess(two_pk)\n" + 14922 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14923 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 14924 " ├─ colSet: (8-14)\n" + 14925 " ├─ tableId: 2\n" + 14926 " └─ Table\n" + 14927 " ├─ name: two_pk\n" + 14928 " └─ columns: [pk1 pk2]\n" + 14929 "", 14930 ExpectedEstimates: "Sort(a.pk1 ASC, a.pk2 ASC, b.pk1 ASC)\n" + 14931 " └─ MergeJoin\n" + 14932 " ├─ cmp: (((a.pk1 + 1), (a.pk2 + 1)) = (b.pk1, b.pk2))\n" + 14933 " ├─ TableAlias(a)\n" + 14934 " │ └─ IndexedTableAccess(two_pk)\n" + 14935 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14936 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14937 " │ └─ columns: [pk1 pk2]\n" + 14938 " └─ TableAlias(b)\n" + 14939 " └─ IndexedTableAccess(two_pk)\n" + 14940 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14941 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14942 " └─ columns: [pk1 pk2]\n" + 14943 "", 14944 ExpectedAnalysis: "Sort(a.pk1 ASC, a.pk2 ASC, b.pk1 ASC)\n" + 14945 " └─ MergeJoin\n" + 14946 " ├─ cmp: (((a.pk1 + 1), (a.pk2 + 1)) = (b.pk1, b.pk2))\n" + 14947 " ├─ TableAlias(a)\n" + 14948 " │ └─ IndexedTableAccess(two_pk)\n" + 14949 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14950 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14951 " │ └─ columns: [pk1 pk2]\n" + 14952 " └─ TableAlias(b)\n" + 14953 " └─ IndexedTableAccess(two_pk)\n" + 14954 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14955 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14956 " └─ columns: [pk1 pk2]\n" + 14957 "", 14958 }, 14959 { 14960 Query: `SELECT a.pk1,a.pk2,b.pk1,b.pk2 FROM two_pk a, two_pk b WHERE a.pk1=b.pk1 AND a.pk2=b.pk2 ORDER BY 1,2,3`, 14961 ExpectedPlan: "Sort(a.pk1:0!null ASC nullsFirst, a.pk2:1!null ASC nullsFirst, b.pk1:2!null ASC nullsFirst)\n" + 14962 " └─ MergeJoin\n" + 14963 " ├─ cmp: Eq\n" + 14964 " │ ├─ TUPLE(a.pk1:0!null, a.pk2:1!null)\n" + 14965 " │ └─ TUPLE(b.pk1:2!null, b.pk2:3!null)\n" + 14966 " ├─ TableAlias(a)\n" + 14967 " │ └─ IndexedTableAccess(two_pk)\n" + 14968 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14969 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 14970 " │ ├─ colSet: (1-7)\n" + 14971 " │ ├─ tableId: 1\n" + 14972 " │ └─ Table\n" + 14973 " │ ├─ name: two_pk\n" + 14974 " │ └─ columns: [pk1 pk2]\n" + 14975 " └─ TableAlias(b)\n" + 14976 " └─ IndexedTableAccess(two_pk)\n" + 14977 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14978 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 14979 " ├─ colSet: (8-14)\n" + 14980 " ├─ tableId: 2\n" + 14981 " └─ Table\n" + 14982 " ├─ name: two_pk\n" + 14983 " └─ columns: [pk1 pk2]\n" + 14984 "", 14985 ExpectedEstimates: "Sort(a.pk1 ASC, a.pk2 ASC, b.pk1 ASC)\n" + 14986 " └─ MergeJoin\n" + 14987 " ├─ cmp: ((a.pk1, a.pk2) = (b.pk1, b.pk2))\n" + 14988 " ├─ TableAlias(a)\n" + 14989 " │ └─ IndexedTableAccess(two_pk)\n" + 14990 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14991 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14992 " │ └─ columns: [pk1 pk2]\n" + 14993 " └─ TableAlias(b)\n" + 14994 " └─ IndexedTableAccess(two_pk)\n" + 14995 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 14996 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 14997 " └─ columns: [pk1 pk2]\n" + 14998 "", 14999 ExpectedAnalysis: "Sort(a.pk1 ASC, a.pk2 ASC, b.pk1 ASC)\n" + 15000 " └─ MergeJoin\n" + 15001 " ├─ cmp: ((a.pk1, a.pk2) = (b.pk1, b.pk2))\n" + 15002 " ├─ TableAlias(a)\n" + 15003 " │ └─ IndexedTableAccess(two_pk)\n" + 15004 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15005 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 15006 " │ └─ columns: [pk1 pk2]\n" + 15007 " └─ TableAlias(b)\n" + 15008 " └─ IndexedTableAccess(two_pk)\n" + 15009 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15010 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 15011 " └─ columns: [pk1 pk2]\n" + 15012 "", 15013 }, 15014 { 15015 Query: `SELECT a.pk1,a.pk2,b.pk1,b.pk2 FROM two_pk a, two_pk b WHERE a.pk1=b.pk2 AND a.pk2=b.pk1 ORDER BY 1,2,3`, 15016 ExpectedPlan: "Sort(a.pk1:0!null ASC nullsFirst, a.pk2:1!null ASC nullsFirst, b.pk1:2!null ASC nullsFirst)\n" + 15017 " └─ LookupJoin\n" + 15018 " ├─ TableAlias(a)\n" + 15019 " │ └─ ProcessTable\n" + 15020 " │ └─ Table\n" + 15021 " │ ├─ name: two_pk\n" + 15022 " │ └─ columns: [pk1 pk2]\n" + 15023 " └─ TableAlias(b)\n" + 15024 " └─ IndexedTableAccess(two_pk)\n" + 15025 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15026 " ├─ keys: [a.pk2:1!null a.pk1:0!null]\n" + 15027 " ├─ colSet: (8-14)\n" + 15028 " ├─ tableId: 2\n" + 15029 " └─ Table\n" + 15030 " ├─ name: two_pk\n" + 15031 " └─ columns: [pk1 pk2]\n" + 15032 "", 15033 ExpectedEstimates: "Sort(a.pk1 ASC, a.pk2 ASC, b.pk1 ASC)\n" + 15034 " └─ LookupJoin\n" + 15035 " ├─ TableAlias(a)\n" + 15036 " │ └─ Table\n" + 15037 " │ ├─ name: two_pk\n" + 15038 " │ └─ columns: [pk1 pk2]\n" + 15039 " └─ TableAlias(b)\n" + 15040 " └─ IndexedTableAccess(two_pk)\n" + 15041 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15042 " ├─ columns: [pk1 pk2]\n" + 15043 " └─ keys: a.pk2, a.pk1\n" + 15044 "", 15045 ExpectedAnalysis: "Sort(a.pk1 ASC, a.pk2 ASC, b.pk1 ASC)\n" + 15046 " └─ LookupJoin\n" + 15047 " ├─ TableAlias(a)\n" + 15048 " │ └─ Table\n" + 15049 " │ ├─ name: two_pk\n" + 15050 " │ └─ columns: [pk1 pk2]\n" + 15051 " └─ TableAlias(b)\n" + 15052 " └─ IndexedTableAccess(two_pk)\n" + 15053 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15054 " ├─ columns: [pk1 pk2]\n" + 15055 " └─ keys: a.pk2, a.pk1\n" + 15056 "", 15057 }, 15058 { 15059 Query: `SELECT one_pk.c5,pk1,pk2 FROM one_pk JOIN two_pk ON pk=pk1 ORDER BY 1,2,3`, 15060 ExpectedPlan: "Project\n" + 15061 " ├─ columns: [one_pk.c5:1, two_pk.pk1:2!null, two_pk.pk2:3!null]\n" + 15062 " └─ Sort(one_pk.c5:1 ASC nullsFirst, two_pk.pk1:2!null ASC nullsFirst, two_pk.pk2:3!null ASC nullsFirst)\n" + 15063 " └─ MergeJoin\n" + 15064 " ├─ cmp: Eq\n" + 15065 " │ ├─ one_pk.pk:0!null\n" + 15066 " │ └─ two_pk.pk1:2!null\n" + 15067 " ├─ IndexedTableAccess(one_pk)\n" + 15068 " │ ├─ index: [one_pk.pk]\n" + 15069 " │ ├─ static: [{[NULL, ∞)}]\n" + 15070 " │ ├─ colSet: (1-6)\n" + 15071 " │ ├─ tableId: 1\n" + 15072 " │ └─ Table\n" + 15073 " │ ├─ name: one_pk\n" + 15074 " │ └─ columns: [pk c5]\n" + 15075 " └─ IndexedTableAccess(two_pk)\n" + 15076 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15077 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 15078 " ├─ colSet: (7-13)\n" + 15079 " ├─ tableId: 2\n" + 15080 " └─ Table\n" + 15081 " ├─ name: two_pk\n" + 15082 " └─ columns: [pk1 pk2]\n" + 15083 "", 15084 ExpectedEstimates: "Project\n" + 15085 " ├─ columns: [one_pk.c5, two_pk.pk1, two_pk.pk2]\n" + 15086 " └─ Sort(one_pk.c5 ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 15087 " └─ MergeJoin\n" + 15088 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 15089 " ├─ IndexedTableAccess(one_pk)\n" + 15090 " │ ├─ index: [one_pk.pk]\n" + 15091 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15092 " │ └─ columns: [pk c5]\n" + 15093 " └─ IndexedTableAccess(two_pk)\n" + 15094 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15095 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 15096 " └─ columns: [pk1 pk2]\n" + 15097 "", 15098 ExpectedAnalysis: "Project\n" + 15099 " ├─ columns: [one_pk.c5, two_pk.pk1, two_pk.pk2]\n" + 15100 " └─ Sort(one_pk.c5 ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 15101 " └─ MergeJoin\n" + 15102 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 15103 " ├─ IndexedTableAccess(one_pk)\n" + 15104 " │ ├─ index: [one_pk.pk]\n" + 15105 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15106 " │ └─ columns: [pk c5]\n" + 15107 " └─ IndexedTableAccess(two_pk)\n" + 15108 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15109 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 15110 " └─ columns: [pk1 pk2]\n" + 15111 "", 15112 }, 15113 { 15114 Query: `SELECT opk.c5,pk1,pk2 FROM one_pk opk JOIN two_pk tpk ON opk.pk=tpk.pk1 ORDER BY 1,2,3`, 15115 ExpectedPlan: "Project\n" + 15116 " ├─ columns: [opk.c5:1, tpk.pk1:2!null, tpk.pk2:3!null]\n" + 15117 " └─ Sort(opk.c5:1 ASC nullsFirst, tpk.pk1:2!null ASC nullsFirst, tpk.pk2:3!null ASC nullsFirst)\n" + 15118 " └─ MergeJoin\n" + 15119 " ├─ cmp: Eq\n" + 15120 " │ ├─ opk.pk:0!null\n" + 15121 " │ └─ tpk.pk1:2!null\n" + 15122 " ├─ TableAlias(opk)\n" + 15123 " │ └─ IndexedTableAccess(one_pk)\n" + 15124 " │ ├─ index: [one_pk.pk]\n" + 15125 " │ ├─ static: [{[NULL, ∞)}]\n" + 15126 " │ ├─ colSet: (1-6)\n" + 15127 " │ ├─ tableId: 1\n" + 15128 " │ └─ Table\n" + 15129 " │ ├─ name: one_pk\n" + 15130 " │ └─ columns: [pk c5]\n" + 15131 " └─ TableAlias(tpk)\n" + 15132 " └─ IndexedTableAccess(two_pk)\n" + 15133 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15134 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 15135 " ├─ colSet: (7-13)\n" + 15136 " ├─ tableId: 2\n" + 15137 " └─ Table\n" + 15138 " ├─ name: two_pk\n" + 15139 " └─ columns: [pk1 pk2]\n" + 15140 "", 15141 ExpectedEstimates: "Project\n" + 15142 " ├─ columns: [opk.c5, tpk.pk1, tpk.pk2]\n" + 15143 " └─ Sort(opk.c5 ASC, tpk.pk1 ASC, tpk.pk2 ASC)\n" + 15144 " └─ MergeJoin\n" + 15145 " ├─ cmp: (opk.pk = tpk.pk1)\n" + 15146 " ├─ TableAlias(opk)\n" + 15147 " │ └─ IndexedTableAccess(one_pk)\n" + 15148 " │ ├─ index: [one_pk.pk]\n" + 15149 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15150 " │ └─ columns: [pk c5]\n" + 15151 " └─ TableAlias(tpk)\n" + 15152 " └─ IndexedTableAccess(two_pk)\n" + 15153 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15154 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 15155 " └─ columns: [pk1 pk2]\n" + 15156 "", 15157 ExpectedAnalysis: "Project\n" + 15158 " ├─ columns: [opk.c5, tpk.pk1, tpk.pk2]\n" + 15159 " └─ Sort(opk.c5 ASC, tpk.pk1 ASC, tpk.pk2 ASC)\n" + 15160 " └─ MergeJoin\n" + 15161 " ├─ cmp: (opk.pk = tpk.pk1)\n" + 15162 " ├─ TableAlias(opk)\n" + 15163 " │ └─ IndexedTableAccess(one_pk)\n" + 15164 " │ ├─ index: [one_pk.pk]\n" + 15165 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15166 " │ └─ columns: [pk c5]\n" + 15167 " └─ TableAlias(tpk)\n" + 15168 " └─ IndexedTableAccess(two_pk)\n" + 15169 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15170 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 15171 " └─ columns: [pk1 pk2]\n" + 15172 "", 15173 }, 15174 { 15175 Query: `SELECT opk.c5,pk1,pk2 FROM one_pk opk JOIN two_pk tpk ON pk=pk1 ORDER BY 1,2,3`, 15176 ExpectedPlan: "Project\n" + 15177 " ├─ columns: [opk.c5:1, tpk.pk1:2!null, tpk.pk2:3!null]\n" + 15178 " └─ Sort(opk.c5:1 ASC nullsFirst, tpk.pk1:2!null ASC nullsFirst, tpk.pk2:3!null ASC nullsFirst)\n" + 15179 " └─ MergeJoin\n" + 15180 " ├─ cmp: Eq\n" + 15181 " │ ├─ opk.pk:0!null\n" + 15182 " │ └─ tpk.pk1:2!null\n" + 15183 " ├─ TableAlias(opk)\n" + 15184 " │ └─ IndexedTableAccess(one_pk)\n" + 15185 " │ ├─ index: [one_pk.pk]\n" + 15186 " │ ├─ static: [{[NULL, ∞)}]\n" + 15187 " │ ├─ colSet: (1-6)\n" + 15188 " │ ├─ tableId: 1\n" + 15189 " │ └─ Table\n" + 15190 " │ ├─ name: one_pk\n" + 15191 " │ └─ columns: [pk c5]\n" + 15192 " └─ TableAlias(tpk)\n" + 15193 " └─ IndexedTableAccess(two_pk)\n" + 15194 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15195 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 15196 " ├─ colSet: (7-13)\n" + 15197 " ├─ tableId: 2\n" + 15198 " └─ Table\n" + 15199 " ├─ name: two_pk\n" + 15200 " └─ columns: [pk1 pk2]\n" + 15201 "", 15202 ExpectedEstimates: "Project\n" + 15203 " ├─ columns: [opk.c5, tpk.pk1, tpk.pk2]\n" + 15204 " └─ Sort(opk.c5 ASC, tpk.pk1 ASC, tpk.pk2 ASC)\n" + 15205 " └─ MergeJoin\n" + 15206 " ├─ cmp: (opk.pk = tpk.pk1)\n" + 15207 " ├─ TableAlias(opk)\n" + 15208 " │ └─ IndexedTableAccess(one_pk)\n" + 15209 " │ ├─ index: [one_pk.pk]\n" + 15210 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15211 " │ └─ columns: [pk c5]\n" + 15212 " └─ TableAlias(tpk)\n" + 15213 " └─ IndexedTableAccess(two_pk)\n" + 15214 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15215 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 15216 " └─ columns: [pk1 pk2]\n" + 15217 "", 15218 ExpectedAnalysis: "Project\n" + 15219 " ├─ columns: [opk.c5, tpk.pk1, tpk.pk2]\n" + 15220 " └─ Sort(opk.c5 ASC, tpk.pk1 ASC, tpk.pk2 ASC)\n" + 15221 " └─ MergeJoin\n" + 15222 " ├─ cmp: (opk.pk = tpk.pk1)\n" + 15223 " ├─ TableAlias(opk)\n" + 15224 " │ └─ IndexedTableAccess(one_pk)\n" + 15225 " │ ├─ index: [one_pk.pk]\n" + 15226 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15227 " │ └─ columns: [pk c5]\n" + 15228 " └─ TableAlias(tpk)\n" + 15229 " └─ IndexedTableAccess(two_pk)\n" + 15230 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15231 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 15232 " └─ columns: [pk1 pk2]\n" + 15233 "", 15234 }, 15235 { 15236 Query: `SELECT opk.c5,pk1,pk2 FROM one_pk opk, two_pk tpk WHERE pk=pk1 ORDER BY 1,2,3`, 15237 ExpectedPlan: "Project\n" + 15238 " ├─ columns: [opk.c5:1, tpk.pk1:2!null, tpk.pk2:3!null]\n" + 15239 " └─ Sort(opk.c5:1 ASC nullsFirst, tpk.pk1:2!null ASC nullsFirst, tpk.pk2:3!null ASC nullsFirst)\n" + 15240 " └─ MergeJoin\n" + 15241 " ├─ cmp: Eq\n" + 15242 " │ ├─ opk.pk:0!null\n" + 15243 " │ └─ tpk.pk1:2!null\n" + 15244 " ├─ TableAlias(opk)\n" + 15245 " │ └─ IndexedTableAccess(one_pk)\n" + 15246 " │ ├─ index: [one_pk.pk]\n" + 15247 " │ ├─ static: [{[NULL, ∞)}]\n" + 15248 " │ ├─ colSet: (1-6)\n" + 15249 " │ ├─ tableId: 1\n" + 15250 " │ └─ Table\n" + 15251 " │ ├─ name: one_pk\n" + 15252 " │ └─ columns: [pk c5]\n" + 15253 " └─ TableAlias(tpk)\n" + 15254 " └─ IndexedTableAccess(two_pk)\n" + 15255 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15256 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 15257 " ├─ colSet: (7-13)\n" + 15258 " ├─ tableId: 2\n" + 15259 " └─ Table\n" + 15260 " ├─ name: two_pk\n" + 15261 " └─ columns: [pk1 pk2]\n" + 15262 "", 15263 ExpectedEstimates: "Project\n" + 15264 " ├─ columns: [opk.c5, tpk.pk1, tpk.pk2]\n" + 15265 " └─ Sort(opk.c5 ASC, tpk.pk1 ASC, tpk.pk2 ASC)\n" + 15266 " └─ MergeJoin\n" + 15267 " ├─ cmp: (opk.pk = tpk.pk1)\n" + 15268 " ├─ TableAlias(opk)\n" + 15269 " │ └─ IndexedTableAccess(one_pk)\n" + 15270 " │ ├─ index: [one_pk.pk]\n" + 15271 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15272 " │ └─ columns: [pk c5]\n" + 15273 " └─ TableAlias(tpk)\n" + 15274 " └─ IndexedTableAccess(two_pk)\n" + 15275 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15276 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 15277 " └─ columns: [pk1 pk2]\n" + 15278 "", 15279 ExpectedAnalysis: "Project\n" + 15280 " ├─ columns: [opk.c5, tpk.pk1, tpk.pk2]\n" + 15281 " └─ Sort(opk.c5 ASC, tpk.pk1 ASC, tpk.pk2 ASC)\n" + 15282 " └─ MergeJoin\n" + 15283 " ├─ cmp: (opk.pk = tpk.pk1)\n" + 15284 " ├─ TableAlias(opk)\n" + 15285 " │ └─ IndexedTableAccess(one_pk)\n" + 15286 " │ ├─ index: [one_pk.pk]\n" + 15287 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15288 " │ └─ columns: [pk c5]\n" + 15289 " └─ TableAlias(tpk)\n" + 15290 " └─ IndexedTableAccess(two_pk)\n" + 15291 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15292 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 15293 " └─ columns: [pk1 pk2]\n" + 15294 "", 15295 }, 15296 { 15297 Query: `SELECT one_pk.c5,pk1,pk2 FROM one_pk,two_pk WHERE pk=pk1 ORDER BY 1,2,3`, 15298 ExpectedPlan: "Project\n" + 15299 " ├─ columns: [one_pk.c5:1, two_pk.pk1:2!null, two_pk.pk2:3!null]\n" + 15300 " └─ Sort(one_pk.c5:1 ASC nullsFirst, two_pk.pk1:2!null ASC nullsFirst, two_pk.pk2:3!null ASC nullsFirst)\n" + 15301 " └─ MergeJoin\n" + 15302 " ├─ cmp: Eq\n" + 15303 " │ ├─ one_pk.pk:0!null\n" + 15304 " │ └─ two_pk.pk1:2!null\n" + 15305 " ├─ IndexedTableAccess(one_pk)\n" + 15306 " │ ├─ index: [one_pk.pk]\n" + 15307 " │ ├─ static: [{[NULL, ∞)}]\n" + 15308 " │ ├─ colSet: (1-6)\n" + 15309 " │ ├─ tableId: 1\n" + 15310 " │ └─ Table\n" + 15311 " │ ├─ name: one_pk\n" + 15312 " │ └─ columns: [pk c5]\n" + 15313 " └─ IndexedTableAccess(two_pk)\n" + 15314 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15315 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 15316 " ├─ colSet: (7-13)\n" + 15317 " ├─ tableId: 2\n" + 15318 " └─ Table\n" + 15319 " ├─ name: two_pk\n" + 15320 " └─ columns: [pk1 pk2]\n" + 15321 "", 15322 ExpectedEstimates: "Project\n" + 15323 " ├─ columns: [one_pk.c5, two_pk.pk1, two_pk.pk2]\n" + 15324 " └─ Sort(one_pk.c5 ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 15325 " └─ MergeJoin\n" + 15326 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 15327 " ├─ IndexedTableAccess(one_pk)\n" + 15328 " │ ├─ index: [one_pk.pk]\n" + 15329 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15330 " │ └─ columns: [pk c5]\n" + 15331 " └─ IndexedTableAccess(two_pk)\n" + 15332 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15333 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 15334 " └─ columns: [pk1 pk2]\n" + 15335 "", 15336 ExpectedAnalysis: "Project\n" + 15337 " ├─ columns: [one_pk.c5, two_pk.pk1, two_pk.pk2]\n" + 15338 " └─ Sort(one_pk.c5 ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 15339 " └─ MergeJoin\n" + 15340 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 15341 " ├─ IndexedTableAccess(one_pk)\n" + 15342 " │ ├─ index: [one_pk.pk]\n" + 15343 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15344 " │ └─ columns: [pk c5]\n" + 15345 " └─ IndexedTableAccess(two_pk)\n" + 15346 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15347 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 15348 " └─ columns: [pk1 pk2]\n" + 15349 "", 15350 }, 15351 { 15352 Query: `SELECT * FROM niltable WHERE i2 = NULL`, 15353 ExpectedPlan: "Filter\n" + 15354 " ├─ Eq\n" + 15355 " │ ├─ niltable.i2:1\n" + 15356 " │ └─ NULL (null)\n" + 15357 " └─ IndexedTableAccess(niltable)\n" + 15358 " ├─ index: [niltable.i2]\n" + 15359 " ├─ static: [{(∞, ∞)}]\n" + 15360 " ├─ colSet: (1-4)\n" + 15361 " ├─ tableId: 1\n" + 15362 " └─ Table\n" + 15363 " ├─ name: niltable\n" + 15364 " └─ columns: [i i2 b f]\n" + 15365 "", 15366 ExpectedEstimates: "Filter\n" + 15367 " ├─ (niltable.i2 = NULL)\n" + 15368 " └─ IndexedTableAccess(niltable)\n" + 15369 " ├─ index: [niltable.i2]\n" + 15370 " ├─ filters: [{(∞, ∞)}]\n" + 15371 " └─ columns: [i i2 b f]\n" + 15372 "", 15373 ExpectedAnalysis: "Filter\n" + 15374 " ├─ (niltable.i2 = NULL)\n" + 15375 " └─ IndexedTableAccess(niltable)\n" + 15376 " ├─ index: [niltable.i2]\n" + 15377 " ├─ filters: [{(∞, ∞)}]\n" + 15378 " └─ columns: [i i2 b f]\n" + 15379 "", 15380 }, 15381 { 15382 Query: `SELECT * FROM niltable WHERE i2 <> NULL`, 15383 ExpectedPlan: "Filter\n" + 15384 " ├─ NOT\n" + 15385 " │ └─ Eq\n" + 15386 " │ ├─ niltable.i2:1\n" + 15387 " │ └─ NULL (null)\n" + 15388 " └─ IndexedTableAccess(niltable)\n" + 15389 " ├─ index: [niltable.i2]\n" + 15390 " ├─ static: [{(∞, ∞)}]\n" + 15391 " ├─ colSet: (1-4)\n" + 15392 " ├─ tableId: 1\n" + 15393 " └─ Table\n" + 15394 " ├─ name: niltable\n" + 15395 " └─ columns: [i i2 b f]\n" + 15396 "", 15397 ExpectedEstimates: "Filter\n" + 15398 " ├─ (NOT((niltable.i2 = NULL)))\n" + 15399 " └─ IndexedTableAccess(niltable)\n" + 15400 " ├─ index: [niltable.i2]\n" + 15401 " ├─ filters: [{(∞, ∞)}]\n" + 15402 " └─ columns: [i i2 b f]\n" + 15403 "", 15404 ExpectedAnalysis: "Filter\n" + 15405 " ├─ (NOT((niltable.i2 = NULL)))\n" + 15406 " └─ IndexedTableAccess(niltable)\n" + 15407 " ├─ index: [niltable.i2]\n" + 15408 " ├─ filters: [{(∞, ∞)}]\n" + 15409 " └─ columns: [i i2 b f]\n" + 15410 "", 15411 }, 15412 { 15413 Query: `SELECT * FROM niltable WHERE i2 > NULL`, 15414 ExpectedPlan: "Filter\n" + 15415 " ├─ GreaterThan\n" + 15416 " │ ├─ niltable.i2:1\n" + 15417 " │ └─ NULL (null)\n" + 15418 " └─ IndexedTableAccess(niltable)\n" + 15419 " ├─ index: [niltable.i2]\n" + 15420 " ├─ static: [{(∞, ∞)}]\n" + 15421 " ├─ colSet: (1-4)\n" + 15422 " ├─ tableId: 1\n" + 15423 " └─ Table\n" + 15424 " ├─ name: niltable\n" + 15425 " └─ columns: [i i2 b f]\n" + 15426 "", 15427 ExpectedEstimates: "Filter\n" + 15428 " ├─ (niltable.i2 > NULL)\n" + 15429 " └─ IndexedTableAccess(niltable)\n" + 15430 " ├─ index: [niltable.i2]\n" + 15431 " ├─ filters: [{(∞, ∞)}]\n" + 15432 " └─ columns: [i i2 b f]\n" + 15433 "", 15434 ExpectedAnalysis: "Filter\n" + 15435 " ├─ (niltable.i2 > NULL)\n" + 15436 " └─ IndexedTableAccess(niltable)\n" + 15437 " ├─ index: [niltable.i2]\n" + 15438 " ├─ filters: [{(∞, ∞)}]\n" + 15439 " └─ columns: [i i2 b f]\n" + 15440 "", 15441 }, 15442 { 15443 Query: `SELECT * FROM niltable WHERE i2 <=> NULL`, 15444 ExpectedPlan: "Filter\n" + 15445 " ├─ (niltable.i2:1 <=> NULL (null))\n" + 15446 " └─ IndexedTableAccess(niltable)\n" + 15447 " ├─ index: [niltable.i2]\n" + 15448 " ├─ static: [{[NULL, NULL]}]\n" + 15449 " ├─ colSet: (1-4)\n" + 15450 " ├─ tableId: 1\n" + 15451 " └─ Table\n" + 15452 " ├─ name: niltable\n" + 15453 " └─ columns: [i i2 b f]\n" + 15454 "", 15455 ExpectedEstimates: "Filter\n" + 15456 " ├─ (niltable.i2 <=> NULL)\n" + 15457 " └─ IndexedTableAccess(niltable)\n" + 15458 " ├─ index: [niltable.i2]\n" + 15459 " ├─ filters: [{[NULL, NULL]}]\n" + 15460 " └─ columns: [i i2 b f]\n" + 15461 "", 15462 ExpectedAnalysis: "Filter\n" + 15463 " ├─ (niltable.i2 <=> NULL)\n" + 15464 " └─ IndexedTableAccess(niltable)\n" + 15465 " ├─ index: [niltable.i2]\n" + 15466 " ├─ filters: [{[NULL, NULL]}]\n" + 15467 " └─ columns: [i i2 b f]\n" + 15468 "", 15469 }, 15470 { 15471 Query: `SELECT pk,i,f FROM one_pk LEFT JOIN niltable ON pk=i ORDER BY 1`, 15472 ExpectedPlan: "Project\n" + 15473 " ├─ columns: [one_pk.pk:0!null, niltable.i:1!null, niltable.f:2]\n" + 15474 " └─ Sort(one_pk.pk:0!null ASC nullsFirst)\n" + 15475 " └─ LeftOuterMergeJoin\n" + 15476 " ├─ cmp: Eq\n" + 15477 " │ ├─ one_pk.pk:0!null\n" + 15478 " │ └─ niltable.i:1!null\n" + 15479 " ├─ IndexedTableAccess(one_pk)\n" + 15480 " │ ├─ index: [one_pk.pk]\n" + 15481 " │ ├─ static: [{[NULL, ∞)}]\n" + 15482 " │ ├─ colSet: (1-6)\n" + 15483 " │ ├─ tableId: 1\n" + 15484 " │ └─ Table\n" + 15485 " │ ├─ name: one_pk\n" + 15486 " │ └─ columns: [pk]\n" + 15487 " └─ IndexedTableAccess(niltable)\n" + 15488 " ├─ index: [niltable.i]\n" + 15489 " ├─ static: [{[NULL, ∞)}]\n" + 15490 " ├─ colSet: (7-10)\n" + 15491 " ├─ tableId: 2\n" + 15492 " └─ Table\n" + 15493 " ├─ name: niltable\n" + 15494 " └─ columns: [i f]\n" + 15495 "", 15496 ExpectedEstimates: "Project\n" + 15497 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 15498 " └─ Sort(one_pk.pk ASC)\n" + 15499 " └─ LeftOuterMergeJoin\n" + 15500 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 15501 " ├─ IndexedTableAccess(one_pk)\n" + 15502 " │ ├─ index: [one_pk.pk]\n" + 15503 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15504 " │ └─ columns: [pk]\n" + 15505 " └─ IndexedTableAccess(niltable)\n" + 15506 " ├─ index: [niltable.i]\n" + 15507 " ├─ filters: [{[NULL, ∞)}]\n" + 15508 " └─ columns: [i f]\n" + 15509 "", 15510 ExpectedAnalysis: "Project\n" + 15511 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 15512 " └─ Sort(one_pk.pk ASC)\n" + 15513 " └─ LeftOuterMergeJoin\n" + 15514 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 15515 " ├─ IndexedTableAccess(one_pk)\n" + 15516 " │ ├─ index: [one_pk.pk]\n" + 15517 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15518 " │ └─ columns: [pk]\n" + 15519 " └─ IndexedTableAccess(niltable)\n" + 15520 " ├─ index: [niltable.i]\n" + 15521 " ├─ filters: [{[NULL, ∞)}]\n" + 15522 " └─ columns: [i f]\n" + 15523 "", 15524 }, 15525 { 15526 Query: `SELECT pk,i,f FROM one_pk LEFT JOIN niltable ON pk=i WHERE f IS NOT NULL ORDER BY 1`, 15527 ExpectedPlan: "Project\n" + 15528 " ├─ columns: [one_pk.pk:0!null, niltable.i:1!null, niltable.f:2]\n" + 15529 " └─ Sort(one_pk.pk:0!null ASC nullsFirst)\n" + 15530 " └─ Filter\n" + 15531 " ├─ NOT\n" + 15532 " │ └─ niltable.f:2 IS NULL\n" + 15533 " └─ LeftOuterMergeJoin\n" + 15534 " ├─ cmp: Eq\n" + 15535 " │ ├─ one_pk.pk:0!null\n" + 15536 " │ └─ niltable.i:1!null\n" + 15537 " ├─ IndexedTableAccess(one_pk)\n" + 15538 " │ ├─ index: [one_pk.pk]\n" + 15539 " │ ├─ static: [{[NULL, ∞)}]\n" + 15540 " │ ├─ colSet: (1-6)\n" + 15541 " │ ├─ tableId: 1\n" + 15542 " │ └─ Table\n" + 15543 " │ ├─ name: one_pk\n" + 15544 " │ └─ columns: [pk]\n" + 15545 " └─ IndexedTableAccess(niltable)\n" + 15546 " ├─ index: [niltable.i]\n" + 15547 " ├─ static: [{[NULL, ∞)}]\n" + 15548 " ├─ colSet: (7-10)\n" + 15549 " ├─ tableId: 2\n" + 15550 " └─ Table\n" + 15551 " ├─ name: niltable\n" + 15552 " └─ columns: [i f]\n" + 15553 "", 15554 ExpectedEstimates: "Project\n" + 15555 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 15556 " └─ Sort(one_pk.pk ASC)\n" + 15557 " └─ Filter\n" + 15558 " ├─ (NOT(niltable.f IS NULL))\n" + 15559 " └─ LeftOuterMergeJoin\n" + 15560 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 15561 " ├─ IndexedTableAccess(one_pk)\n" + 15562 " │ ├─ index: [one_pk.pk]\n" + 15563 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15564 " │ └─ columns: [pk]\n" + 15565 " └─ IndexedTableAccess(niltable)\n" + 15566 " ├─ index: [niltable.i]\n" + 15567 " ├─ filters: [{[NULL, ∞)}]\n" + 15568 " └─ columns: [i f]\n" + 15569 "", 15570 ExpectedAnalysis: "Project\n" + 15571 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 15572 " └─ Sort(one_pk.pk ASC)\n" + 15573 " └─ Filter\n" + 15574 " ├─ (NOT(niltable.f IS NULL))\n" + 15575 " └─ LeftOuterMergeJoin\n" + 15576 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 15577 " ├─ IndexedTableAccess(one_pk)\n" + 15578 " │ ├─ index: [one_pk.pk]\n" + 15579 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15580 " │ └─ columns: [pk]\n" + 15581 " └─ IndexedTableAccess(niltable)\n" + 15582 " ├─ index: [niltable.i]\n" + 15583 " ├─ filters: [{[NULL, ∞)}]\n" + 15584 " └─ columns: [i f]\n" + 15585 "", 15586 }, 15587 { 15588 Query: `SELECT pk,i,f FROM one_pk LEFT JOIN niltable ON pk=i WHERE pk > 1 ORDER BY 1`, 15589 ExpectedPlan: "Project\n" + 15590 " ├─ columns: [one_pk.pk:0!null, niltable.i:1!null, niltable.f:2]\n" + 15591 " └─ Sort(one_pk.pk:0!null ASC nullsFirst)\n" + 15592 " └─ LeftOuterMergeJoin\n" + 15593 " ├─ cmp: Eq\n" + 15594 " │ ├─ one_pk.pk:0!null\n" + 15595 " │ └─ niltable.i:1!null\n" + 15596 " ├─ Filter\n" + 15597 " │ ├─ GreaterThan\n" + 15598 " │ │ ├─ one_pk.pk:0!null\n" + 15599 " │ │ └─ 1 (tinyint)\n" + 15600 " │ └─ IndexedTableAccess(one_pk)\n" + 15601 " │ ├─ index: [one_pk.pk]\n" + 15602 " │ ├─ static: [{[NULL, ∞)}]\n" + 15603 " │ ├─ colSet: (1-6)\n" + 15604 " │ ├─ tableId: 1\n" + 15605 " │ └─ Table\n" + 15606 " │ ├─ name: one_pk\n" + 15607 " │ └─ columns: [pk]\n" + 15608 " └─ IndexedTableAccess(niltable)\n" + 15609 " ├─ index: [niltable.i]\n" + 15610 " ├─ static: [{[NULL, ∞)}]\n" + 15611 " ├─ colSet: (7-10)\n" + 15612 " ├─ tableId: 2\n" + 15613 " └─ Table\n" + 15614 " ├─ name: niltable\n" + 15615 " └─ columns: [i f]\n" + 15616 "", 15617 ExpectedEstimates: "Project\n" + 15618 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 15619 " └─ Sort(one_pk.pk ASC)\n" + 15620 " └─ LeftOuterMergeJoin\n" + 15621 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 15622 " ├─ Filter\n" + 15623 " │ ├─ (one_pk.pk > 1)\n" + 15624 " │ └─ IndexedTableAccess(one_pk)\n" + 15625 " │ ├─ index: [one_pk.pk]\n" + 15626 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15627 " │ └─ columns: [pk]\n" + 15628 " └─ IndexedTableAccess(niltable)\n" + 15629 " ├─ index: [niltable.i]\n" + 15630 " ├─ filters: [{[NULL, ∞)}]\n" + 15631 " └─ columns: [i f]\n" + 15632 "", 15633 ExpectedAnalysis: "Project\n" + 15634 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 15635 " └─ Sort(one_pk.pk ASC)\n" + 15636 " └─ LeftOuterMergeJoin\n" + 15637 " ├─ cmp: (one_pk.pk = niltable.i)\n" + 15638 " ├─ Filter\n" + 15639 " │ ├─ (one_pk.pk > 1)\n" + 15640 " │ └─ IndexedTableAccess(one_pk)\n" + 15641 " │ ├─ index: [one_pk.pk]\n" + 15642 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15643 " │ └─ columns: [pk]\n" + 15644 " └─ IndexedTableAccess(niltable)\n" + 15645 " ├─ index: [niltable.i]\n" + 15646 " ├─ filters: [{[NULL, ∞)}]\n" + 15647 " └─ columns: [i f]\n" + 15648 "", 15649 }, 15650 { 15651 Query: `SELECT pk,i,f FROM one_pk RIGHT JOIN niltable ON pk=i ORDER BY 2,3`, 15652 ExpectedPlan: "Project\n" + 15653 " ├─ columns: [one_pk.pk:2!null, niltable.i:0!null, niltable.f:1]\n" + 15654 " └─ Sort(niltable.i:0!null ASC nullsFirst, niltable.f:1 ASC nullsFirst)\n" + 15655 " └─ LeftOuterMergeJoin\n" + 15656 " ├─ cmp: Eq\n" + 15657 " │ ├─ niltable.i:0!null\n" + 15658 " │ └─ one_pk.pk:2!null\n" + 15659 " ├─ IndexedTableAccess(niltable)\n" + 15660 " │ ├─ index: [niltable.i]\n" + 15661 " │ ├─ static: [{[NULL, ∞)}]\n" + 15662 " │ ├─ colSet: (7-10)\n" + 15663 " │ ├─ tableId: 2\n" + 15664 " │ └─ Table\n" + 15665 " │ ├─ name: niltable\n" + 15666 " │ └─ columns: [i f]\n" + 15667 " └─ IndexedTableAccess(one_pk)\n" + 15668 " ├─ index: [one_pk.pk]\n" + 15669 " ├─ static: [{[NULL, ∞)}]\n" + 15670 " ├─ colSet: (1-6)\n" + 15671 " ├─ tableId: 1\n" + 15672 " └─ Table\n" + 15673 " ├─ name: one_pk\n" + 15674 " └─ columns: [pk]\n" + 15675 "", 15676 ExpectedEstimates: "Project\n" + 15677 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 15678 " └─ Sort(niltable.i ASC, niltable.f ASC)\n" + 15679 " └─ LeftOuterMergeJoin\n" + 15680 " ├─ cmp: (niltable.i = one_pk.pk)\n" + 15681 " ├─ IndexedTableAccess(niltable)\n" + 15682 " │ ├─ index: [niltable.i]\n" + 15683 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15684 " │ └─ columns: [i f]\n" + 15685 " └─ IndexedTableAccess(one_pk)\n" + 15686 " ├─ index: [one_pk.pk]\n" + 15687 " ├─ filters: [{[NULL, ∞)}]\n" + 15688 " └─ columns: [pk]\n" + 15689 "", 15690 ExpectedAnalysis: "Project\n" + 15691 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 15692 " └─ Sort(niltable.i ASC, niltable.f ASC)\n" + 15693 " └─ LeftOuterMergeJoin\n" + 15694 " ├─ cmp: (niltable.i = one_pk.pk)\n" + 15695 " ├─ IndexedTableAccess(niltable)\n" + 15696 " │ ├─ index: [niltable.i]\n" + 15697 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15698 " │ └─ columns: [i f]\n" + 15699 " └─ IndexedTableAccess(one_pk)\n" + 15700 " ├─ index: [one_pk.pk]\n" + 15701 " ├─ filters: [{[NULL, ∞)}]\n" + 15702 " └─ columns: [pk]\n" + 15703 "", 15704 }, 15705 { 15706 Query: `SELECT pk,i,f FROM one_pk RIGHT JOIN niltable ON pk=i WHERE f IS NOT NULL ORDER BY 2,3`, 15707 ExpectedPlan: "Project\n" + 15708 " ├─ columns: [one_pk.pk:2!null, niltable.i:0!null, niltable.f:1]\n" + 15709 " └─ Sort(niltable.i:0!null ASC nullsFirst, niltable.f:1 ASC nullsFirst)\n" + 15710 " └─ LeftOuterMergeJoin\n" + 15711 " ├─ cmp: Eq\n" + 15712 " │ ├─ niltable.i:0!null\n" + 15713 " │ └─ one_pk.pk:2!null\n" + 15714 " ├─ Filter\n" + 15715 " │ ├─ NOT\n" + 15716 " │ │ └─ niltable.f:1 IS NULL\n" + 15717 " │ └─ IndexedTableAccess(niltable)\n" + 15718 " │ ├─ index: [niltable.i]\n" + 15719 " │ ├─ static: [{[NULL, ∞)}]\n" + 15720 " │ ├─ colSet: (7-10)\n" + 15721 " │ ├─ tableId: 2\n" + 15722 " │ └─ Table\n" + 15723 " │ ├─ name: niltable\n" + 15724 " │ └─ columns: [i f]\n" + 15725 " └─ IndexedTableAccess(one_pk)\n" + 15726 " ├─ index: [one_pk.pk]\n" + 15727 " ├─ static: [{[NULL, ∞)}]\n" + 15728 " ├─ colSet: (1-6)\n" + 15729 " ├─ tableId: 1\n" + 15730 " └─ Table\n" + 15731 " ├─ name: one_pk\n" + 15732 " └─ columns: [pk]\n" + 15733 "", 15734 ExpectedEstimates: "Project\n" + 15735 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 15736 " └─ Sort(niltable.i ASC, niltable.f ASC)\n" + 15737 " └─ LeftOuterMergeJoin\n" + 15738 " ├─ cmp: (niltable.i = one_pk.pk)\n" + 15739 " ├─ Filter\n" + 15740 " │ ├─ (NOT(niltable.f IS NULL))\n" + 15741 " │ └─ IndexedTableAccess(niltable)\n" + 15742 " │ ├─ index: [niltable.i]\n" + 15743 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15744 " │ └─ columns: [i f]\n" + 15745 " └─ IndexedTableAccess(one_pk)\n" + 15746 " ├─ index: [one_pk.pk]\n" + 15747 " ├─ filters: [{[NULL, ∞)}]\n" + 15748 " └─ columns: [pk]\n" + 15749 "", 15750 ExpectedAnalysis: "Project\n" + 15751 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 15752 " └─ Sort(niltable.i ASC, niltable.f ASC)\n" + 15753 " └─ LeftOuterMergeJoin\n" + 15754 " ├─ cmp: (niltable.i = one_pk.pk)\n" + 15755 " ├─ Filter\n" + 15756 " │ ├─ (NOT(niltable.f IS NULL))\n" + 15757 " │ └─ IndexedTableAccess(niltable)\n" + 15758 " │ ├─ index: [niltable.i]\n" + 15759 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15760 " │ └─ columns: [i f]\n" + 15761 " └─ IndexedTableAccess(one_pk)\n" + 15762 " ├─ index: [one_pk.pk]\n" + 15763 " ├─ filters: [{[NULL, ∞)}]\n" + 15764 " └─ columns: [pk]\n" + 15765 "", 15766 }, 15767 { 15768 Query: `SELECT pk,i,f FROM one_pk RIGHT JOIN niltable ON pk=i WHERE pk > 0 ORDER BY 2,3`, 15769 ExpectedPlan: "Project\n" + 15770 " ├─ columns: [one_pk.pk:2!null, niltable.i:0!null, niltable.f:1]\n" + 15771 " └─ Sort(niltable.i:0!null ASC nullsFirst, niltable.f:1 ASC nullsFirst)\n" + 15772 " └─ Filter\n" + 15773 " ├─ GreaterThan\n" + 15774 " │ ├─ one_pk.pk:2!null\n" + 15775 " │ └─ 0 (tinyint)\n" + 15776 " └─ LeftOuterMergeJoin\n" + 15777 " ├─ cmp: Eq\n" + 15778 " │ ├─ niltable.i:0!null\n" + 15779 " │ └─ one_pk.pk:2!null\n" + 15780 " ├─ IndexedTableAccess(niltable)\n" + 15781 " │ ├─ index: [niltable.i]\n" + 15782 " │ ├─ static: [{[NULL, ∞)}]\n" + 15783 " │ ├─ colSet: (7-10)\n" + 15784 " │ ├─ tableId: 2\n" + 15785 " │ └─ Table\n" + 15786 " │ ├─ name: niltable\n" + 15787 " │ └─ columns: [i f]\n" + 15788 " └─ IndexedTableAccess(one_pk)\n" + 15789 " ├─ index: [one_pk.pk]\n" + 15790 " ├─ static: [{[NULL, ∞)}]\n" + 15791 " ├─ colSet: (1-6)\n" + 15792 " ├─ tableId: 1\n" + 15793 " └─ Table\n" + 15794 " ├─ name: one_pk\n" + 15795 " └─ columns: [pk]\n" + 15796 "", 15797 ExpectedEstimates: "Project\n" + 15798 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 15799 " └─ Sort(niltable.i ASC, niltable.f ASC)\n" + 15800 " └─ Filter\n" + 15801 " ├─ (one_pk.pk > 0)\n" + 15802 " └─ LeftOuterMergeJoin\n" + 15803 " ├─ cmp: (niltable.i = one_pk.pk)\n" + 15804 " ├─ IndexedTableAccess(niltable)\n" + 15805 " │ ├─ index: [niltable.i]\n" + 15806 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15807 " │ └─ columns: [i f]\n" + 15808 " └─ IndexedTableAccess(one_pk)\n" + 15809 " ├─ index: [one_pk.pk]\n" + 15810 " ├─ filters: [{[NULL, ∞)}]\n" + 15811 " └─ columns: [pk]\n" + 15812 "", 15813 ExpectedAnalysis: "Project\n" + 15814 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 15815 " └─ Sort(niltable.i ASC, niltable.f ASC)\n" + 15816 " └─ Filter\n" + 15817 " ├─ (one_pk.pk > 0)\n" + 15818 " └─ LeftOuterMergeJoin\n" + 15819 " ├─ cmp: (niltable.i = one_pk.pk)\n" + 15820 " ├─ IndexedTableAccess(niltable)\n" + 15821 " │ ├─ index: [niltable.i]\n" + 15822 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15823 " │ └─ columns: [i f]\n" + 15824 " └─ IndexedTableAccess(one_pk)\n" + 15825 " ├─ index: [one_pk.pk]\n" + 15826 " ├─ filters: [{[NULL, ∞)}]\n" + 15827 " └─ columns: [pk]\n" + 15828 "", 15829 }, 15830 { 15831 Query: `SELECT pk,i,f FROM one_pk RIGHT JOIN niltable ON pk=i and pk > 0 ORDER BY 2,3`, 15832 ExpectedPlan: "Project\n" + 15833 " ├─ columns: [one_pk.pk:2!null, niltable.i:0!null, niltable.f:1]\n" + 15834 " └─ Sort(niltable.i:0!null ASC nullsFirst, niltable.f:1 ASC nullsFirst)\n" + 15835 " └─ LeftOuterMergeJoin\n" + 15836 " ├─ cmp: Eq\n" + 15837 " │ ├─ niltable.i:0!null\n" + 15838 " │ └─ one_pk.pk:2!null\n" + 15839 " ├─ sel: GreaterThan\n" + 15840 " │ ├─ one_pk.pk:2!null\n" + 15841 " │ └─ 0 (tinyint)\n" + 15842 " ├─ IndexedTableAccess(niltable)\n" + 15843 " │ ├─ index: [niltable.i]\n" + 15844 " │ ├─ static: [{[NULL, ∞)}]\n" + 15845 " │ ├─ colSet: (7-10)\n" + 15846 " │ ├─ tableId: 2\n" + 15847 " │ └─ Table\n" + 15848 " │ ├─ name: niltable\n" + 15849 " │ └─ columns: [i f]\n" + 15850 " └─ IndexedTableAccess(one_pk)\n" + 15851 " ├─ index: [one_pk.pk]\n" + 15852 " ├─ static: [{[NULL, ∞)}]\n" + 15853 " ├─ colSet: (1-6)\n" + 15854 " ├─ tableId: 1\n" + 15855 " └─ Table\n" + 15856 " ├─ name: one_pk\n" + 15857 " └─ columns: [pk]\n" + 15858 "", 15859 ExpectedEstimates: "Project\n" + 15860 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 15861 " └─ Sort(niltable.i ASC, niltable.f ASC)\n" + 15862 " └─ LeftOuterMergeJoin\n" + 15863 " ├─ cmp: (niltable.i = one_pk.pk)\n" + 15864 " ├─ sel: (one_pk.pk > 0)\n" + 15865 " ├─ IndexedTableAccess(niltable)\n" + 15866 " │ ├─ index: [niltable.i]\n" + 15867 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15868 " │ └─ columns: [i f]\n" + 15869 " └─ IndexedTableAccess(one_pk)\n" + 15870 " ├─ index: [one_pk.pk]\n" + 15871 " ├─ filters: [{[NULL, ∞)}]\n" + 15872 " └─ columns: [pk]\n" + 15873 "", 15874 ExpectedAnalysis: "Project\n" + 15875 " ├─ columns: [one_pk.pk, niltable.i, niltable.f]\n" + 15876 " └─ Sort(niltable.i ASC, niltable.f ASC)\n" + 15877 " └─ LeftOuterMergeJoin\n" + 15878 " ├─ cmp: (niltable.i = one_pk.pk)\n" + 15879 " ├─ sel: (one_pk.pk > 0)\n" + 15880 " ├─ IndexedTableAccess(niltable)\n" + 15881 " │ ├─ index: [niltable.i]\n" + 15882 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15883 " │ └─ columns: [i f]\n" + 15884 " └─ IndexedTableAccess(one_pk)\n" + 15885 " ├─ index: [one_pk.pk]\n" + 15886 " ├─ filters: [{[NULL, ∞)}]\n" + 15887 " └─ columns: [pk]\n" + 15888 "", 15889 }, 15890 { 15891 Query: `SELECT pk,pk1,pk2 FROM one_pk JOIN two_pk ON one_pk.pk=two_pk.pk1 AND one_pk.pk=two_pk.pk2 ORDER BY 1,2,3`, 15892 ExpectedPlan: "Sort(one_pk.pk:0!null ASC nullsFirst, two_pk.pk1:1!null ASC nullsFirst, two_pk.pk2:2!null ASC nullsFirst)\n" + 15893 " └─ MergeJoin\n" + 15894 " ├─ cmp: Eq\n" + 15895 " │ ├─ one_pk.pk:0!null\n" + 15896 " │ └─ two_pk.pk1:1!null\n" + 15897 " ├─ sel: Eq\n" + 15898 " │ ├─ one_pk.pk:0!null\n" + 15899 " │ └─ two_pk.pk2:2!null\n" + 15900 " ├─ IndexedTableAccess(one_pk)\n" + 15901 " │ ├─ index: [one_pk.pk]\n" + 15902 " │ ├─ static: [{[NULL, ∞)}]\n" + 15903 " │ ├─ colSet: (1-6)\n" + 15904 " │ ├─ tableId: 1\n" + 15905 " │ └─ Table\n" + 15906 " │ ├─ name: one_pk\n" + 15907 " │ └─ columns: [pk]\n" + 15908 " └─ IndexedTableAccess(two_pk)\n" + 15909 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15910 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 15911 " ├─ colSet: (7-13)\n" + 15912 " ├─ tableId: 2\n" + 15913 " └─ Table\n" + 15914 " ├─ name: two_pk\n" + 15915 " └─ columns: [pk1 pk2]\n" + 15916 "", 15917 ExpectedEstimates: "Sort(one_pk.pk ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 15918 " └─ MergeJoin\n" + 15919 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 15920 " ├─ sel: (one_pk.pk = two_pk.pk2)\n" + 15921 " ├─ IndexedTableAccess(one_pk)\n" + 15922 " │ ├─ index: [one_pk.pk]\n" + 15923 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15924 " │ └─ columns: [pk]\n" + 15925 " └─ IndexedTableAccess(two_pk)\n" + 15926 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15927 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 15928 " └─ columns: [pk1 pk2]\n" + 15929 "", 15930 ExpectedAnalysis: "Sort(one_pk.pk ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 15931 " └─ MergeJoin\n" + 15932 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 15933 " ├─ sel: (one_pk.pk = two_pk.pk2)\n" + 15934 " ├─ IndexedTableAccess(one_pk)\n" + 15935 " │ ├─ index: [one_pk.pk]\n" + 15936 " │ ├─ filters: [{[NULL, ∞)}]\n" + 15937 " │ └─ columns: [pk]\n" + 15938 " └─ IndexedTableAccess(two_pk)\n" + 15939 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 15940 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 15941 " └─ columns: [pk1 pk2]\n" + 15942 "", 15943 }, 15944 { 15945 Query: `SELECT pk,pk1,pk2 FROM one_pk JOIN two_pk ON pk1-pk>0 AND pk2<1`, 15946 ExpectedPlan: "Project\n" + 15947 " ├─ columns: [one_pk.pk:2!null, two_pk.pk1:0!null, two_pk.pk2:1!null]\n" + 15948 " └─ InnerJoin\n" + 15949 " ├─ GreaterThan\n" + 15950 " │ ├─ (two_pk.pk1:0!null - one_pk.pk:2!null)\n" + 15951 " │ └─ 0 (tinyint)\n" + 15952 " ├─ Filter\n" + 15953 " │ ├─ LessThan\n" + 15954 " │ │ ├─ two_pk.pk2:1!null\n" + 15955 " │ │ └─ 1 (tinyint)\n" + 15956 " │ └─ ProcessTable\n" + 15957 " │ └─ Table\n" + 15958 " │ ├─ name: two_pk\n" + 15959 " │ └─ columns: [pk1 pk2]\n" + 15960 " └─ ProcessTable\n" + 15961 " └─ Table\n" + 15962 " ├─ name: one_pk\n" + 15963 " └─ columns: [pk]\n" + 15964 "", 15965 ExpectedEstimates: "Project\n" + 15966 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 15967 " └─ InnerJoin (estimated cost=13.120 rows=3)\n" + 15968 " ├─ ((two_pk.pk1 - one_pk.pk) > 0)\n" + 15969 " ├─ Filter\n" + 15970 " │ ├─ (two_pk.pk2 < 1)\n" + 15971 " │ └─ Table\n" + 15972 " │ ├─ name: two_pk\n" + 15973 " │ └─ columns: [pk1 pk2]\n" + 15974 " └─ Table\n" + 15975 " ├─ name: one_pk\n" + 15976 " └─ columns: [pk]\n" + 15977 "", 15978 ExpectedAnalysis: "Project\n" + 15979 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 15980 " └─ InnerJoin (estimated cost=13.120 rows=3) (actual rows=1 loops=1)\n" + 15981 " ├─ ((two_pk.pk1 - one_pk.pk) > 0)\n" + 15982 " ├─ Filter\n" + 15983 " │ ├─ (two_pk.pk2 < 1)\n" + 15984 " │ └─ Table\n" + 15985 " │ ├─ name: two_pk\n" + 15986 " │ └─ columns: [pk1 pk2]\n" + 15987 " └─ Table\n" + 15988 " ├─ name: one_pk\n" + 15989 " └─ columns: [pk]\n" + 15990 "", 15991 }, 15992 { 15993 Query: `SELECT pk,pk1,pk2 FROM one_pk JOIN two_pk ORDER BY 1,2,3`, 15994 ExpectedPlan: "Project\n" + 15995 " ├─ columns: [one_pk.pk:2!null, two_pk.pk1:0!null, two_pk.pk2:1!null]\n" + 15996 " └─ Sort(one_pk.pk:2!null ASC nullsFirst, two_pk.pk1:0!null ASC nullsFirst, two_pk.pk2:1!null ASC nullsFirst)\n" + 15997 " └─ CrossJoin\n" + 15998 " ├─ ProcessTable\n" + 15999 " │ └─ Table\n" + 16000 " │ ├─ name: two_pk\n" + 16001 " │ └─ columns: [pk1 pk2]\n" + 16002 " └─ ProcessTable\n" + 16003 " └─ Table\n" + 16004 " ├─ name: one_pk\n" + 16005 " └─ columns: [pk]\n" + 16006 "", 16007 ExpectedEstimates: "Project\n" + 16008 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 16009 " └─ Sort(one_pk.pk ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 16010 " └─ CrossJoin\n" + 16011 " ├─ Table\n" + 16012 " │ ├─ name: two_pk\n" + 16013 " │ └─ columns: [pk1 pk2]\n" + 16014 " └─ Table\n" + 16015 " ├─ name: one_pk\n" + 16016 " └─ columns: [pk]\n" + 16017 "", 16018 ExpectedAnalysis: "Project\n" + 16019 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 16020 " └─ Sort(one_pk.pk ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 16021 " └─ CrossJoin\n" + 16022 " ├─ Table\n" + 16023 " │ ├─ name: two_pk\n" + 16024 " │ └─ columns: [pk1 pk2]\n" + 16025 " └─ Table\n" + 16026 " ├─ name: one_pk\n" + 16027 " └─ columns: [pk]\n" + 16028 "", 16029 }, 16030 { 16031 Query: `SELECT pk,pk1,pk2 FROM one_pk LEFT JOIN two_pk ON one_pk.pk=two_pk.pk1 AND one_pk.pk=two_pk.pk2 ORDER BY 1,2,3`, 16032 ExpectedPlan: "Project\n" + 16033 " ├─ columns: [one_pk.pk:0!null, two_pk.pk1:1!null, two_pk.pk2:2!null]\n" + 16034 " └─ Sort(one_pk.pk:0!null ASC nullsFirst, two_pk.pk1:1!null ASC nullsFirst, two_pk.pk2:2!null ASC nullsFirst)\n" + 16035 " └─ LeftOuterMergeJoin\n" + 16036 " ├─ cmp: Eq\n" + 16037 " │ ├─ one_pk.pk:0!null\n" + 16038 " │ └─ two_pk.pk1:1!null\n" + 16039 " ├─ sel: Eq\n" + 16040 " │ ├─ one_pk.pk:0!null\n" + 16041 " │ └─ two_pk.pk2:2!null\n" + 16042 " ├─ IndexedTableAccess(one_pk)\n" + 16043 " │ ├─ index: [one_pk.pk]\n" + 16044 " │ ├─ static: [{[NULL, ∞)}]\n" + 16045 " │ ├─ colSet: (1-6)\n" + 16046 " │ ├─ tableId: 1\n" + 16047 " │ └─ Table\n" + 16048 " │ ├─ name: one_pk\n" + 16049 " │ └─ columns: [pk]\n" + 16050 " └─ IndexedTableAccess(two_pk)\n" + 16051 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16052 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 16053 " ├─ colSet: (7-13)\n" + 16054 " ├─ tableId: 2\n" + 16055 " └─ Table\n" + 16056 " ├─ name: two_pk\n" + 16057 " └─ columns: [pk1 pk2]\n" + 16058 "", 16059 ExpectedEstimates: "Project\n" + 16060 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 16061 " └─ Sort(one_pk.pk ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 16062 " └─ LeftOuterMergeJoin\n" + 16063 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 16064 " ├─ sel: (one_pk.pk = two_pk.pk2)\n" + 16065 " ├─ IndexedTableAccess(one_pk)\n" + 16066 " │ ├─ index: [one_pk.pk]\n" + 16067 " │ ├─ filters: [{[NULL, ∞)}]\n" + 16068 " │ └─ columns: [pk]\n" + 16069 " └─ IndexedTableAccess(two_pk)\n" + 16070 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16071 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 16072 " └─ columns: [pk1 pk2]\n" + 16073 "", 16074 ExpectedAnalysis: "Project\n" + 16075 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 16076 " └─ Sort(one_pk.pk ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 16077 " └─ LeftOuterMergeJoin\n" + 16078 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 16079 " ├─ sel: (one_pk.pk = two_pk.pk2)\n" + 16080 " ├─ IndexedTableAccess(one_pk)\n" + 16081 " │ ├─ index: [one_pk.pk]\n" + 16082 " │ ├─ filters: [{[NULL, ∞)}]\n" + 16083 " │ └─ columns: [pk]\n" + 16084 " └─ IndexedTableAccess(two_pk)\n" + 16085 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16086 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 16087 " └─ columns: [pk1 pk2]\n" + 16088 "", 16089 }, 16090 { 16091 Query: `SELECT pk,pk1,pk2 FROM one_pk LEFT JOIN two_pk ON pk=pk1 ORDER BY 1,2,3`, 16092 ExpectedPlan: "Project\n" + 16093 " ├─ columns: [one_pk.pk:0!null, two_pk.pk1:1!null, two_pk.pk2:2!null]\n" + 16094 " └─ Sort(one_pk.pk:0!null ASC nullsFirst, two_pk.pk1:1!null ASC nullsFirst, two_pk.pk2:2!null ASC nullsFirst)\n" + 16095 " └─ LeftOuterMergeJoin\n" + 16096 " ├─ cmp: Eq\n" + 16097 " │ ├─ one_pk.pk:0!null\n" + 16098 " │ └─ two_pk.pk1:1!null\n" + 16099 " ├─ IndexedTableAccess(one_pk)\n" + 16100 " │ ├─ index: [one_pk.pk]\n" + 16101 " │ ├─ static: [{[NULL, ∞)}]\n" + 16102 " │ ├─ colSet: (1-6)\n" + 16103 " │ ├─ tableId: 1\n" + 16104 " │ └─ Table\n" + 16105 " │ ├─ name: one_pk\n" + 16106 " │ └─ columns: [pk]\n" + 16107 " └─ IndexedTableAccess(two_pk)\n" + 16108 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16109 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 16110 " ├─ colSet: (7-13)\n" + 16111 " ├─ tableId: 2\n" + 16112 " └─ Table\n" + 16113 " ├─ name: two_pk\n" + 16114 " └─ columns: [pk1 pk2]\n" + 16115 "", 16116 ExpectedEstimates: "Project\n" + 16117 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 16118 " └─ Sort(one_pk.pk ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 16119 " └─ LeftOuterMergeJoin\n" + 16120 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 16121 " ├─ IndexedTableAccess(one_pk)\n" + 16122 " │ ├─ index: [one_pk.pk]\n" + 16123 " │ ├─ filters: [{[NULL, ∞)}]\n" + 16124 " │ └─ columns: [pk]\n" + 16125 " └─ IndexedTableAccess(two_pk)\n" + 16126 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16127 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 16128 " └─ columns: [pk1 pk2]\n" + 16129 "", 16130 ExpectedAnalysis: "Project\n" + 16131 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 16132 " └─ Sort(one_pk.pk ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 16133 " └─ LeftOuterMergeJoin\n" + 16134 " ├─ cmp: (one_pk.pk = two_pk.pk1)\n" + 16135 " ├─ IndexedTableAccess(one_pk)\n" + 16136 " │ ├─ index: [one_pk.pk]\n" + 16137 " │ ├─ filters: [{[NULL, ∞)}]\n" + 16138 " │ └─ columns: [pk]\n" + 16139 " └─ IndexedTableAccess(two_pk)\n" + 16140 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16141 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 16142 " └─ columns: [pk1 pk2]\n" + 16143 "", 16144 }, 16145 { 16146 Query: `SELECT pk,pk1,pk2 FROM one_pk RIGHT JOIN two_pk ON one_pk.pk=two_pk.pk1 AND one_pk.pk=two_pk.pk2 ORDER BY 1,2,3`, 16147 ExpectedPlan: "Project\n" + 16148 " ├─ columns: [one_pk.pk:2!null, two_pk.pk1:0!null, two_pk.pk2:1!null]\n" + 16149 " └─ Sort(one_pk.pk:2!null ASC nullsFirst, two_pk.pk1:0!null ASC nullsFirst, two_pk.pk2:1!null ASC nullsFirst)\n" + 16150 " └─ LeftOuterMergeJoin\n" + 16151 " ├─ cmp: Eq\n" + 16152 " │ ├─ TUPLE(two_pk.pk1:0!null, two_pk.pk2:1!null)\n" + 16153 " │ └─ TUPLE(one_pk.pk:2!null, one_pk.pk:2!null)\n" + 16154 " ├─ IndexedTableAccess(two_pk)\n" + 16155 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16156 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 16157 " │ ├─ colSet: (7-13)\n" + 16158 " │ ├─ tableId: 2\n" + 16159 " │ └─ Table\n" + 16160 " │ ├─ name: two_pk\n" + 16161 " │ └─ columns: [pk1 pk2]\n" + 16162 " └─ IndexedTableAccess(one_pk)\n" + 16163 " ├─ index: [one_pk.pk]\n" + 16164 " ├─ static: [{[NULL, ∞)}]\n" + 16165 " ├─ colSet: (1-6)\n" + 16166 " ├─ tableId: 1\n" + 16167 " └─ Table\n" + 16168 " ├─ name: one_pk\n" + 16169 " └─ columns: [pk]\n" + 16170 "", 16171 ExpectedEstimates: "Project\n" + 16172 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 16173 " └─ Sort(one_pk.pk ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 16174 " └─ LeftOuterMergeJoin\n" + 16175 " ├─ cmp: ((two_pk.pk1, two_pk.pk2) = (one_pk.pk, one_pk.pk))\n" + 16176 " ├─ IndexedTableAccess(two_pk)\n" + 16177 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16178 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 16179 " │ └─ columns: [pk1 pk2]\n" + 16180 " └─ IndexedTableAccess(one_pk)\n" + 16181 " ├─ index: [one_pk.pk]\n" + 16182 " ├─ filters: [{[NULL, ∞)}]\n" + 16183 " └─ columns: [pk]\n" + 16184 "", 16185 ExpectedAnalysis: "Project\n" + 16186 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 16187 " └─ Sort(one_pk.pk ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 16188 " └─ LeftOuterMergeJoin\n" + 16189 " ├─ cmp: ((two_pk.pk1, two_pk.pk2) = (one_pk.pk, one_pk.pk))\n" + 16190 " ├─ IndexedTableAccess(two_pk)\n" + 16191 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16192 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 16193 " │ └─ columns: [pk1 pk2]\n" + 16194 " └─ IndexedTableAccess(one_pk)\n" + 16195 " ├─ index: [one_pk.pk]\n" + 16196 " ├─ filters: [{[NULL, ∞)}]\n" + 16197 " └─ columns: [pk]\n" + 16198 "", 16199 }, 16200 { 16201 Query: `SELECT pk,pk1,pk2 FROM one_pk opk JOIN two_pk tpk ON opk.pk=tpk.pk1 AND opk.pk=tpk.pk2 ORDER BY 1,2,3`, 16202 ExpectedPlan: "Sort(opk.pk:0!null ASC nullsFirst, tpk.pk1:1!null ASC nullsFirst, tpk.pk2:2!null ASC nullsFirst)\n" + 16203 " └─ MergeJoin\n" + 16204 " ├─ cmp: Eq\n" + 16205 " │ ├─ opk.pk:0!null\n" + 16206 " │ └─ tpk.pk1:1!null\n" + 16207 " ├─ sel: Eq\n" + 16208 " │ ├─ opk.pk:0!null\n" + 16209 " │ └─ tpk.pk2:2!null\n" + 16210 " ├─ TableAlias(opk)\n" + 16211 " │ └─ IndexedTableAccess(one_pk)\n" + 16212 " │ ├─ index: [one_pk.pk]\n" + 16213 " │ ├─ static: [{[NULL, ∞)}]\n" + 16214 " │ ├─ colSet: (1-6)\n" + 16215 " │ ├─ tableId: 1\n" + 16216 " │ └─ Table\n" + 16217 " │ ├─ name: one_pk\n" + 16218 " │ └─ columns: [pk]\n" + 16219 " └─ TableAlias(tpk)\n" + 16220 " └─ IndexedTableAccess(two_pk)\n" + 16221 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16222 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 16223 " ├─ colSet: (7-13)\n" + 16224 " ├─ tableId: 2\n" + 16225 " └─ Table\n" + 16226 " ├─ name: two_pk\n" + 16227 " └─ columns: [pk1 pk2]\n" + 16228 "", 16229 ExpectedEstimates: "Sort(opk.pk ASC, tpk.pk1 ASC, tpk.pk2 ASC)\n" + 16230 " └─ MergeJoin\n" + 16231 " ├─ cmp: (opk.pk = tpk.pk1)\n" + 16232 " ├─ sel: (opk.pk = tpk.pk2)\n" + 16233 " ├─ TableAlias(opk)\n" + 16234 " │ └─ IndexedTableAccess(one_pk)\n" + 16235 " │ ├─ index: [one_pk.pk]\n" + 16236 " │ ├─ filters: [{[NULL, ∞)}]\n" + 16237 " │ └─ columns: [pk]\n" + 16238 " └─ TableAlias(tpk)\n" + 16239 " └─ IndexedTableAccess(two_pk)\n" + 16240 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16241 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 16242 " └─ columns: [pk1 pk2]\n" + 16243 "", 16244 ExpectedAnalysis: "Sort(opk.pk ASC, tpk.pk1 ASC, tpk.pk2 ASC)\n" + 16245 " └─ MergeJoin\n" + 16246 " ├─ cmp: (opk.pk = tpk.pk1)\n" + 16247 " ├─ sel: (opk.pk = tpk.pk2)\n" + 16248 " ├─ TableAlias(opk)\n" + 16249 " │ └─ IndexedTableAccess(one_pk)\n" + 16250 " │ ├─ index: [one_pk.pk]\n" + 16251 " │ ├─ filters: [{[NULL, ∞)}]\n" + 16252 " │ └─ columns: [pk]\n" + 16253 " └─ TableAlias(tpk)\n" + 16254 " └─ IndexedTableAccess(two_pk)\n" + 16255 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16256 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 16257 " └─ columns: [pk1 pk2]\n" + 16258 "", 16259 }, 16260 { 16261 Query: `SELECT pk,pk1,pk2 FROM one_pk opk JOIN two_pk tpk ON pk=tpk.pk1 AND pk=tpk.pk2 ORDER BY 1,2,3`, 16262 ExpectedPlan: "Sort(opk.pk:0!null ASC nullsFirst, tpk.pk1:1!null ASC nullsFirst, tpk.pk2:2!null ASC nullsFirst)\n" + 16263 " └─ MergeJoin\n" + 16264 " ├─ cmp: Eq\n" + 16265 " │ ├─ opk.pk:0!null\n" + 16266 " │ └─ tpk.pk1:1!null\n" + 16267 " ├─ sel: Eq\n" + 16268 " │ ├─ opk.pk:0!null\n" + 16269 " │ └─ tpk.pk2:2!null\n" + 16270 " ├─ TableAlias(opk)\n" + 16271 " │ └─ IndexedTableAccess(one_pk)\n" + 16272 " │ ├─ index: [one_pk.pk]\n" + 16273 " │ ├─ static: [{[NULL, ∞)}]\n" + 16274 " │ ├─ colSet: (1-6)\n" + 16275 " │ ├─ tableId: 1\n" + 16276 " │ └─ Table\n" + 16277 " │ ├─ name: one_pk\n" + 16278 " │ └─ columns: [pk]\n" + 16279 " └─ TableAlias(tpk)\n" + 16280 " └─ IndexedTableAccess(two_pk)\n" + 16281 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16282 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 16283 " ├─ colSet: (7-13)\n" + 16284 " ├─ tableId: 2\n" + 16285 " └─ Table\n" + 16286 " ├─ name: two_pk\n" + 16287 " └─ columns: [pk1 pk2]\n" + 16288 "", 16289 ExpectedEstimates: "Sort(opk.pk ASC, tpk.pk1 ASC, tpk.pk2 ASC)\n" + 16290 " └─ MergeJoin\n" + 16291 " ├─ cmp: (opk.pk = tpk.pk1)\n" + 16292 " ├─ sel: (opk.pk = tpk.pk2)\n" + 16293 " ├─ TableAlias(opk)\n" + 16294 " │ └─ IndexedTableAccess(one_pk)\n" + 16295 " │ ├─ index: [one_pk.pk]\n" + 16296 " │ ├─ filters: [{[NULL, ∞)}]\n" + 16297 " │ └─ columns: [pk]\n" + 16298 " └─ TableAlias(tpk)\n" + 16299 " └─ IndexedTableAccess(two_pk)\n" + 16300 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16301 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 16302 " └─ columns: [pk1 pk2]\n" + 16303 "", 16304 ExpectedAnalysis: "Sort(opk.pk ASC, tpk.pk1 ASC, tpk.pk2 ASC)\n" + 16305 " └─ MergeJoin\n" + 16306 " ├─ cmp: (opk.pk = tpk.pk1)\n" + 16307 " ├─ sel: (opk.pk = tpk.pk2)\n" + 16308 " ├─ TableAlias(opk)\n" + 16309 " │ └─ IndexedTableAccess(one_pk)\n" + 16310 " │ ├─ index: [one_pk.pk]\n" + 16311 " │ ├─ filters: [{[NULL, ∞)}]\n" + 16312 " │ └─ columns: [pk]\n" + 16313 " └─ TableAlias(tpk)\n" + 16314 " └─ IndexedTableAccess(two_pk)\n" + 16315 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16316 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 16317 " └─ columns: [pk1 pk2]\n" + 16318 "", 16319 }, 16320 { 16321 Query: `SELECT pk,pk1,pk2 FROM one_pk,two_pk WHERE one_pk.c1=two_pk.c1 ORDER BY 1,2,3`, 16322 ExpectedPlan: "Project\n" + 16323 " ├─ columns: [one_pk.pk:0!null, two_pk.pk1:2!null, two_pk.pk2:3!null]\n" + 16324 " └─ Sort(one_pk.pk:0!null ASC nullsFirst, two_pk.pk1:2!null ASC nullsFirst, two_pk.pk2:3!null ASC nullsFirst)\n" + 16325 " └─ HashJoin\n" + 16326 " ├─ Eq\n" + 16327 " │ ├─ one_pk.c1:1\n" + 16328 " │ └─ two_pk.c1:4!null\n" + 16329 " ├─ ProcessTable\n" + 16330 " │ └─ Table\n" + 16331 " │ ├─ name: one_pk\n" + 16332 " │ └─ columns: [pk c1]\n" + 16333 " └─ HashLookup\n" + 16334 " ├─ left-key: TUPLE(one_pk.c1:1)\n" + 16335 " ├─ right-key: TUPLE(two_pk.c1:2!null)\n" + 16336 " └─ ProcessTable\n" + 16337 " └─ Table\n" + 16338 " ├─ name: two_pk\n" + 16339 " └─ columns: [pk1 pk2 c1]\n" + 16340 "", 16341 ExpectedEstimates: "Project\n" + 16342 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 16343 " └─ Sort(one_pk.pk ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 16344 " └─ HashJoin\n" + 16345 " ├─ (one_pk.c1 = two_pk.c1)\n" + 16346 " ├─ Table\n" + 16347 " │ ├─ name: one_pk\n" + 16348 " │ └─ columns: [pk c1]\n" + 16349 " └─ HashLookup\n" + 16350 " ├─ left-key: (one_pk.c1)\n" + 16351 " ├─ right-key: (two_pk.c1)\n" + 16352 " └─ Table\n" + 16353 " ├─ name: two_pk\n" + 16354 " └─ columns: [pk1 pk2 c1]\n" + 16355 "", 16356 ExpectedAnalysis: "Project\n" + 16357 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2]\n" + 16358 " └─ Sort(one_pk.pk ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 16359 " └─ HashJoin\n" + 16360 " ├─ (one_pk.c1 = two_pk.c1)\n" + 16361 " ├─ Table\n" + 16362 " │ ├─ name: one_pk\n" + 16363 " │ └─ columns: [pk c1]\n" + 16364 " └─ HashLookup\n" + 16365 " ├─ left-key: (one_pk.c1)\n" + 16366 " ├─ right-key: (two_pk.c1)\n" + 16367 " └─ Table\n" + 16368 " ├─ name: two_pk\n" + 16369 " └─ columns: [pk1 pk2 c1]\n" + 16370 "", 16371 }, 16372 { 16373 Query: `SELECT pk,pk1,pk2,one_pk.c1 AS foo, two_pk.c1 AS bar FROM one_pk JOIN two_pk ON one_pk.c1=two_pk.c1 ORDER BY 1,2,3`, 16374 ExpectedPlan: "Project\n" + 16375 " ├─ columns: [one_pk.pk:0!null, two_pk.pk1:6!null, two_pk.pk2:7!null, one_pk.c1:1 as foo, two_pk.c1:8!null as bar]\n" + 16376 " └─ Sort(one_pk.pk:0!null ASC nullsFirst, two_pk.pk1:6!null ASC nullsFirst, two_pk.pk2:7!null ASC nullsFirst)\n" + 16377 " └─ Project\n" + 16378 " ├─ columns: [one_pk.pk:0!null, one_pk.c1:1, one_pk.c2:2, one_pk.c3:3, one_pk.c4:4, one_pk.c5:5, two_pk.pk1:6!null, two_pk.pk2:7!null, two_pk.c1:8!null, two_pk.c2:9!null, two_pk.c3:10!null, two_pk.c4:11!null, two_pk.c5:12!null, one_pk.c1:1 as foo, two_pk.c1:8!null as bar]\n" + 16379 " └─ HashJoin\n" + 16380 " ├─ Eq\n" + 16381 " │ ├─ one_pk.c1:1\n" + 16382 " │ └─ two_pk.c1:8!null\n" + 16383 " ├─ ProcessTable\n" + 16384 " │ └─ Table\n" + 16385 " │ ├─ name: one_pk\n" + 16386 " │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 16387 " └─ HashLookup\n" + 16388 " ├─ left-key: TUPLE(one_pk.c1:1)\n" + 16389 " ├─ right-key: TUPLE(two_pk.c1:2!null)\n" + 16390 " └─ ProcessTable\n" + 16391 " └─ Table\n" + 16392 " ├─ name: two_pk\n" + 16393 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 16394 "", 16395 ExpectedEstimates: "Project\n" + 16396 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2, one_pk.c1 as foo, two_pk.c1 as bar]\n" + 16397 " └─ Sort(one_pk.pk ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 16398 " └─ Project\n" + 16399 " ├─ columns: [one_pk.pk, one_pk.c1, one_pk.c2, one_pk.c3, one_pk.c4, one_pk.c5, two_pk.pk1, two_pk.pk2, two_pk.c1, two_pk.c2, two_pk.c3, two_pk.c4, two_pk.c5, one_pk.c1 as foo, two_pk.c1 as bar]\n" + 16400 " └─ HashJoin\n" + 16401 " ├─ (one_pk.c1 = two_pk.c1)\n" + 16402 " ├─ Table\n" + 16403 " │ ├─ name: one_pk\n" + 16404 " │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 16405 " └─ HashLookup\n" + 16406 " ├─ left-key: (one_pk.c1)\n" + 16407 " ├─ right-key: (two_pk.c1)\n" + 16408 " └─ Table\n" + 16409 " ├─ name: two_pk\n" + 16410 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 16411 "", 16412 ExpectedAnalysis: "Project\n" + 16413 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2, one_pk.c1 as foo, two_pk.c1 as bar]\n" + 16414 " └─ Sort(one_pk.pk ASC, two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 16415 " └─ Project\n" + 16416 " ├─ columns: [one_pk.pk, one_pk.c1, one_pk.c2, one_pk.c3, one_pk.c4, one_pk.c5, two_pk.pk1, two_pk.pk2, two_pk.c1, two_pk.c2, two_pk.c3, two_pk.c4, two_pk.c5, one_pk.c1 as foo, two_pk.c1 as bar]\n" + 16417 " └─ HashJoin\n" + 16418 " ├─ (one_pk.c1 = two_pk.c1)\n" + 16419 " ├─ Table\n" + 16420 " │ ├─ name: one_pk\n" + 16421 " │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 16422 " └─ HashLookup\n" + 16423 " ├─ left-key: (one_pk.c1)\n" + 16424 " ├─ right-key: (two_pk.c1)\n" + 16425 " └─ Table\n" + 16426 " ├─ name: two_pk\n" + 16427 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 16428 "", 16429 }, 16430 { 16431 Query: `SELECT pk,pk1,pk2,one_pk.c1 AS foo,two_pk.c1 AS bar FROM one_pk JOIN two_pk ON one_pk.c1=two_pk.c1 WHERE one_pk.c1=10`, 16432 ExpectedPlan: "Project\n" + 16433 " ├─ columns: [one_pk.pk:3!null, two_pk.pk1:0!null, two_pk.pk2:1!null, one_pk.c1:4 as foo, two_pk.c1:2!null as bar]\n" + 16434 " └─ HashJoin\n" + 16435 " ├─ Eq\n" + 16436 " │ ├─ one_pk.c1:4\n" + 16437 " │ └─ two_pk.c1:2!null\n" + 16438 " ├─ ProcessTable\n" + 16439 " │ └─ Table\n" + 16440 " │ ├─ name: two_pk\n" + 16441 " │ └─ columns: [pk1 pk2 c1]\n" + 16442 " └─ HashLookup\n" + 16443 " ├─ left-key: TUPLE(two_pk.c1:2!null)\n" + 16444 " ├─ right-key: TUPLE(one_pk.c1:1)\n" + 16445 " └─ Filter\n" + 16446 " ├─ Eq\n" + 16447 " │ ├─ one_pk.c1:1\n" + 16448 " │ └─ 10 (tinyint)\n" + 16449 " └─ ProcessTable\n" + 16450 " └─ Table\n" + 16451 " ├─ name: one_pk\n" + 16452 " └─ columns: [pk c1]\n" + 16453 "", 16454 ExpectedEstimates: "Project\n" + 16455 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2, one_pk.c1 as foo, two_pk.c1 as bar]\n" + 16456 " └─ HashJoin (estimated cost=13.070 rows=3)\n" + 16457 " ├─ (one_pk.c1 = two_pk.c1)\n" + 16458 " ├─ Table\n" + 16459 " │ ├─ name: two_pk\n" + 16460 " │ └─ columns: [pk1 pk2 c1]\n" + 16461 " └─ HashLookup\n" + 16462 " ├─ left-key: (two_pk.c1)\n" + 16463 " ├─ right-key: (one_pk.c1)\n" + 16464 " └─ Filter\n" + 16465 " ├─ (one_pk.c1 = 10)\n" + 16466 " └─ Table\n" + 16467 " ├─ name: one_pk\n" + 16468 " └─ columns: [pk c1]\n" + 16469 "", 16470 ExpectedAnalysis: "Project\n" + 16471 " ├─ columns: [one_pk.pk, two_pk.pk1, two_pk.pk2, one_pk.c1 as foo, two_pk.c1 as bar]\n" + 16472 " └─ HashJoin (estimated cost=13.070 rows=3) (actual rows=1 loops=1)\n" + 16473 " ├─ (one_pk.c1 = two_pk.c1)\n" + 16474 " ├─ Table\n" + 16475 " │ ├─ name: two_pk\n" + 16476 " │ └─ columns: [pk1 pk2 c1]\n" + 16477 " └─ HashLookup\n" + 16478 " ├─ left-key: (two_pk.c1)\n" + 16479 " ├─ right-key: (one_pk.c1)\n" + 16480 " └─ Filter\n" + 16481 " ├─ (one_pk.c1 = 10)\n" + 16482 " └─ Table\n" + 16483 " ├─ name: one_pk\n" + 16484 " └─ columns: [pk c1]\n" + 16485 "", 16486 }, 16487 { 16488 Query: `SELECT pk,pk2 FROM one_pk t1, two_pk t2 WHERE pk=1 AND pk2=1 ORDER BY 1,2`, 16489 ExpectedPlan: "Project\n" + 16490 " ├─ columns: [t1.pk:1!null, t2.pk2:0!null]\n" + 16491 " └─ Sort(t1.pk:1!null ASC nullsFirst, t2.pk2:0!null ASC nullsFirst)\n" + 16492 " └─ CrossJoin\n" + 16493 " ├─ Filter\n" + 16494 " │ ├─ Eq\n" + 16495 " │ │ ├─ t2.pk2:0!null\n" + 16496 " │ │ └─ 1 (tinyint)\n" + 16497 " │ └─ TableAlias(t2)\n" + 16498 " │ └─ ProcessTable\n" + 16499 " │ └─ Table\n" + 16500 " │ ├─ name: two_pk\n" + 16501 " │ └─ columns: [pk2]\n" + 16502 " └─ TableAlias(t1)\n" + 16503 " └─ IndexedTableAccess(one_pk)\n" + 16504 " ├─ index: [one_pk.pk]\n" + 16505 " ├─ static: [{[1, 1]}]\n" + 16506 " ├─ colSet: (1-6)\n" + 16507 " ├─ tableId: 1\n" + 16508 " └─ Table\n" + 16509 " ├─ name: one_pk\n" + 16510 " └─ columns: [pk]\n" + 16511 "", 16512 ExpectedEstimates: "Project\n" + 16513 " ├─ columns: [t1.pk, t2.pk2]\n" + 16514 " └─ Sort(t1.pk ASC, t2.pk2 ASC)\n" + 16515 " └─ CrossJoin\n" + 16516 " ├─ Filter\n" + 16517 " │ ├─ (t2.pk2 = 1)\n" + 16518 " │ └─ TableAlias(t2)\n" + 16519 " │ └─ Table\n" + 16520 " │ ├─ name: two_pk\n" + 16521 " │ └─ columns: [pk2]\n" + 16522 " └─ TableAlias(t1)\n" + 16523 " └─ IndexedTableAccess(one_pk)\n" + 16524 " ├─ index: [one_pk.pk]\n" + 16525 " ├─ filters: [{[1, 1]}]\n" + 16526 " └─ columns: [pk]\n" + 16527 "", 16528 ExpectedAnalysis: "Project\n" + 16529 " ├─ columns: [t1.pk, t2.pk2]\n" + 16530 " └─ Sort(t1.pk ASC, t2.pk2 ASC)\n" + 16531 " └─ CrossJoin\n" + 16532 " ├─ Filter\n" + 16533 " │ ├─ (t2.pk2 = 1)\n" + 16534 " │ └─ TableAlias(t2)\n" + 16535 " │ └─ Table\n" + 16536 " │ ├─ name: two_pk\n" + 16537 " │ └─ columns: [pk2]\n" + 16538 " └─ TableAlias(t1)\n" + 16539 " └─ IndexedTableAccess(one_pk)\n" + 16540 " ├─ index: [one_pk.pk]\n" + 16541 " ├─ filters: [{[1, 1]}]\n" + 16542 " └─ columns: [pk]\n" + 16543 "", 16544 }, 16545 { 16546 Query: `SELECT pk,pk1,pk2 FROM one_pk t1, two_pk t2 WHERE pk=1 AND pk2=1 AND pk1=1 ORDER BY 1,2`, 16547 ExpectedPlan: "Project\n" + 16548 " ├─ columns: [t1.pk:2!null, t2.pk1:0!null, t2.pk2:1!null]\n" + 16549 " └─ Sort(t1.pk:2!null ASC nullsFirst, t2.pk1:0!null ASC nullsFirst)\n" + 16550 " └─ CrossJoin\n" + 16551 " ├─ TableAlias(t2)\n" + 16552 " │ └─ IndexedTableAccess(two_pk)\n" + 16553 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16554 " │ ├─ static: [{[1, 1], [1, 1]}]\n" + 16555 " │ ├─ colSet: (7-13)\n" + 16556 " │ ├─ tableId: 2\n" + 16557 " │ └─ Table\n" + 16558 " │ ├─ name: two_pk\n" + 16559 " │ └─ columns: [pk1 pk2]\n" + 16560 " └─ TableAlias(t1)\n" + 16561 " └─ IndexedTableAccess(one_pk)\n" + 16562 " ├─ index: [one_pk.pk]\n" + 16563 " ├─ static: [{[1, 1]}]\n" + 16564 " ├─ colSet: (1-6)\n" + 16565 " ├─ tableId: 1\n" + 16566 " └─ Table\n" + 16567 " ├─ name: one_pk\n" + 16568 " └─ columns: [pk]\n" + 16569 "", 16570 ExpectedEstimates: "Project\n" + 16571 " ├─ columns: [t1.pk, t2.pk1, t2.pk2]\n" + 16572 " └─ Sort(t1.pk ASC, t2.pk1 ASC)\n" + 16573 " └─ CrossJoin\n" + 16574 " ├─ TableAlias(t2)\n" + 16575 " │ └─ IndexedTableAccess(two_pk)\n" + 16576 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16577 " │ ├─ filters: [{[1, 1], [1, 1]}]\n" + 16578 " │ └─ columns: [pk1 pk2]\n" + 16579 " └─ TableAlias(t1)\n" + 16580 " └─ IndexedTableAccess(one_pk)\n" + 16581 " ├─ index: [one_pk.pk]\n" + 16582 " ├─ filters: [{[1, 1]}]\n" + 16583 " └─ columns: [pk]\n" + 16584 "", 16585 ExpectedAnalysis: "Project\n" + 16586 " ├─ columns: [t1.pk, t2.pk1, t2.pk2]\n" + 16587 " └─ Sort(t1.pk ASC, t2.pk1 ASC)\n" + 16588 " └─ CrossJoin\n" + 16589 " ├─ TableAlias(t2)\n" + 16590 " │ └─ IndexedTableAccess(two_pk)\n" + 16591 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 16592 " │ ├─ filters: [{[1, 1], [1, 1]}]\n" + 16593 " │ └─ columns: [pk1 pk2]\n" + 16594 " └─ TableAlias(t1)\n" + 16595 " └─ IndexedTableAccess(one_pk)\n" + 16596 " ├─ index: [one_pk.pk]\n" + 16597 " ├─ filters: [{[1, 1]}]\n" + 16598 " └─ columns: [pk]\n" + 16599 "", 16600 }, 16601 { 16602 Query: `SELECT i FROM mytable mt 16603 WHERE (SELECT i FROM mytable where i = mt.i and i > 2) IS NOT NULL 16604 AND (SELECT i2 FROM othertable where i2 = i) IS NOT NULL`, 16605 ExpectedPlan: "Project\n" + 16606 " ├─ columns: [mt.i:0!null]\n" + 16607 " └─ Filter\n" + 16608 " ├─ AND\n" + 16609 " │ ├─ NOT\n" + 16610 " │ │ └─ Subquery\n" + 16611 " │ │ ├─ cacheable: false\n" + 16612 " │ │ ├─ alias-string: select i from mytable where i = mt.i and i > 2\n" + 16613 " │ │ └─ Filter\n" + 16614 " │ │ ├─ Eq\n" + 16615 " │ │ │ ├─ mytable.i:2!null\n" + 16616 " │ │ │ └─ mt.i:0!null\n" + 16617 " │ │ └─ IndexedTableAccess(mytable)\n" + 16618 " │ │ ├─ index: [mytable.i]\n" + 16619 " │ │ ├─ static: [{(2, ∞)}]\n" + 16620 " │ │ ├─ colSet: (3,4)\n" + 16621 " │ │ ├─ tableId: 2\n" + 16622 " │ │ └─ Table\n" + 16623 " │ │ ├─ name: mytable\n" + 16624 " │ │ └─ columns: [i]\n" + 16625 " │ │ IS NULL\n" + 16626 " │ └─ NOT\n" + 16627 " │ └─ Subquery\n" + 16628 " │ ├─ cacheable: false\n" + 16629 " │ ├─ alias-string: select i2 from othertable where i2 = i\n" + 16630 " │ └─ Filter\n" + 16631 " │ ├─ Eq\n" + 16632 " │ │ ├─ othertable.i2:2!null\n" + 16633 " │ │ └─ mt.i:0!null\n" + 16634 " │ └─ IndexedTableAccess(othertable)\n" + 16635 " │ ├─ index: [othertable.i2]\n" + 16636 " │ ├─ keys: [mt.i:0!null]\n" + 16637 " │ ├─ colSet: (5,6)\n" + 16638 " │ ├─ tableId: 3\n" + 16639 " │ └─ Table\n" + 16640 " │ ├─ name: othertable\n" + 16641 " │ └─ columns: [i2]\n" + 16642 " │ IS NULL\n" + 16643 " └─ TableAlias(mt)\n" + 16644 " └─ ProcessTable\n" + 16645 " └─ Table\n" + 16646 " ├─ name: mytable\n" + 16647 " └─ columns: [i s]\n" + 16648 "", 16649 ExpectedEstimates: "Project\n" + 16650 " ├─ columns: [mt.i]\n" + 16651 " └─ Filter\n" + 16652 " ├─ ((NOT(Subquery\n" + 16653 " │ ├─ cacheable: false\n" + 16654 " │ └─ Filter\n" + 16655 " │ ├─ (mytable.i = mt.i)\n" + 16656 " │ └─ IndexedTableAccess(mytable)\n" + 16657 " │ ├─ index: [mytable.i]\n" + 16658 " │ ├─ filters: [{(2, ∞)}]\n" + 16659 " │ └─ columns: [i]\n" + 16660 " │ IS NULL)) AND (NOT(Subquery\n" + 16661 " │ ├─ cacheable: false\n" + 16662 " │ └─ Filter\n" + 16663 " │ ├─ (othertable.i2 = mt.i)\n" + 16664 " │ └─ IndexedTableAccess(othertable)\n" + 16665 " │ ├─ index: [othertable.i2]\n" + 16666 " │ ├─ columns: [i2]\n" + 16667 " │ └─ keys: mt.i\n" + 16668 " │ IS NULL)))\n" + 16669 " └─ TableAlias(mt)\n" + 16670 " └─ Table\n" + 16671 " └─ name: mytable\n" + 16672 "", 16673 ExpectedAnalysis: "Project\n" + 16674 " ├─ columns: [mt.i]\n" + 16675 " └─ Filter\n" + 16676 " ├─ ((NOT(Subquery\n" + 16677 " │ ├─ cacheable: false\n" + 16678 " │ └─ Filter\n" + 16679 " │ ├─ (mytable.i = mt.i)\n" + 16680 " │ └─ IndexedTableAccess(mytable)\n" + 16681 " │ ├─ index: [mytable.i]\n" + 16682 " │ ├─ filters: [{(2, ∞)}]\n" + 16683 " │ └─ columns: [i]\n" + 16684 " │ IS NULL)) AND (NOT(Subquery\n" + 16685 " │ ├─ cacheable: false\n" + 16686 " │ └─ Filter\n" + 16687 " │ ├─ (othertable.i2 = mt.i)\n" + 16688 " │ └─ IndexedTableAccess(othertable)\n" + 16689 " │ ├─ index: [othertable.i2]\n" + 16690 " │ ├─ columns: [i2]\n" + 16691 " │ └─ keys: mt.i\n" + 16692 " │ IS NULL)))\n" + 16693 " └─ TableAlias(mt)\n" + 16694 " └─ Table\n" + 16695 " └─ name: mytable\n" + 16696 "", 16697 }, 16698 { 16699 Query: `SELECT i FROM mytable mt 16700 WHERE (SELECT i FROM mytable where i = mt.i) IS NOT NULL 16701 AND (SELECT i2 FROM othertable where i2 = i and i > 2) IS NOT NULL`, 16702 ExpectedPlan: "Project\n" + 16703 " ├─ columns: [mt.i:0!null]\n" + 16704 " └─ Filter\n" + 16705 " ├─ AND\n" + 16706 " │ ├─ NOT\n" + 16707 " │ │ └─ Subquery\n" + 16708 " │ │ ├─ cacheable: false\n" + 16709 " │ │ ├─ alias-string: select i from mytable where i = mt.i\n" + 16710 " │ │ └─ Filter\n" + 16711 " │ │ ├─ Eq\n" + 16712 " │ │ │ ├─ mytable.i:2!null\n" + 16713 " │ │ │ └─ mt.i:0!null\n" + 16714 " │ │ └─ IndexedTableAccess(mytable)\n" + 16715 " │ │ ├─ index: [mytable.i]\n" + 16716 " │ │ ├─ keys: [mt.i:0!null]\n" + 16717 " │ │ ├─ colSet: (3,4)\n" + 16718 " │ │ ├─ tableId: 2\n" + 16719 " │ │ └─ Table\n" + 16720 " │ │ ├─ name: mytable\n" + 16721 " │ │ └─ columns: [i]\n" + 16722 " │ │ IS NULL\n" + 16723 " │ └─ NOT\n" + 16724 " │ └─ Subquery\n" + 16725 " │ ├─ cacheable: false\n" + 16726 " │ ├─ alias-string: select i2 from othertable where i2 = i and i > 2\n" + 16727 " │ └─ Filter\n" + 16728 " │ ├─ AND\n" + 16729 " │ │ ├─ Eq\n" + 16730 " │ │ │ ├─ othertable.i2:2!null\n" + 16731 " │ │ │ └─ mt.i:0!null\n" + 16732 " │ │ └─ GreaterThan\n" + 16733 " │ │ ├─ mt.i:0!null\n" + 16734 " │ │ └─ 2 (tinyint)\n" + 16735 " │ └─ IndexedTableAccess(othertable)\n" + 16736 " │ ├─ index: [othertable.i2]\n" + 16737 " │ ├─ keys: [mt.i:0!null]\n" + 16738 " │ ├─ colSet: (5,6)\n" + 16739 " │ ├─ tableId: 3\n" + 16740 " │ └─ Table\n" + 16741 " │ ├─ name: othertable\n" + 16742 " │ └─ columns: [i2]\n" + 16743 " │ IS NULL\n" + 16744 " └─ TableAlias(mt)\n" + 16745 " └─ ProcessTable\n" + 16746 " └─ Table\n" + 16747 " ├─ name: mytable\n" + 16748 " └─ columns: [i s]\n" + 16749 "", 16750 ExpectedEstimates: "Project\n" + 16751 " ├─ columns: [mt.i]\n" + 16752 " └─ Filter\n" + 16753 " ├─ ((NOT(Subquery\n" + 16754 " │ ├─ cacheable: false\n" + 16755 " │ └─ Filter\n" + 16756 " │ ├─ (mytable.i = mt.i)\n" + 16757 " │ └─ IndexedTableAccess(mytable)\n" + 16758 " │ ├─ index: [mytable.i]\n" + 16759 " │ ├─ columns: [i]\n" + 16760 " │ └─ keys: mt.i\n" + 16761 " │ IS NULL)) AND (NOT(Subquery\n" + 16762 " │ ├─ cacheable: false\n" + 16763 " │ └─ Filter\n" + 16764 " │ ├─ ((othertable.i2 = mt.i) AND (mt.i > 2))\n" + 16765 " │ └─ IndexedTableAccess(othertable)\n" + 16766 " │ ├─ index: [othertable.i2]\n" + 16767 " │ ├─ columns: [i2]\n" + 16768 " │ └─ keys: mt.i\n" + 16769 " │ IS NULL)))\n" + 16770 " └─ TableAlias(mt)\n" + 16771 " └─ Table\n" + 16772 " └─ name: mytable\n" + 16773 "", 16774 ExpectedAnalysis: "Project\n" + 16775 " ├─ columns: [mt.i]\n" + 16776 " └─ Filter\n" + 16777 " ├─ ((NOT(Subquery\n" + 16778 " │ ├─ cacheable: false\n" + 16779 " │ └─ Filter\n" + 16780 " │ ├─ (mytable.i = mt.i)\n" + 16781 " │ └─ IndexedTableAccess(mytable)\n" + 16782 " │ ├─ index: [mytable.i]\n" + 16783 " │ ├─ columns: [i]\n" + 16784 " │ └─ keys: mt.i\n" + 16785 " │ IS NULL)) AND (NOT(Subquery\n" + 16786 " │ ├─ cacheable: false\n" + 16787 " │ └─ Filter\n" + 16788 " │ ├─ ((othertable.i2 = mt.i) AND (mt.i > 2))\n" + 16789 " │ └─ IndexedTableAccess(othertable)\n" + 16790 " │ ├─ index: [othertable.i2]\n" + 16791 " │ ├─ columns: [i2]\n" + 16792 " │ └─ keys: mt.i\n" + 16793 " │ IS NULL)))\n" + 16794 " └─ TableAlias(mt)\n" + 16795 " └─ Table\n" + 16796 " └─ name: mytable\n" + 16797 "", 16798 }, 16799 { 16800 Query: `SELECT pk,pk2, (SELECT pk from one_pk where pk = 1 limit 1) FROM one_pk t1, two_pk t2 WHERE pk=1 AND pk2=1 ORDER BY 1,2`, 16801 ExpectedPlan: "Project\n" + 16802 " ├─ columns: [t1.pk:7!null, t2.pk2:1!null, Subquery\n" + 16803 " │ ├─ cacheable: true\n" + 16804 " │ ├─ alias-string: select pk from one_pk where pk = 1 limit 1\n" + 16805 " │ └─ Limit(1)\n" + 16806 " │ └─ IndexedTableAccess(one_pk)\n" + 16807 " │ ├─ index: [one_pk.pk]\n" + 16808 " │ ├─ static: [{[1, 1]}]\n" + 16809 " │ ├─ colSet: (14-19)\n" + 16810 " │ ├─ tableId: 3\n" + 16811 " │ └─ Table\n" + 16812 " │ ├─ name: one_pk\n" + 16813 " │ └─ columns: [pk]\n" + 16814 " │ as (SELECT pk from one_pk where pk = 1 limit 1)]\n" + 16815 " └─ Sort(t1.pk:7!null ASC nullsFirst, t2.pk2:1!null ASC nullsFirst)\n" + 16816 " └─ CrossJoin\n" + 16817 " ├─ Filter\n" + 16818 " │ ├─ Eq\n" + 16819 " │ │ ├─ t2.pk2:1!null\n" + 16820 " │ │ └─ 1 (tinyint)\n" + 16821 " │ └─ TableAlias(t2)\n" + 16822 " │ └─ ProcessTable\n" + 16823 " │ └─ Table\n" + 16824 " │ ├─ name: two_pk\n" + 16825 " │ └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 16826 " └─ TableAlias(t1)\n" + 16827 " └─ IndexedTableAccess(one_pk)\n" + 16828 " ├─ index: [one_pk.pk]\n" + 16829 " ├─ static: [{[1, 1]}]\n" + 16830 " ├─ colSet: (1-6)\n" + 16831 " ├─ tableId: 1\n" + 16832 " └─ Table\n" + 16833 " ├─ name: one_pk\n" + 16834 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 16835 "", 16836 ExpectedEstimates: "Project\n" + 16837 " ├─ columns: [t1.pk, t2.pk2, Subquery\n" + 16838 " │ ├─ cacheable: true\n" + 16839 " │ └─ Limit(1)\n" + 16840 " │ └─ IndexedTableAccess(one_pk)\n" + 16841 " │ ├─ index: [one_pk.pk]\n" + 16842 " │ ├─ filters: [{[1, 1]}]\n" + 16843 " │ └─ columns: [pk]\n" + 16844 " │ as (SELECT pk from one_pk where pk = 1 limit 1)]\n" + 16845 " └─ Sort(t1.pk ASC, t2.pk2 ASC)\n" + 16846 " └─ CrossJoin\n" + 16847 " ├─ Filter\n" + 16848 " │ ├─ (t2.pk2 = 1)\n" + 16849 " │ └─ TableAlias(t2)\n" + 16850 " │ └─ Table\n" + 16851 " │ └─ name: two_pk\n" + 16852 " └─ TableAlias(t1)\n" + 16853 " └─ IndexedTableAccess(one_pk)\n" + 16854 " ├─ index: [one_pk.pk]\n" + 16855 " └─ filters: [{[1, 1]}]\n" + 16856 "", 16857 ExpectedAnalysis: "Project\n" + 16858 " ├─ columns: [t1.pk, t2.pk2, Subquery\n" + 16859 " │ ├─ cacheable: true\n" + 16860 " │ └─ Limit(1)\n" + 16861 " │ └─ IndexedTableAccess(one_pk)\n" + 16862 " │ ├─ index: [one_pk.pk]\n" + 16863 " │ ├─ filters: [{[1, 1]}]\n" + 16864 " │ └─ columns: [pk]\n" + 16865 " │ as (SELECT pk from one_pk where pk = 1 limit 1)]\n" + 16866 " └─ Sort(t1.pk ASC, t2.pk2 ASC)\n" + 16867 " └─ CrossJoin\n" + 16868 " ├─ Filter\n" + 16869 " │ ├─ (t2.pk2 = 1)\n" + 16870 " │ └─ TableAlias(t2)\n" + 16871 " │ └─ Table\n" + 16872 " │ └─ name: two_pk\n" + 16873 " └─ TableAlias(t1)\n" + 16874 " └─ IndexedTableAccess(one_pk)\n" + 16875 " ├─ index: [one_pk.pk]\n" + 16876 " └─ filters: [{[1, 1]}]\n" + 16877 "", 16878 }, 16879 { 16880 Query: `SELECT ROW_NUMBER() OVER (ORDER BY s2 ASC) idx, i2, s2 FROM othertable WHERE s2 <> 'second' ORDER BY i2 ASC`, 16881 ExpectedPlan: "Project\n" + 16882 " ├─ columns: [row_number() over ( order by othertable.s2 asc):0!null as idx, othertable.i2:1!null, othertable.s2:2!null]\n" + 16883 " └─ Sort(othertable.i2:1!null ASC nullsFirst)\n" + 16884 " └─ Project\n" + 16885 " ├─ columns: [row_number() over ( order by othertable.s2 asc):0!null, othertable.i2:1!null, othertable.s2:2!null, row_number() over ( order by othertable.s2 asc):0!null as idx]\n" + 16886 " └─ Window\n" + 16887 " ├─ row_number() over ( order by othertable.s2 ASC)\n" + 16888 " ├─ othertable.i2:1!null\n" + 16889 " ├─ othertable.s2:0!null\n" + 16890 " └─ Filter\n" + 16891 " ├─ NOT\n" + 16892 " │ └─ Eq\n" + 16893 " │ ├─ othertable.s2:0!null\n" + 16894 " │ └─ second (longtext)\n" + 16895 " └─ IndexedTableAccess(othertable)\n" + 16896 " ├─ index: [othertable.s2]\n" + 16897 " ├─ static: [{(NULL, second)}, {(second, ∞)}]\n" + 16898 " ├─ colSet: (1,2)\n" + 16899 " ├─ tableId: 1\n" + 16900 " └─ Table\n" + 16901 " ├─ name: othertable\n" + 16902 " └─ columns: [s2 i2]\n" + 16903 "", 16904 ExpectedEstimates: "Project\n" + 16905 " ├─ columns: [row_number() over ( order by othertable.s2 asc) as idx, othertable.i2, othertable.s2]\n" + 16906 " └─ Sort(othertable.i2 ASC)\n" + 16907 " └─ Project\n" + 16908 " ├─ columns: [row_number() over ( order by othertable.s2 asc), othertable.i2, othertable.s2, row_number() over ( order by othertable.s2 asc) as idx]\n" + 16909 " └─ Window(row_number() over ( order by othertable.s2 ASC), othertable.i2, othertable.s2)\n" + 16910 " └─ Filter\n" + 16911 " ├─ (NOT((othertable.s2 = 'second')))\n" + 16912 " └─ IndexedTableAccess(othertable)\n" + 16913 " ├─ index: [othertable.s2]\n" + 16914 " ├─ filters: [{(NULL, second)}, {(second, ∞)}]\n" + 16915 " └─ columns: [s2 i2]\n" + 16916 "", 16917 ExpectedAnalysis: "Project\n" + 16918 " ├─ columns: [row_number() over ( order by othertable.s2 asc) as idx, othertable.i2, othertable.s2]\n" + 16919 " └─ Sort(othertable.i2 ASC)\n" + 16920 " └─ Project\n" + 16921 " ├─ columns: [row_number() over ( order by othertable.s2 asc), othertable.i2, othertable.s2, row_number() over ( order by othertable.s2 asc) as idx]\n" + 16922 " └─ Window(row_number() over ( order by othertable.s2 ASC), othertable.i2, othertable.s2)\n" + 16923 " └─ Filter\n" + 16924 " ├─ (NOT((othertable.s2 = 'second')))\n" + 16925 " └─ IndexedTableAccess(othertable)\n" + 16926 " ├─ index: [othertable.s2]\n" + 16927 " ├─ filters: [{(NULL, second)}, {(second, ∞)}]\n" + 16928 " └─ columns: [s2 i2]\n" + 16929 "", 16930 }, 16931 { 16932 Query: `SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY s2 ASC) idx, i2, s2 FROM othertable ORDER BY i2 ASC) a WHERE s2 <> 'second'`, 16933 ExpectedPlan: "SubqueryAlias\n" + 16934 " ├─ name: a\n" + 16935 " ├─ outerVisibility: false\n" + 16936 " ├─ isLateral: false\n" + 16937 " ├─ cacheable: true\n" + 16938 " ├─ colSet: (5-7)\n" + 16939 " ├─ tableId: 2\n" + 16940 " └─ Filter\n" + 16941 " ├─ NOT\n" + 16942 " │ └─ Eq\n" + 16943 " │ ├─ othertable.s2:2!null\n" + 16944 " │ └─ second (longtext)\n" + 16945 " └─ Project\n" + 16946 " ├─ columns: [row_number() over ( order by othertable.s2 asc):0!null as idx, othertable.i2:1!null, othertable.s2:2!null]\n" + 16947 " └─ Sort(othertable.i2:1!null ASC nullsFirst)\n" + 16948 " └─ Project\n" + 16949 " ├─ columns: [row_number() over ( order by othertable.s2 asc):0!null, othertable.i2:1!null, othertable.s2:2!null, row_number() over ( order by othertable.s2 asc):0!null as idx]\n" + 16950 " └─ Window\n" + 16951 " ├─ row_number() over ( order by othertable.s2 ASC)\n" + 16952 " ├─ othertable.i2:1!null\n" + 16953 " ├─ othertable.s2:0!null\n" + 16954 " └─ Table\n" + 16955 " ├─ name: othertable\n" + 16956 " ├─ columns: [s2 i2]\n" + 16957 " ├─ colSet: (1,2)\n" + 16958 " └─ tableId: 1\n" + 16959 "", 16960 ExpectedEstimates: "SubqueryAlias\n" + 16961 " ├─ name: a\n" + 16962 " ├─ outerVisibility: false\n" + 16963 " ├─ isLateral: false\n" + 16964 " ├─ cacheable: true\n" + 16965 " └─ Filter\n" + 16966 " ├─ (NOT((othertable.s2 = 'second')))\n" + 16967 " └─ Project\n" + 16968 " ├─ columns: [row_number() over ( order by othertable.s2 asc) as idx, othertable.i2, othertable.s2]\n" + 16969 " └─ Sort(othertable.i2 ASC)\n" + 16970 " └─ Project\n" + 16971 " ├─ columns: [row_number() over ( order by othertable.s2 asc), othertable.i2, othertable.s2, row_number() over ( order by othertable.s2 asc) as idx]\n" + 16972 " └─ Window(row_number() over ( order by othertable.s2 ASC), othertable.i2, othertable.s2)\n" + 16973 " └─ Table\n" + 16974 " ├─ name: othertable\n" + 16975 " └─ columns: [s2 i2]\n" + 16976 "", 16977 ExpectedAnalysis: "SubqueryAlias\n" + 16978 " ├─ name: a\n" + 16979 " ├─ outerVisibility: false\n" + 16980 " ├─ isLateral: false\n" + 16981 " ├─ cacheable: true\n" + 16982 " └─ Filter\n" + 16983 " ├─ (NOT((othertable.s2 = 'second')))\n" + 16984 " └─ Project\n" + 16985 " ├─ columns: [row_number() over ( order by othertable.s2 asc) as idx, othertable.i2, othertable.s2]\n" + 16986 " └─ Sort(othertable.i2 ASC)\n" + 16987 " └─ Project\n" + 16988 " ├─ columns: [row_number() over ( order by othertable.s2 asc), othertable.i2, othertable.s2, row_number() over ( order by othertable.s2 asc) as idx]\n" + 16989 " └─ Window(row_number() over ( order by othertable.s2 ASC), othertable.i2, othertable.s2)\n" + 16990 " └─ Table\n" + 16991 " ├─ name: othertable\n" + 16992 " └─ columns: [s2 i2]\n" + 16993 "", 16994 }, 16995 { 16996 Query: `SELECT ROW_NUMBER() OVER (ORDER BY s2 ASC) idx, i2, s2 FROM othertable WHERE i2 < 2 OR i2 > 2 ORDER BY i2 ASC`, 16997 ExpectedPlan: "Project\n" + 16998 " ├─ columns: [row_number() over ( order by othertable.s2 asc):0!null as idx, othertable.i2:1!null, othertable.s2:2!null]\n" + 16999 " └─ Sort(othertable.i2:1!null ASC nullsFirst)\n" + 17000 " └─ Project\n" + 17001 " ├─ columns: [row_number() over ( order by othertable.s2 asc):0!null, othertable.i2:1!null, othertable.s2:2!null, row_number() over ( order by othertable.s2 asc):0!null as idx]\n" + 17002 " └─ Window\n" + 17003 " ├─ row_number() over ( order by othertable.s2 ASC)\n" + 17004 " ├─ othertable.i2:1!null\n" + 17005 " ├─ othertable.s2:0!null\n" + 17006 " └─ IndexedTableAccess(othertable)\n" + 17007 " ├─ index: [othertable.i2]\n" + 17008 " ├─ static: [{(NULL, 2)}, {(2, ∞)}]\n" + 17009 " ├─ colSet: (1,2)\n" + 17010 " ├─ tableId: 1\n" + 17011 " └─ Table\n" + 17012 " ├─ name: othertable\n" + 17013 " └─ columns: [s2 i2]\n" + 17014 "", 17015 ExpectedEstimates: "Project\n" + 17016 " ├─ columns: [row_number() over ( order by othertable.s2 asc) as idx, othertable.i2, othertable.s2]\n" + 17017 " └─ Sort(othertable.i2 ASC)\n" + 17018 " └─ Project\n" + 17019 " ├─ columns: [row_number() over ( order by othertable.s2 asc), othertable.i2, othertable.s2, row_number() over ( order by othertable.s2 asc) as idx]\n" + 17020 " └─ Window(row_number() over ( order by othertable.s2 ASC), othertable.i2, othertable.s2)\n" + 17021 " └─ IndexedTableAccess(othertable)\n" + 17022 " ├─ index: [othertable.i2]\n" + 17023 " ├─ filters: [{(NULL, 2)}, {(2, ∞)}]\n" + 17024 " └─ columns: [s2 i2]\n" + 17025 "", 17026 ExpectedAnalysis: "Project\n" + 17027 " ├─ columns: [row_number() over ( order by othertable.s2 asc) as idx, othertable.i2, othertable.s2]\n" + 17028 " └─ Sort(othertable.i2 ASC)\n" + 17029 " └─ Project\n" + 17030 " ├─ columns: [row_number() over ( order by othertable.s2 asc), othertable.i2, othertable.s2, row_number() over ( order by othertable.s2 asc) as idx]\n" + 17031 " └─ Window(row_number() over ( order by othertable.s2 ASC), othertable.i2, othertable.s2)\n" + 17032 " └─ IndexedTableAccess(othertable)\n" + 17033 " ├─ index: [othertable.i2]\n" + 17034 " ├─ filters: [{(NULL, 2)}, {(2, ∞)}]\n" + 17035 " └─ columns: [s2 i2]\n" + 17036 "", 17037 }, 17038 { 17039 Query: `SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY s2 ASC) idx, i2, s2 FROM othertable ORDER BY i2 ASC) a WHERE i2 < 2 OR i2 > 2`, 17040 ExpectedPlan: "SubqueryAlias\n" + 17041 " ├─ name: a\n" + 17042 " ├─ outerVisibility: false\n" + 17043 " ├─ isLateral: false\n" + 17044 " ├─ cacheable: true\n" + 17045 " ├─ colSet: (5-7)\n" + 17046 " ├─ tableId: 2\n" + 17047 " └─ Filter\n" + 17048 " ├─ Or\n" + 17049 " │ ├─ LessThan\n" + 17050 " │ │ ├─ othertable.i2:1!null\n" + 17051 " │ │ └─ 2 (tinyint)\n" + 17052 " │ └─ GreaterThan\n" + 17053 " │ ├─ othertable.i2:1!null\n" + 17054 " │ └─ 2 (tinyint)\n" + 17055 " └─ Project\n" + 17056 " ├─ columns: [row_number() over ( order by othertable.s2 asc):0!null as idx, othertable.i2:1!null, othertable.s2:2!null]\n" + 17057 " └─ Sort(othertable.i2:1!null ASC nullsFirst)\n" + 17058 " └─ Project\n" + 17059 " ├─ columns: [row_number() over ( order by othertable.s2 asc):0!null, othertable.i2:1!null, othertable.s2:2!null, row_number() over ( order by othertable.s2 asc):0!null as idx]\n" + 17060 " └─ Window\n" + 17061 " ├─ row_number() over ( order by othertable.s2 ASC)\n" + 17062 " ├─ othertable.i2:1!null\n" + 17063 " ├─ othertable.s2:0!null\n" + 17064 " └─ Table\n" + 17065 " ├─ name: othertable\n" + 17066 " ├─ columns: [s2 i2]\n" + 17067 " ├─ colSet: (1,2)\n" + 17068 " └─ tableId: 1\n" + 17069 "", 17070 ExpectedEstimates: "SubqueryAlias\n" + 17071 " ├─ name: a\n" + 17072 " ├─ outerVisibility: false\n" + 17073 " ├─ isLateral: false\n" + 17074 " ├─ cacheable: true\n" + 17075 " └─ Filter\n" + 17076 " ├─ ((othertable.i2 < 2) OR (othertable.i2 > 2))\n" + 17077 " └─ Project\n" + 17078 " ├─ columns: [row_number() over ( order by othertable.s2 asc) as idx, othertable.i2, othertable.s2]\n" + 17079 " └─ Sort(othertable.i2 ASC)\n" + 17080 " └─ Project\n" + 17081 " ├─ columns: [row_number() over ( order by othertable.s2 asc), othertable.i2, othertable.s2, row_number() over ( order by othertable.s2 asc) as idx]\n" + 17082 " └─ Window(row_number() over ( order by othertable.s2 ASC), othertable.i2, othertable.s2)\n" + 17083 " └─ Table\n" + 17084 " ├─ name: othertable\n" + 17085 " └─ columns: [s2 i2]\n" + 17086 "", 17087 ExpectedAnalysis: "SubqueryAlias\n" + 17088 " ├─ name: a\n" + 17089 " ├─ outerVisibility: false\n" + 17090 " ├─ isLateral: false\n" + 17091 " ├─ cacheable: true\n" + 17092 " └─ Filter\n" + 17093 " ├─ ((othertable.i2 < 2) OR (othertable.i2 > 2))\n" + 17094 " └─ Project\n" + 17095 " ├─ columns: [row_number() over ( order by othertable.s2 asc) as idx, othertable.i2, othertable.s2]\n" + 17096 " └─ Sort(othertable.i2 ASC)\n" + 17097 " └─ Project\n" + 17098 " ├─ columns: [row_number() over ( order by othertable.s2 asc), othertable.i2, othertable.s2, row_number() over ( order by othertable.s2 asc) as idx]\n" + 17099 " └─ Window(row_number() over ( order by othertable.s2 ASC), othertable.i2, othertable.s2)\n" + 17100 " └─ Table\n" + 17101 " ├─ name: othertable\n" + 17102 " └─ columns: [s2 i2]\n" + 17103 "", 17104 }, 17105 { 17106 Query: `SELECT t, n, lag(t, 1, t+1) over (partition by n) FROM bigtable`, 17107 ExpectedPlan: "Project\n" + 17108 " ├─ columns: [bigtable.t:1!null, bigtable.n:2, lag(bigtable.t, 1, (bigtable.t + 1)) over ( partition by bigtable.n rows between unbounded preceding and unbounded following):0 as lag(t, 1, t+1) over (partition by n)]\n" + 17109 " └─ Window\n" + 17110 " ├─ lag(bigtable.t, 1, (bigtable.t + 1)) over ( partition by bigtable.n ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)\n" + 17111 " ├─ bigtable.t:0!null\n" + 17112 " ├─ bigtable.n:1\n" + 17113 " └─ ProcessTable\n" + 17114 " └─ Table\n" + 17115 " ├─ name: bigtable\n" + 17116 " └─ columns: [t n]\n" + 17117 "", 17118 ExpectedEstimates: "Project\n" + 17119 " ├─ columns: [bigtable.t, bigtable.n, lag(bigtable.t, 1, (bigtable.t + 1)) over ( partition by bigtable.n rows between unbounded preceding and unbounded following) as lag(t, 1, t+1) over (partition by n)]\n" + 17120 " └─ Window(lag(bigtable.t, 1, (bigtable.t + 1)) over ( partition by bigtable.n ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), bigtable.t, bigtable.n)\n" + 17121 " └─ Table\n" + 17122 " ├─ name: bigtable\n" + 17123 " └─ columns: [t n]\n" + 17124 "", 17125 ExpectedAnalysis: "Project\n" + 17126 " ├─ columns: [bigtable.t, bigtable.n, lag(bigtable.t, 1, (bigtable.t + 1)) over ( partition by bigtable.n rows between unbounded preceding and unbounded following) as lag(t, 1, t+1) over (partition by n)]\n" + 17127 " └─ Window(lag(bigtable.t, 1, (bigtable.t + 1)) over ( partition by bigtable.n ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), bigtable.t, bigtable.n)\n" + 17128 " └─ Table\n" + 17129 " ├─ name: bigtable\n" + 17130 " └─ columns: [t n]\n" + 17131 "", 17132 }, 17133 { 17134 Query: `select i, row_number() over (w3) from mytable window w1 as (w2), w2 as (), w3 as (w1)`, 17135 ExpectedPlan: "Project\n" + 17136 " ├─ columns: [mytable.i:1!null, row_number() over ( rows between unbounded preceding and unbounded following):0!null as row_number() over (w3)]\n" + 17137 " └─ Window\n" + 17138 " ├─ row_number() over ( ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)\n" + 17139 " ├─ mytable.i:0!null\n" + 17140 " └─ ProcessTable\n" + 17141 " └─ Table\n" + 17142 " ├─ name: mytable\n" + 17143 " └─ columns: [i]\n" + 17144 "", 17145 ExpectedEstimates: "Project\n" + 17146 " ├─ columns: [mytable.i, row_number() over ( rows between unbounded preceding and unbounded following) as row_number() over (w3)]\n" + 17147 " └─ Window(row_number() over ( ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), mytable.i)\n" + 17148 " └─ Table\n" + 17149 " ├─ name: mytable\n" + 17150 " └─ columns: [i]\n" + 17151 "", 17152 ExpectedAnalysis: "Project\n" + 17153 " ├─ columns: [mytable.i, row_number() over ( rows between unbounded preceding and unbounded following) as row_number() over (w3)]\n" + 17154 " └─ Window(row_number() over ( ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), mytable.i)\n" + 17155 " └─ Table\n" + 17156 " ├─ name: mytable\n" + 17157 " └─ columns: [i]\n" + 17158 "", 17159 }, 17160 { 17161 Query: `select i, row_number() over (w1 partition by s) from mytable window w1 as (order by i asc)`, 17162 ExpectedPlan: "Project\n" + 17163 " ├─ columns: [mytable.i:1!null, row_number() over ( partition by mytable.s order by mytable.i asc rows between unbounded preceding and unbounded following):0!null as row_number() over (w1 partition by s)]\n" + 17164 " └─ Window\n" + 17165 " ├─ row_number() over ( partition by mytable.s order by mytable.i ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)\n" + 17166 " ├─ mytable.i:0!null\n" + 17167 " └─ ProcessTable\n" + 17168 " └─ Table\n" + 17169 " ├─ name: mytable\n" + 17170 " └─ columns: [i s]\n" + 17171 "", 17172 ExpectedEstimates: "Project\n" + 17173 " ├─ columns: [mytable.i, row_number() over ( partition by mytable.s order by mytable.i asc rows between unbounded preceding and unbounded following) as row_number() over (w1 partition by s)]\n" + 17174 " └─ Window(row_number() over ( partition by mytable.s order by mytable.i ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), mytable.i)\n" + 17175 " └─ Table\n" + 17176 " ├─ name: mytable\n" + 17177 " └─ columns: [i s]\n" + 17178 "", 17179 ExpectedAnalysis: "Project\n" + 17180 " ├─ columns: [mytable.i, row_number() over ( partition by mytable.s order by mytable.i asc rows between unbounded preceding and unbounded following) as row_number() over (w1 partition by s)]\n" + 17181 " └─ Window(row_number() over ( partition by mytable.s order by mytable.i ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), mytable.i)\n" + 17182 " └─ Table\n" + 17183 " ├─ name: mytable\n" + 17184 " └─ columns: [i s]\n" + 17185 "", 17186 }, 17187 { 17188 Query: `DELETE FROM two_pk WHERE c1 > 1`, 17189 ExpectedPlan: "RowUpdateAccumulator\n" + 17190 " └─ Delete\n" + 17191 " └─ Filter\n" + 17192 " ├─ GreaterThan\n" + 17193 " │ ├─ two_pk.c1:2!null\n" + 17194 " │ └─ 1 (tinyint)\n" + 17195 " └─ ProcessTable\n" + 17196 " └─ Table\n" + 17197 " ├─ name: two_pk\n" + 17198 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 17199 "", 17200 }, 17201 { 17202 Query: `DELETE FROM two_pk WHERE pk1 = 1 AND pk2 = 2`, 17203 ExpectedPlan: "RowUpdateAccumulator\n" + 17204 " └─ Delete\n" + 17205 " └─ IndexedTableAccess(two_pk)\n" + 17206 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 17207 " ├─ static: [{[1, 1], [2, 2]}]\n" + 17208 " ├─ colSet: (1-7)\n" + 17209 " ├─ tableId: 1\n" + 17210 " └─ Table\n" + 17211 " ├─ name: two_pk\n" + 17212 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 17213 "", 17214 }, 17215 { 17216 Query: `UPDATE two_pk SET c1 = 1 WHERE c1 > 1`, 17217 ExpectedPlan: "RowUpdateAccumulator\n" + 17218 " └─ Update\n" + 17219 " └─ UpdateSource(SET two_pk.c1:2!null = 1 (tinyint))\n" + 17220 " └─ Filter\n" + 17221 " ├─ GreaterThan\n" + 17222 " │ ├─ two_pk.c1:2!null\n" + 17223 " │ └─ 1 (tinyint)\n" + 17224 " └─ ProcessTable\n" + 17225 " └─ Table\n" + 17226 " ├─ name: two_pk\n" + 17227 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 17228 "", 17229 }, 17230 { 17231 Query: `UPDATE two_pk SET c1 = 1 WHERE pk1 = 1 AND pk2 = 2`, 17232 ExpectedPlan: "RowUpdateAccumulator\n" + 17233 " └─ Update\n" + 17234 " └─ UpdateSource(SET two_pk.c1:2!null = 1 (tinyint))\n" + 17235 " └─ IndexedTableAccess(two_pk)\n" + 17236 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 17237 " ├─ static: [{[1, 1], [2, 2]}]\n" + 17238 " ├─ colSet: (1-7)\n" + 17239 " ├─ tableId: 1\n" + 17240 " └─ Table\n" + 17241 " ├─ name: two_pk\n" + 17242 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 17243 "", 17244 }, 17245 { 17246 Query: `UPDATE /*+ JOIN_ORDER(two_pk, one_pk) */ one_pk JOIN two_pk on one_pk.pk = two_pk.pk1 SET two_pk.c1 = two_pk.c1 + 1`, 17247 ExpectedPlan: "RowUpdateAccumulator\n" + 17248 " └─ Update\n" + 17249 " └─ Update Join\n" + 17250 " └─ UpdateSource(SET two_pk.c1:8!null = (two_pk.c1:8!null + 1 (tinyint)))\n" + 17251 " └─ MergeJoin\n" + 17252 " ├─ cmp: Eq\n" + 17253 " │ ├─ one_pk.pk:0!null\n" + 17254 " │ └─ two_pk.pk1:6!null\n" + 17255 " ├─ IndexedTableAccess(one_pk)\n" + 17256 " │ ├─ index: [one_pk.pk]\n" + 17257 " │ ├─ static: [{[NULL, ∞)}]\n" + 17258 " │ ├─ colSet: (1-6)\n" + 17259 " │ ├─ tableId: 1\n" + 17260 " │ └─ Table\n" + 17261 " │ ├─ name: one_pk\n" + 17262 " │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 17263 " └─ IndexedTableAccess(two_pk)\n" + 17264 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 17265 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 17266 " ├─ colSet: (7-13)\n" + 17267 " ├─ tableId: 2\n" + 17268 " └─ Table\n" + 17269 " ├─ name: two_pk\n" + 17270 " └─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 17271 "", 17272 }, 17273 { 17274 Query: `UPDATE one_pk INNER JOIN (SELECT * FROM two_pk) as t2 on one_pk.pk = t2.pk1 SET one_pk.c1 = one_pk.c1 + 1, one_pk.c2 = one_pk.c2 + 1`, 17275 ExpectedPlan: "RowUpdateAccumulator\n" + 17276 " └─ Update\n" + 17277 " └─ Update Join\n" + 17278 " └─ UpdateSource(SET one_pk.c1:1 = (one_pk.c1:1 + 1 (tinyint)),SET one_pk.c2:2 = (one_pk.c2:2 + 1 (tinyint)))\n" + 17279 " └─ Project\n" + 17280 " ├─ columns: [one_pk.pk:7!null, one_pk.c1:8, one_pk.c2:9, one_pk.c3:10, one_pk.c4:11, one_pk.c5:12, t2.pk1:0!null, t2.pk2:1!null, t2.c1:2!null, t2.c2:3!null, t2.c3:4!null, t2.c4:5!null, t2.c5:6!null]\n" + 17281 " └─ HashJoin\n" + 17282 " ├─ Eq\n" + 17283 " │ ├─ one_pk.pk:7!null\n" + 17284 " │ └─ t2.pk1:0!null\n" + 17285 " ├─ SubqueryAlias\n" + 17286 " │ ├─ name: t2\n" + 17287 " │ ├─ outerVisibility: false\n" + 17288 " │ ├─ isLateral: false\n" + 17289 " │ ├─ cacheable: true\n" + 17290 " │ ├─ colSet: (14-20)\n" + 17291 " │ ├─ tableId: 3\n" + 17292 " │ └─ Table\n" + 17293 " │ ├─ name: two_pk\n" + 17294 " │ ├─ columns: [pk1 pk2 c1 c2 c3 c4 c5]\n" + 17295 " │ ├─ colSet: (7-13)\n" + 17296 " │ └─ tableId: 2\n" + 17297 " └─ HashLookup\n" + 17298 " ├─ left-key: TUPLE(t2.pk1:0!null)\n" + 17299 " ├─ right-key: TUPLE(one_pk.pk:0!null)\n" + 17300 " └─ ProcessTable\n" + 17301 " └─ Table\n" + 17302 " ├─ name: one_pk\n" + 17303 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 17304 "", 17305 }, 17306 { 17307 Query: `SELECT a.* FROM invert_pk as a, invert_pk as b WHERE a.y = b.z`, 17308 ExpectedPlan: "Project\n" + 17309 " ├─ columns: [a.x:1!null, a.y:2!null, a.z:3!null]\n" + 17310 " └─ InnerJoin\n" + 17311 " ├─ Eq\n" + 17312 " │ ├─ a.y:2!null\n" + 17313 " │ └─ b.z:0!null\n" + 17314 " ├─ TableAlias(b)\n" + 17315 " │ └─ ProcessTable\n" + 17316 " │ └─ Table\n" + 17317 " │ ├─ name: invert_pk\n" + 17318 " │ └─ columns: [z]\n" + 17319 " └─ TableAlias(a)\n" + 17320 " └─ Table\n" + 17321 " ├─ name: invert_pk\n" + 17322 " ├─ columns: [x y z]\n" + 17323 " ├─ colSet: (1-3)\n" + 17324 " └─ tableId: 1\n" + 17325 "", 17326 ExpectedEstimates: "Project\n" + 17327 " ├─ columns: [a.x, a.y, a.z]\n" + 17328 " └─ InnerJoin (estimated cost=10.090 rows=3)\n" + 17329 " ├─ (a.y = b.z)\n" + 17330 " ├─ TableAlias(b)\n" + 17331 " │ └─ Table\n" + 17332 " │ ├─ name: invert_pk\n" + 17333 " │ └─ columns: [z]\n" + 17334 " └─ TableAlias(a)\n" + 17335 " └─ Table\n" + 17336 " ├─ name: invert_pk\n" + 17337 " └─ columns: [x y z]\n" + 17338 "", 17339 ExpectedAnalysis: "Project\n" + 17340 " ├─ columns: [a.x, a.y, a.z]\n" + 17341 " └─ InnerJoin (estimated cost=10.090 rows=3) (actual rows=3 loops=1)\n" + 17342 " ├─ (a.y = b.z)\n" + 17343 " ├─ TableAlias(b)\n" + 17344 " │ └─ Table\n" + 17345 " │ ├─ name: invert_pk\n" + 17346 " │ └─ columns: [z]\n" + 17347 " └─ TableAlias(a)\n" + 17348 " └─ Table\n" + 17349 " ├─ name: invert_pk\n" + 17350 " └─ columns: [x y z]\n" + 17351 "", 17352 }, 17353 { 17354 Query: `SELECT a.* FROM invert_pk as a, invert_pk as b WHERE a.y = b.z AND a.z = 2`, 17355 ExpectedPlan: "Project\n" + 17356 " ├─ columns: [a.x:1!null, a.y:2!null, a.z:3!null]\n" + 17357 " └─ InnerJoin\n" + 17358 " ├─ Eq\n" + 17359 " │ ├─ a.y:2!null\n" + 17360 " │ └─ b.z:0!null\n" + 17361 " ├─ TableAlias(b)\n" + 17362 " │ └─ ProcessTable\n" + 17363 " │ └─ Table\n" + 17364 " │ ├─ name: invert_pk\n" + 17365 " │ └─ columns: [z]\n" + 17366 " └─ Filter\n" + 17367 " ├─ Eq\n" + 17368 " │ ├─ a.z:2!null\n" + 17369 " │ └─ 2 (tinyint)\n" + 17370 " └─ TableAlias(a)\n" + 17371 " └─ Table\n" + 17372 " ├─ name: invert_pk\n" + 17373 " ├─ columns: [x y z]\n" + 17374 " ├─ colSet: (1-3)\n" + 17375 " └─ tableId: 1\n" + 17376 "", 17377 ExpectedEstimates: "Project\n" + 17378 " ├─ columns: [a.x, a.y, a.z]\n" + 17379 " └─ InnerJoin (estimated cost=7.060 rows=2)\n" + 17380 " ├─ (a.y = b.z)\n" + 17381 " ├─ TableAlias(b)\n" + 17382 " │ └─ Table\n" + 17383 " │ ├─ name: invert_pk\n" + 17384 " │ └─ columns: [z]\n" + 17385 " └─ Filter\n" + 17386 " ├─ (a.z = 2)\n" + 17387 " └─ TableAlias(a)\n" + 17388 " └─ Table\n" + 17389 " ├─ name: invert_pk\n" + 17390 " └─ columns: [x y z]\n" + 17391 "", 17392 ExpectedAnalysis: "Project\n" + 17393 " ├─ columns: [a.x, a.y, a.z]\n" + 17394 " └─ InnerJoin (estimated cost=7.060 rows=2) (actual rows=1 loops=1)\n" + 17395 " ├─ (a.y = b.z)\n" + 17396 " ├─ TableAlias(b)\n" + 17397 " │ └─ Table\n" + 17398 " │ ├─ name: invert_pk\n" + 17399 " │ └─ columns: [z]\n" + 17400 " └─ Filter\n" + 17401 " ├─ (a.z = 2)\n" + 17402 " └─ TableAlias(a)\n" + 17403 " └─ Table\n" + 17404 " ├─ name: invert_pk\n" + 17405 " └─ columns: [x y z]\n" + 17406 "", 17407 }, 17408 { 17409 Query: `SELECT * FROM invert_pk WHERE y = 0`, 17410 ExpectedPlan: "IndexedTableAccess(invert_pk)\n" + 17411 " ├─ index: [invert_pk.y,invert_pk.z,invert_pk.x]\n" + 17412 " ├─ static: [{[0, 0], [NULL, ∞), [NULL, ∞)}]\n" + 17413 " ├─ colSet: (1-3)\n" + 17414 " ├─ tableId: 1\n" + 17415 " └─ Table\n" + 17416 " ├─ name: invert_pk\n" + 17417 " └─ columns: [x y z]\n" + 17418 "", 17419 ExpectedEstimates: "IndexedTableAccess(invert_pk)\n" + 17420 " ├─ index: [invert_pk.y,invert_pk.z,invert_pk.x]\n" + 17421 " ├─ filters: [{[0, 0], [NULL, ∞), [NULL, ∞)}]\n" + 17422 " └─ columns: [x y z]\n" + 17423 "", 17424 ExpectedAnalysis: "IndexedTableAccess(invert_pk)\n" + 17425 " ├─ index: [invert_pk.y,invert_pk.z,invert_pk.x]\n" + 17426 " ├─ filters: [{[0, 0], [NULL, ∞), [NULL, ∞)}]\n" + 17427 " └─ columns: [x y z]\n" + 17428 "", 17429 }, 17430 { 17431 Query: `SELECT * FROM invert_pk WHERE y >= 0`, 17432 ExpectedPlan: "IndexedTableAccess(invert_pk)\n" + 17433 " ├─ index: [invert_pk.y,invert_pk.z,invert_pk.x]\n" + 17434 " ├─ static: [{[0, ∞), [NULL, ∞), [NULL, ∞)}]\n" + 17435 " ├─ colSet: (1-3)\n" + 17436 " ├─ tableId: 1\n" + 17437 " └─ Table\n" + 17438 " ├─ name: invert_pk\n" + 17439 " └─ columns: [x y z]\n" + 17440 "", 17441 ExpectedEstimates: "IndexedTableAccess(invert_pk)\n" + 17442 " ├─ index: [invert_pk.y,invert_pk.z,invert_pk.x]\n" + 17443 " ├─ filters: [{[0, ∞), [NULL, ∞), [NULL, ∞)}]\n" + 17444 " └─ columns: [x y z]\n" + 17445 "", 17446 ExpectedAnalysis: "IndexedTableAccess(invert_pk)\n" + 17447 " ├─ index: [invert_pk.y,invert_pk.z,invert_pk.x]\n" + 17448 " ├─ filters: [{[0, ∞), [NULL, ∞), [NULL, ∞)}]\n" + 17449 " └─ columns: [x y z]\n" + 17450 "", 17451 }, 17452 { 17453 Query: `SELECT * FROM invert_pk WHERE y >= 0 AND z < 1`, 17454 ExpectedPlan: "IndexedTableAccess(invert_pk)\n" + 17455 " ├─ index: [invert_pk.y,invert_pk.z,invert_pk.x]\n" + 17456 " ├─ static: [{[0, ∞), (NULL, 1), [NULL, ∞)}]\n" + 17457 " ├─ colSet: (1-3)\n" + 17458 " ├─ tableId: 1\n" + 17459 " └─ Table\n" + 17460 " ├─ name: invert_pk\n" + 17461 " └─ columns: [x y z]\n" + 17462 "", 17463 ExpectedEstimates: "IndexedTableAccess(invert_pk)\n" + 17464 " ├─ index: [invert_pk.y,invert_pk.z,invert_pk.x]\n" + 17465 " ├─ filters: [{[0, ∞), (NULL, 1), [NULL, ∞)}]\n" + 17466 " └─ columns: [x y z]\n" + 17467 "", 17468 ExpectedAnalysis: "IndexedTableAccess(invert_pk)\n" + 17469 " ├─ index: [invert_pk.y,invert_pk.z,invert_pk.x]\n" + 17470 " ├─ filters: [{[0, ∞), (NULL, 1), [NULL, ∞)}]\n" + 17471 " └─ columns: [x y z]\n" + 17472 "", 17473 }, 17474 { 17475 Query: `SELECT * FROM one_pk WHERE pk IN (1)`, 17476 ExpectedPlan: "IndexedTableAccess(one_pk)\n" + 17477 " ├─ index: [one_pk.pk]\n" + 17478 " ├─ static: [{[1, 1]}]\n" + 17479 " ├─ colSet: (1-6)\n" + 17480 " ├─ tableId: 1\n" + 17481 " └─ Table\n" + 17482 " ├─ name: one_pk\n" + 17483 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 17484 "", 17485 ExpectedEstimates: "IndexedTableAccess(one_pk)\n" + 17486 " ├─ index: [one_pk.pk]\n" + 17487 " ├─ filters: [{[1, 1]}]\n" + 17488 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 17489 "", 17490 ExpectedAnalysis: "IndexedTableAccess(one_pk)\n" + 17491 " ├─ index: [one_pk.pk]\n" + 17492 " ├─ filters: [{[1, 1]}]\n" + 17493 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 17494 "", 17495 }, 17496 { 17497 Query: `SELECT a.* FROM one_pk a CROSS JOIN one_pk c LEFT JOIN one_pk b ON b.pk = c.pk and b.pk = a.pk`, 17498 ExpectedPlan: "Project\n" + 17499 " ├─ columns: [a.pk:1!null, a.c1:2, a.c2:3, a.c3:4, a.c4:5, a.c5:6]\n" + 17500 " └─ LeftOuterHashJoin\n" + 17501 " ├─ AND\n" + 17502 " │ ├─ Eq\n" + 17503 " │ │ ├─ b.pk:7!null\n" + 17504 " │ │ └─ c.pk:0!null\n" + 17505 " │ └─ Eq\n" + 17506 " │ ├─ b.pk:7!null\n" + 17507 " │ └─ a.pk:1!null\n" + 17508 " ├─ CrossJoin\n" + 17509 " │ ├─ TableAlias(c)\n" + 17510 " │ │ └─ ProcessTable\n" + 17511 " │ │ └─ Table\n" + 17512 " │ │ ├─ name: one_pk\n" + 17513 " │ │ └─ columns: [pk]\n" + 17514 " │ └─ TableAlias(a)\n" + 17515 " │ └─ Table\n" + 17516 " │ ├─ name: one_pk\n" + 17517 " │ ├─ columns: [pk c1 c2 c3 c4 c5]\n" + 17518 " │ ├─ colSet: (1-6)\n" + 17519 " │ └─ tableId: 1\n" + 17520 " └─ HashLookup\n" + 17521 " ├─ left-key: TUPLE(c.pk:0!null, a.pk:1!null)\n" + 17522 " ├─ right-key: TUPLE(b.pk:0!null, b.pk:0!null)\n" + 17523 " └─ TableAlias(b)\n" + 17524 " └─ Table\n" + 17525 " ├─ name: one_pk\n" + 17526 " ├─ columns: [pk]\n" + 17527 " ├─ colSet: (13-18)\n" + 17528 " └─ tableId: 3\n" + 17529 "", 17530 ExpectedEstimates: "Project\n" + 17531 " ├─ columns: [a.pk, a.c1, a.c2, a.c3, a.c4, a.c5]\n" + 17532 " └─ LeftOuterHashJoin (estimated cost=17.100 rows=5)\n" + 17533 " ├─ ((b.pk = c.pk) AND (b.pk = a.pk))\n" + 17534 " ├─ CrossJoin (estimated cost=17.160 rows=5)\n" + 17535 " │ ├─ TableAlias(c)\n" + 17536 " │ │ └─ Table\n" + 17537 " │ │ ├─ name: one_pk\n" + 17538 " │ │ └─ columns: [pk]\n" + 17539 " │ └─ TableAlias(a)\n" + 17540 " │ └─ Table\n" + 17541 " │ ├─ name: one_pk\n" + 17542 " │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 17543 " └─ HashLookup\n" + 17544 " ├─ left-key: (c.pk, a.pk)\n" + 17545 " ├─ right-key: (b.pk, b.pk)\n" + 17546 " └─ TableAlias(b)\n" + 17547 " └─ Table\n" + 17548 " ├─ name: one_pk\n" + 17549 " └─ columns: [pk]\n" + 17550 "", 17551 ExpectedAnalysis: "Project\n" + 17552 " ├─ columns: [a.pk, a.c1, a.c2, a.c3, a.c4, a.c5]\n" + 17553 " └─ LeftOuterHashJoin (estimated cost=17.100 rows=5) (actual rows=16 loops=1)\n" + 17554 " ├─ ((b.pk = c.pk) AND (b.pk = a.pk))\n" + 17555 " ├─ CrossJoin (estimated cost=17.160 rows=5) (actual rows=16 loops=1)\n" + 17556 " │ ├─ TableAlias(c)\n" + 17557 " │ │ └─ Table\n" + 17558 " │ │ ├─ name: one_pk\n" + 17559 " │ │ └─ columns: [pk]\n" + 17560 " │ └─ TableAlias(a)\n" + 17561 " │ └─ Table\n" + 17562 " │ ├─ name: one_pk\n" + 17563 " │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 17564 " └─ HashLookup\n" + 17565 " ├─ left-key: (c.pk, a.pk)\n" + 17566 " ├─ right-key: (b.pk, b.pk)\n" + 17567 " └─ TableAlias(b)\n" + 17568 " └─ Table\n" + 17569 " ├─ name: one_pk\n" + 17570 " └─ columns: [pk]\n" + 17571 "", 17572 }, 17573 { 17574 Query: `SELECT a.* FROM one_pk a CROSS JOIN one_pk c RIGHT JOIN one_pk b ON b.pk = c.pk and b.pk = a.pk`, 17575 ExpectedPlan: "Project\n" + 17576 " ├─ columns: [a.pk:2!null, a.c1:3, a.c2:4, a.c3:5, a.c4:6, a.c5:7]\n" + 17577 " └─ LeftOuterHashJoin\n" + 17578 " ├─ AND\n" + 17579 " │ ├─ Eq\n" + 17580 " │ │ ├─ b.pk:0!null\n" + 17581 " │ │ └─ c.pk:1!null\n" + 17582 " │ └─ Eq\n" + 17583 " │ ├─ b.pk:0!null\n" + 17584 " │ └─ a.pk:2!null\n" + 17585 " ├─ TableAlias(b)\n" + 17586 " │ └─ ProcessTable\n" + 17587 " │ └─ Table\n" + 17588 " │ ├─ name: one_pk\n" + 17589 " │ └─ columns: [pk]\n" + 17590 " └─ HashLookup\n" + 17591 " ├─ left-key: TUPLE(b.pk:0!null, b.pk:0!null)\n" + 17592 " ├─ right-key: TUPLE(c.pk:0!null, a.pk:1!null)\n" + 17593 " └─ CrossJoin\n" + 17594 " ├─ TableAlias(c)\n" + 17595 " │ └─ Table\n" + 17596 " │ ├─ name: one_pk\n" + 17597 " │ ├─ columns: [pk]\n" + 17598 " │ ├─ colSet: (7-12)\n" + 17599 " │ └─ tableId: 2\n" + 17600 " └─ TableAlias(a)\n" + 17601 " └─ Table\n" + 17602 " ├─ name: one_pk\n" + 17603 " ├─ columns: [pk c1 c2 c3 c4 c5]\n" + 17604 " ├─ colSet: (1-6)\n" + 17605 " └─ tableId: 1\n" + 17606 "", 17607 ExpectedEstimates: "Project\n" + 17608 " ├─ columns: [a.pk, a.c1, a.c2, a.c3, a.c4, a.c5]\n" + 17609 " └─ LeftOuterHashJoin (estimated cost=19.090 rows=5)\n" + 17610 " ├─ ((b.pk = c.pk) AND (b.pk = a.pk))\n" + 17611 " ├─ TableAlias(b)\n" + 17612 " │ └─ Table\n" + 17613 " │ ├─ name: one_pk\n" + 17614 " │ └─ columns: [pk]\n" + 17615 " └─ HashLookup\n" + 17616 " ├─ left-key: (b.pk, b.pk)\n" + 17617 " ├─ right-key: (c.pk, a.pk)\n" + 17618 " └─ CrossJoin\n" + 17619 " ├─ TableAlias(c)\n" + 17620 " │ └─ Table\n" + 17621 " │ ├─ name: one_pk\n" + 17622 " │ └─ columns: [pk]\n" + 17623 " └─ TableAlias(a)\n" + 17624 " └─ Table\n" + 17625 " ├─ name: one_pk\n" + 17626 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 17627 "", 17628 ExpectedAnalysis: "Project\n" + 17629 " ├─ columns: [a.pk, a.c1, a.c2, a.c3, a.c4, a.c5]\n" + 17630 " └─ LeftOuterHashJoin (estimated cost=19.090 rows=5) (actual rows=4 loops=1)\n" + 17631 " ├─ ((b.pk = c.pk) AND (b.pk = a.pk))\n" + 17632 " ├─ TableAlias(b)\n" + 17633 " │ └─ Table\n" + 17634 " │ ├─ name: one_pk\n" + 17635 " │ └─ columns: [pk]\n" + 17636 " └─ HashLookup\n" + 17637 " ├─ left-key: (b.pk, b.pk)\n" + 17638 " ├─ right-key: (c.pk, a.pk)\n" + 17639 " └─ CrossJoin\n" + 17640 " ├─ TableAlias(c)\n" + 17641 " │ └─ Table\n" + 17642 " │ ├─ name: one_pk\n" + 17643 " │ └─ columns: [pk]\n" + 17644 " └─ TableAlias(a)\n" + 17645 " └─ Table\n" + 17646 " ├─ name: one_pk\n" + 17647 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 17648 "", 17649 }, 17650 { 17651 Query: `SELECT a.* FROM one_pk a CROSS JOIN one_pk c INNER JOIN one_pk b ON b.pk = c.pk and b.pk = a.pk`, 17652 ExpectedPlan: "Project\n" + 17653 " ├─ columns: [a.pk:2!null, a.c1:3, a.c2:4, a.c3:5, a.c4:6, a.c5:7]\n" + 17654 " └─ LookupJoin\n" + 17655 " ├─ Eq\n" + 17656 " │ ├─ a.pk:2!null\n" + 17657 " │ └─ c.pk:0!null\n" + 17658 " ├─ MergeJoin\n" + 17659 " │ ├─ cmp: Eq\n" + 17660 " │ │ ├─ c.pk:0!null\n" + 17661 " │ │ └─ b.pk:1!null\n" + 17662 " │ ├─ TableAlias(c)\n" + 17663 " │ │ └─ IndexedTableAccess(one_pk)\n" + 17664 " │ │ ├─ index: [one_pk.pk]\n" + 17665 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 17666 " │ │ ├─ colSet: (7-12)\n" + 17667 " │ │ ├─ tableId: 2\n" + 17668 " │ │ └─ Table\n" + 17669 " │ │ ├─ name: one_pk\n" + 17670 " │ │ └─ columns: [pk]\n" + 17671 " │ └─ TableAlias(b)\n" + 17672 " │ └─ IndexedTableAccess(one_pk)\n" + 17673 " │ ├─ index: [one_pk.pk]\n" + 17674 " │ ├─ static: [{[NULL, ∞)}]\n" + 17675 " │ ├─ colSet: (13-18)\n" + 17676 " │ ├─ tableId: 3\n" + 17677 " │ └─ Table\n" + 17678 " │ ├─ name: one_pk\n" + 17679 " │ └─ columns: [pk]\n" + 17680 " └─ TableAlias(a)\n" + 17681 " └─ IndexedTableAccess(one_pk)\n" + 17682 " ├─ index: [one_pk.pk]\n" + 17683 " ├─ keys: [b.pk:1!null]\n" + 17684 " ├─ colSet: (1-6)\n" + 17685 " ├─ tableId: 1\n" + 17686 " └─ Table\n" + 17687 " ├─ name: one_pk\n" + 17688 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 17689 "", 17690 ExpectedEstimates: "Project\n" + 17691 " ├─ columns: [a.pk, a.c1, a.c2, a.c3, a.c4, a.c5]\n" + 17692 " └─ LookupJoin (estimated cost=13.200 rows=4)\n" + 17693 " ├─ (a.pk = c.pk)\n" + 17694 " ├─ MergeJoin (estimated cost=8.120 rows=4)\n" + 17695 " │ ├─ cmp: (c.pk = b.pk)\n" + 17696 " │ ├─ TableAlias(c)\n" + 17697 " │ │ └─ IndexedTableAccess(one_pk)\n" + 17698 " │ │ ├─ index: [one_pk.pk]\n" + 17699 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 17700 " │ │ └─ columns: [pk]\n" + 17701 " │ └─ TableAlias(b)\n" + 17702 " │ └─ IndexedTableAccess(one_pk)\n" + 17703 " │ ├─ index: [one_pk.pk]\n" + 17704 " │ ├─ filters: [{[NULL, ∞)}]\n" + 17705 " │ └─ columns: [pk]\n" + 17706 " └─ TableAlias(a)\n" + 17707 " └─ IndexedTableAccess(one_pk)\n" + 17708 " ├─ index: [one_pk.pk]\n" + 17709 " ├─ columns: [pk c1 c2 c3 c4 c5]\n" + 17710 " └─ keys: b.pk\n" + 17711 "", 17712 ExpectedAnalysis: "Project\n" + 17713 " ├─ columns: [a.pk, a.c1, a.c2, a.c3, a.c4, a.c5]\n" + 17714 " └─ LookupJoin (estimated cost=13.200 rows=4) (actual rows=4 loops=1)\n" + 17715 " ├─ (a.pk = c.pk)\n" + 17716 " ├─ MergeJoin (estimated cost=8.120 rows=4) (actual rows=4 loops=1)\n" + 17717 " │ ├─ cmp: (c.pk = b.pk)\n" + 17718 " │ ├─ TableAlias(c)\n" + 17719 " │ │ └─ IndexedTableAccess(one_pk)\n" + 17720 " │ │ ├─ index: [one_pk.pk]\n" + 17721 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 17722 " │ │ └─ columns: [pk]\n" + 17723 " │ └─ TableAlias(b)\n" + 17724 " │ └─ IndexedTableAccess(one_pk)\n" + 17725 " │ ├─ index: [one_pk.pk]\n" + 17726 " │ ├─ filters: [{[NULL, ∞)}]\n" + 17727 " │ └─ columns: [pk]\n" + 17728 " └─ TableAlias(a)\n" + 17729 " └─ IndexedTableAccess(one_pk)\n" + 17730 " ├─ index: [one_pk.pk]\n" + 17731 " ├─ columns: [pk c1 c2 c3 c4 c5]\n" + 17732 " └─ keys: b.pk\n" + 17733 "", 17734 }, 17735 { 17736 Query: `SELECT a.* FROM one_pk a CROSS JOIN one_pk b INNER JOIN one_pk c ON b.pk = c.pk LEFT JOIN one_pk d ON c.pk = d.pk`, 17737 ExpectedPlan: "Project\n" + 17738 " ├─ columns: [a.pk:2!null, a.c1:3, a.c2:4, a.c3:5, a.c4:6, a.c5:7]\n" + 17739 " └─ LeftOuterHashJoin\n" + 17740 " ├─ Eq\n" + 17741 " │ ├─ c.pk:1!null\n" + 17742 " │ └─ d.pk:8!null\n" + 17743 " ├─ CrossJoin\n" + 17744 " │ ├─ MergeJoin\n" + 17745 " │ │ ├─ cmp: Eq\n" + 17746 " │ │ │ ├─ b.pk:0!null\n" + 17747 " │ │ │ └─ c.pk:1!null\n" + 17748 " │ │ ├─ TableAlias(b)\n" + 17749 " │ │ │ └─ IndexedTableAccess(one_pk)\n" + 17750 " │ │ │ ├─ index: [one_pk.pk]\n" + 17751 " │ │ │ ├─ static: [{[NULL, ∞)}]\n" + 17752 " │ │ │ ├─ colSet: (7-12)\n" + 17753 " │ │ │ ├─ tableId: 2\n" + 17754 " │ │ │ └─ Table\n" + 17755 " │ │ │ ├─ name: one_pk\n" + 17756 " │ │ │ └─ columns: [pk]\n" + 17757 " │ │ └─ TableAlias(c)\n" + 17758 " │ │ └─ IndexedTableAccess(one_pk)\n" + 17759 " │ │ ├─ index: [one_pk.pk]\n" + 17760 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 17761 " │ │ ├─ colSet: (13-18)\n" + 17762 " │ │ ├─ tableId: 3\n" + 17763 " │ │ └─ Table\n" + 17764 " │ │ ├─ name: one_pk\n" + 17765 " │ │ └─ columns: [pk]\n" + 17766 " │ └─ TableAlias(a)\n" + 17767 " │ └─ ProcessTable\n" + 17768 " │ └─ Table\n" + 17769 " │ ├─ name: one_pk\n" + 17770 " │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 17771 " └─ HashLookup\n" + 17772 " ├─ left-key: TUPLE(c.pk:1!null)\n" + 17773 " ├─ right-key: TUPLE(d.pk:0!null)\n" + 17774 " └─ TableAlias(d)\n" + 17775 " └─ Table\n" + 17776 " ├─ name: one_pk\n" + 17777 " ├─ columns: [pk]\n" + 17778 " ├─ colSet: (19-24)\n" + 17779 " └─ tableId: 4\n" + 17780 "", 17781 ExpectedEstimates: "Project\n" + 17782 " ├─ columns: [a.pk, a.c1, a.c2, a.c3, a.c4, a.c5]\n" + 17783 " └─ LeftOuterHashJoin (estimated cost=17.100 rows=5)\n" + 17784 " ├─ (c.pk = d.pk)\n" + 17785 " ├─ CrossJoin (estimated cost=17.160 rows=5)\n" + 17786 " │ ├─ MergeJoin (estimated cost=8.120 rows=4)\n" + 17787 " │ │ ├─ cmp: (b.pk = c.pk)\n" + 17788 " │ │ ├─ TableAlias(b)\n" + 17789 " │ │ │ └─ IndexedTableAccess(one_pk)\n" + 17790 " │ │ │ ├─ index: [one_pk.pk]\n" + 17791 " │ │ │ ├─ filters: [{[NULL, ∞)}]\n" + 17792 " │ │ │ └─ columns: [pk]\n" + 17793 " │ │ └─ TableAlias(c)\n" + 17794 " │ │ └─ IndexedTableAccess(one_pk)\n" + 17795 " │ │ ├─ index: [one_pk.pk]\n" + 17796 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 17797 " │ │ └─ columns: [pk]\n" + 17798 " │ └─ TableAlias(a)\n" + 17799 " │ └─ Table\n" + 17800 " │ ├─ name: one_pk\n" + 17801 " │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 17802 " └─ HashLookup\n" + 17803 " ├─ left-key: (c.pk)\n" + 17804 " ├─ right-key: (d.pk)\n" + 17805 " └─ TableAlias(d)\n" + 17806 " └─ Table\n" + 17807 " ├─ name: one_pk\n" + 17808 " └─ columns: [pk]\n" + 17809 "", 17810 ExpectedAnalysis: "Project\n" + 17811 " ├─ columns: [a.pk, a.c1, a.c2, a.c3, a.c4, a.c5]\n" + 17812 " └─ LeftOuterHashJoin (estimated cost=17.100 rows=5) (actual rows=16 loops=1)\n" + 17813 " ├─ (c.pk = d.pk)\n" + 17814 " ├─ CrossJoin (estimated cost=17.160 rows=5) (actual rows=16 loops=1)\n" + 17815 " │ ├─ MergeJoin (estimated cost=8.120 rows=4) (actual rows=4 loops=1)\n" + 17816 " │ │ ├─ cmp: (b.pk = c.pk)\n" + 17817 " │ │ ├─ TableAlias(b)\n" + 17818 " │ │ │ └─ IndexedTableAccess(one_pk)\n" + 17819 " │ │ │ ├─ index: [one_pk.pk]\n" + 17820 " │ │ │ ├─ filters: [{[NULL, ∞)}]\n" + 17821 " │ │ │ └─ columns: [pk]\n" + 17822 " │ │ └─ TableAlias(c)\n" + 17823 " │ │ └─ IndexedTableAccess(one_pk)\n" + 17824 " │ │ ├─ index: [one_pk.pk]\n" + 17825 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 17826 " │ │ └─ columns: [pk]\n" + 17827 " │ └─ TableAlias(a)\n" + 17828 " │ └─ Table\n" + 17829 " │ ├─ name: one_pk\n" + 17830 " │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 17831 " └─ HashLookup\n" + 17832 " ├─ left-key: (c.pk)\n" + 17833 " ├─ right-key: (d.pk)\n" + 17834 " └─ TableAlias(d)\n" + 17835 " └─ Table\n" + 17836 " ├─ name: one_pk\n" + 17837 " └─ columns: [pk]\n" + 17838 "", 17839 }, 17840 { 17841 Query: `SELECT a.* FROM one_pk a CROSS JOIN one_pk c INNER JOIN (select * from one_pk) b ON b.pk = c.pk`, 17842 ExpectedPlan: "Project\n" + 17843 " ├─ columns: [a.pk:7!null, a.c1:8, a.c2:9, a.c3:10, a.c4:11, a.c5:12]\n" + 17844 " └─ HashJoin\n" + 17845 " ├─ Eq\n" + 17846 " │ ├─ b.pk:0!null\n" + 17847 " │ └─ c.pk:6!null\n" + 17848 " ├─ SubqueryAlias\n" + 17849 " │ ├─ name: b\n" + 17850 " │ ├─ outerVisibility: false\n" + 17851 " │ ├─ isLateral: false\n" + 17852 " │ ├─ cacheable: true\n" + 17853 " │ ├─ colSet: (19-24)\n" + 17854 " │ ├─ tableId: 4\n" + 17855 " │ └─ Table\n" + 17856 " │ ├─ name: one_pk\n" + 17857 " │ ├─ columns: [pk c1 c2 c3 c4 c5]\n" + 17858 " │ ├─ colSet: (13-18)\n" + 17859 " │ └─ tableId: 3\n" + 17860 " └─ HashLookup\n" + 17861 " ├─ left-key: TUPLE(b.pk:0!null)\n" + 17862 " ├─ right-key: TUPLE(c.pk:0!null)\n" + 17863 " └─ CrossJoin\n" + 17864 " ├─ TableAlias(c)\n" + 17865 " │ └─ ProcessTable\n" + 17866 " │ └─ Table\n" + 17867 " │ ├─ name: one_pk\n" + 17868 " │ └─ columns: [pk]\n" + 17869 " └─ TableAlias(a)\n" + 17870 " └─ Table\n" + 17871 " ├─ name: one_pk\n" + 17872 " ├─ columns: [pk c1 c2 c3 c4 c5]\n" + 17873 " ├─ colSet: (1-6)\n" + 17874 " └─ tableId: 1\n" + 17875 "", 17876 ExpectedEstimates: "Project\n" + 17877 " ├─ columns: [a.pk, a.c1, a.c2, a.c3, a.c4, a.c5]\n" + 17878 " └─ HashJoin (estimated cost=116.060 rows=6)\n" + 17879 " ├─ (b.pk = c.pk)\n" + 17880 " ├─ SubqueryAlias\n" + 17881 " │ ├─ name: b\n" + 17882 " │ ├─ outerVisibility: false\n" + 17883 " │ ├─ isLateral: false\n" + 17884 " │ ├─ cacheable: true\n" + 17885 " │ └─ Table\n" + 17886 " │ ├─ name: one_pk\n" + 17887 " │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 17888 " └─ HashLookup\n" + 17889 " ├─ left-key: (b.pk)\n" + 17890 " ├─ right-key: (c.pk)\n" + 17891 " └─ CrossJoin\n" + 17892 " ├─ TableAlias(c)\n" + 17893 " │ └─ Table\n" + 17894 " │ ├─ name: one_pk\n" + 17895 " │ └─ columns: [pk]\n" + 17896 " └─ TableAlias(a)\n" + 17897 " └─ Table\n" + 17898 " ├─ name: one_pk\n" + 17899 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 17900 "", 17901 ExpectedAnalysis: "Project\n" + 17902 " ├─ columns: [a.pk, a.c1, a.c2, a.c3, a.c4, a.c5]\n" + 17903 " └─ HashJoin (estimated cost=116.060 rows=6) (actual rows=16 loops=1)\n" + 17904 " ├─ (b.pk = c.pk)\n" + 17905 " ├─ SubqueryAlias\n" + 17906 " │ ├─ name: b\n" + 17907 " │ ├─ outerVisibility: false\n" + 17908 " │ ├─ isLateral: false\n" + 17909 " │ ├─ cacheable: true\n" + 17910 " │ └─ Table\n" + 17911 " │ ├─ name: one_pk\n" + 17912 " │ └─ columns: [pk c1 c2 c3 c4 c5]\n" + 17913 " └─ HashLookup\n" + 17914 " ├─ left-key: (b.pk)\n" + 17915 " ├─ right-key: (c.pk)\n" + 17916 " └─ CrossJoin\n" + 17917 " ├─ TableAlias(c)\n" + 17918 " │ └─ Table\n" + 17919 " │ ├─ name: one_pk\n" + 17920 " │ └─ columns: [pk]\n" + 17921 " └─ TableAlias(a)\n" + 17922 " └─ Table\n" + 17923 " ├─ name: one_pk\n" + 17924 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 17925 "", 17926 }, 17927 { 17928 Query: `SELECT * FROM tabletest join mytable mt INNER JOIN othertable ot ON tabletest.i = ot.i2 order by 1,3,6`, 17929 ExpectedPlan: "Project\n" + 17930 " ├─ columns: [tabletest.i:2!null, tabletest.s:3!null, mt.i:0!null, mt.s:1!null, ot.s2:4!null, ot.i2:5!null]\n" + 17931 " └─ Sort(tabletest.i:2!null ASC nullsFirst, mt.i:0!null ASC nullsFirst, ot.i2:5!null ASC nullsFirst)\n" + 17932 " └─ LookupJoin\n" + 17933 " ├─ CrossJoin\n" + 17934 " │ ├─ TableAlias(mt)\n" + 17935 " │ │ └─ ProcessTable\n" + 17936 " │ │ └─ Table\n" + 17937 " │ │ ├─ name: mytable\n" + 17938 " │ │ └─ columns: [i s]\n" + 17939 " │ └─ ProcessTable\n" + 17940 " │ └─ Table\n" + 17941 " │ ├─ name: tabletest\n" + 17942 " │ └─ columns: [i s]\n" + 17943 " └─ TableAlias(ot)\n" + 17944 " └─ IndexedTableAccess(othertable)\n" + 17945 " ├─ index: [othertable.i2]\n" + 17946 " ├─ keys: [tabletest.i:2!null]\n" + 17947 " ├─ colSet: (5,6)\n" + 17948 " ├─ tableId: 3\n" + 17949 " └─ Table\n" + 17950 " ├─ name: othertable\n" + 17951 " └─ columns: [s2 i2]\n" + 17952 "", 17953 ExpectedEstimates: "Project\n" + 17954 " ├─ columns: [tabletest.i, tabletest.s, mt.i, mt.s, ot.s2, ot.i2]\n" + 17955 " └─ Sort(tabletest.i ASC, mt.i ASC, ot.i2 ASC)\n" + 17956 " └─ LookupJoin\n" + 17957 " ├─ CrossJoin\n" + 17958 " │ ├─ TableAlias(mt)\n" + 17959 " │ │ └─ Table\n" + 17960 " │ │ ├─ name: mytable\n" + 17961 " │ │ └─ columns: [i s]\n" + 17962 " │ └─ Table\n" + 17963 " │ ├─ name: tabletest\n" + 17964 " │ └─ columns: [i s]\n" + 17965 " └─ TableAlias(ot)\n" + 17966 " └─ IndexedTableAccess(othertable)\n" + 17967 " ├─ index: [othertable.i2]\n" + 17968 " ├─ columns: [s2 i2]\n" + 17969 " └─ keys: tabletest.i\n" + 17970 "", 17971 ExpectedAnalysis: "Project\n" + 17972 " ├─ columns: [tabletest.i, tabletest.s, mt.i, mt.s, ot.s2, ot.i2]\n" + 17973 " └─ Sort(tabletest.i ASC, mt.i ASC, ot.i2 ASC)\n" + 17974 " └─ LookupJoin\n" + 17975 " ├─ CrossJoin\n" + 17976 " │ ├─ TableAlias(mt)\n" + 17977 " │ │ └─ Table\n" + 17978 " │ │ ├─ name: mytable\n" + 17979 " │ │ └─ columns: [i s]\n" + 17980 " │ └─ Table\n" + 17981 " │ ├─ name: tabletest\n" + 17982 " │ └─ columns: [i s]\n" + 17983 " └─ TableAlias(ot)\n" + 17984 " └─ IndexedTableAccess(othertable)\n" + 17985 " ├─ index: [othertable.i2]\n" + 17986 " ├─ columns: [s2 i2]\n" + 17987 " └─ keys: tabletest.i\n" + 17988 "", 17989 }, 17990 { 17991 Query: `select a.pk, c.v2 from one_pk_three_idx a cross join one_pk_three_idx b right join one_pk_three_idx c on b.pk = c.v1 where b.pk = 0 and c.v2 = 0;`, 17992 ExpectedPlan: "Project\n" + 17993 " ├─ columns: [a.pk:3!null, c.v2:1]\n" + 17994 " └─ Filter\n" + 17995 " ├─ Eq\n" + 17996 " │ ├─ b.pk:2!null\n" + 17997 " │ └─ 0 (tinyint)\n" + 17998 " └─ LeftOuterHashJoin\n" + 17999 " ├─ Eq\n" + 18000 " │ ├─ b.pk:2!null\n" + 18001 " │ └─ c.v1:0\n" + 18002 " ├─ Filter\n" + 18003 " │ ├─ Eq\n" + 18004 " │ │ ├─ c.v2:1\n" + 18005 " │ │ └─ 0 (tinyint)\n" + 18006 " │ └─ TableAlias(c)\n" + 18007 " │ └─ ProcessTable\n" + 18008 " │ └─ Table\n" + 18009 " │ ├─ name: one_pk_three_idx\n" + 18010 " │ └─ columns: [v1 v2]\n" + 18011 " └─ HashLookup\n" + 18012 " ├─ left-key: TUPLE(c.v1:0)\n" + 18013 " ├─ right-key: TUPLE(b.pk:0!null)\n" + 18014 " └─ CrossJoin\n" + 18015 " ├─ TableAlias(b)\n" + 18016 " │ └─ Table\n" + 18017 " │ ├─ name: one_pk_three_idx\n" + 18018 " │ ├─ columns: [pk]\n" + 18019 " │ ├─ colSet: (5-8)\n" + 18020 " │ └─ tableId: 2\n" + 18021 " └─ TableAlias(a)\n" + 18022 " └─ Table\n" + 18023 " ├─ name: one_pk_three_idx\n" + 18024 " ├─ columns: [pk]\n" + 18025 " ├─ colSet: (1-4)\n" + 18026 " └─ tableId: 1\n" + 18027 "", 18028 ExpectedEstimates: "Project\n" + 18029 " ├─ columns: [a.pk, c.v2]\n" + 18030 " └─ Filter\n" + 18031 " ├─ (b.pk = 0)\n" + 18032 " └─ LeftOuterHashJoin (estimated cost=36.130 rows=7)\n" + 18033 " ├─ (b.pk = c.v1)\n" + 18034 " ├─ Filter\n" + 18035 " │ ├─ (c.v2 = 0)\n" + 18036 " │ └─ TableAlias(c)\n" + 18037 " │ └─ Table\n" + 18038 " │ ├─ name: one_pk_three_idx\n" + 18039 " │ └─ columns: [v1 v2]\n" + 18040 " └─ HashLookup\n" + 18041 " ├─ left-key: (c.v1)\n" + 18042 " ├─ right-key: (b.pk)\n" + 18043 " └─ CrossJoin\n" + 18044 " ├─ TableAlias(b)\n" + 18045 " │ └─ Table\n" + 18046 " │ ├─ name: one_pk_three_idx\n" + 18047 " │ └─ columns: [pk]\n" + 18048 " └─ TableAlias(a)\n" + 18049 " └─ Table\n" + 18050 " ├─ name: one_pk_three_idx\n" + 18051 " └─ columns: [pk]\n" + 18052 "", 18053 ExpectedAnalysis: "Project\n" + 18054 " ├─ columns: [a.pk, c.v2]\n" + 18055 " └─ Filter\n" + 18056 " ├─ (b.pk = 0)\n" + 18057 " └─ LeftOuterHashJoin (estimated cost=36.130 rows=7) (actual rows=32 loops=1)\n" + 18058 " ├─ (b.pk = c.v1)\n" + 18059 " ├─ Filter\n" + 18060 " │ ├─ (c.v2 = 0)\n" + 18061 " │ └─ TableAlias(c)\n" + 18062 " │ └─ Table\n" + 18063 " │ ├─ name: one_pk_three_idx\n" + 18064 " │ └─ columns: [v1 v2]\n" + 18065 " └─ HashLookup\n" + 18066 " ├─ left-key: (c.v1)\n" + 18067 " ├─ right-key: (b.pk)\n" + 18068 " └─ CrossJoin\n" + 18069 " ├─ TableAlias(b)\n" + 18070 " │ └─ Table\n" + 18071 " │ ├─ name: one_pk_three_idx\n" + 18072 " │ └─ columns: [pk]\n" + 18073 " └─ TableAlias(a)\n" + 18074 " └─ Table\n" + 18075 " ├─ name: one_pk_three_idx\n" + 18076 " └─ columns: [pk]\n" + 18077 "", 18078 }, 18079 { 18080 Query: `select a.pk, c.v2 from one_pk_three_idx a cross join one_pk_three_idx b left join one_pk_three_idx c on b.pk = c.v1 where b.pk = 0 and a.v2 = 1;`, 18081 ExpectedPlan: "Project\n" + 18082 " ├─ columns: [a.pk:1!null, c.v2:4]\n" + 18083 " └─ LeftOuterHashJoin\n" + 18084 " ├─ Eq\n" + 18085 " │ ├─ b.pk:0!null\n" + 18086 " │ └─ c.v1:3\n" + 18087 " ├─ CrossJoin\n" + 18088 " │ ├─ TableAlias(b)\n" + 18089 " │ │ └─ IndexedTableAccess(one_pk_three_idx)\n" + 18090 " │ │ ├─ index: [one_pk_three_idx.pk]\n" + 18091 " │ │ ├─ static: [{[0, 0]}]\n" + 18092 " │ │ ├─ colSet: (5-8)\n" + 18093 " │ │ ├─ tableId: 2\n" + 18094 " │ │ └─ Table\n" + 18095 " │ │ ├─ name: one_pk_three_idx\n" + 18096 " │ │ └─ columns: [pk]\n" + 18097 " │ └─ Filter\n" + 18098 " │ ├─ Eq\n" + 18099 " │ │ ├─ a.v2:1\n" + 18100 " │ │ └─ 1 (tinyint)\n" + 18101 " │ └─ TableAlias(a)\n" + 18102 " │ └─ ProcessTable\n" + 18103 " │ └─ Table\n" + 18104 " │ ├─ name: one_pk_three_idx\n" + 18105 " │ └─ columns: [pk v2]\n" + 18106 " └─ HashLookup\n" + 18107 " ├─ left-key: TUPLE(b.pk:0!null)\n" + 18108 " ├─ right-key: TUPLE(c.v1:0)\n" + 18109 " └─ TableAlias(c)\n" + 18110 " └─ Table\n" + 18111 " ├─ name: one_pk_three_idx\n" + 18112 " ├─ columns: [v1 v2]\n" + 18113 " ├─ colSet: (9-12)\n" + 18114 " └─ tableId: 3\n" + 18115 "", 18116 ExpectedEstimates: "Project\n" + 18117 " ├─ columns: [a.pk, c.v2]\n" + 18118 " └─ LeftOuterHashJoin (estimated cost=30.130 rows=7)\n" + 18119 " ├─ (b.pk = c.v1)\n" + 18120 " ├─ CrossJoin (estimated cost=49.480 rows=6)\n" + 18121 " │ ├─ TableAlias(b)\n" + 18122 " │ │ └─ IndexedTableAccess(one_pk_three_idx)\n" + 18123 " │ │ ├─ index: [one_pk_three_idx.pk]\n" + 18124 " │ │ ├─ filters: [{[0, 0]}]\n" + 18125 " │ │ └─ columns: [pk]\n" + 18126 " │ └─ Filter\n" + 18127 " │ ├─ (a.v2 = 1)\n" + 18128 " │ └─ TableAlias(a)\n" + 18129 " │ └─ Table\n" + 18130 " │ ├─ name: one_pk_three_idx\n" + 18131 " │ └─ columns: [pk v2]\n" + 18132 " └─ HashLookup\n" + 18133 " ├─ left-key: (b.pk)\n" + 18134 " ├─ right-key: (c.v1)\n" + 18135 " └─ TableAlias(c)\n" + 18136 " └─ Table\n" + 18137 " ├─ name: one_pk_three_idx\n" + 18138 " └─ columns: [v1 v2]\n" + 18139 "", 18140 ExpectedAnalysis: "Project\n" + 18141 " ├─ columns: [a.pk, c.v2]\n" + 18142 " └─ LeftOuterHashJoin (estimated cost=30.130 rows=7) (actual rows=4 loops=1)\n" + 18143 " ├─ (b.pk = c.v1)\n" + 18144 " ├─ CrossJoin (estimated cost=49.480 rows=6) (actual rows=1 loops=1)\n" + 18145 " │ ├─ TableAlias(b)\n" + 18146 " │ │ └─ IndexedTableAccess(one_pk_three_idx)\n" + 18147 " │ │ ├─ index: [one_pk_three_idx.pk]\n" + 18148 " │ │ ├─ filters: [{[0, 0]}]\n" + 18149 " │ │ └─ columns: [pk]\n" + 18150 " │ └─ Filter\n" + 18151 " │ ├─ (a.v2 = 1)\n" + 18152 " │ └─ TableAlias(a)\n" + 18153 " │ └─ Table\n" + 18154 " │ ├─ name: one_pk_three_idx\n" + 18155 " │ └─ columns: [pk v2]\n" + 18156 " └─ HashLookup\n" + 18157 " ├─ left-key: (b.pk)\n" + 18158 " ├─ right-key: (c.v1)\n" + 18159 " └─ TableAlias(c)\n" + 18160 " └─ Table\n" + 18161 " ├─ name: one_pk_three_idx\n" + 18162 " └─ columns: [v1 v2]\n" + 18163 "", 18164 }, 18165 { 18166 Query: `with a as (select a.i, a.s from mytable a CROSS JOIN mytable b) select * from a RIGHT JOIN mytable c on a.i+1 = c.i-1;`, 18167 ExpectedPlan: "Project\n" + 18168 " ├─ columns: [a.i:2!null, a.s:3!null, c.i:0!null, c.s:1!null]\n" + 18169 " └─ LeftOuterJoin\n" + 18170 " ├─ Eq\n" + 18171 " │ ├─ (a.i:2!null + 1 (tinyint))\n" + 18172 " │ └─ (c.i:0!null - 1 (tinyint))\n" + 18173 " ├─ TableAlias(c)\n" + 18174 " │ └─ ProcessTable\n" + 18175 " │ └─ Table\n" + 18176 " │ ├─ name: mytable\n" + 18177 " │ └─ columns: [i s]\n" + 18178 " └─ SubqueryAlias\n" + 18179 " ├─ name: a\n" + 18180 " ├─ outerVisibility: false\n" + 18181 " ├─ isLateral: false\n" + 18182 " ├─ cacheable: true\n" + 18183 " ├─ colSet: (5,6)\n" + 18184 " ├─ tableId: 3\n" + 18185 " └─ CrossJoin\n" + 18186 " ├─ TableAlias(b)\n" + 18187 " │ └─ Table\n" + 18188 " │ ├─ name: mytable\n" + 18189 " │ ├─ columns: []\n" + 18190 " │ ├─ colSet: (3,4)\n" + 18191 " │ └─ tableId: 2\n" + 18192 " └─ TableAlias(a)\n" + 18193 " └─ Table\n" + 18194 " ├─ name: mytable\n" + 18195 " ├─ columns: [i s]\n" + 18196 " ├─ colSet: (1,2)\n" + 18197 " └─ tableId: 1\n" + 18198 "", 18199 ExpectedEstimates: "Project\n" + 18200 " ├─ columns: [a.i, a.s, c.i, c.s]\n" + 18201 " └─ LeftOuterJoin (estimated cost=302.000 rows=3)\n" + 18202 " ├─ ((a.i + 1) = (c.i - 1))\n" + 18203 " ├─ TableAlias(c)\n" + 18204 " │ └─ Table\n" + 18205 " │ ├─ name: mytable\n" + 18206 " │ └─ columns: [i s]\n" + 18207 " └─ SubqueryAlias\n" + 18208 " ├─ name: a\n" + 18209 " ├─ outerVisibility: false\n" + 18210 " ├─ isLateral: false\n" + 18211 " ├─ cacheable: true\n" + 18212 " └─ CrossJoin\n" + 18213 " ├─ TableAlias(b)\n" + 18214 " │ └─ Table\n" + 18215 " │ ├─ name: mytable\n" + 18216 " │ └─ columns: []\n" + 18217 " └─ TableAlias(a)\n" + 18218 " └─ Table\n" + 18219 " ├─ name: mytable\n" + 18220 " └─ columns: [i s]\n" + 18221 "", 18222 ExpectedAnalysis: "Project\n" + 18223 " ├─ columns: [a.i, a.s, c.i, c.s]\n" + 18224 " └─ LeftOuterJoin (estimated cost=302.000 rows=3) (actual rows=5 loops=1)\n" + 18225 " ├─ ((a.i + 1) = (c.i - 1))\n" + 18226 " ├─ TableAlias(c)\n" + 18227 " │ └─ Table\n" + 18228 " │ ├─ name: mytable\n" + 18229 " │ └─ columns: [i s]\n" + 18230 " └─ SubqueryAlias\n" + 18231 " ├─ name: a\n" + 18232 " ├─ outerVisibility: false\n" + 18233 " ├─ isLateral: false\n" + 18234 " ├─ cacheable: true\n" + 18235 " └─ CrossJoin\n" + 18236 " ├─ TableAlias(b)\n" + 18237 " │ └─ Table\n" + 18238 " │ ├─ name: mytable\n" + 18239 " │ └─ columns: []\n" + 18240 " └─ TableAlias(a)\n" + 18241 " └─ Table\n" + 18242 " ├─ name: mytable\n" + 18243 " └─ columns: [i s]\n" + 18244 "", 18245 }, 18246 { 18247 Query: `select a.* from mytable a RIGHT JOIN mytable b on a.i = b.i+1 LEFT JOIN mytable c on a.i = c.i-1 RIGHT JOIN mytable d on b.i = d.i;`, 18248 ExpectedPlan: "Project\n" + 18249 " ├─ columns: [a.i:2!null, a.s:3!null]\n" + 18250 " └─ LeftOuterJoin\n" + 18251 " ├─ Eq\n" + 18252 " │ ├─ b.i:1!null\n" + 18253 " │ └─ d.i:0!null\n" + 18254 " ├─ TableAlias(d)\n" + 18255 " │ └─ ProcessTable\n" + 18256 " │ └─ Table\n" + 18257 " │ ├─ name: mytable\n" + 18258 " │ └─ columns: [i]\n" + 18259 " └─ LeftOuterJoin\n" + 18260 " ├─ Eq\n" + 18261 " │ ├─ a.i:2!null\n" + 18262 " │ └─ (c.i:4!null - 1 (tinyint))\n" + 18263 " ├─ LeftOuterMergeJoin\n" + 18264 " │ ├─ cmp: Eq\n" + 18265 " │ │ ├─ (b.i:1!null + 1 (tinyint))\n" + 18266 " │ │ └─ a.i:2!null\n" + 18267 " │ ├─ TableAlias(b)\n" + 18268 " │ │ └─ IndexedTableAccess(mytable)\n" + 18269 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 18270 " │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 18271 " │ │ ├─ colSet: (3,4)\n" + 18272 " │ │ ├─ tableId: 2\n" + 18273 " │ │ └─ Table\n" + 18274 " │ │ ├─ name: mytable\n" + 18275 " │ │ └─ columns: [i]\n" + 18276 " │ └─ TableAlias(a)\n" + 18277 " │ └─ IndexedTableAccess(mytable)\n" + 18278 " │ ├─ index: [mytable.i,mytable.s]\n" + 18279 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 18280 " │ ├─ colSet: (1,2)\n" + 18281 " │ ├─ tableId: 1\n" + 18282 " │ └─ Table\n" + 18283 " │ ├─ name: mytable\n" + 18284 " │ └─ columns: [i s]\n" + 18285 " └─ TableAlias(c)\n" + 18286 " └─ Table\n" + 18287 " ├─ name: mytable\n" + 18288 " ├─ columns: [i]\n" + 18289 " ├─ colSet: (5,6)\n" + 18290 " └─ tableId: 3\n" + 18291 "", 18292 ExpectedEstimates: "Project\n" + 18293 " ├─ columns: [a.i, a.s]\n" + 18294 " └─ LeftOuterJoin (estimated cost=8.090 rows=3)\n" + 18295 " ├─ (b.i = d.i)\n" + 18296 " ├─ TableAlias(d)\n" + 18297 " │ └─ Table\n" + 18298 " │ ├─ name: mytable\n" + 18299 " │ └─ columns: [i]\n" + 18300 " └─ LeftOuterJoin (estimated cost=8.090 rows=3)\n" + 18301 " ├─ (a.i = (c.i - 1))\n" + 18302 " ├─ LeftOuterMergeJoin (estimated cost=6.120 rows=3)\n" + 18303 " │ ├─ cmp: ((b.i + 1) = a.i)\n" + 18304 " │ ├─ TableAlias(b)\n" + 18305 " │ │ └─ IndexedTableAccess(mytable)\n" + 18306 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 18307 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18308 " │ │ └─ columns: [i]\n" + 18309 " │ └─ TableAlias(a)\n" + 18310 " │ └─ IndexedTableAccess(mytable)\n" + 18311 " │ ├─ index: [mytable.i,mytable.s]\n" + 18312 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18313 " │ └─ columns: [i s]\n" + 18314 " └─ TableAlias(c)\n" + 18315 " └─ Table\n" + 18316 " ├─ name: mytable\n" + 18317 " └─ columns: [i]\n" + 18318 "", 18319 ExpectedAnalysis: "Project\n" + 18320 " ├─ columns: [a.i, a.s]\n" + 18321 " └─ LeftOuterJoin (estimated cost=8.090 rows=3) (actual rows=3 loops=1)\n" + 18322 " ├─ (b.i = d.i)\n" + 18323 " ├─ TableAlias(d)\n" + 18324 " │ └─ Table\n" + 18325 " │ ├─ name: mytable\n" + 18326 " │ └─ columns: [i]\n" + 18327 " └─ LeftOuterJoin (estimated cost=8.090 rows=3) (actual rows=3 loops=3)\n" + 18328 " ├─ (a.i = (c.i - 1))\n" + 18329 " ├─ LeftOuterMergeJoin (estimated cost=6.120 rows=3) (actual rows=3 loops=3)\n" + 18330 " │ ├─ cmp: ((b.i + 1) = a.i)\n" + 18331 " │ ├─ TableAlias(b)\n" + 18332 " │ │ └─ IndexedTableAccess(mytable)\n" + 18333 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 18334 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18335 " │ │ └─ columns: [i]\n" + 18336 " │ └─ TableAlias(a)\n" + 18337 " │ └─ IndexedTableAccess(mytable)\n" + 18338 " │ ├─ index: [mytable.i,mytable.s]\n" + 18339 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18340 " │ └─ columns: [i s]\n" + 18341 " └─ TableAlias(c)\n" + 18342 " └─ Table\n" + 18343 " ├─ name: mytable\n" + 18344 " └─ columns: [i]\n" + 18345 "", 18346 }, 18347 { 18348 Query: `select a.*,b.* from mytable a RIGHT JOIN othertable b on a.i = b.i2+1 LEFT JOIN mytable c on a.i = c.i-1 LEFT JOIN othertable d on b.i2 = d.i2;`, 18349 ExpectedPlan: "Project\n" + 18350 " ├─ columns: [a.i:2!null, a.s:3!null, b.s2:0!null, b.i2:1!null]\n" + 18351 " └─ LeftOuterJoin\n" + 18352 " ├─ Eq\n" + 18353 " │ ├─ b.i2:1!null\n" + 18354 " │ └─ d.i2:5!null\n" + 18355 " ├─ LeftOuterJoin\n" + 18356 " │ ├─ Eq\n" + 18357 " │ │ ├─ a.i:2!null\n" + 18358 " │ │ └─ (c.i:4!null - 1 (tinyint))\n" + 18359 " │ ├─ LeftOuterMergeJoin\n" + 18360 " │ │ ├─ cmp: Eq\n" + 18361 " │ │ │ ├─ (b.i2:1!null + 1 (tinyint))\n" + 18362 " │ │ │ └─ a.i:2!null\n" + 18363 " │ │ ├─ TableAlias(b)\n" + 18364 " │ │ │ └─ IndexedTableAccess(othertable)\n" + 18365 " │ │ │ ├─ index: [othertable.i2]\n" + 18366 " │ │ │ ├─ static: [{[NULL, ∞)}]\n" + 18367 " │ │ │ ├─ colSet: (3,4)\n" + 18368 " │ │ │ ├─ tableId: 2\n" + 18369 " │ │ │ └─ Table\n" + 18370 " │ │ │ ├─ name: othertable\n" + 18371 " │ │ │ └─ columns: [s2 i2]\n" + 18372 " │ │ └─ TableAlias(a)\n" + 18373 " │ │ └─ IndexedTableAccess(mytable)\n" + 18374 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 18375 " │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 18376 " │ │ ├─ colSet: (1,2)\n" + 18377 " │ │ ├─ tableId: 1\n" + 18378 " │ │ └─ Table\n" + 18379 " │ │ ├─ name: mytable\n" + 18380 " │ │ └─ columns: [i s]\n" + 18381 " │ └─ TableAlias(c)\n" + 18382 " │ └─ ProcessTable\n" + 18383 " │ └─ Table\n" + 18384 " │ ├─ name: mytable\n" + 18385 " │ └─ columns: [i]\n" + 18386 " └─ TableAlias(d)\n" + 18387 " └─ ProcessTable\n" + 18388 " └─ Table\n" + 18389 " ├─ name: othertable\n" + 18390 " └─ columns: [i2]\n" + 18391 "", 18392 ExpectedEstimates: "Project\n" + 18393 " ├─ columns: [a.i, a.s, b.s2, b.i2]\n" + 18394 " └─ LeftOuterJoin (estimated cost=8.090 rows=3)\n" + 18395 " ├─ (b.i2 = d.i2)\n" + 18396 " ├─ LeftOuterJoin (estimated cost=8.090 rows=3)\n" + 18397 " │ ├─ (a.i = (c.i - 1))\n" + 18398 " │ ├─ LeftOuterMergeJoin (estimated cost=6.120 rows=3)\n" + 18399 " │ │ ├─ cmp: ((b.i2 + 1) = a.i)\n" + 18400 " │ │ ├─ TableAlias(b)\n" + 18401 " │ │ │ └─ IndexedTableAccess(othertable)\n" + 18402 " │ │ │ ├─ index: [othertable.i2]\n" + 18403 " │ │ │ ├─ filters: [{[NULL, ∞)}]\n" + 18404 " │ │ │ └─ columns: [s2 i2]\n" + 18405 " │ │ └─ TableAlias(a)\n" + 18406 " │ │ └─ IndexedTableAccess(mytable)\n" + 18407 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 18408 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18409 " │ │ └─ columns: [i s]\n" + 18410 " │ └─ TableAlias(c)\n" + 18411 " │ └─ Table\n" + 18412 " │ ├─ name: mytable\n" + 18413 " │ └─ columns: [i]\n" + 18414 " └─ TableAlias(d)\n" + 18415 " └─ Table\n" + 18416 " ├─ name: othertable\n" + 18417 " └─ columns: [i2]\n" + 18418 "", 18419 ExpectedAnalysis: "Project\n" + 18420 " ├─ columns: [a.i, a.s, b.s2, b.i2]\n" + 18421 " └─ LeftOuterJoin (estimated cost=8.090 rows=3) (actual rows=3 loops=1)\n" + 18422 " ├─ (b.i2 = d.i2)\n" + 18423 " ├─ LeftOuterJoin (estimated cost=8.090 rows=3) (actual rows=3 loops=1)\n" + 18424 " │ ├─ (a.i = (c.i - 1))\n" + 18425 " │ ├─ LeftOuterMergeJoin (estimated cost=6.120 rows=3) (actual rows=3 loops=1)\n" + 18426 " │ │ ├─ cmp: ((b.i2 + 1) = a.i)\n" + 18427 " │ │ ├─ TableAlias(b)\n" + 18428 " │ │ │ └─ IndexedTableAccess(othertable)\n" + 18429 " │ │ │ ├─ index: [othertable.i2]\n" + 18430 " │ │ │ ├─ filters: [{[NULL, ∞)}]\n" + 18431 " │ │ │ └─ columns: [s2 i2]\n" + 18432 " │ │ └─ TableAlias(a)\n" + 18433 " │ │ └─ IndexedTableAccess(mytable)\n" + 18434 " │ │ ├─ index: [mytable.i,mytable.s]\n" + 18435 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18436 " │ │ └─ columns: [i s]\n" + 18437 " │ └─ TableAlias(c)\n" + 18438 " │ └─ Table\n" + 18439 " │ ├─ name: mytable\n" + 18440 " │ └─ columns: [i]\n" + 18441 " └─ TableAlias(d)\n" + 18442 " └─ Table\n" + 18443 " ├─ name: othertable\n" + 18444 " └─ columns: [i2]\n" + 18445 "", 18446 }, 18447 { 18448 Query: `select a.*,b.* from mytable a RIGHT JOIN othertable b on a.i = b.i2+1 RIGHT JOIN mytable c on a.i = c.i-1 LEFT JOIN othertable d on b.i2 = d.i2;`, 18449 ExpectedPlan: "Project\n" + 18450 " ├─ columns: [a.i:3!null, a.s:4!null, b.s2:1!null, b.i2:2!null]\n" + 18451 " └─ LeftOuterJoin\n" + 18452 " ├─ Eq\n" + 18453 " │ ├─ b.i2:2!null\n" + 18454 " │ └─ d.i2:5!null\n" + 18455 " ├─ LeftOuterJoin\n" + 18456 " │ ├─ Eq\n" + 18457 " │ │ ├─ a.i:3!null\n" + 18458 " │ │ └─ (c.i:0!null - 1 (tinyint))\n" + 18459 " │ ├─ TableAlias(c)\n" + 18460 " │ │ └─ ProcessTable\n" + 18461 " │ │ └─ Table\n" + 18462 " │ │ ├─ name: mytable\n" + 18463 " │ │ └─ columns: [i]\n" + 18464 " │ └─ LeftOuterMergeJoin\n" + 18465 " │ ├─ cmp: Eq\n" + 18466 " │ │ ├─ (b.i2:2!null + 1 (tinyint))\n" + 18467 " │ │ └─ a.i:3!null\n" + 18468 " │ ├─ TableAlias(b)\n" + 18469 " │ │ └─ IndexedTableAccess(othertable)\n" + 18470 " │ │ ├─ index: [othertable.i2]\n" + 18471 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 18472 " │ │ ├─ colSet: (3,4)\n" + 18473 " │ │ ├─ tableId: 2\n" + 18474 " │ │ └─ Table\n" + 18475 " │ │ ├─ name: othertable\n" + 18476 " │ │ └─ columns: [s2 i2]\n" + 18477 " │ └─ TableAlias(a)\n" + 18478 " │ └─ IndexedTableAccess(mytable)\n" + 18479 " │ ├─ index: [mytable.i,mytable.s]\n" + 18480 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 18481 " │ ├─ colSet: (1,2)\n" + 18482 " │ ├─ tableId: 1\n" + 18483 " │ └─ Table\n" + 18484 " │ ├─ name: mytable\n" + 18485 " │ └─ columns: [i s]\n" + 18486 " └─ TableAlias(d)\n" + 18487 " └─ ProcessTable\n" + 18488 " └─ Table\n" + 18489 " ├─ name: othertable\n" + 18490 " └─ columns: [i2]\n" + 18491 "", 18492 ExpectedEstimates: "Project\n" + 18493 " ├─ columns: [a.i, a.s, b.s2, b.i2]\n" + 18494 " └─ LeftOuterJoin (estimated cost=8.090 rows=3)\n" + 18495 " ├─ (b.i2 = d.i2)\n" + 18496 " ├─ LeftOuterJoin (estimated cost=8.090 rows=3)\n" + 18497 " │ ├─ (a.i = (c.i - 1))\n" + 18498 " │ ├─ TableAlias(c)\n" + 18499 " │ │ └─ Table\n" + 18500 " │ │ ├─ name: mytable\n" + 18501 " │ │ └─ columns: [i]\n" + 18502 " │ └─ LeftOuterMergeJoin (estimated cost=6.120 rows=3)\n" + 18503 " │ ├─ cmp: ((b.i2 + 1) = a.i)\n" + 18504 " │ ├─ TableAlias(b)\n" + 18505 " │ │ └─ IndexedTableAccess(othertable)\n" + 18506 " │ │ ├─ index: [othertable.i2]\n" + 18507 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 18508 " │ │ └─ columns: [s2 i2]\n" + 18509 " │ └─ TableAlias(a)\n" + 18510 " │ └─ IndexedTableAccess(mytable)\n" + 18511 " │ ├─ index: [mytable.i,mytable.s]\n" + 18512 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18513 " │ └─ columns: [i s]\n" + 18514 " └─ TableAlias(d)\n" + 18515 " └─ Table\n" + 18516 " ├─ name: othertable\n" + 18517 " └─ columns: [i2]\n" + 18518 "", 18519 ExpectedAnalysis: "Project\n" + 18520 " ├─ columns: [a.i, a.s, b.s2, b.i2]\n" + 18521 " └─ LeftOuterJoin (estimated cost=8.090 rows=3) (actual rows=3 loops=1)\n" + 18522 " ├─ (b.i2 = d.i2)\n" + 18523 " ├─ LeftOuterJoin (estimated cost=8.090 rows=3) (actual rows=3 loops=1)\n" + 18524 " │ ├─ (a.i = (c.i - 1))\n" + 18525 " │ ├─ TableAlias(c)\n" + 18526 " │ │ └─ Table\n" + 18527 " │ │ ├─ name: mytable\n" + 18528 " │ │ └─ columns: [i]\n" + 18529 " │ └─ LeftOuterMergeJoin (estimated cost=6.120 rows=3) (actual rows=3 loops=3)\n" + 18530 " │ ├─ cmp: ((b.i2 + 1) = a.i)\n" + 18531 " │ ├─ TableAlias(b)\n" + 18532 " │ │ └─ IndexedTableAccess(othertable)\n" + 18533 " │ │ ├─ index: [othertable.i2]\n" + 18534 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 18535 " │ │ └─ columns: [s2 i2]\n" + 18536 " │ └─ TableAlias(a)\n" + 18537 " │ └─ IndexedTableAccess(mytable)\n" + 18538 " │ ├─ index: [mytable.i,mytable.s]\n" + 18539 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18540 " │ └─ columns: [i s]\n" + 18541 " └─ TableAlias(d)\n" + 18542 " └─ Table\n" + 18543 " ├─ name: othertable\n" + 18544 " └─ columns: [i2]\n" + 18545 "", 18546 }, 18547 { 18548 Query: `select i.pk, j.v3 from one_pk_two_idx i JOIN one_pk_three_idx j on i.v1 = j.pk;`, 18549 ExpectedPlan: "Project\n" + 18550 " ├─ columns: [i.pk:0!null, j.v3:3]\n" + 18551 " └─ MergeJoin\n" + 18552 " ├─ cmp: Eq\n" + 18553 " │ ├─ i.v1:1\n" + 18554 " │ └─ j.pk:2!null\n" + 18555 " ├─ TableAlias(i)\n" + 18556 " │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 18557 " │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 18558 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 18559 " │ ├─ colSet: (1-3)\n" + 18560 " │ ├─ tableId: 1\n" + 18561 " │ └─ Table\n" + 18562 " │ ├─ name: one_pk_two_idx\n" + 18563 " │ └─ columns: [pk v1]\n" + 18564 " └─ TableAlias(j)\n" + 18565 " └─ IndexedTableAccess(one_pk_three_idx)\n" + 18566 " ├─ index: [one_pk_three_idx.pk]\n" + 18567 " ├─ static: [{[NULL, ∞)}]\n" + 18568 " ├─ colSet: (4-7)\n" + 18569 " ├─ tableId: 2\n" + 18570 " └─ Table\n" + 18571 " ├─ name: one_pk_three_idx\n" + 18572 " └─ columns: [pk v3]\n" + 18573 "", 18574 ExpectedEstimates: "Project\n" + 18575 " ├─ columns: [i.pk, j.v3]\n" + 18576 " └─ MergeJoin (estimated cost=16.240 rows=8)\n" + 18577 " ├─ cmp: (i.v1 = j.pk)\n" + 18578 " ├─ TableAlias(i)\n" + 18579 " │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 18580 " │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 18581 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18582 " │ └─ columns: [pk v1]\n" + 18583 " └─ TableAlias(j)\n" + 18584 " └─ IndexedTableAccess(one_pk_three_idx)\n" + 18585 " ├─ index: [one_pk_three_idx.pk]\n" + 18586 " ├─ filters: [{[NULL, ∞)}]\n" + 18587 " └─ columns: [pk v3]\n" + 18588 "", 18589 ExpectedAnalysis: "Project\n" + 18590 " ├─ columns: [i.pk, j.v3]\n" + 18591 " └─ MergeJoin (estimated cost=16.240 rows=8) (actual rows=8 loops=1)\n" + 18592 " ├─ cmp: (i.v1 = j.pk)\n" + 18593 " ├─ TableAlias(i)\n" + 18594 " │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 18595 " │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 18596 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18597 " │ └─ columns: [pk v1]\n" + 18598 " └─ TableAlias(j)\n" + 18599 " └─ IndexedTableAccess(one_pk_three_idx)\n" + 18600 " ├─ index: [one_pk_three_idx.pk]\n" + 18601 " ├─ filters: [{[NULL, ∞)}]\n" + 18602 " └─ columns: [pk v3]\n" + 18603 "", 18604 }, 18605 { 18606 Query: `select i.pk, j.v3, k.c1 from one_pk_two_idx i JOIN one_pk_three_idx j on i.v1 = j.pk JOIN one_pk k on j.v3 = k.pk;`, 18607 ExpectedPlan: "Project\n" + 18608 " ├─ columns: [i.pk:0!null, j.v3:3, k.c1:5]\n" + 18609 " └─ HashJoin\n" + 18610 " ├─ Eq\n" + 18611 " │ ├─ j.v3:3\n" + 18612 " │ └─ k.pk:4!null\n" + 18613 " ├─ MergeJoin\n" + 18614 " │ ├─ cmp: Eq\n" + 18615 " │ │ ├─ i.v1:1\n" + 18616 " │ │ └─ j.pk:2!null\n" + 18617 " │ ├─ TableAlias(i)\n" + 18618 " │ │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 18619 " │ │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 18620 " │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 18621 " │ │ ├─ colSet: (1-3)\n" + 18622 " │ │ ├─ tableId: 1\n" + 18623 " │ │ └─ Table\n" + 18624 " │ │ ├─ name: one_pk_two_idx\n" + 18625 " │ │ └─ columns: [pk v1]\n" + 18626 " │ └─ TableAlias(j)\n" + 18627 " │ └─ IndexedTableAccess(one_pk_three_idx)\n" + 18628 " │ ├─ index: [one_pk_three_idx.pk]\n" + 18629 " │ ├─ static: [{[NULL, ∞)}]\n" + 18630 " │ ├─ colSet: (4-7)\n" + 18631 " │ ├─ tableId: 2\n" + 18632 " │ └─ Table\n" + 18633 " │ ├─ name: one_pk_three_idx\n" + 18634 " │ └─ columns: [pk v3]\n" + 18635 " └─ HashLookup\n" + 18636 " ├─ left-key: TUPLE(j.v3:3)\n" + 18637 " ├─ right-key: TUPLE(k.pk:0!null)\n" + 18638 " └─ TableAlias(k)\n" + 18639 " └─ ProcessTable\n" + 18640 " └─ Table\n" + 18641 " ├─ name: one_pk\n" + 18642 " └─ columns: [pk c1]\n" + 18643 "", 18644 ExpectedEstimates: "Project\n" + 18645 " ├─ columns: [i.pk, j.v3, k.c1]\n" + 18646 " └─ HashJoin (estimated cost=20.160 rows=8)\n" + 18647 " ├─ (j.v3 = k.pk)\n" + 18648 " ├─ MergeJoin (estimated cost=16.240 rows=8)\n" + 18649 " │ ├─ cmp: (i.v1 = j.pk)\n" + 18650 " │ ├─ TableAlias(i)\n" + 18651 " │ │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 18652 " │ │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 18653 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18654 " │ │ └─ columns: [pk v1]\n" + 18655 " │ └─ TableAlias(j)\n" + 18656 " │ └─ IndexedTableAccess(one_pk_three_idx)\n" + 18657 " │ ├─ index: [one_pk_three_idx.pk]\n" + 18658 " │ ├─ filters: [{[NULL, ∞)}]\n" + 18659 " │ └─ columns: [pk v3]\n" + 18660 " └─ HashLookup\n" + 18661 " ├─ left-key: (j.v3)\n" + 18662 " ├─ right-key: (k.pk)\n" + 18663 " └─ TableAlias(k)\n" + 18664 " └─ Table\n" + 18665 " ├─ name: one_pk\n" + 18666 " └─ columns: [pk c1]\n" + 18667 "", 18668 ExpectedAnalysis: "Project\n" + 18669 " ├─ columns: [i.pk, j.v3, k.c1]\n" + 18670 " └─ HashJoin (estimated cost=20.160 rows=8) (actual rows=7 loops=1)\n" + 18671 " ├─ (j.v3 = k.pk)\n" + 18672 " ├─ MergeJoin (estimated cost=16.240 rows=8) (actual rows=8 loops=1)\n" + 18673 " │ ├─ cmp: (i.v1 = j.pk)\n" + 18674 " │ ├─ TableAlias(i)\n" + 18675 " │ │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 18676 " │ │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 18677 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18678 " │ │ └─ columns: [pk v1]\n" + 18679 " │ └─ TableAlias(j)\n" + 18680 " │ └─ IndexedTableAccess(one_pk_three_idx)\n" + 18681 " │ ├─ index: [one_pk_three_idx.pk]\n" + 18682 " │ ├─ filters: [{[NULL, ∞)}]\n" + 18683 " │ └─ columns: [pk v3]\n" + 18684 " └─ HashLookup\n" + 18685 " ├─ left-key: (j.v3)\n" + 18686 " ├─ right-key: (k.pk)\n" + 18687 " └─ TableAlias(k)\n" + 18688 " └─ Table\n" + 18689 " ├─ name: one_pk\n" + 18690 " └─ columns: [pk c1]\n" + 18691 "", 18692 }, 18693 { 18694 Query: `select i.pk, j.v3 from (one_pk_two_idx i JOIN one_pk_three_idx j on((i.v1 = j.pk)));`, 18695 ExpectedPlan: "Project\n" + 18696 " ├─ columns: [i.pk:0!null, j.v3:3]\n" + 18697 " └─ MergeJoin\n" + 18698 " ├─ cmp: Eq\n" + 18699 " │ ├─ i.v1:1\n" + 18700 " │ └─ j.pk:2!null\n" + 18701 " ├─ TableAlias(i)\n" + 18702 " │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 18703 " │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 18704 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 18705 " │ ├─ colSet: (1-3)\n" + 18706 " │ ├─ tableId: 1\n" + 18707 " │ └─ Table\n" + 18708 " │ ├─ name: one_pk_two_idx\n" + 18709 " │ └─ columns: [pk v1]\n" + 18710 " └─ TableAlias(j)\n" + 18711 " └─ IndexedTableAccess(one_pk_three_idx)\n" + 18712 " ├─ index: [one_pk_three_idx.pk]\n" + 18713 " ├─ static: [{[NULL, ∞)}]\n" + 18714 " ├─ colSet: (4-7)\n" + 18715 " ├─ tableId: 2\n" + 18716 " └─ Table\n" + 18717 " ├─ name: one_pk_three_idx\n" + 18718 " └─ columns: [pk v3]\n" + 18719 "", 18720 ExpectedEstimates: "Project\n" + 18721 " ├─ columns: [i.pk, j.v3]\n" + 18722 " └─ MergeJoin (estimated cost=16.240 rows=8)\n" + 18723 " ├─ cmp: (i.v1 = j.pk)\n" + 18724 " ├─ TableAlias(i)\n" + 18725 " │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 18726 " │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 18727 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18728 " │ └─ columns: [pk v1]\n" + 18729 " └─ TableAlias(j)\n" + 18730 " └─ IndexedTableAccess(one_pk_three_idx)\n" + 18731 " ├─ index: [one_pk_three_idx.pk]\n" + 18732 " ├─ filters: [{[NULL, ∞)}]\n" + 18733 " └─ columns: [pk v3]\n" + 18734 "", 18735 ExpectedAnalysis: "Project\n" + 18736 " ├─ columns: [i.pk, j.v3]\n" + 18737 " └─ MergeJoin (estimated cost=16.240 rows=8) (actual rows=8 loops=1)\n" + 18738 " ├─ cmp: (i.v1 = j.pk)\n" + 18739 " ├─ TableAlias(i)\n" + 18740 " │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 18741 " │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 18742 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18743 " │ └─ columns: [pk v1]\n" + 18744 " └─ TableAlias(j)\n" + 18745 " └─ IndexedTableAccess(one_pk_three_idx)\n" + 18746 " ├─ index: [one_pk_three_idx.pk]\n" + 18747 " ├─ filters: [{[NULL, ∞)}]\n" + 18748 " └─ columns: [pk v3]\n" + 18749 "", 18750 }, 18751 { 18752 Query: `select i.pk, j.v3, k.c1 from ((one_pk_two_idx i JOIN one_pk_three_idx j on ((i.v1 = j.pk))) JOIN one_pk k on((j.v3 = k.pk)));`, 18753 ExpectedPlan: "Project\n" + 18754 " ├─ columns: [i.pk:0!null, j.v3:3, k.c1:5]\n" + 18755 " └─ HashJoin\n" + 18756 " ├─ Eq\n" + 18757 " │ ├─ j.v3:3\n" + 18758 " │ └─ k.pk:4!null\n" + 18759 " ├─ MergeJoin\n" + 18760 " │ ├─ cmp: Eq\n" + 18761 " │ │ ├─ i.v1:1\n" + 18762 " │ │ └─ j.pk:2!null\n" + 18763 " │ ├─ TableAlias(i)\n" + 18764 " │ │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 18765 " │ │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 18766 " │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 18767 " │ │ ├─ colSet: (1-3)\n" + 18768 " │ │ ├─ tableId: 1\n" + 18769 " │ │ └─ Table\n" + 18770 " │ │ ├─ name: one_pk_two_idx\n" + 18771 " │ │ └─ columns: [pk v1]\n" + 18772 " │ └─ TableAlias(j)\n" + 18773 " │ └─ IndexedTableAccess(one_pk_three_idx)\n" + 18774 " │ ├─ index: [one_pk_three_idx.pk]\n" + 18775 " │ ├─ static: [{[NULL, ∞)}]\n" + 18776 " │ ├─ colSet: (4-7)\n" + 18777 " │ ├─ tableId: 2\n" + 18778 " │ └─ Table\n" + 18779 " │ ├─ name: one_pk_three_idx\n" + 18780 " │ └─ columns: [pk v3]\n" + 18781 " └─ HashLookup\n" + 18782 " ├─ left-key: TUPLE(j.v3:3)\n" + 18783 " ├─ right-key: TUPLE(k.pk:0!null)\n" + 18784 " └─ TableAlias(k)\n" + 18785 " └─ ProcessTable\n" + 18786 " └─ Table\n" + 18787 " ├─ name: one_pk\n" + 18788 " └─ columns: [pk c1]\n" + 18789 "", 18790 ExpectedEstimates: "Project\n" + 18791 " ├─ columns: [i.pk, j.v3, k.c1]\n" + 18792 " └─ HashJoin (estimated cost=20.160 rows=8)\n" + 18793 " ├─ (j.v3 = k.pk)\n" + 18794 " ├─ MergeJoin (estimated cost=16.240 rows=8)\n" + 18795 " │ ├─ cmp: (i.v1 = j.pk)\n" + 18796 " │ ├─ TableAlias(i)\n" + 18797 " │ │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 18798 " │ │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 18799 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18800 " │ │ └─ columns: [pk v1]\n" + 18801 " │ └─ TableAlias(j)\n" + 18802 " │ └─ IndexedTableAccess(one_pk_three_idx)\n" + 18803 " │ ├─ index: [one_pk_three_idx.pk]\n" + 18804 " │ ├─ filters: [{[NULL, ∞)}]\n" + 18805 " │ └─ columns: [pk v3]\n" + 18806 " └─ HashLookup\n" + 18807 " ├─ left-key: (j.v3)\n" + 18808 " ├─ right-key: (k.pk)\n" + 18809 " └─ TableAlias(k)\n" + 18810 " └─ Table\n" + 18811 " ├─ name: one_pk\n" + 18812 " └─ columns: [pk c1]\n" + 18813 "", 18814 ExpectedAnalysis: "Project\n" + 18815 " ├─ columns: [i.pk, j.v3, k.c1]\n" + 18816 " └─ HashJoin (estimated cost=20.160 rows=8) (actual rows=7 loops=1)\n" + 18817 " ├─ (j.v3 = k.pk)\n" + 18818 " ├─ MergeJoin (estimated cost=16.240 rows=8) (actual rows=8 loops=1)\n" + 18819 " │ ├─ cmp: (i.v1 = j.pk)\n" + 18820 " │ ├─ TableAlias(i)\n" + 18821 " │ │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 18822 " │ │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 18823 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18824 " │ │ └─ columns: [pk v1]\n" + 18825 " │ └─ TableAlias(j)\n" + 18826 " │ └─ IndexedTableAccess(one_pk_three_idx)\n" + 18827 " │ ├─ index: [one_pk_three_idx.pk]\n" + 18828 " │ ├─ filters: [{[NULL, ∞)}]\n" + 18829 " │ └─ columns: [pk v3]\n" + 18830 " └─ HashLookup\n" + 18831 " ├─ left-key: (j.v3)\n" + 18832 " ├─ right-key: (k.pk)\n" + 18833 " └─ TableAlias(k)\n" + 18834 " └─ Table\n" + 18835 " ├─ name: one_pk\n" + 18836 " └─ columns: [pk c1]\n" + 18837 "", 18838 }, 18839 { 18840 Query: `select i.pk, j.v3, k.c1 from (one_pk_two_idx i JOIN one_pk_three_idx j on ((i.v1 = j.pk)) JOIN one_pk k on((j.v3 = k.pk)))`, 18841 ExpectedPlan: "Project\n" + 18842 " ├─ columns: [i.pk:0!null, j.v3:3, k.c1:5]\n" + 18843 " └─ HashJoin\n" + 18844 " ├─ Eq\n" + 18845 " │ ├─ j.v3:3\n" + 18846 " │ └─ k.pk:4!null\n" + 18847 " ├─ MergeJoin\n" + 18848 " │ ├─ cmp: Eq\n" + 18849 " │ │ ├─ i.v1:1\n" + 18850 " │ │ └─ j.pk:2!null\n" + 18851 " │ ├─ TableAlias(i)\n" + 18852 " │ │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 18853 " │ │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 18854 " │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 18855 " │ │ ├─ colSet: (1-3)\n" + 18856 " │ │ ├─ tableId: 1\n" + 18857 " │ │ └─ Table\n" + 18858 " │ │ ├─ name: one_pk_two_idx\n" + 18859 " │ │ └─ columns: [pk v1]\n" + 18860 " │ └─ TableAlias(j)\n" + 18861 " │ └─ IndexedTableAccess(one_pk_three_idx)\n" + 18862 " │ ├─ index: [one_pk_three_idx.pk]\n" + 18863 " │ ├─ static: [{[NULL, ∞)}]\n" + 18864 " │ ├─ colSet: (4-7)\n" + 18865 " │ ├─ tableId: 2\n" + 18866 " │ └─ Table\n" + 18867 " │ ├─ name: one_pk_three_idx\n" + 18868 " │ └─ columns: [pk v3]\n" + 18869 " └─ HashLookup\n" + 18870 " ├─ left-key: TUPLE(j.v3:3)\n" + 18871 " ├─ right-key: TUPLE(k.pk:0!null)\n" + 18872 " └─ TableAlias(k)\n" + 18873 " └─ ProcessTable\n" + 18874 " └─ Table\n" + 18875 " ├─ name: one_pk\n" + 18876 " └─ columns: [pk c1]\n" + 18877 "", 18878 ExpectedEstimates: "Project\n" + 18879 " ├─ columns: [i.pk, j.v3, k.c1]\n" + 18880 " └─ HashJoin (estimated cost=20.160 rows=8)\n" + 18881 " ├─ (j.v3 = k.pk)\n" + 18882 " ├─ MergeJoin (estimated cost=16.240 rows=8)\n" + 18883 " │ ├─ cmp: (i.v1 = j.pk)\n" + 18884 " │ ├─ TableAlias(i)\n" + 18885 " │ │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 18886 " │ │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 18887 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18888 " │ │ └─ columns: [pk v1]\n" + 18889 " │ └─ TableAlias(j)\n" + 18890 " │ └─ IndexedTableAccess(one_pk_three_idx)\n" + 18891 " │ ├─ index: [one_pk_three_idx.pk]\n" + 18892 " │ ├─ filters: [{[NULL, ∞)}]\n" + 18893 " │ └─ columns: [pk v3]\n" + 18894 " └─ HashLookup\n" + 18895 " ├─ left-key: (j.v3)\n" + 18896 " ├─ right-key: (k.pk)\n" + 18897 " └─ TableAlias(k)\n" + 18898 " └─ Table\n" + 18899 " ├─ name: one_pk\n" + 18900 " └─ columns: [pk c1]\n" + 18901 "", 18902 ExpectedAnalysis: "Project\n" + 18903 " ├─ columns: [i.pk, j.v3, k.c1]\n" + 18904 " └─ HashJoin (estimated cost=20.160 rows=8) (actual rows=7 loops=1)\n" + 18905 " ├─ (j.v3 = k.pk)\n" + 18906 " ├─ MergeJoin (estimated cost=16.240 rows=8) (actual rows=8 loops=1)\n" + 18907 " │ ├─ cmp: (i.v1 = j.pk)\n" + 18908 " │ ├─ TableAlias(i)\n" + 18909 " │ │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 18910 " │ │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 18911 " │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 18912 " │ │ └─ columns: [pk v1]\n" + 18913 " │ └─ TableAlias(j)\n" + 18914 " │ └─ IndexedTableAccess(one_pk_three_idx)\n" + 18915 " │ ├─ index: [one_pk_three_idx.pk]\n" + 18916 " │ ├─ filters: [{[NULL, ∞)}]\n" + 18917 " │ └─ columns: [pk v3]\n" + 18918 " └─ HashLookup\n" + 18919 " ├─ left-key: (j.v3)\n" + 18920 " ├─ right-key: (k.pk)\n" + 18921 " └─ TableAlias(k)\n" + 18922 " └─ Table\n" + 18923 " ├─ name: one_pk\n" + 18924 " └─ columns: [pk c1]\n" + 18925 "", 18926 }, 18927 { 18928 Query: `select a.* from one_pk_two_idx a RIGHT JOIN (one_pk_two_idx i JOIN one_pk_three_idx j on i.v1 = j.pk) on a.pk = i.v1 LEFT JOIN (one_pk_two_idx k JOIN one_pk_three_idx l on k.v1 = l.pk) on a.pk = l.v2;`, 18929 ExpectedPlan: "Project\n" + 18930 " ├─ columns: [a.pk:2!null, a.v1:3, a.v2:4]\n" + 18931 " └─ LeftOuterHashJoin\n" + 18932 " ├─ Eq\n" + 18933 " │ ├─ a.pk:2!null\n" + 18934 " │ └─ l.v2:7\n" + 18935 " ├─ LeftOuterHashJoin\n" + 18936 " │ ├─ Eq\n" + 18937 " │ │ ├─ a.pk:2!null\n" + 18938 " │ │ └─ i.v1:0\n" + 18939 " │ ├─ MergeJoin\n" + 18940 " │ │ ├─ cmp: Eq\n" + 18941 " │ │ │ ├─ i.v1:0\n" + 18942 " │ │ │ └─ j.pk:1!null\n" + 18943 " │ │ ├─ TableAlias(i)\n" + 18944 " │ │ │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 18945 " │ │ │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 18946 " │ │ │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 18947 " │ │ │ ├─ colSet: (4-6)\n" + 18948 " │ │ │ ├─ tableId: 2\n" + 18949 " │ │ │ └─ Table\n" + 18950 " │ │ │ ├─ name: one_pk_two_idx\n" + 18951 " │ │ │ └─ columns: [v1]\n" + 18952 " │ │ └─ TableAlias(j)\n" + 18953 " │ │ └─ IndexedTableAccess(one_pk_three_idx)\n" + 18954 " │ │ ├─ index: [one_pk_three_idx.pk]\n" + 18955 " │ │ ├─ static: [{[NULL, ∞)}]\n" + 18956 " │ │ ├─ colSet: (7-10)\n" + 18957 " │ │ ├─ tableId: 3\n" + 18958 " │ │ └─ Table\n" + 18959 " │ │ ├─ name: one_pk_three_idx\n" + 18960 " │ │ └─ columns: [pk]\n" + 18961 " │ └─ HashLookup\n" + 18962 " │ ├─ left-key: TUPLE(i.v1:0)\n" + 18963 " │ ├─ right-key: TUPLE(a.pk:0!null)\n" + 18964 " │ └─ TableAlias(a)\n" + 18965 " │ └─ ProcessTable\n" + 18966 " │ └─ Table\n" + 18967 " │ ├─ name: one_pk_two_idx\n" + 18968 " │ └─ columns: [pk v1 v2]\n" + 18969 " └─ HashLookup\n" + 18970 " ├─ left-key: TUPLE(a.pk:2!null)\n" + 18971 " ├─ right-key: TUPLE(l.v2:2)\n" + 18972 " └─ MergeJoin\n" + 18973 " ├─ cmp: Eq\n" + 18974 " │ ├─ k.v1:5\n" + 18975 " │ └─ l.pk:6!null\n" + 18976 " ├─ TableAlias(k)\n" + 18977 " │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 18978 " │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 18979 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 18980 " │ ├─ colSet: (11-13)\n" + 18981 " │ ├─ tableId: 4\n" + 18982 " │ └─ Table\n" + 18983 " │ ├─ name: one_pk_two_idx\n" + 18984 " │ └─ columns: [v1]\n" + 18985 " └─ TableAlias(l)\n" + 18986 " └─ IndexedTableAccess(one_pk_three_idx)\n" + 18987 " ├─ index: [one_pk_three_idx.pk]\n" + 18988 " ├─ static: [{[NULL, ∞)}]\n" + 18989 " ├─ colSet: (14-17)\n" + 18990 " ├─ tableId: 5\n" + 18991 " └─ Table\n" + 18992 " ├─ name: one_pk_three_idx\n" + 18993 " └─ columns: [pk v2]\n" + 18994 "", 18995 ExpectedEstimates: "Project\n" + 18996 " ├─ columns: [a.pk, a.v1, a.v2]\n" + 18997 " └─ LeftOuterHashJoin (estimated cost=34.200 rows=10)\n" + 18998 " ├─ (a.pk = l.v2)\n" + 18999 " ├─ LeftOuterHashJoin (estimated cost=32.180 rows=10)\n" + 19000 " │ ├─ (a.pk = i.v1)\n" + 19001 " │ ├─ MergeJoin (estimated cost=16.240 rows=8)\n" + 19002 " │ │ ├─ cmp: (i.v1 = j.pk)\n" + 19003 " │ │ ├─ TableAlias(i)\n" + 19004 " │ │ │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 19005 " │ │ │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 19006 " │ │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 19007 " │ │ │ └─ columns: [v1]\n" + 19008 " │ │ └─ TableAlias(j)\n" + 19009 " │ │ └─ IndexedTableAccess(one_pk_three_idx)\n" + 19010 " │ │ ├─ index: [one_pk_three_idx.pk]\n" + 19011 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 19012 " │ │ └─ columns: [pk]\n" + 19013 " │ └─ HashLookup\n" + 19014 " │ ├─ left-key: (i.v1)\n" + 19015 " │ ├─ right-key: (a.pk)\n" + 19016 " │ └─ TableAlias(a)\n" + 19017 " │ └─ Table\n" + 19018 " │ ├─ name: one_pk_two_idx\n" + 19019 " │ └─ columns: [pk v1 v2]\n" + 19020 " └─ HashLookup\n" + 19021 " ├─ left-key: (a.pk)\n" + 19022 " ├─ right-key: (l.v2)\n" + 19023 " └─ MergeJoin\n" + 19024 " ├─ cmp: (k.v1 = l.pk)\n" + 19025 " ├─ TableAlias(k)\n" + 19026 " │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 19027 " │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 19028 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 19029 " │ └─ columns: [v1]\n" + 19030 " └─ TableAlias(l)\n" + 19031 " └─ IndexedTableAccess(one_pk_three_idx)\n" + 19032 " ├─ index: [one_pk_three_idx.pk]\n" + 19033 " ├─ filters: [{[NULL, ∞)}]\n" + 19034 " └─ columns: [pk v2]\n" + 19035 "", 19036 ExpectedAnalysis: "Project\n" + 19037 " ├─ columns: [a.pk, a.v1, a.v2]\n" + 19038 " └─ LeftOuterHashJoin (estimated cost=34.200 rows=10) (actual rows=11 loops=1)\n" + 19039 " ├─ (a.pk = l.v2)\n" + 19040 " ├─ LeftOuterHashJoin (estimated cost=32.180 rows=10) (actual rows=8 loops=1)\n" + 19041 " │ ├─ (a.pk = i.v1)\n" + 19042 " │ ├─ MergeJoin (estimated cost=16.240 rows=8) (actual rows=8 loops=1)\n" + 19043 " │ │ ├─ cmp: (i.v1 = j.pk)\n" + 19044 " │ │ ├─ TableAlias(i)\n" + 19045 " │ │ │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 19046 " │ │ │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 19047 " │ │ │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 19048 " │ │ │ └─ columns: [v1]\n" + 19049 " │ │ └─ TableAlias(j)\n" + 19050 " │ │ └─ IndexedTableAccess(one_pk_three_idx)\n" + 19051 " │ │ ├─ index: [one_pk_three_idx.pk]\n" + 19052 " │ │ ├─ filters: [{[NULL, ∞)}]\n" + 19053 " │ │ └─ columns: [pk]\n" + 19054 " │ └─ HashLookup\n" + 19055 " │ ├─ left-key: (i.v1)\n" + 19056 " │ ├─ right-key: (a.pk)\n" + 19057 " │ └─ TableAlias(a)\n" + 19058 " │ └─ Table\n" + 19059 " │ ├─ name: one_pk_two_idx\n" + 19060 " │ └─ columns: [pk v1 v2]\n" + 19061 " └─ HashLookup\n" + 19062 " ├─ left-key: (a.pk)\n" + 19063 " ├─ right-key: (l.v2)\n" + 19064 " └─ MergeJoin\n" + 19065 " ├─ cmp: (k.v1 = l.pk)\n" + 19066 " ├─ TableAlias(k)\n" + 19067 " │ └─ IndexedTableAccess(one_pk_two_idx)\n" + 19068 " │ ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 19069 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 19070 " │ └─ columns: [v1]\n" + 19071 " └─ TableAlias(l)\n" + 19072 " └─ IndexedTableAccess(one_pk_three_idx)\n" + 19073 " ├─ index: [one_pk_three_idx.pk]\n" + 19074 " ├─ filters: [{[NULL, ∞)}]\n" + 19075 " └─ columns: [pk v2]\n" + 19076 "", 19077 }, 19078 { 19079 Query: `select a.* from one_pk_two_idx a LEFT JOIN (one_pk_two_idx i JOIN one_pk_three_idx j on i.pk = j.v3) on a.pk = i.pk RIGHT JOIN (one_pk_two_idx k JOIN one_pk_three_idx l on k.v2 = l.v3) on a.v1 = l.v2;`, 19080 ExpectedPlan: "Project\n" + 19081 " ├─ columns: [a.pk:3!null, a.v1:4, a.v2:5]\n" + 19082 " └─ LeftOuterHashJoin\n" + 19083 " ├─ Eq\n" + 19084 " │ ├─ a.v1:4\n" + 19085 " │ └─ l.v2:1\n" + 19086 " ├─ HashJoin\n" + 19087 " │ ├─ Eq\n" + 19088 " │ │ ├─ k.v2:0\n" + 19089 " │ │ └─ l.v3:2\n" + 19090 " │ ├─ TableAlias(k)\n" + 19091 " │ │ └─ ProcessTable\n" + 19092 " │ │ └─ Table\n" + 19093 " │ │ ├─ name: one_pk_two_idx\n" + 19094 " │ │ └─ columns: [v2]\n" + 19095 " │ └─ HashLookup\n" + 19096 " │ ├─ left-key: TUPLE(k.v2:0)\n" + 19097 " │ ├─ right-key: TUPLE(l.v3:1)\n" + 19098 " │ └─ TableAlias(l)\n" + 19099 " │ └─ ProcessTable\n" + 19100 " │ └─ Table\n" + 19101 " │ ├─ name: one_pk_three_idx\n" + 19102 " │ └─ columns: [v2 v3]\n" + 19103 " └─ HashLookup\n" + 19104 " ├─ left-key: TUPLE(l.v2:1)\n" + 19105 " ├─ right-key: TUPLE(a.v1:1)\n" + 19106 " └─ LeftOuterHashJoin\n" + 19107 " ├─ Eq\n" + 19108 " │ ├─ a.pk:3!null\n" + 19109 " │ └─ i.pk:7!null\n" + 19110 " ├─ TableAlias(a)\n" + 19111 " │ └─ Table\n" + 19112 " │ ├─ name: one_pk_two_idx\n" + 19113 " │ ├─ columns: [pk v1 v2]\n" + 19114 " │ ├─ colSet: (1-3)\n" + 19115 " │ └─ tableId: 1\n" + 19116 " └─ HashLookup\n" + 19117 " ├─ left-key: TUPLE(a.pk:3!null)\n" + 19118 " ├─ right-key: TUPLE(i.pk:1!null)\n" + 19119 " └─ LookupJoin\n" + 19120 " ├─ TableAlias(j)\n" + 19121 " │ └─ Table\n" + 19122 " │ ├─ name: one_pk_three_idx\n" + 19123 " │ ├─ columns: [v3]\n" + 19124 " │ ├─ colSet: (7-10)\n" + 19125 " │ └─ tableId: 3\n" + 19126 " └─ TableAlias(i)\n" + 19127 " └─ IndexedTableAccess(one_pk_two_idx)\n" + 19128 " ├─ index: [one_pk_two_idx.pk]\n" + 19129 " ├─ keys: [j.v3:6]\n" + 19130 " ├─ colSet: (4-6)\n" + 19131 " ├─ tableId: 2\n" + 19132 " └─ Table\n" + 19133 " ├─ name: one_pk_two_idx\n" + 19134 " └─ columns: [pk]\n" + 19135 "", 19136 ExpectedEstimates: "Project\n" + 19137 " ├─ columns: [a.pk, a.v1, a.v2]\n" + 19138 " └─ LeftOuterHashJoin (estimated cost=40.220 rows=12)\n" + 19139 " ├─ (a.v1 = l.v2)\n" + 19140 " ├─ HashJoin (estimated cost=32.180 rows=10)\n" + 19141 " │ ├─ (k.v2 = l.v3)\n" + 19142 " │ ├─ TableAlias(k)\n" + 19143 " │ │ └─ Table\n" + 19144 " │ │ ├─ name: one_pk_two_idx\n" + 19145 " │ │ └─ columns: [v2]\n" + 19146 " │ └─ HashLookup\n" + 19147 " │ ├─ left-key: (k.v2)\n" + 19148 " │ ├─ right-key: (l.v3)\n" + 19149 " │ └─ TableAlias(l)\n" + 19150 " │ └─ Table\n" + 19151 " │ ├─ name: one_pk_three_idx\n" + 19152 " │ └─ columns: [v2 v3]\n" + 19153 " └─ HashLookup\n" + 19154 " ├─ left-key: (l.v2)\n" + 19155 " ├─ right-key: (a.v1)\n" + 19156 " └─ LeftOuterHashJoin\n" + 19157 " ├─ (a.pk = i.pk)\n" + 19158 " ├─ TableAlias(a)\n" + 19159 " │ └─ Table\n" + 19160 " │ ├─ name: one_pk_two_idx\n" + 19161 " │ └─ columns: [pk v1 v2]\n" + 19162 " └─ HashLookup\n" + 19163 " ├─ left-key: (a.pk)\n" + 19164 " ├─ right-key: (i.pk)\n" + 19165 " └─ LookupJoin\n" + 19166 " ├─ TableAlias(j)\n" + 19167 " │ └─ Table\n" + 19168 " │ ├─ name: one_pk_three_idx\n" + 19169 " │ └─ columns: [v3]\n" + 19170 " └─ TableAlias(i)\n" + 19171 " └─ IndexedTableAccess(one_pk_two_idx)\n" + 19172 " ├─ index: [one_pk_two_idx.pk]\n" + 19173 " ├─ columns: [pk]\n" + 19174 " └─ keys: j.v3\n" + 19175 "", 19176 ExpectedAnalysis: "Project\n" + 19177 " ├─ columns: [a.pk, a.v1, a.v2]\n" + 19178 " └─ LeftOuterHashJoin (estimated cost=40.220 rows=12) (actual rows=20 loops=1)\n" + 19179 " ├─ (a.v1 = l.v2)\n" + 19180 " ├─ HashJoin (estimated cost=32.180 rows=10) (actual rows=8 loops=1)\n" + 19181 " │ ├─ (k.v2 = l.v3)\n" + 19182 " │ ├─ TableAlias(k)\n" + 19183 " │ │ └─ Table\n" + 19184 " │ │ ├─ name: one_pk_two_idx\n" + 19185 " │ │ └─ columns: [v2]\n" + 19186 " │ └─ HashLookup\n" + 19187 " │ ├─ left-key: (k.v2)\n" + 19188 " │ ├─ right-key: (l.v3)\n" + 19189 " │ └─ TableAlias(l)\n" + 19190 " │ └─ Table\n" + 19191 " │ ├─ name: one_pk_three_idx\n" + 19192 " │ └─ columns: [v2 v3]\n" + 19193 " └─ HashLookup\n" + 19194 " ├─ left-key: (l.v2)\n" + 19195 " ├─ right-key: (a.v1)\n" + 19196 " └─ LeftOuterHashJoin\n" + 19197 " ├─ (a.pk = i.pk)\n" + 19198 " ├─ TableAlias(a)\n" + 19199 " │ └─ Table\n" + 19200 " │ ├─ name: one_pk_two_idx\n" + 19201 " │ └─ columns: [pk v1 v2]\n" + 19202 " └─ HashLookup\n" + 19203 " ├─ left-key: (a.pk)\n" + 19204 " ├─ right-key: (i.pk)\n" + 19205 " └─ LookupJoin\n" + 19206 " ├─ TableAlias(j)\n" + 19207 " │ └─ Table\n" + 19208 " │ ├─ name: one_pk_three_idx\n" + 19209 " │ └─ columns: [v3]\n" + 19210 " └─ TableAlias(i)\n" + 19211 " └─ IndexedTableAccess(one_pk_two_idx)\n" + 19212 " ├─ index: [one_pk_two_idx.pk]\n" + 19213 " ├─ columns: [pk]\n" + 19214 " └─ keys: j.v3\n" + 19215 "", 19216 }, 19217 { 19218 Query: `select a.* from mytable a join mytable b on a.i = b.i and a.i > 2`, 19219 ExpectedPlan: "Project\n" + 19220 " ├─ columns: [a.i:0!null, a.s:1!null]\n" + 19221 " └─ LookupJoin\n" + 19222 " ├─ TableAlias(a)\n" + 19223 " │ └─ IndexedTableAccess(mytable)\n" + 19224 " │ ├─ index: [mytable.i]\n" + 19225 " │ ├─ static: [{(2, ∞)}]\n" + 19226 " │ ├─ colSet: (1,2)\n" + 19227 " │ ├─ tableId: 1\n" + 19228 " │ └─ Table\n" + 19229 " │ ├─ name: mytable\n" + 19230 " │ └─ columns: [i s]\n" + 19231 " └─ TableAlias(b)\n" + 19232 " └─ IndexedTableAccess(mytable)\n" + 19233 " ├─ index: [mytable.i]\n" + 19234 " ├─ keys: [a.i:0!null]\n" + 19235 " ├─ colSet: (3,4)\n" + 19236 " ├─ tableId: 2\n" + 19237 " └─ Table\n" + 19238 " ├─ name: mytable\n" + 19239 " └─ columns: [i]\n" + 19240 "", 19241 ExpectedEstimates: "Project\n" + 19242 " ├─ columns: [a.i, a.s]\n" + 19243 " └─ LookupJoin (estimated cost=3.300 rows=1)\n" + 19244 " ├─ TableAlias(a)\n" + 19245 " │ └─ IndexedTableAccess(mytable)\n" + 19246 " │ ├─ index: [mytable.i]\n" + 19247 " │ ├─ filters: [{(2, ∞)}]\n" + 19248 " │ └─ columns: [i s]\n" + 19249 " └─ TableAlias(b)\n" + 19250 " └─ IndexedTableAccess(mytable)\n" + 19251 " ├─ index: [mytable.i]\n" + 19252 " ├─ columns: [i]\n" + 19253 " └─ keys: a.i\n" + 19254 "", 19255 ExpectedAnalysis: "Project\n" + 19256 " ├─ columns: [a.i, a.s]\n" + 19257 " └─ LookupJoin (estimated cost=3.300 rows=1) (actual rows=1 loops=1)\n" + 19258 " ├─ TableAlias(a)\n" + 19259 " │ └─ IndexedTableAccess(mytable)\n" + 19260 " │ ├─ index: [mytable.i]\n" + 19261 " │ ├─ filters: [{(2, ∞)}]\n" + 19262 " │ └─ columns: [i s]\n" + 19263 " └─ TableAlias(b)\n" + 19264 " └─ IndexedTableAccess(mytable)\n" + 19265 " ├─ index: [mytable.i]\n" + 19266 " ├─ columns: [i]\n" + 19267 " └─ keys: a.i\n" + 19268 "", 19269 }, 19270 { 19271 Query: `select a.* from mytable a join mytable b on a.i = b.i and now() >= coalesce(NULL, NULL, now())`, 19272 ExpectedPlan: "Project\n" + 19273 " ├─ columns: [a.i:0!null, a.s:1!null]\n" + 19274 " └─ MergeJoin\n" + 19275 " ├─ cmp: Eq\n" + 19276 " │ ├─ a.i:0!null\n" + 19277 " │ └─ b.i:2!null\n" + 19278 " ├─ Filter\n" + 19279 " │ ├─ GreaterThanOrEqual\n" + 19280 " │ │ ├─ NOW()\n" + 19281 " │ │ └─ coalesce(NULL (null),NULL (null),NOW())\n" + 19282 " │ └─ TableAlias(a)\n" + 19283 " │ └─ IndexedTableAccess(mytable)\n" + 19284 " │ ├─ index: [mytable.i,mytable.s]\n" + 19285 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 19286 " │ ├─ colSet: (1,2)\n" + 19287 " │ ├─ tableId: 1\n" + 19288 " │ └─ Table\n" + 19289 " │ ├─ name: mytable\n" + 19290 " │ └─ columns: [i s]\n" + 19291 " └─ TableAlias(b)\n" + 19292 " └─ IndexedTableAccess(mytable)\n" + 19293 " ├─ index: [mytable.i]\n" + 19294 " ├─ static: [{[NULL, ∞)}]\n" + 19295 " ├─ colSet: (3,4)\n" + 19296 " ├─ tableId: 2\n" + 19297 " └─ Table\n" + 19298 " ├─ name: mytable\n" + 19299 " └─ columns: [i]\n" + 19300 "", 19301 ExpectedEstimates: "Project\n" + 19302 " ├─ columns: [a.i, a.s]\n" + 19303 " └─ MergeJoin (estimated cost=5.070 rows=2)\n" + 19304 " ├─ cmp: (a.i = b.i)\n" + 19305 " ├─ Filter\n" + 19306 " │ ├─ (NOW() >= coalesce(NULL,NULL,NOW()))\n" + 19307 " │ └─ TableAlias(a)\n" + 19308 " │ └─ IndexedTableAccess(mytable)\n" + 19309 " │ ├─ index: [mytable.i,mytable.s]\n" + 19310 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 19311 " │ └─ columns: [i s]\n" + 19312 " └─ TableAlias(b)\n" + 19313 " └─ IndexedTableAccess(mytable)\n" + 19314 " ├─ index: [mytable.i]\n" + 19315 " ├─ filters: [{[NULL, ∞)}]\n" + 19316 " └─ columns: [i]\n" + 19317 "", 19318 ExpectedAnalysis: "Project\n" + 19319 " ├─ columns: [a.i, a.s]\n" + 19320 " └─ MergeJoin (estimated cost=5.070 rows=2) (actual rows=3 loops=1)\n" + 19321 " ├─ cmp: (a.i = b.i)\n" + 19322 " ├─ Filter\n" + 19323 " │ ├─ (NOW() >= coalesce(NULL,NULL,NOW()))\n" + 19324 " │ └─ TableAlias(a)\n" + 19325 " │ └─ IndexedTableAccess(mytable)\n" + 19326 " │ ├─ index: [mytable.i,mytable.s]\n" + 19327 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 19328 " │ └─ columns: [i s]\n" + 19329 " └─ TableAlias(b)\n" + 19330 " └─ IndexedTableAccess(mytable)\n" + 19331 " ├─ index: [mytable.i]\n" + 19332 " ├─ filters: [{[NULL, ∞)}]\n" + 19333 " └─ columns: [i]\n" + 19334 "", 19335 }, 19336 { 19337 Query: `SELECT * from one_pk_three_idx where pk < 1 and v1 = 1 and v2 = 1`, 19338 ExpectedPlan: "Filter\n" + 19339 " ├─ LessThan\n" + 19340 " │ ├─ one_pk_three_idx.pk:0!null\n" + 19341 " │ └─ 1 (tinyint)\n" + 19342 " └─ IndexedTableAccess(one_pk_three_idx)\n" + 19343 " ├─ index: [one_pk_three_idx.v1,one_pk_three_idx.v2,one_pk_three_idx.v3]\n" + 19344 " ├─ static: [{[1, 1], [1, 1], [NULL, ∞)}]\n" + 19345 " ├─ colSet: (1-4)\n" + 19346 " ├─ tableId: 1\n" + 19347 " └─ Table\n" + 19348 " ├─ name: one_pk_three_idx\n" + 19349 " └─ columns: [pk v1 v2 v3]\n" + 19350 "", 19351 ExpectedEstimates: "Filter\n" + 19352 " ├─ (one_pk_three_idx.pk < 1)\n" + 19353 " └─ IndexedTableAccess(one_pk_three_idx)\n" + 19354 " ├─ index: [one_pk_three_idx.v1,one_pk_three_idx.v2,one_pk_three_idx.v3]\n" + 19355 " ├─ filters: [{[1, 1], [1, 1], [NULL, ∞)}]\n" + 19356 " └─ columns: [pk v1 v2 v3]\n" + 19357 "", 19358 ExpectedAnalysis: "Filter\n" + 19359 " ├─ (one_pk_three_idx.pk < 1)\n" + 19360 " └─ IndexedTableAccess(one_pk_three_idx)\n" + 19361 " ├─ index: [one_pk_three_idx.v1,one_pk_three_idx.v2,one_pk_three_idx.v3]\n" + 19362 " ├─ filters: [{[1, 1], [1, 1], [NULL, ∞)}]\n" + 19363 " └─ columns: [pk v1 v2 v3]\n" + 19364 "", 19365 }, 19366 { 19367 Query: `SELECT * from one_pk_three_idx where pk = 1 and v1 = 1 and v2 = 1`, 19368 ExpectedPlan: "Filter\n" + 19369 " ├─ AND\n" + 19370 " │ ├─ Eq\n" + 19371 " │ │ ├─ one_pk_three_idx.v1:1\n" + 19372 " │ │ └─ 1 (tinyint)\n" + 19373 " │ └─ Eq\n" + 19374 " │ ├─ one_pk_three_idx.v2:2\n" + 19375 " │ └─ 1 (tinyint)\n" + 19376 " └─ IndexedTableAccess(one_pk_three_idx)\n" + 19377 " ├─ index: [one_pk_three_idx.pk]\n" + 19378 " ├─ static: [{[1, 1]}]\n" + 19379 " ├─ colSet: (1-4)\n" + 19380 " ├─ tableId: 1\n" + 19381 " └─ Table\n" + 19382 " ├─ name: one_pk_three_idx\n" + 19383 " └─ columns: [pk v1 v2 v3]\n" + 19384 "", 19385 ExpectedEstimates: "Filter\n" + 19386 " ├─ ((one_pk_three_idx.v1 = 1) AND (one_pk_three_idx.v2 = 1))\n" + 19387 " └─ IndexedTableAccess(one_pk_three_idx)\n" + 19388 " ├─ index: [one_pk_three_idx.pk]\n" + 19389 " ├─ filters: [{[1, 1]}]\n" + 19390 " └─ columns: [pk v1 v2 v3]\n" + 19391 "", 19392 ExpectedAnalysis: "Filter\n" + 19393 " ├─ ((one_pk_three_idx.v1 = 1) AND (one_pk_three_idx.v2 = 1))\n" + 19394 " └─ IndexedTableAccess(one_pk_three_idx)\n" + 19395 " ├─ index: [one_pk_three_idx.pk]\n" + 19396 " ├─ filters: [{[1, 1]}]\n" + 19397 " └─ columns: [pk v1 v2 v3]\n" + 19398 "", 19399 }, 19400 { 19401 Query: `select * from mytable a join niltable b on a.i = b.i and b <=> NULL`, 19402 ExpectedPlan: "MergeJoin\n" + 19403 " ├─ cmp: Eq\n" + 19404 " │ ├─ a.i:0!null\n" + 19405 " │ └─ b.i:2!null\n" + 19406 " ├─ sel: (b.b:4 <=> NULL (null))\n" + 19407 " ├─ TableAlias(a)\n" + 19408 " │ └─ IndexedTableAccess(mytable)\n" + 19409 " │ ├─ index: [mytable.i,mytable.s]\n" + 19410 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 19411 " │ ├─ colSet: (1,2)\n" + 19412 " │ ├─ tableId: 1\n" + 19413 " │ └─ Table\n" + 19414 " │ ├─ name: mytable\n" + 19415 " │ └─ columns: [i s]\n" + 19416 " └─ TableAlias(b)\n" + 19417 " └─ IndexedTableAccess(niltable)\n" + 19418 " ├─ index: [niltable.i]\n" + 19419 " ├─ static: [{[NULL, ∞)}]\n" + 19420 " ├─ colSet: (3-6)\n" + 19421 " ├─ tableId: 2\n" + 19422 " └─ Table\n" + 19423 " ├─ name: niltable\n" + 19424 " └─ columns: [i i2 b f]\n" + 19425 "", 19426 ExpectedEstimates: "MergeJoin (estimated cost=9.120 rows=3)\n" + 19427 " ├─ cmp: (a.i = b.i)\n" + 19428 " ├─ sel: (b.b <=> NULL)\n" + 19429 " ├─ TableAlias(a)\n" + 19430 " │ └─ IndexedTableAccess(mytable)\n" + 19431 " │ ├─ index: [mytable.i,mytable.s]\n" + 19432 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 19433 " │ └─ columns: [i s]\n" + 19434 " └─ TableAlias(b)\n" + 19435 " └─ IndexedTableAccess(niltable)\n" + 19436 " ├─ index: [niltable.i]\n" + 19437 " ├─ filters: [{[NULL, ∞)}]\n" + 19438 " └─ columns: [i i2 b f]\n" + 19439 "", 19440 ExpectedAnalysis: "MergeJoin (estimated cost=9.120 rows=3) (actual rows=1 loops=1)\n" + 19441 " ├─ cmp: (a.i = b.i)\n" + 19442 " ├─ sel: (b.b <=> NULL)\n" + 19443 " ├─ TableAlias(a)\n" + 19444 " │ └─ IndexedTableAccess(mytable)\n" + 19445 " │ ├─ index: [mytable.i,mytable.s]\n" + 19446 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 19447 " │ └─ columns: [i s]\n" + 19448 " └─ TableAlias(b)\n" + 19449 " └─ IndexedTableAccess(niltable)\n" + 19450 " ├─ index: [niltable.i]\n" + 19451 " ├─ filters: [{[NULL, ∞)}]\n" + 19452 " └─ columns: [i i2 b f]\n" + 19453 "", 19454 }, 19455 { 19456 Query: `select * from mytable a join niltable b on a.i = b.i and b IS NOT NULL`, 19457 ExpectedPlan: "MergeJoin\n" + 19458 " ├─ cmp: Eq\n" + 19459 " │ ├─ a.i:0!null\n" + 19460 " │ └─ b.i:2!null\n" + 19461 " ├─ sel: NOT\n" + 19462 " │ └─ b.b:4 IS NULL\n" + 19463 " ├─ TableAlias(a)\n" + 19464 " │ └─ IndexedTableAccess(mytable)\n" + 19465 " │ ├─ index: [mytable.i,mytable.s]\n" + 19466 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 19467 " │ ├─ colSet: (1,2)\n" + 19468 " │ ├─ tableId: 1\n" + 19469 " │ └─ Table\n" + 19470 " │ ├─ name: mytable\n" + 19471 " │ └─ columns: [i s]\n" + 19472 " └─ TableAlias(b)\n" + 19473 " └─ IndexedTableAccess(niltable)\n" + 19474 " ├─ index: [niltable.i]\n" + 19475 " ├─ static: [{[NULL, ∞)}]\n" + 19476 " ├─ colSet: (3-6)\n" + 19477 " ├─ tableId: 2\n" + 19478 " └─ Table\n" + 19479 " ├─ name: niltable\n" + 19480 " └─ columns: [i i2 b f]\n" + 19481 "", 19482 ExpectedEstimates: "MergeJoin (estimated cost=9.120 rows=3)\n" + 19483 " ├─ cmp: (a.i = b.i)\n" + 19484 " ├─ sel: (NOT(b.b IS NULL))\n" + 19485 " ├─ TableAlias(a)\n" + 19486 " │ └─ IndexedTableAccess(mytable)\n" + 19487 " │ ├─ index: [mytable.i,mytable.s]\n" + 19488 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 19489 " │ └─ columns: [i s]\n" + 19490 " └─ TableAlias(b)\n" + 19491 " └─ IndexedTableAccess(niltable)\n" + 19492 " ├─ index: [niltable.i]\n" + 19493 " ├─ filters: [{[NULL, ∞)}]\n" + 19494 " └─ columns: [i i2 b f]\n" + 19495 "", 19496 ExpectedAnalysis: "MergeJoin (estimated cost=9.120 rows=3) (actual rows=2 loops=1)\n" + 19497 " ├─ cmp: (a.i = b.i)\n" + 19498 " ├─ sel: (NOT(b.b IS NULL))\n" + 19499 " ├─ TableAlias(a)\n" + 19500 " │ └─ IndexedTableAccess(mytable)\n" + 19501 " │ ├─ index: [mytable.i,mytable.s]\n" + 19502 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 19503 " │ └─ columns: [i s]\n" + 19504 " └─ TableAlias(b)\n" + 19505 " └─ IndexedTableAccess(niltable)\n" + 19506 " ├─ index: [niltable.i]\n" + 19507 " ├─ filters: [{[NULL, ∞)}]\n" + 19508 " └─ columns: [i i2 b f]\n" + 19509 "", 19510 }, 19511 { 19512 Query: `select * from mytable a join niltable b on a.i = b.i and b != 0`, 19513 ExpectedPlan: "MergeJoin\n" + 19514 " ├─ cmp: Eq\n" + 19515 " │ ├─ a.i:0!null\n" + 19516 " │ └─ b.i:2!null\n" + 19517 " ├─ TableAlias(a)\n" + 19518 " │ └─ IndexedTableAccess(mytable)\n" + 19519 " │ ├─ index: [mytable.i,mytable.s]\n" + 19520 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 19521 " │ ├─ colSet: (1,2)\n" + 19522 " │ ├─ tableId: 1\n" + 19523 " │ └─ Table\n" + 19524 " │ ├─ name: mytable\n" + 19525 " │ └─ columns: [i s]\n" + 19526 " └─ Filter\n" + 19527 " ├─ NOT\n" + 19528 " │ └─ Eq\n" + 19529 " │ ├─ b.b:2\n" + 19530 " │ └─ 0 (tinyint)\n" + 19531 " └─ TableAlias(b)\n" + 19532 " └─ IndexedTableAccess(niltable)\n" + 19533 " ├─ index: [niltable.i]\n" + 19534 " ├─ static: [{[NULL, ∞)}]\n" + 19535 " ├─ colSet: (3-6)\n" + 19536 " ├─ tableId: 2\n" + 19537 " └─ Table\n" + 19538 " ├─ name: niltable\n" + 19539 " └─ columns: [i i2 b f]\n" + 19540 "", 19541 ExpectedEstimates: "MergeJoin (estimated cost=7.100 rows=3)\n" + 19542 " ├─ cmp: (a.i = b.i)\n" + 19543 " ├─ TableAlias(a)\n" + 19544 " │ └─ IndexedTableAccess(mytable)\n" + 19545 " │ ├─ index: [mytable.i,mytable.s]\n" + 19546 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 19547 " │ └─ columns: [i s]\n" + 19548 " └─ Filter\n" + 19549 " ├─ (NOT((b.b = 0)))\n" + 19550 " └─ TableAlias(b)\n" + 19551 " └─ IndexedTableAccess(niltable)\n" + 19552 " ├─ index: [niltable.i]\n" + 19553 " ├─ filters: [{[NULL, ∞)}]\n" + 19554 " └─ columns: [i i2 b f]\n" + 19555 "", 19556 ExpectedAnalysis: "MergeJoin (estimated cost=7.100 rows=3) (actual rows=1 loops=1)\n" + 19557 " ├─ cmp: (a.i = b.i)\n" + 19558 " ├─ TableAlias(a)\n" + 19559 " │ └─ IndexedTableAccess(mytable)\n" + 19560 " │ ├─ index: [mytable.i,mytable.s]\n" + 19561 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 19562 " │ └─ columns: [i s]\n" + 19563 " └─ Filter\n" + 19564 " ├─ (NOT((b.b = 0)))\n" + 19565 " └─ TableAlias(b)\n" + 19566 " └─ IndexedTableAccess(niltable)\n" + 19567 " ├─ index: [niltable.i]\n" + 19568 " ├─ filters: [{[NULL, ∞)}]\n" + 19569 " └─ columns: [i i2 b f]\n" + 19570 "", 19571 }, 19572 { 19573 Query: `select * from mytable a join niltable b on a.i = b.i and s IS NOT NULL`, 19574 ExpectedPlan: "MergeJoin\n" + 19575 " ├─ cmp: Eq\n" + 19576 " │ ├─ a.i:0!null\n" + 19577 " │ └─ b.i:2!null\n" + 19578 " ├─ sel: NOT\n" + 19579 " │ └─ a.s:1!null IS NULL\n" + 19580 " ├─ TableAlias(a)\n" + 19581 " │ └─ IndexedTableAccess(mytable)\n" + 19582 " │ ├─ index: [mytable.i,mytable.s]\n" + 19583 " │ ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 19584 " │ ├─ colSet: (1,2)\n" + 19585 " │ ├─ tableId: 1\n" + 19586 " │ └─ Table\n" + 19587 " │ ├─ name: mytable\n" + 19588 " │ └─ columns: [i s]\n" + 19589 " └─ TableAlias(b)\n" + 19590 " └─ IndexedTableAccess(niltable)\n" + 19591 " ├─ index: [niltable.i]\n" + 19592 " ├─ static: [{[NULL, ∞)}]\n" + 19593 " ├─ colSet: (3-6)\n" + 19594 " ├─ tableId: 2\n" + 19595 " └─ Table\n" + 19596 " ├─ name: niltable\n" + 19597 " └─ columns: [i i2 b f]\n" + 19598 "", 19599 ExpectedEstimates: "MergeJoin (estimated cost=9.120 rows=3)\n" + 19600 " ├─ cmp: (a.i = b.i)\n" + 19601 " ├─ sel: (NOT(a.s IS NULL))\n" + 19602 " ├─ TableAlias(a)\n" + 19603 " │ └─ IndexedTableAccess(mytable)\n" + 19604 " │ ├─ index: [mytable.i,mytable.s]\n" + 19605 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 19606 " │ └─ columns: [i s]\n" + 19607 " └─ TableAlias(b)\n" + 19608 " └─ IndexedTableAccess(niltable)\n" + 19609 " ├─ index: [niltable.i]\n" + 19610 " ├─ filters: [{[NULL, ∞)}]\n" + 19611 " └─ columns: [i i2 b f]\n" + 19612 "", 19613 ExpectedAnalysis: "MergeJoin (estimated cost=9.120 rows=3) (actual rows=3 loops=1)\n" + 19614 " ├─ cmp: (a.i = b.i)\n" + 19615 " ├─ sel: (NOT(a.s IS NULL))\n" + 19616 " ├─ TableAlias(a)\n" + 19617 " │ └─ IndexedTableAccess(mytable)\n" + 19618 " │ ├─ index: [mytable.i,mytable.s]\n" + 19619 " │ ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 19620 " │ └─ columns: [i s]\n" + 19621 " └─ TableAlias(b)\n" + 19622 " └─ IndexedTableAccess(niltable)\n" + 19623 " ├─ index: [niltable.i]\n" + 19624 " ├─ filters: [{[NULL, ∞)}]\n" + 19625 " └─ columns: [i i2 b f]\n" + 19626 "", 19627 }, 19628 { 19629 Query: `select * from mytable a join niltable b on a.i <> b.i and b != 0;`, 19630 ExpectedPlan: "Project\n" + 19631 " ├─ columns: [a.i:4!null, a.s:5!null, b.i:0!null, b.i2:1, b.b:2, b.f:3]\n" + 19632 " └─ InnerJoin\n" + 19633 " ├─ NOT\n" + 19634 " │ └─ Eq\n" + 19635 " │ ├─ a.i:4!null\n" + 19636 " │ └─ b.i:0!null\n" + 19637 " ├─ Filter\n" + 19638 " │ ├─ NOT\n" + 19639 " │ │ └─ Eq\n" + 19640 " │ │ ├─ b.b:2\n" + 19641 " │ │ └─ 0 (tinyint)\n" + 19642 " │ └─ TableAlias(b)\n" + 19643 " │ └─ ProcessTable\n" + 19644 " │ └─ Table\n" + 19645 " │ ├─ name: niltable\n" + 19646 " │ └─ columns: [i i2 b f]\n" + 19647 " └─ TableAlias(a)\n" + 19648 " └─ ProcessTable\n" + 19649 " └─ Table\n" + 19650 " ├─ name: mytable\n" + 19651 " └─ columns: [i s]\n" + 19652 "", 19653 ExpectedEstimates: "Project\n" + 19654 " ├─ columns: [a.i, a.s, b.i, b.i2, b.b, b.f]\n" + 19655 " └─ InnerJoin (estimated cost=13.120 rows=3)\n" + 19656 " ├─ (NOT((a.i = b.i)))\n" + 19657 " ├─ Filter\n" + 19658 " │ ├─ (NOT((b.b = 0)))\n" + 19659 " │ └─ TableAlias(b)\n" + 19660 " │ └─ Table\n" + 19661 " │ ├─ name: niltable\n" + 19662 " │ └─ columns: [i i2 b f]\n" + 19663 " └─ TableAlias(a)\n" + 19664 " └─ Table\n" + 19665 " ├─ name: mytable\n" + 19666 " └─ columns: [i s]\n" + 19667 "", 19668 ExpectedAnalysis: "Project\n" + 19669 " ├─ columns: [a.i, a.s, b.i, b.i2, b.b, b.f]\n" + 19670 " └─ InnerJoin (estimated cost=13.120 rows=3) (actual rows=5 loops=1)\n" + 19671 " ├─ (NOT((a.i = b.i)))\n" + 19672 " ├─ Filter\n" + 19673 " │ ├─ (NOT((b.b = 0)))\n" + 19674 " │ └─ TableAlias(b)\n" + 19675 " │ └─ Table\n" + 19676 " │ ├─ name: niltable\n" + 19677 " │ └─ columns: [i i2 b f]\n" + 19678 " └─ TableAlias(a)\n" + 19679 " └─ Table\n" + 19680 " ├─ name: mytable\n" + 19681 " └─ columns: [i s]\n" + 19682 "", 19683 }, 19684 { 19685 Query: `select * from mytable a join niltable b on a.i <> b.i;`, 19686 ExpectedPlan: "Project\n" + 19687 " ├─ columns: [a.i:4!null, a.s:5!null, b.i:0!null, b.i2:1, b.b:2, b.f:3]\n" + 19688 " └─ InnerJoin\n" + 19689 " ├─ NOT\n" + 19690 " │ └─ Eq\n" + 19691 " │ ├─ a.i:4!null\n" + 19692 " │ └─ b.i:0!null\n" + 19693 " ├─ TableAlias(b)\n" + 19694 " │ └─ ProcessTable\n" + 19695 " │ └─ Table\n" + 19696 " │ ├─ name: niltable\n" + 19697 " │ └─ columns: [i i2 b f]\n" + 19698 " └─ TableAlias(a)\n" + 19699 " └─ ProcessTable\n" + 19700 " └─ Table\n" + 19701 " ├─ name: mytable\n" + 19702 " └─ columns: [i s]\n" + 19703 "", 19704 ExpectedEstimates: "Project\n" + 19705 " ├─ columns: [a.i, a.s, b.i, b.i2, b.b, b.f]\n" + 19706 " └─ InnerJoin (estimated cost=19.180 rows=3)\n" + 19707 " ├─ (NOT((a.i = b.i)))\n" + 19708 " ├─ TableAlias(b)\n" + 19709 " │ └─ Table\n" + 19710 " │ ├─ name: niltable\n" + 19711 " │ └─ columns: [i i2 b f]\n" + 19712 " └─ TableAlias(a)\n" + 19713 " └─ Table\n" + 19714 " ├─ name: mytable\n" + 19715 " └─ columns: [i s]\n" + 19716 "", 19717 ExpectedAnalysis: "Project\n" + 19718 " ├─ columns: [a.i, a.s, b.i, b.i2, b.b, b.f]\n" + 19719 " └─ InnerJoin (estimated cost=19.180 rows=3) (actual rows=15 loops=1)\n" + 19720 " ├─ (NOT((a.i = b.i)))\n" + 19721 " ├─ TableAlias(b)\n" + 19722 " │ └─ Table\n" + 19723 " │ ├─ name: niltable\n" + 19724 " │ └─ columns: [i i2 b f]\n" + 19725 " └─ TableAlias(a)\n" + 19726 " └─ Table\n" + 19727 " ├─ name: mytable\n" + 19728 " └─ columns: [i s]\n" + 19729 "", 19730 }, 19731 { 19732 Query: "with recursive a as (select 1 union select 2) select * from (select 1 where 1 in (select * from a)) as `temp`\n" + 19733 "", 19734 19735 ExpectedPlan: "SubqueryAlias\n" + 19736 " ├─ name: temp\n" + 19737 " ├─ outerVisibility: false\n" + 19738 " ├─ isLateral: false\n" + 19739 " ├─ cacheable: true\n" + 19740 " ├─ colSet: (4)\n" + 19741 " ├─ tableId: 4\n" + 19742 " └─ Project\n" + 19743 " ├─ columns: [1 (tinyint)]\n" + 19744 " └─ SemiJoin\n" + 19745 " ├─ Table\n" + 19746 " │ ├─ name: \n" + 19747 " │ ├─ columns: []\n" + 19748 " │ ├─ colSet: ()\n" + 19749 " │ └─ tableId: 0\n" + 19750 " └─ Filter\n" + 19751 " ├─ Eq\n" + 19752 " │ ├─ 1 (tinyint)\n" + 19753 " │ └─ a.1:0!null\n" + 19754 " └─ SubqueryAlias\n" + 19755 " ├─ name: a\n" + 19756 " ├─ outerVisibility: false\n" + 19757 " ├─ isLateral: false\n" + 19758 " ├─ cacheable: true\n" + 19759 " ├─ colSet: (1)\n" + 19760 " ├─ tableId: 2\n" + 19761 " └─ Union distinct\n" + 19762 " ├─ Project\n" + 19763 " │ ├─ columns: [1 (tinyint)]\n" + 19764 " │ └─ Table\n" + 19765 " │ ├─ name: \n" + 19766 " │ ├─ columns: []\n" + 19767 " │ ├─ colSet: ()\n" + 19768 " │ └─ tableId: 0\n" + 19769 " └─ Project\n" + 19770 " ├─ columns: [2 (tinyint)]\n" + 19771 " └─ Table\n" + 19772 " ├─ name: \n" + 19773 " ├─ columns: []\n" + 19774 " ├─ colSet: ()\n" + 19775 " └─ tableId: 0\n" + 19776 "", 19777 ExpectedEstimates: "SubqueryAlias\n" + 19778 " ├─ name: temp\n" + 19779 " ├─ outerVisibility: false\n" + 19780 " ├─ isLateral: false\n" + 19781 " ├─ cacheable: true\n" + 19782 " └─ Project\n" + 19783 " ├─ columns: [1]\n" + 19784 " └─ SemiJoin\n" + 19785 " ├─ Table\n" + 19786 " │ └─ name: \n" + 19787 " └─ Filter\n" + 19788 " ├─ (1 = a.1)\n" + 19789 " └─ SubqueryAlias\n" + 19790 " ├─ name: a\n" + 19791 " ├─ outerVisibility: false\n" + 19792 " ├─ isLateral: false\n" + 19793 " ├─ cacheable: true\n" + 19794 " └─ Union distinct\n" + 19795 " ├─ Project\n" + 19796 " │ ├─ columns: [1]\n" + 19797 " │ └─ Table\n" + 19798 " │ └─ name: \n" + 19799 " └─ Project\n" + 19800 " ├─ columns: [2]\n" + 19801 " └─ Table\n" + 19802 " └─ name: \n" + 19803 "", 19804 ExpectedAnalysis: "SubqueryAlias\n" + 19805 " ├─ name: temp\n" + 19806 " ├─ outerVisibility: false\n" + 19807 " ├─ isLateral: false\n" + 19808 " ├─ cacheable: true\n" + 19809 " └─ Project\n" + 19810 " ├─ columns: [1]\n" + 19811 " └─ SemiJoin\n" + 19812 " ├─ Table\n" + 19813 " │ └─ name: \n" + 19814 " └─ Filter\n" + 19815 " ├─ (1 = a.1)\n" + 19816 " └─ SubqueryAlias\n" + 19817 " ├─ name: a\n" + 19818 " ├─ outerVisibility: false\n" + 19819 " ├─ isLateral: false\n" + 19820 " ├─ cacheable: true\n" + 19821 " └─ Union distinct\n" + 19822 " ├─ Project\n" + 19823 " │ ├─ columns: [1]\n" + 19824 " │ └─ Table\n" + 19825 " │ └─ name: \n" + 19826 " └─ Project\n" + 19827 " ├─ columns: [2]\n" + 19828 " └─ Table\n" + 19829 " └─ name: \n" + 19830 "", 19831 }, 19832 { 19833 Query: `SELECT pk,pk1,pk2 FROM one_pk t1, two_pk t2 WHERE pk=1 AND pk2=1 AND pk1=1 ORDER BY 1,2`, 19834 ExpectedPlan: "Project\n" + 19835 " ├─ columns: [t1.pk:2!null, t2.pk1:0!null, t2.pk2:1!null]\n" + 19836 " └─ Sort(t1.pk:2!null ASC nullsFirst, t2.pk1:0!null ASC nullsFirst)\n" + 19837 " └─ CrossJoin\n" + 19838 " ├─ TableAlias(t2)\n" + 19839 " │ └─ IndexedTableAccess(two_pk)\n" + 19840 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 19841 " │ ├─ static: [{[1, 1], [1, 1]}]\n" + 19842 " │ ├─ colSet: (7-13)\n" + 19843 " │ ├─ tableId: 2\n" + 19844 " │ └─ Table\n" + 19845 " │ ├─ name: two_pk\n" + 19846 " │ └─ columns: [pk1 pk2]\n" + 19847 " └─ TableAlias(t1)\n" + 19848 " └─ IndexedTableAccess(one_pk)\n" + 19849 " ├─ index: [one_pk.pk]\n" + 19850 " ├─ static: [{[1, 1]}]\n" + 19851 " ├─ colSet: (1-6)\n" + 19852 " ├─ tableId: 1\n" + 19853 " └─ Table\n" + 19854 " ├─ name: one_pk\n" + 19855 " └─ columns: [pk]\n" + 19856 "", 19857 ExpectedEstimates: "Project\n" + 19858 " ├─ columns: [t1.pk, t2.pk1, t2.pk2]\n" + 19859 " └─ Sort(t1.pk ASC, t2.pk1 ASC)\n" + 19860 " └─ CrossJoin\n" + 19861 " ├─ TableAlias(t2)\n" + 19862 " │ └─ IndexedTableAccess(two_pk)\n" + 19863 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 19864 " │ ├─ filters: [{[1, 1], [1, 1]}]\n" + 19865 " │ └─ columns: [pk1 pk2]\n" + 19866 " └─ TableAlias(t1)\n" + 19867 " └─ IndexedTableAccess(one_pk)\n" + 19868 " ├─ index: [one_pk.pk]\n" + 19869 " ├─ filters: [{[1, 1]}]\n" + 19870 " └─ columns: [pk]\n" + 19871 "", 19872 ExpectedAnalysis: "Project\n" + 19873 " ├─ columns: [t1.pk, t2.pk1, t2.pk2]\n" + 19874 " └─ Sort(t1.pk ASC, t2.pk1 ASC)\n" + 19875 " └─ CrossJoin\n" + 19876 " ├─ TableAlias(t2)\n" + 19877 " │ └─ IndexedTableAccess(two_pk)\n" + 19878 " │ ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 19879 " │ ├─ filters: [{[1, 1], [1, 1]}]\n" + 19880 " │ └─ columns: [pk1 pk2]\n" + 19881 " └─ TableAlias(t1)\n" + 19882 " └─ IndexedTableAccess(one_pk)\n" + 19883 " ├─ index: [one_pk.pk]\n" + 19884 " ├─ filters: [{[1, 1]}]\n" + 19885 " └─ columns: [pk]\n" + 19886 "", 19887 }, 19888 { 19889 Query: `with recursive a as (select 1 union select 2) select * from a union select * from a limit 1;`, 19890 ExpectedPlan: "Union distinct\n" + 19891 " ├─ limit: 1\n" + 19892 " ├─ SubqueryAlias\n" + 19893 " │ ├─ name: a\n" + 19894 " │ ├─ outerVisibility: false\n" + 19895 " │ ├─ isLateral: false\n" + 19896 " │ ├─ cacheable: true\n" + 19897 " │ ├─ colSet: (1)\n" + 19898 " │ ├─ tableId: 2\n" + 19899 " │ └─ Union distinct\n" + 19900 " │ ├─ Project\n" + 19901 " │ │ ├─ columns: [1 (tinyint)]\n" + 19902 " │ │ └─ Table\n" + 19903 " │ │ ├─ name: \n" + 19904 " │ │ ├─ columns: []\n" + 19905 " │ │ ├─ colSet: ()\n" + 19906 " │ │ └─ tableId: 0\n" + 19907 " │ └─ Project\n" + 19908 " │ ├─ columns: [2 (tinyint)]\n" + 19909 " │ └─ Table\n" + 19910 " │ ├─ name: \n" + 19911 " │ ├─ columns: []\n" + 19912 " │ ├─ colSet: ()\n" + 19913 " │ └─ tableId: 0\n" + 19914 " └─ SubqueryAlias\n" + 19915 " ├─ name: a\n" + 19916 " ├─ outerVisibility: false\n" + 19917 " ├─ isLateral: false\n" + 19918 " ├─ cacheable: true\n" + 19919 " ├─ colSet: (1)\n" + 19920 " ├─ tableId: 2\n" + 19921 " └─ Union distinct\n" + 19922 " ├─ Project\n" + 19923 " │ ├─ columns: [1 (tinyint)]\n" + 19924 " │ └─ Table\n" + 19925 " │ ├─ name: \n" + 19926 " │ ├─ columns: []\n" + 19927 " │ ├─ colSet: ()\n" + 19928 " │ └─ tableId: 0\n" + 19929 " └─ Project\n" + 19930 " ├─ columns: [2 (tinyint)]\n" + 19931 " └─ Table\n" + 19932 " ├─ name: \n" + 19933 " ├─ columns: []\n" + 19934 " ├─ colSet: ()\n" + 19935 " └─ tableId: 0\n" + 19936 "", 19937 ExpectedEstimates: "Union distinct\n" + 19938 " ├─ limit: 1\n" + 19939 " ├─ SubqueryAlias\n" + 19940 " │ ├─ name: a\n" + 19941 " │ ├─ outerVisibility: false\n" + 19942 " │ ├─ isLateral: false\n" + 19943 " │ ├─ cacheable: true\n" + 19944 " │ └─ Union distinct\n" + 19945 " │ ├─ Project\n" + 19946 " │ │ ├─ columns: [1]\n" + 19947 " │ │ └─ Table\n" + 19948 " │ │ └─ name: \n" + 19949 " │ └─ Project\n" + 19950 " │ ├─ columns: [2]\n" + 19951 " │ └─ Table\n" + 19952 " │ └─ name: \n" + 19953 " └─ SubqueryAlias\n" + 19954 " ├─ name: a\n" + 19955 " ├─ outerVisibility: false\n" + 19956 " ├─ isLateral: false\n" + 19957 " ├─ cacheable: true\n" + 19958 " └─ Union distinct\n" + 19959 " ├─ Project\n" + 19960 " │ ├─ columns: [1]\n" + 19961 " │ └─ Table\n" + 19962 " │ └─ name: \n" + 19963 " └─ Project\n" + 19964 " ├─ columns: [2]\n" + 19965 " └─ Table\n" + 19966 " └─ name: \n" + 19967 "", 19968 ExpectedAnalysis: "Union distinct\n" + 19969 " ├─ limit: 1\n" + 19970 " ├─ SubqueryAlias\n" + 19971 " │ ├─ name: a\n" + 19972 " │ ├─ outerVisibility: false\n" + 19973 " │ ├─ isLateral: false\n" + 19974 " │ ├─ cacheable: true\n" + 19975 " │ └─ Union distinct\n" + 19976 " │ ├─ Project\n" + 19977 " │ │ ├─ columns: [1]\n" + 19978 " │ │ └─ Table\n" + 19979 " │ │ └─ name: \n" + 19980 " │ └─ Project\n" + 19981 " │ ├─ columns: [2]\n" + 19982 " │ └─ Table\n" + 19983 " │ └─ name: \n" + 19984 " └─ SubqueryAlias\n" + 19985 " ├─ name: a\n" + 19986 " ├─ outerVisibility: false\n" + 19987 " ├─ isLateral: false\n" + 19988 " ├─ cacheable: true\n" + 19989 " └─ Union distinct\n" + 19990 " ├─ Project\n" + 19991 " │ ├─ columns: [1]\n" + 19992 " │ └─ Table\n" + 19993 " │ └─ name: \n" + 19994 " └─ Project\n" + 19995 " ├─ columns: [2]\n" + 19996 " └─ Table\n" + 19997 " └─ name: \n" + 19998 "", 19999 }, 20000 { 20001 Query: `with recursive a(x) as (select 1 union select 2) select * from a having x > 1 union select * from a having x > 1;`, 20002 ExpectedPlan: "Union distinct\n" + 20003 " ├─ Having\n" + 20004 " │ ├─ GreaterThan\n" + 20005 " │ │ ├─ a.x:0!null\n" + 20006 " │ │ └─ 1 (tinyint)\n" + 20007 " │ └─ SubqueryAlias\n" + 20008 " │ ├─ name: a\n" + 20009 " │ ├─ outerVisibility: false\n" + 20010 " │ ├─ isLateral: false\n" + 20011 " │ ├─ cacheable: true\n" + 20012 " │ ├─ colSet: (1)\n" + 20013 " │ ├─ tableId: 2\n" + 20014 " │ └─ Union distinct\n" + 20015 " │ ├─ Project\n" + 20016 " │ │ ├─ columns: [1 (tinyint)]\n" + 20017 " │ │ └─ Table\n" + 20018 " │ │ ├─ name: \n" + 20019 " │ │ ├─ columns: []\n" + 20020 " │ │ ├─ colSet: ()\n" + 20021 " │ │ └─ tableId: 0\n" + 20022 " │ └─ Project\n" + 20023 " │ ├─ columns: [2 (tinyint)]\n" + 20024 " │ └─ Table\n" + 20025 " │ ├─ name: \n" + 20026 " │ ├─ columns: []\n" + 20027 " │ ├─ colSet: ()\n" + 20028 " │ └─ tableId: 0\n" + 20029 " └─ Having\n" + 20030 " ├─ GreaterThan\n" + 20031 " │ ├─ a.x:0!null\n" + 20032 " │ └─ 1 (tinyint)\n" + 20033 " └─ SubqueryAlias\n" + 20034 " ├─ name: a\n" + 20035 " ├─ outerVisibility: false\n" + 20036 " ├─ isLateral: false\n" + 20037 " ├─ cacheable: true\n" + 20038 " ├─ colSet: (1)\n" + 20039 " ├─ tableId: 2\n" + 20040 " └─ Union distinct\n" + 20041 " ├─ Project\n" + 20042 " │ ├─ columns: [1 (tinyint)]\n" + 20043 " │ └─ Table\n" + 20044 " │ ├─ name: \n" + 20045 " │ ├─ columns: []\n" + 20046 " │ ├─ colSet: ()\n" + 20047 " │ └─ tableId: 0\n" + 20048 " └─ Project\n" + 20049 " ├─ columns: [2 (tinyint)]\n" + 20050 " └─ Table\n" + 20051 " ├─ name: \n" + 20052 " ├─ columns: []\n" + 20053 " ├─ colSet: ()\n" + 20054 " └─ tableId: 0\n" + 20055 "", 20056 ExpectedEstimates: "Union distinct\n" + 20057 " ├─ Having((a.x > 1))\n" + 20058 " │ └─ SubqueryAlias\n" + 20059 " │ ├─ name: a\n" + 20060 " │ ├─ outerVisibility: false\n" + 20061 " │ ├─ isLateral: false\n" + 20062 " │ ├─ cacheable: true\n" + 20063 " │ └─ Union distinct\n" + 20064 " │ ├─ Project\n" + 20065 " │ │ ├─ columns: [1]\n" + 20066 " │ │ └─ Table\n" + 20067 " │ │ └─ name: \n" + 20068 " │ └─ Project\n" + 20069 " │ ├─ columns: [2]\n" + 20070 " │ └─ Table\n" + 20071 " │ └─ name: \n" + 20072 " └─ Having((a.x > 1))\n" + 20073 " └─ SubqueryAlias\n" + 20074 " ├─ name: a\n" + 20075 " ├─ outerVisibility: false\n" + 20076 " ├─ isLateral: false\n" + 20077 " ├─ cacheable: true\n" + 20078 " └─ Union distinct\n" + 20079 " ├─ Project\n" + 20080 " │ ├─ columns: [1]\n" + 20081 " │ └─ Table\n" + 20082 " │ └─ name: \n" + 20083 " └─ Project\n" + 20084 " ├─ columns: [2]\n" + 20085 " └─ Table\n" + 20086 " └─ name: \n" + 20087 "", 20088 ExpectedAnalysis: "Union distinct\n" + 20089 " ├─ Having((a.x > 1))\n" + 20090 " │ └─ SubqueryAlias\n" + 20091 " │ ├─ name: a\n" + 20092 " │ ├─ outerVisibility: false\n" + 20093 " │ ├─ isLateral: false\n" + 20094 " │ ├─ cacheable: true\n" + 20095 " │ └─ Union distinct\n" + 20096 " │ ├─ Project\n" + 20097 " │ │ ├─ columns: [1]\n" + 20098 " │ │ └─ Table\n" + 20099 " │ │ └─ name: \n" + 20100 " │ └─ Project\n" + 20101 " │ ├─ columns: [2]\n" + 20102 " │ └─ Table\n" + 20103 " │ └─ name: \n" + 20104 " └─ Having((a.x > 1))\n" + 20105 " └─ SubqueryAlias\n" + 20106 " ├─ name: a\n" + 20107 " ├─ outerVisibility: false\n" + 20108 " ├─ isLateral: false\n" + 20109 " ├─ cacheable: true\n" + 20110 " └─ Union distinct\n" + 20111 " ├─ Project\n" + 20112 " │ ├─ columns: [1]\n" + 20113 " │ └─ Table\n" + 20114 " │ └─ name: \n" + 20115 " └─ Project\n" + 20116 " ├─ columns: [2]\n" + 20117 " └─ Table\n" + 20118 " └─ name: \n" + 20119 "", 20120 }, 20121 { 20122 Query: `with recursive a(x) as (select 1 union select 2) select * from a where x > 1 union select * from a where x > 1;`, 20123 ExpectedPlan: "Union distinct\n" + 20124 " ├─ Filter\n" + 20125 " │ ├─ GreaterThan\n" + 20126 " │ │ ├─ a.x:0!null\n" + 20127 " │ │ └─ 1 (tinyint)\n" + 20128 " │ └─ SubqueryAlias\n" + 20129 " │ ├─ name: a\n" + 20130 " │ ├─ outerVisibility: false\n" + 20131 " │ ├─ isLateral: false\n" + 20132 " │ ├─ cacheable: true\n" + 20133 " │ ├─ colSet: (1)\n" + 20134 " │ ├─ tableId: 2\n" + 20135 " │ └─ Union distinct\n" + 20136 " │ ├─ Project\n" + 20137 " │ │ ├─ columns: [1 (tinyint)]\n" + 20138 " │ │ └─ Table\n" + 20139 " │ │ ├─ name: \n" + 20140 " │ │ ├─ columns: []\n" + 20141 " │ │ ├─ colSet: ()\n" + 20142 " │ │ └─ tableId: 0\n" + 20143 " │ └─ Project\n" + 20144 " │ ├─ columns: [2 (tinyint)]\n" + 20145 " │ └─ Table\n" + 20146 " │ ├─ name: \n" + 20147 " │ ├─ columns: []\n" + 20148 " │ ├─ colSet: ()\n" + 20149 " │ └─ tableId: 0\n" + 20150 " └─ Filter\n" + 20151 " ├─ GreaterThan\n" + 20152 " │ ├─ a.x:0!null\n" + 20153 " │ └─ 1 (tinyint)\n" + 20154 " └─ SubqueryAlias\n" + 20155 " ├─ name: a\n" + 20156 " ├─ outerVisibility: false\n" + 20157 " ├─ isLateral: false\n" + 20158 " ├─ cacheable: true\n" + 20159 " ├─ colSet: (1)\n" + 20160 " ├─ tableId: 2\n" + 20161 " └─ Union distinct\n" + 20162 " ├─ Project\n" + 20163 " │ ├─ columns: [1 (tinyint)]\n" + 20164 " │ └─ Table\n" + 20165 " │ ├─ name: \n" + 20166 " │ ├─ columns: []\n" + 20167 " │ ├─ colSet: ()\n" + 20168 " │ └─ tableId: 0\n" + 20169 " └─ Project\n" + 20170 " ├─ columns: [2 (tinyint)]\n" + 20171 " └─ Table\n" + 20172 " ├─ name: \n" + 20173 " ├─ columns: []\n" + 20174 " ├─ colSet: ()\n" + 20175 " └─ tableId: 0\n" + 20176 "", 20177 ExpectedEstimates: "Union distinct\n" + 20178 " ├─ Filter\n" + 20179 " │ ├─ (a.x > 1)\n" + 20180 " │ └─ SubqueryAlias\n" + 20181 " │ ├─ name: a\n" + 20182 " │ ├─ outerVisibility: false\n" + 20183 " │ ├─ isLateral: false\n" + 20184 " │ ├─ cacheable: true\n" + 20185 " │ └─ Union distinct\n" + 20186 " │ ├─ Project\n" + 20187 " │ │ ├─ columns: [1]\n" + 20188 " │ │ └─ Table\n" + 20189 " │ │ └─ name: \n" + 20190 " │ └─ Project\n" + 20191 " │ ├─ columns: [2]\n" + 20192 " │ └─ Table\n" + 20193 " │ └─ name: \n" + 20194 " └─ Filter\n" + 20195 " ├─ (a.x > 1)\n" + 20196 " └─ SubqueryAlias\n" + 20197 " ├─ name: a\n" + 20198 " ├─ outerVisibility: false\n" + 20199 " ├─ isLateral: false\n" + 20200 " ├─ cacheable: true\n" + 20201 " └─ Union distinct\n" + 20202 " ├─ Project\n" + 20203 " │ ├─ columns: [1]\n" + 20204 " │ └─ Table\n" + 20205 " │ └─ name: \n" + 20206 " └─ Project\n" + 20207 " ├─ columns: [2]\n" + 20208 " └─ Table\n" + 20209 " └─ name: \n" + 20210 "", 20211 ExpectedAnalysis: "Union distinct\n" + 20212 " ├─ Filter\n" + 20213 " │ ├─ (a.x > 1)\n" + 20214 " │ └─ SubqueryAlias\n" + 20215 " │ ├─ name: a\n" + 20216 " │ ├─ outerVisibility: false\n" + 20217 " │ ├─ isLateral: false\n" + 20218 " │ ├─ cacheable: true\n" + 20219 " │ └─ Union distinct\n" + 20220 " │ ├─ Project\n" + 20221 " │ │ ├─ columns: [1]\n" + 20222 " │ │ └─ Table\n" + 20223 " │ │ └─ name: \n" + 20224 " │ └─ Project\n" + 20225 " │ ├─ columns: [2]\n" + 20226 " │ └─ Table\n" + 20227 " │ └─ name: \n" + 20228 " └─ Filter\n" + 20229 " ├─ (a.x > 1)\n" + 20230 " └─ SubqueryAlias\n" + 20231 " ├─ name: a\n" + 20232 " ├─ outerVisibility: false\n" + 20233 " ├─ isLateral: false\n" + 20234 " ├─ cacheable: true\n" + 20235 " └─ Union distinct\n" + 20236 " ├─ Project\n" + 20237 " │ ├─ columns: [1]\n" + 20238 " │ └─ Table\n" + 20239 " │ └─ name: \n" + 20240 " └─ Project\n" + 20241 " ├─ columns: [2]\n" + 20242 " └─ Table\n" + 20243 " └─ name: \n" + 20244 "", 20245 }, 20246 { 20247 Query: `with recursive a(x) as (select 1 union select 2) select * from a union select * from a group by x;`, 20248 ExpectedPlan: "Union distinct\n" + 20249 " ├─ SubqueryAlias\n" + 20250 " │ ├─ name: a\n" + 20251 " │ ├─ outerVisibility: false\n" + 20252 " │ ├─ isLateral: false\n" + 20253 " │ ├─ cacheable: true\n" + 20254 " │ ├─ colSet: (1)\n" + 20255 " │ ├─ tableId: 2\n" + 20256 " │ └─ Union distinct\n" + 20257 " │ ├─ Project\n" + 20258 " │ │ ├─ columns: [1 (tinyint)]\n" + 20259 " │ │ └─ Table\n" + 20260 " │ │ ├─ name: \n" + 20261 " │ │ ├─ columns: []\n" + 20262 " │ │ ├─ colSet: ()\n" + 20263 " │ │ └─ tableId: 0\n" + 20264 " │ └─ Project\n" + 20265 " │ ├─ columns: [2 (tinyint)]\n" + 20266 " │ └─ Table\n" + 20267 " │ ├─ name: \n" + 20268 " │ ├─ columns: []\n" + 20269 " │ ├─ colSet: ()\n" + 20270 " │ └─ tableId: 0\n" + 20271 " └─ GroupBy\n" + 20272 " ├─ select: a.x:0!null\n" + 20273 " ├─ group: a.x:0!null\n" + 20274 " └─ SubqueryAlias\n" + 20275 " ├─ name: a\n" + 20276 " ├─ outerVisibility: false\n" + 20277 " ├─ isLateral: false\n" + 20278 " ├─ cacheable: true\n" + 20279 " ├─ colSet: (1)\n" + 20280 " ├─ tableId: 2\n" + 20281 " └─ Union distinct\n" + 20282 " ├─ Project\n" + 20283 " │ ├─ columns: [1 (tinyint)]\n" + 20284 " │ └─ Table\n" + 20285 " │ ├─ name: \n" + 20286 " │ ├─ columns: []\n" + 20287 " │ ├─ colSet: ()\n" + 20288 " │ └─ tableId: 0\n" + 20289 " └─ Project\n" + 20290 " ├─ columns: [2 (tinyint)]\n" + 20291 " └─ Table\n" + 20292 " ├─ name: \n" + 20293 " ├─ columns: []\n" + 20294 " ├─ colSet: ()\n" + 20295 " └─ tableId: 0\n" + 20296 "", 20297 ExpectedEstimates: "Union distinct\n" + 20298 " ├─ SubqueryAlias\n" + 20299 " │ ├─ name: a\n" + 20300 " │ ├─ outerVisibility: false\n" + 20301 " │ ├─ isLateral: false\n" + 20302 " │ ├─ cacheable: true\n" + 20303 " │ └─ Union distinct\n" + 20304 " │ ├─ Project\n" + 20305 " │ │ ├─ columns: [1]\n" + 20306 " │ │ └─ Table\n" + 20307 " │ │ └─ name: \n" + 20308 " │ └─ Project\n" + 20309 " │ ├─ columns: [2]\n" + 20310 " │ └─ Table\n" + 20311 " │ └─ name: \n" + 20312 " └─ GroupBy\n" + 20313 " ├─ SelectedExprs(a.x)\n" + 20314 " ├─ Grouping(a.x)\n" + 20315 " └─ SubqueryAlias\n" + 20316 " ├─ name: a\n" + 20317 " ├─ outerVisibility: false\n" + 20318 " ├─ isLateral: false\n" + 20319 " ├─ cacheable: true\n" + 20320 " └─ Union distinct\n" + 20321 " ├─ Project\n" + 20322 " │ ├─ columns: [1]\n" + 20323 " │ └─ Table\n" + 20324 " │ └─ name: \n" + 20325 " └─ Project\n" + 20326 " ├─ columns: [2]\n" + 20327 " └─ Table\n" + 20328 " └─ name: \n" + 20329 "", 20330 ExpectedAnalysis: "Union distinct\n" + 20331 " ├─ SubqueryAlias\n" + 20332 " │ ├─ name: a\n" + 20333 " │ ├─ outerVisibility: false\n" + 20334 " │ ├─ isLateral: false\n" + 20335 " │ ├─ cacheable: true\n" + 20336 " │ └─ Union distinct\n" + 20337 " │ ├─ Project\n" + 20338 " │ │ ├─ columns: [1]\n" + 20339 " │ │ └─ Table\n" + 20340 " │ │ └─ name: \n" + 20341 " │ └─ Project\n" + 20342 " │ ├─ columns: [2]\n" + 20343 " │ └─ Table\n" + 20344 " │ └─ name: \n" + 20345 " └─ GroupBy\n" + 20346 " ├─ SelectedExprs(a.x)\n" + 20347 " ├─ Grouping(a.x)\n" + 20348 " └─ SubqueryAlias\n" + 20349 " ├─ name: a\n" + 20350 " ├─ outerVisibility: false\n" + 20351 " ├─ isLateral: false\n" + 20352 " ├─ cacheable: true\n" + 20353 " └─ Union distinct\n" + 20354 " ├─ Project\n" + 20355 " │ ├─ columns: [1]\n" + 20356 " │ └─ Table\n" + 20357 " │ └─ name: \n" + 20358 " └─ Project\n" + 20359 " ├─ columns: [2]\n" + 20360 " └─ Table\n" + 20361 " └─ name: \n" + 20362 "", 20363 }, 20364 { 20365 Query: `with recursive a(x) as (select 1 union select 2) select * from a union select * from a order by x desc;`, 20366 ExpectedPlan: "Union distinct\n" + 20367 " ├─ sortFields: a.x:0!null\n" + 20368 " ├─ SubqueryAlias\n" + 20369 " │ ├─ name: a\n" + 20370 " │ ├─ outerVisibility: false\n" + 20371 " │ ├─ isLateral: false\n" + 20372 " │ ├─ cacheable: true\n" + 20373 " │ ├─ colSet: (1)\n" + 20374 " │ ├─ tableId: 2\n" + 20375 " │ └─ Union distinct\n" + 20376 " │ ├─ Project\n" + 20377 " │ │ ├─ columns: [1 (tinyint)]\n" + 20378 " │ │ └─ Table\n" + 20379 " │ │ ├─ name: \n" + 20380 " │ │ ├─ columns: []\n" + 20381 " │ │ ├─ colSet: ()\n" + 20382 " │ │ └─ tableId: 0\n" + 20383 " │ └─ Project\n" + 20384 " │ ├─ columns: [2 (tinyint)]\n" + 20385 " │ └─ Table\n" + 20386 " │ ├─ name: \n" + 20387 " │ ├─ columns: []\n" + 20388 " │ ├─ colSet: ()\n" + 20389 " │ └─ tableId: 0\n" + 20390 " └─ SubqueryAlias\n" + 20391 " ├─ name: a\n" + 20392 " ├─ outerVisibility: false\n" + 20393 " ├─ isLateral: false\n" + 20394 " ├─ cacheable: true\n" + 20395 " ├─ colSet: (1)\n" + 20396 " ├─ tableId: 2\n" + 20397 " └─ Union distinct\n" + 20398 " ├─ Project\n" + 20399 " │ ├─ columns: [1 (tinyint)]\n" + 20400 " │ └─ Table\n" + 20401 " │ ├─ name: \n" + 20402 " │ ├─ columns: []\n" + 20403 " │ ├─ colSet: ()\n" + 20404 " │ └─ tableId: 0\n" + 20405 " └─ Project\n" + 20406 " ├─ columns: [2 (tinyint)]\n" + 20407 " └─ Table\n" + 20408 " ├─ name: \n" + 20409 " ├─ columns: []\n" + 20410 " ├─ colSet: ()\n" + 20411 " └─ tableId: 0\n" + 20412 "", 20413 ExpectedEstimates: "Union distinct\n" + 20414 " ├─ sortFields: [a.x]\n" + 20415 " ├─ SubqueryAlias\n" + 20416 " │ ├─ name: a\n" + 20417 " │ ├─ outerVisibility: false\n" + 20418 " │ ├─ isLateral: false\n" + 20419 " │ ├─ cacheable: true\n" + 20420 " │ └─ Union distinct\n" + 20421 " │ ├─ Project\n" + 20422 " │ │ ├─ columns: [1]\n" + 20423 " │ │ └─ Table\n" + 20424 " │ │ └─ name: \n" + 20425 " │ └─ Project\n" + 20426 " │ ├─ columns: [2]\n" + 20427 " │ └─ Table\n" + 20428 " │ └─ name: \n" + 20429 " └─ SubqueryAlias\n" + 20430 " ├─ name: a\n" + 20431 " ├─ outerVisibility: false\n" + 20432 " ├─ isLateral: false\n" + 20433 " ├─ cacheable: true\n" + 20434 " └─ Union distinct\n" + 20435 " ├─ Project\n" + 20436 " │ ├─ columns: [1]\n" + 20437 " │ └─ Table\n" + 20438 " │ └─ name: \n" + 20439 " └─ Project\n" + 20440 " ├─ columns: [2]\n" + 20441 " └─ Table\n" + 20442 " └─ name: \n" + 20443 "", 20444 ExpectedAnalysis: "Union distinct\n" + 20445 " ├─ sortFields: [a.x]\n" + 20446 " ├─ SubqueryAlias\n" + 20447 " │ ├─ name: a\n" + 20448 " │ ├─ outerVisibility: false\n" + 20449 " │ ├─ isLateral: false\n" + 20450 " │ ├─ cacheable: true\n" + 20451 " │ └─ Union distinct\n" + 20452 " │ ├─ Project\n" + 20453 " │ │ ├─ columns: [1]\n" + 20454 " │ │ └─ Table\n" + 20455 " │ │ └─ name: \n" + 20456 " │ └─ Project\n" + 20457 " │ ├─ columns: [2]\n" + 20458 " │ └─ Table\n" + 20459 " │ └─ name: \n" + 20460 " └─ SubqueryAlias\n" + 20461 " ├─ name: a\n" + 20462 " ├─ outerVisibility: false\n" + 20463 " ├─ isLateral: false\n" + 20464 " ├─ cacheable: true\n" + 20465 " └─ Union distinct\n" + 20466 " ├─ Project\n" + 20467 " │ ├─ columns: [1]\n" + 20468 " │ └─ Table\n" + 20469 " │ └─ name: \n" + 20470 " └─ Project\n" + 20471 " ├─ columns: [2]\n" + 20472 " └─ Table\n" + 20473 " └─ name: \n" + 20474 "", 20475 }, 20476 { 20477 Query: `WITH recursive n(i) as (SELECT 1 UNION ALL SELECT i + 1 FROM n WHERE i+1 <= 10 LIMIT 5) SELECT count(i) FROM n;`, 20478 ExpectedPlan: "Project\n" + 20479 " ├─ columns: [count(n.i):0!null as count(i)]\n" + 20480 " └─ GroupBy\n" + 20481 " ├─ select: COUNT(n.i:0!null)\n" + 20482 " ├─ group: \n" + 20483 " └─ SubqueryAlias\n" + 20484 " ├─ name: n\n" + 20485 " ├─ outerVisibility: false\n" + 20486 " ├─ isLateral: false\n" + 20487 " ├─ cacheable: true\n" + 20488 " ├─ colSet: (2)\n" + 20489 " ├─ tableId: 1\n" + 20490 " └─ RecursiveCTE\n" + 20491 " └─ Union all\n" + 20492 " ├─ limit: 5\n" + 20493 " ├─ Project\n" + 20494 " │ ├─ columns: [1 (tinyint)]\n" + 20495 " │ └─ Table\n" + 20496 " │ ├─ name: \n" + 20497 " │ ├─ columns: []\n" + 20498 " │ ├─ colSet: ()\n" + 20499 " │ └─ tableId: 0\n" + 20500 " └─ Project\n" + 20501 " ├─ columns: [(n.i:0!null + 1 (tinyint)) as i + 1]\n" + 20502 " └─ Filter\n" + 20503 " ├─ LessThanOrEqual\n" + 20504 " │ ├─ (n.i:0!null + 1 (tinyint))\n" + 20505 " │ └─ 10 (tinyint)\n" + 20506 " └─ RecursiveTable(n)\n" + 20507 "", 20508 ExpectedEstimates: "Project\n" + 20509 " ├─ columns: [count(n.i) as count(i)]\n" + 20510 " └─ GroupBy\n" + 20511 " ├─ SelectedExprs(COUNT(n.i))\n" + 20512 " ├─ Grouping()\n" + 20513 " └─ SubqueryAlias\n" + 20514 " ├─ name: n\n" + 20515 " ├─ outerVisibility: false\n" + 20516 " ├─ isLateral: false\n" + 20517 " ├─ cacheable: true\n" + 20518 " └─ RecursiveCTE\n" + 20519 " └─ Union all\n" + 20520 " ├─ limit: 5\n" + 20521 " ├─ Project\n" + 20522 " │ ├─ columns: [1]\n" + 20523 " │ └─ Table\n" + 20524 " │ └─ name: \n" + 20525 " └─ Project\n" + 20526 " ├─ columns: [(n.i + 1) as i + 1]\n" + 20527 " └─ Filter\n" + 20528 " ├─ ((n.i + 1) <= 10)\n" + 20529 " └─ RecursiveTable(n)\n" + 20530 "", 20531 ExpectedAnalysis: "Project\n" + 20532 " ├─ columns: [count(n.i) as count(i)]\n" + 20533 " └─ GroupBy\n" + 20534 " ├─ SelectedExprs(COUNT(n.i))\n" + 20535 " ├─ Grouping()\n" + 20536 " └─ SubqueryAlias\n" + 20537 " ├─ name: n\n" + 20538 " ├─ outerVisibility: false\n" + 20539 " ├─ isLateral: false\n" + 20540 " ├─ cacheable: true\n" + 20541 " └─ RecursiveCTE\n" + 20542 " └─ Union all\n" + 20543 " ├─ limit: 5\n" + 20544 " ├─ Project\n" + 20545 " │ ├─ columns: [1]\n" + 20546 " │ └─ Table\n" + 20547 " │ └─ name: \n" + 20548 " └─ Project\n" + 20549 " ├─ columns: [(n.i + 1) as i + 1]\n" + 20550 " └─ Filter\n" + 20551 " ├─ ((n.i + 1) <= 10)\n" + 20552 " └─ RecursiveTable(n)\n" + 20553 "", 20554 }, 20555 { 20556 Query: `WITH recursive n(i) as (SELECT 1 UNION ALL SELECT i + 1 FROM n GROUP BY i HAVING i+1 <= 10) SELECT count(i) FROM n;`, 20557 ExpectedPlan: "Project\n" + 20558 " ├─ columns: [count(n.i):0!null as count(i)]\n" + 20559 " └─ GroupBy\n" + 20560 " ├─ select: COUNT(n.i:0!null)\n" + 20561 " ├─ group: \n" + 20562 " └─ SubqueryAlias\n" + 20563 " ├─ name: n\n" + 20564 " ├─ outerVisibility: false\n" + 20565 " ├─ isLateral: false\n" + 20566 " ├─ cacheable: true\n" + 20567 " ├─ colSet: (2)\n" + 20568 " ├─ tableId: 1\n" + 20569 " └─ RecursiveCTE\n" + 20570 " └─ Union all\n" + 20571 " ├─ Project\n" + 20572 " │ ├─ columns: [1 (tinyint)]\n" + 20573 " │ └─ Table\n" + 20574 " │ ├─ name: \n" + 20575 " │ ├─ columns: []\n" + 20576 " │ ├─ colSet: ()\n" + 20577 " │ └─ tableId: 0\n" + 20578 " └─ Project\n" + 20579 " ├─ columns: [(n.i:0!null + 1 (tinyint)) as i + 1]\n" + 20580 " └─ Having\n" + 20581 " ├─ LessThanOrEqual\n" + 20582 " │ ├─ (n.i:0!null + 1 (tinyint))\n" + 20583 " │ └─ 10 (tinyint)\n" + 20584 " └─ GroupBy\n" + 20585 " ├─ select: n.i:0!null\n" + 20586 " ├─ group: n.i:0!null\n" + 20587 " └─ RecursiveTable(n)\n" + 20588 "", 20589 ExpectedEstimates: "Project\n" + 20590 " ├─ columns: [count(n.i) as count(i)]\n" + 20591 " └─ GroupBy\n" + 20592 " ├─ SelectedExprs(COUNT(n.i))\n" + 20593 " ├─ Grouping()\n" + 20594 " └─ SubqueryAlias\n" + 20595 " ├─ name: n\n" + 20596 " ├─ outerVisibility: false\n" + 20597 " ├─ isLateral: false\n" + 20598 " ├─ cacheable: true\n" + 20599 " └─ RecursiveCTE\n" + 20600 " └─ Union all\n" + 20601 " ├─ Project\n" + 20602 " │ ├─ columns: [1]\n" + 20603 " │ └─ Table\n" + 20604 " │ └─ name: \n" + 20605 " └─ Project\n" + 20606 " ├─ columns: [(n.i + 1) as i + 1]\n" + 20607 " └─ Having(((n.i + 1) <= 10))\n" + 20608 " └─ GroupBy\n" + 20609 " ├─ SelectedExprs(n.i)\n" + 20610 " ├─ Grouping(n.i)\n" + 20611 " └─ RecursiveTable(n)\n" + 20612 "", 20613 ExpectedAnalysis: "Project\n" + 20614 " ├─ columns: [count(n.i) as count(i)]\n" + 20615 " └─ GroupBy\n" + 20616 " ├─ SelectedExprs(COUNT(n.i))\n" + 20617 " ├─ Grouping()\n" + 20618 " └─ SubqueryAlias\n" + 20619 " ├─ name: n\n" + 20620 " ├─ outerVisibility: false\n" + 20621 " ├─ isLateral: false\n" + 20622 " ├─ cacheable: true\n" + 20623 " └─ RecursiveCTE\n" + 20624 " └─ Union all\n" + 20625 " ├─ Project\n" + 20626 " │ ├─ columns: [1]\n" + 20627 " │ └─ Table\n" + 20628 " │ └─ name: \n" + 20629 " └─ Project\n" + 20630 " ├─ columns: [(n.i + 1) as i + 1]\n" + 20631 " └─ Having(((n.i + 1) <= 10))\n" + 20632 " └─ GroupBy\n" + 20633 " ├─ SelectedExprs(n.i)\n" + 20634 " ├─ Grouping(n.i)\n" + 20635 " └─ RecursiveTable(n)\n" + 20636 "", 20637 }, 20638 { 20639 Query: `WITH recursive n(i) as (SELECT 1 UNION ALL SELECT i + 1 FROM n WHERE i+1 <= 10 LIMIT 1) SELECT count(i) FROM n;`, 20640 ExpectedPlan: "Project\n" + 20641 " ├─ columns: [count(n.i):0!null as count(i)]\n" + 20642 " └─ GroupBy\n" + 20643 " ├─ select: COUNT(n.i:0!null)\n" + 20644 " ├─ group: \n" + 20645 " └─ SubqueryAlias\n" + 20646 " ├─ name: n\n" + 20647 " ├─ outerVisibility: false\n" + 20648 " ├─ isLateral: false\n" + 20649 " ├─ cacheable: true\n" + 20650 " ├─ colSet: (2)\n" + 20651 " ├─ tableId: 1\n" + 20652 " └─ RecursiveCTE\n" + 20653 " └─ Union all\n" + 20654 " ├─ limit: 1\n" + 20655 " ├─ Project\n" + 20656 " │ ├─ columns: [1 (tinyint)]\n" + 20657 " │ └─ Table\n" + 20658 " │ ├─ name: \n" + 20659 " │ ├─ columns: []\n" + 20660 " │ ├─ colSet: ()\n" + 20661 " │ └─ tableId: 0\n" + 20662 " └─ Project\n" + 20663 " ├─ columns: [(n.i:0!null + 1 (tinyint)) as i + 1]\n" + 20664 " └─ Filter\n" + 20665 " ├─ LessThanOrEqual\n" + 20666 " │ ├─ (n.i:0!null + 1 (tinyint))\n" + 20667 " │ └─ 10 (tinyint)\n" + 20668 " └─ RecursiveTable(n)\n" + 20669 "", 20670 ExpectedEstimates: "Project\n" + 20671 " ├─ columns: [count(n.i) as count(i)]\n" + 20672 " └─ GroupBy\n" + 20673 " ├─ SelectedExprs(COUNT(n.i))\n" + 20674 " ├─ Grouping()\n" + 20675 " └─ SubqueryAlias\n" + 20676 " ├─ name: n\n" + 20677 " ├─ outerVisibility: false\n" + 20678 " ├─ isLateral: false\n" + 20679 " ├─ cacheable: true\n" + 20680 " └─ RecursiveCTE\n" + 20681 " └─ Union all\n" + 20682 " ├─ limit: 1\n" + 20683 " ├─ Project\n" + 20684 " │ ├─ columns: [1]\n" + 20685 " │ └─ Table\n" + 20686 " │ └─ name: \n" + 20687 " └─ Project\n" + 20688 " ├─ columns: [(n.i + 1) as i + 1]\n" + 20689 " └─ Filter\n" + 20690 " ├─ ((n.i + 1) <= 10)\n" + 20691 " └─ RecursiveTable(n)\n" + 20692 "", 20693 ExpectedAnalysis: "Project\n" + 20694 " ├─ columns: [count(n.i) as count(i)]\n" + 20695 " └─ GroupBy\n" + 20696 " ├─ SelectedExprs(COUNT(n.i))\n" + 20697 " ├─ Grouping()\n" + 20698 " └─ SubqueryAlias\n" + 20699 " ├─ name: n\n" + 20700 " ├─ outerVisibility: false\n" + 20701 " ├─ isLateral: false\n" + 20702 " ├─ cacheable: true\n" + 20703 " └─ RecursiveCTE\n" + 20704 " └─ Union all\n" + 20705 " ├─ limit: 1\n" + 20706 " ├─ Project\n" + 20707 " │ ├─ columns: [1]\n" + 20708 " │ └─ Table\n" + 20709 " │ └─ name: \n" + 20710 " └─ Project\n" + 20711 " ├─ columns: [(n.i + 1) as i + 1]\n" + 20712 " └─ Filter\n" + 20713 " ├─ ((n.i + 1) <= 10)\n" + 20714 " └─ RecursiveTable(n)\n" + 20715 "", 20716 }, 20717 { 20718 Query: "with recursive a as (select 1 union select 2) select * from (select 1 where 1 in (select * from a)) as `temp`\n" + 20719 "", 20720 20721 ExpectedPlan: "SubqueryAlias\n" + 20722 " ├─ name: temp\n" + 20723 " ├─ outerVisibility: false\n" + 20724 " ├─ isLateral: false\n" + 20725 " ├─ cacheable: true\n" + 20726 " ├─ colSet: (4)\n" + 20727 " ├─ tableId: 4\n" + 20728 " └─ Project\n" + 20729 " ├─ columns: [1 (tinyint)]\n" + 20730 " └─ SemiJoin\n" + 20731 " ├─ Table\n" + 20732 " │ ├─ name: \n" + 20733 " │ ├─ columns: []\n" + 20734 " │ ├─ colSet: ()\n" + 20735 " │ └─ tableId: 0\n" + 20736 " └─ Filter\n" + 20737 " ├─ Eq\n" + 20738 " │ ├─ 1 (tinyint)\n" + 20739 " │ └─ a.1:0!null\n" + 20740 " └─ SubqueryAlias\n" + 20741 " ├─ name: a\n" + 20742 " ├─ outerVisibility: false\n" + 20743 " ├─ isLateral: false\n" + 20744 " ├─ cacheable: true\n" + 20745 " ├─ colSet: (1)\n" + 20746 " ├─ tableId: 2\n" + 20747 " └─ Union distinct\n" + 20748 " ├─ Project\n" + 20749 " │ ├─ columns: [1 (tinyint)]\n" + 20750 " │ └─ Table\n" + 20751 " │ ├─ name: \n" + 20752 " │ ├─ columns: []\n" + 20753 " │ ├─ colSet: ()\n" + 20754 " │ └─ tableId: 0\n" + 20755 " └─ Project\n" + 20756 " ├─ columns: [2 (tinyint)]\n" + 20757 " └─ Table\n" + 20758 " ├─ name: \n" + 20759 " ├─ columns: []\n" + 20760 " ├─ colSet: ()\n" + 20761 " └─ tableId: 0\n" + 20762 "", 20763 ExpectedEstimates: "SubqueryAlias\n" + 20764 " ├─ name: temp\n" + 20765 " ├─ outerVisibility: false\n" + 20766 " ├─ isLateral: false\n" + 20767 " ├─ cacheable: true\n" + 20768 " └─ Project\n" + 20769 " ├─ columns: [1]\n" + 20770 " └─ SemiJoin\n" + 20771 " ├─ Table\n" + 20772 " │ └─ name: \n" + 20773 " └─ Filter\n" + 20774 " ├─ (1 = a.1)\n" + 20775 " └─ SubqueryAlias\n" + 20776 " ├─ name: a\n" + 20777 " ├─ outerVisibility: false\n" + 20778 " ├─ isLateral: false\n" + 20779 " ├─ cacheable: true\n" + 20780 " └─ Union distinct\n" + 20781 " ├─ Project\n" + 20782 " │ ├─ columns: [1]\n" + 20783 " │ └─ Table\n" + 20784 " │ └─ name: \n" + 20785 " └─ Project\n" + 20786 " ├─ columns: [2]\n" + 20787 " └─ Table\n" + 20788 " └─ name: \n" + 20789 "", 20790 ExpectedAnalysis: "SubqueryAlias\n" + 20791 " ├─ name: temp\n" + 20792 " ├─ outerVisibility: false\n" + 20793 " ├─ isLateral: false\n" + 20794 " ├─ cacheable: true\n" + 20795 " └─ Project\n" + 20796 " ├─ columns: [1]\n" + 20797 " └─ SemiJoin\n" + 20798 " ├─ Table\n" + 20799 " │ └─ name: \n" + 20800 " └─ Filter\n" + 20801 " ├─ (1 = a.1)\n" + 20802 " └─ SubqueryAlias\n" + 20803 " ├─ name: a\n" + 20804 " ├─ outerVisibility: false\n" + 20805 " ├─ isLateral: false\n" + 20806 " ├─ cacheable: true\n" + 20807 " └─ Union distinct\n" + 20808 " ├─ Project\n" + 20809 " │ ├─ columns: [1]\n" + 20810 " │ └─ Table\n" + 20811 " │ └─ name: \n" + 20812 " └─ Project\n" + 20813 " ├─ columns: [2]\n" + 20814 " └─ Table\n" + 20815 " └─ name: \n" + 20816 "", 20817 }, 20818 { 20819 Query: `select 1 union select * from (select 2 union select 3) a union select 4;`, 20820 ExpectedPlan: "Union distinct\n" + 20821 " ├─ Union distinct\n" + 20822 " │ ├─ Project\n" + 20823 " │ │ ├─ columns: [1 (tinyint)]\n" + 20824 " │ │ └─ ProcessTable\n" + 20825 " │ │ └─ Table\n" + 20826 " │ │ ├─ name: \n" + 20827 " │ │ └─ columns: []\n" + 20828 " │ └─ SubqueryAlias\n" + 20829 " │ ├─ name: a\n" + 20830 " │ ├─ outerVisibility: false\n" + 20831 " │ ├─ isLateral: false\n" + 20832 " │ ├─ cacheable: true\n" + 20833 " │ ├─ colSet: (4)\n" + 20834 " │ ├─ tableId: 2\n" + 20835 " │ └─ Union distinct\n" + 20836 " │ ├─ Project\n" + 20837 " │ │ ├─ columns: [2 (tinyint)]\n" + 20838 " │ │ └─ Table\n" + 20839 " │ │ ├─ name: \n" + 20840 " │ │ ├─ columns: []\n" + 20841 " │ │ ├─ colSet: ()\n" + 20842 " │ │ └─ tableId: 0\n" + 20843 " │ └─ Project\n" + 20844 " │ ├─ columns: [3 (tinyint)]\n" + 20845 " │ └─ Table\n" + 20846 " │ ├─ name: \n" + 20847 " │ ├─ columns: []\n" + 20848 " │ ├─ colSet: ()\n" + 20849 " │ └─ tableId: 0\n" + 20850 " └─ Project\n" + 20851 " ├─ columns: [4 (tinyint)]\n" + 20852 " └─ ProcessTable\n" + 20853 " └─ Table\n" + 20854 " ├─ name: \n" + 20855 " └─ columns: []\n" + 20856 "", 20857 ExpectedEstimates: "Union distinct\n" + 20858 " ├─ Union distinct\n" + 20859 " │ ├─ Project\n" + 20860 " │ │ ├─ columns: [1]\n" + 20861 " │ │ └─ Table\n" + 20862 " │ │ └─ name: \n" + 20863 " │ └─ SubqueryAlias\n" + 20864 " │ ├─ name: a\n" + 20865 " │ ├─ outerVisibility: false\n" + 20866 " │ ├─ isLateral: false\n" + 20867 " │ ├─ cacheable: true\n" + 20868 " │ └─ Union distinct\n" + 20869 " │ ├─ Project\n" + 20870 " │ │ ├─ columns: [2]\n" + 20871 " │ │ └─ Table\n" + 20872 " │ │ └─ name: \n" + 20873 " │ └─ Project\n" + 20874 " │ ├─ columns: [3]\n" + 20875 " │ └─ Table\n" + 20876 " │ └─ name: \n" + 20877 " └─ Project\n" + 20878 " ├─ columns: [4]\n" + 20879 " └─ Table\n" + 20880 " └─ name: \n" + 20881 "", 20882 ExpectedAnalysis: "Union distinct\n" + 20883 " ├─ Union distinct\n" + 20884 " │ ├─ Project\n" + 20885 " │ │ ├─ columns: [1]\n" + 20886 " │ │ └─ Table\n" + 20887 " │ │ └─ name: \n" + 20888 " │ └─ SubqueryAlias\n" + 20889 " │ ├─ name: a\n" + 20890 " │ ├─ outerVisibility: false\n" + 20891 " │ ├─ isLateral: false\n" + 20892 " │ ├─ cacheable: true\n" + 20893 " │ └─ Union distinct\n" + 20894 " │ ├─ Project\n" + 20895 " │ │ ├─ columns: [2]\n" + 20896 " │ │ └─ Table\n" + 20897 " │ │ └─ name: \n" + 20898 " │ └─ Project\n" + 20899 " │ ├─ columns: [3]\n" + 20900 " │ └─ Table\n" + 20901 " │ └─ name: \n" + 20902 " └─ Project\n" + 20903 " ├─ columns: [4]\n" + 20904 " └─ Table\n" + 20905 " └─ name: \n" + 20906 "", 20907 }, 20908 { 20909 Query: `select 1 union select * from (select 2 union select 3) a union select 4;`, 20910 ExpectedPlan: "Union distinct\n" + 20911 " ├─ Union distinct\n" + 20912 " │ ├─ Project\n" + 20913 " │ │ ├─ columns: [1 (tinyint)]\n" + 20914 " │ │ └─ ProcessTable\n" + 20915 " │ │ └─ Table\n" + 20916 " │ │ ├─ name: \n" + 20917 " │ │ └─ columns: []\n" + 20918 " │ └─ SubqueryAlias\n" + 20919 " │ ├─ name: a\n" + 20920 " │ ├─ outerVisibility: false\n" + 20921 " │ ├─ isLateral: false\n" + 20922 " │ ├─ cacheable: true\n" + 20923 " │ ├─ colSet: (4)\n" + 20924 " │ ├─ tableId: 2\n" + 20925 " │ └─ Union distinct\n" + 20926 " │ ├─ Project\n" + 20927 " │ │ ├─ columns: [2 (tinyint)]\n" + 20928 " │ │ └─ Table\n" + 20929 " │ │ ├─ name: \n" + 20930 " │ │ ├─ columns: []\n" + 20931 " │ │ ├─ colSet: ()\n" + 20932 " │ │ └─ tableId: 0\n" + 20933 " │ └─ Project\n" + 20934 " │ ├─ columns: [3 (tinyint)]\n" + 20935 " │ └─ Table\n" + 20936 " │ ├─ name: \n" + 20937 " │ ├─ columns: []\n" + 20938 " │ ├─ colSet: ()\n" + 20939 " │ └─ tableId: 0\n" + 20940 " └─ Project\n" + 20941 " ├─ columns: [4 (tinyint)]\n" + 20942 " └─ ProcessTable\n" + 20943 " └─ Table\n" + 20944 " ├─ name: \n" + 20945 " └─ columns: []\n" + 20946 "", 20947 ExpectedEstimates: "Union distinct\n" + 20948 " ├─ Union distinct\n" + 20949 " │ ├─ Project\n" + 20950 " │ │ ├─ columns: [1]\n" + 20951 " │ │ └─ Table\n" + 20952 " │ │ └─ name: \n" + 20953 " │ └─ SubqueryAlias\n" + 20954 " │ ├─ name: a\n" + 20955 " │ ├─ outerVisibility: false\n" + 20956 " │ ├─ isLateral: false\n" + 20957 " │ ├─ cacheable: true\n" + 20958 " │ └─ Union distinct\n" + 20959 " │ ├─ Project\n" + 20960 " │ │ ├─ columns: [2]\n" + 20961 " │ │ └─ Table\n" + 20962 " │ │ └─ name: \n" + 20963 " │ └─ Project\n" + 20964 " │ ├─ columns: [3]\n" + 20965 " │ └─ Table\n" + 20966 " │ └─ name: \n" + 20967 " └─ Project\n" + 20968 " ├─ columns: [4]\n" + 20969 " └─ Table\n" + 20970 " └─ name: \n" + 20971 "", 20972 ExpectedAnalysis: "Union distinct\n" + 20973 " ├─ Union distinct\n" + 20974 " │ ├─ Project\n" + 20975 " │ │ ├─ columns: [1]\n" + 20976 " │ │ └─ Table\n" + 20977 " │ │ └─ name: \n" + 20978 " │ └─ SubqueryAlias\n" + 20979 " │ ├─ name: a\n" + 20980 " │ ├─ outerVisibility: false\n" + 20981 " │ ├─ isLateral: false\n" + 20982 " │ ├─ cacheable: true\n" + 20983 " │ └─ Union distinct\n" + 20984 " │ ├─ Project\n" + 20985 " │ │ ├─ columns: [2]\n" + 20986 " │ │ └─ Table\n" + 20987 " │ │ └─ name: \n" + 20988 " │ └─ Project\n" + 20989 " │ ├─ columns: [3]\n" + 20990 " │ └─ Table\n" + 20991 " │ └─ name: \n" + 20992 " └─ Project\n" + 20993 " ├─ columns: [4]\n" + 20994 " └─ Table\n" + 20995 " └─ name: \n" + 20996 "", 20997 }, 20998 { 20999 Query: `With recursive a(x) as (select 1 union select 4 union select * from (select 2 union select 3) b union select x+1 from a where x < 10) select count(*) from a;`, 21000 ExpectedPlan: "Project\n" + 21001 " ├─ columns: [count(1):0!null as count(*)]\n" + 21002 " └─ GroupBy\n" + 21003 " ├─ select: COUNT(1 (bigint))\n" + 21004 " ├─ group: \n" + 21005 " └─ SubqueryAlias\n" + 21006 " ├─ name: a\n" + 21007 " ├─ outerVisibility: false\n" + 21008 " ├─ isLateral: false\n" + 21009 " ├─ cacheable: true\n" + 21010 " ├─ colSet: (6)\n" + 21011 " ├─ tableId: 5\n" + 21012 " └─ RecursiveCTE\n" + 21013 " └─ Union distinct\n" + 21014 " ├─ Union distinct\n" + 21015 " │ ├─ Union distinct\n" + 21016 " │ │ ├─ Project\n" + 21017 " │ │ │ ├─ columns: [1 (tinyint)]\n" + 21018 " │ │ │ └─ Table\n" + 21019 " │ │ │ ├─ name: \n" + 21020 " │ │ │ ├─ columns: []\n" + 21021 " │ │ │ ├─ colSet: ()\n" + 21022 " │ │ │ └─ tableId: 0\n" + 21023 " │ │ └─ Project\n" + 21024 " │ │ ├─ columns: [4 (tinyint)]\n" + 21025 " │ │ └─ Table\n" + 21026 " │ │ ├─ name: \n" + 21027 " │ │ ├─ columns: []\n" + 21028 " │ │ ├─ colSet: ()\n" + 21029 " │ │ └─ tableId: 0\n" + 21030 " │ └─ SubqueryAlias\n" + 21031 " │ ├─ name: b\n" + 21032 " │ ├─ outerVisibility: false\n" + 21033 " │ ├─ isLateral: false\n" + 21034 " │ ├─ cacheable: true\n" + 21035 " │ ├─ colSet: (5)\n" + 21036 " │ ├─ tableId: 3\n" + 21037 " │ └─ Union distinct\n" + 21038 " │ ├─ Project\n" + 21039 " │ │ ├─ columns: [2 (tinyint)]\n" + 21040 " │ │ └─ Table\n" + 21041 " │ │ ├─ name: \n" + 21042 " │ │ ├─ columns: []\n" + 21043 " │ │ ├─ colSet: ()\n" + 21044 " │ │ └─ tableId: 0\n" + 21045 " │ └─ Project\n" + 21046 " │ ├─ columns: [3 (tinyint)]\n" + 21047 " │ └─ Table\n" + 21048 " │ ├─ name: \n" + 21049 " │ ├─ columns: []\n" + 21050 " │ ├─ colSet: ()\n" + 21051 " │ └─ tableId: 0\n" + 21052 " └─ Project\n" + 21053 " ├─ columns: [(a.x:0!null + 1 (tinyint)) as x+1]\n" + 21054 " └─ Filter\n" + 21055 " ├─ LessThan\n" + 21056 " │ ├─ a.x:0!null\n" + 21057 " │ └─ 10 (tinyint)\n" + 21058 " └─ RecursiveTable(a)\n" + 21059 "", 21060 ExpectedEstimates: "Project\n" + 21061 " ├─ columns: [count(1) as count(*)]\n" + 21062 " └─ GroupBy\n" + 21063 " ├─ SelectedExprs(COUNT(1))\n" + 21064 " ├─ Grouping()\n" + 21065 " └─ SubqueryAlias\n" + 21066 " ├─ name: a\n" + 21067 " ├─ outerVisibility: false\n" + 21068 " ├─ isLateral: false\n" + 21069 " ├─ cacheable: true\n" + 21070 " └─ RecursiveCTE\n" + 21071 " └─ Union distinct\n" + 21072 " ├─ Union distinct\n" + 21073 " │ ├─ Union distinct\n" + 21074 " │ │ ├─ Project\n" + 21075 " │ │ │ ├─ columns: [1]\n" + 21076 " │ │ │ └─ Table\n" + 21077 " │ │ │ └─ name: \n" + 21078 " │ │ └─ Project\n" + 21079 " │ │ ├─ columns: [4]\n" + 21080 " │ │ └─ Table\n" + 21081 " │ │ └─ name: \n" + 21082 " │ └─ SubqueryAlias\n" + 21083 " │ ├─ name: b\n" + 21084 " │ ├─ outerVisibility: false\n" + 21085 " │ ├─ isLateral: false\n" + 21086 " │ ├─ cacheable: true\n" + 21087 " │ └─ Union distinct\n" + 21088 " │ ├─ Project\n" + 21089 " │ │ ├─ columns: [2]\n" + 21090 " │ │ └─ Table\n" + 21091 " │ │ └─ name: \n" + 21092 " │ └─ Project\n" + 21093 " │ ├─ columns: [3]\n" + 21094 " │ └─ Table\n" + 21095 " │ └─ name: \n" + 21096 " └─ Project\n" + 21097 " ├─ columns: [(a.x + 1) as x+1]\n" + 21098 " └─ Filter\n" + 21099 " ├─ (a.x < 10)\n" + 21100 " └─ RecursiveTable(a)\n" + 21101 "", 21102 ExpectedAnalysis: "Project\n" + 21103 " ├─ columns: [count(1) as count(*)]\n" + 21104 " └─ GroupBy\n" + 21105 " ├─ SelectedExprs(COUNT(1))\n" + 21106 " ├─ Grouping()\n" + 21107 " └─ SubqueryAlias\n" + 21108 " ├─ name: a\n" + 21109 " ├─ outerVisibility: false\n" + 21110 " ├─ isLateral: false\n" + 21111 " ├─ cacheable: true\n" + 21112 " └─ RecursiveCTE\n" + 21113 " └─ Union distinct\n" + 21114 " ├─ Union distinct\n" + 21115 " │ ├─ Union distinct\n" + 21116 " │ │ ├─ Project\n" + 21117 " │ │ │ ├─ columns: [1]\n" + 21118 " │ │ │ └─ Table\n" + 21119 " │ │ │ └─ name: \n" + 21120 " │ │ └─ Project\n" + 21121 " │ │ ├─ columns: [4]\n" + 21122 " │ │ └─ Table\n" + 21123 " │ │ └─ name: \n" + 21124 " │ └─ SubqueryAlias\n" + 21125 " │ ├─ name: b\n" + 21126 " │ ├─ outerVisibility: false\n" + 21127 " │ ├─ isLateral: false\n" + 21128 " │ ├─ cacheable: true\n" + 21129 " │ └─ Union distinct\n" + 21130 " │ ├─ Project\n" + 21131 " │ │ ├─ columns: [2]\n" + 21132 " │ │ └─ Table\n" + 21133 " │ │ └─ name: \n" + 21134 " │ └─ Project\n" + 21135 " │ ├─ columns: [3]\n" + 21136 " │ └─ Table\n" + 21137 " │ └─ name: \n" + 21138 " └─ Project\n" + 21139 " ├─ columns: [(a.x + 1) as x+1]\n" + 21140 " └─ Filter\n" + 21141 " ├─ (a.x < 10)\n" + 21142 " └─ RecursiveTable(a)\n" + 21143 "", 21144 }, 21145 { 21146 Query: `with a(j) as (select 1), b(i) as (select 2) select j from a union (select i from b order by 1 desc) union select j from a;`, 21147 ExpectedPlan: "Union distinct\n" + 21148 " ├─ Union distinct\n" + 21149 " │ ├─ SubqueryAlias\n" + 21150 " │ │ ├─ name: a\n" + 21151 " │ │ ├─ outerVisibility: false\n" + 21152 " │ │ ├─ isLateral: false\n" + 21153 " │ │ ├─ cacheable: true\n" + 21154 " │ │ ├─ colSet: (2)\n" + 21155 " │ │ ├─ tableId: 1\n" + 21156 " │ │ └─ Project\n" + 21157 " │ │ ├─ columns: [1 (tinyint)]\n" + 21158 " │ │ └─ Table\n" + 21159 " │ │ ├─ name: \n" + 21160 " │ │ ├─ columns: []\n" + 21161 " │ │ ├─ colSet: ()\n" + 21162 " │ │ └─ tableId: 0\n" + 21163 " │ └─ Sort(b.i:0!null DESC nullsFirst)\n" + 21164 " │ └─ SubqueryAlias\n" + 21165 " │ ├─ name: b\n" + 21166 " │ ├─ outerVisibility: false\n" + 21167 " │ ├─ isLateral: false\n" + 21168 " │ ├─ cacheable: true\n" + 21169 " │ ├─ colSet: (4)\n" + 21170 " │ ├─ tableId: 3\n" + 21171 " │ └─ Project\n" + 21172 " │ ├─ columns: [2 (tinyint)]\n" + 21173 " │ └─ Table\n" + 21174 " │ ├─ name: \n" + 21175 " │ ├─ columns: []\n" + 21176 " │ ├─ colSet: ()\n" + 21177 " │ └─ tableId: 0\n" + 21178 " └─ SubqueryAlias\n" + 21179 " ├─ name: a\n" + 21180 " ├─ outerVisibility: false\n" + 21181 " ├─ isLateral: false\n" + 21182 " ├─ cacheable: true\n" + 21183 " ├─ colSet: (2)\n" + 21184 " ├─ tableId: 1\n" + 21185 " └─ Project\n" + 21186 " ├─ columns: [1 (tinyint)]\n" + 21187 " └─ Table\n" + 21188 " ├─ name: \n" + 21189 " ├─ columns: []\n" + 21190 " ├─ colSet: ()\n" + 21191 " └─ tableId: 0\n" + 21192 "", 21193 ExpectedEstimates: "Union distinct\n" + 21194 " ├─ Union distinct\n" + 21195 " │ ├─ SubqueryAlias\n" + 21196 " │ │ ├─ name: a\n" + 21197 " │ │ ├─ outerVisibility: false\n" + 21198 " │ │ ├─ isLateral: false\n" + 21199 " │ │ ├─ cacheable: true\n" + 21200 " │ │ └─ Project\n" + 21201 " │ │ ├─ columns: [1]\n" + 21202 " │ │ └─ Table\n" + 21203 " │ │ └─ name: \n" + 21204 " │ └─ Sort(b.i DESC)\n" + 21205 " │ └─ SubqueryAlias\n" + 21206 " │ ├─ name: b\n" + 21207 " │ ├─ outerVisibility: false\n" + 21208 " │ ├─ isLateral: false\n" + 21209 " │ ├─ cacheable: true\n" + 21210 " │ └─ Project\n" + 21211 " │ ├─ columns: [2]\n" + 21212 " │ └─ Table\n" + 21213 " │ └─ name: \n" + 21214 " └─ SubqueryAlias\n" + 21215 " ├─ name: a\n" + 21216 " ├─ outerVisibility: false\n" + 21217 " ├─ isLateral: false\n" + 21218 " ├─ cacheable: true\n" + 21219 " └─ Project\n" + 21220 " ├─ columns: [1]\n" + 21221 " └─ Table\n" + 21222 " └─ name: \n" + 21223 "", 21224 ExpectedAnalysis: "Union distinct\n" + 21225 " ├─ Union distinct\n" + 21226 " │ ├─ SubqueryAlias\n" + 21227 " │ │ ├─ name: a\n" + 21228 " │ │ ├─ outerVisibility: false\n" + 21229 " │ │ ├─ isLateral: false\n" + 21230 " │ │ ├─ cacheable: true\n" + 21231 " │ │ └─ Project\n" + 21232 " │ │ ├─ columns: [1]\n" + 21233 " │ │ └─ Table\n" + 21234 " │ │ └─ name: \n" + 21235 " │ └─ Sort(b.i DESC)\n" + 21236 " │ └─ SubqueryAlias\n" + 21237 " │ ├─ name: b\n" + 21238 " │ ├─ outerVisibility: false\n" + 21239 " │ ├─ isLateral: false\n" + 21240 " │ ├─ cacheable: true\n" + 21241 " │ └─ Project\n" + 21242 " │ ├─ columns: [2]\n" + 21243 " │ └─ Table\n" + 21244 " │ └─ name: \n" + 21245 " └─ SubqueryAlias\n" + 21246 " ├─ name: a\n" + 21247 " ├─ outerVisibility: false\n" + 21248 " ├─ isLateral: false\n" + 21249 " ├─ cacheable: true\n" + 21250 " └─ Project\n" + 21251 " ├─ columns: [1]\n" + 21252 " └─ Table\n" + 21253 " └─ name: \n" + 21254 "", 21255 }, 21256 { 21257 Query: `with a(j) as (select 1), b(i) as (select 2) (select t1.j as k from a t1 join a t2 on t1.j = t2.j union select i from b order by k desc limit 1) union select j from a;`, 21258 ExpectedPlan: "Union distinct\n" + 21259 " ├─ sortFields: k:0!null\n" + 21260 " ├─ limit: 1\n" + 21261 " ├─ Union distinct\n" + 21262 " │ ├─ Project\n" + 21263 " │ │ ├─ columns: [t1.j:0!null as k]\n" + 21264 " │ │ └─ HashJoin\n" + 21265 " │ │ ├─ Eq\n" + 21266 " │ │ │ ├─ t1.j:0!null\n" + 21267 " │ │ │ └─ t2.j:1!null\n" + 21268 " │ │ ├─ SubqueryAlias\n" + 21269 " │ │ │ ├─ name: t1\n" + 21270 " │ │ │ ├─ outerVisibility: false\n" + 21271 " │ │ │ ├─ isLateral: false\n" + 21272 " │ │ │ ├─ cacheable: true\n" + 21273 " │ │ │ ├─ colSet: (5)\n" + 21274 " │ │ │ ├─ tableId: 5\n" + 21275 " │ │ │ └─ Project\n" + 21276 " │ │ │ ├─ columns: [1 (tinyint)]\n" + 21277 " │ │ │ └─ Table\n" + 21278 " │ │ │ ├─ name: \n" + 21279 " │ │ │ ├─ columns: []\n" + 21280 " │ │ │ ├─ colSet: ()\n" + 21281 " │ │ │ └─ tableId: 0\n" + 21282 " │ │ └─ HashLookup\n" + 21283 " │ │ ├─ left-key: TUPLE(t1.j:0!null)\n" + 21284 " │ │ ├─ right-key: TUPLE(t2.j:0!null)\n" + 21285 " │ │ └─ SubqueryAlias\n" + 21286 " │ │ ├─ name: t2\n" + 21287 " │ │ ├─ outerVisibility: false\n" + 21288 " │ │ ├─ isLateral: false\n" + 21289 " │ │ ├─ cacheable: true\n" + 21290 " │ │ ├─ colSet: (6)\n" + 21291 " │ │ ├─ tableId: 6\n" + 21292 " │ │ └─ Project\n" + 21293 " │ │ ├─ columns: [1 (tinyint)]\n" + 21294 " │ │ └─ Table\n" + 21295 " │ │ ├─ name: \n" + 21296 " │ │ ├─ columns: []\n" + 21297 " │ │ ├─ colSet: ()\n" + 21298 " │ │ └─ tableId: 0\n" + 21299 " │ └─ SubqueryAlias\n" + 21300 " │ ├─ name: b\n" + 21301 " │ ├─ outerVisibility: false\n" + 21302 " │ ├─ isLateral: false\n" + 21303 " │ ├─ cacheable: true\n" + 21304 " │ ├─ colSet: (4)\n" + 21305 " │ ├─ tableId: 3\n" + 21306 " │ └─ Project\n" + 21307 " │ ├─ columns: [2 (tinyint)]\n" + 21308 " │ └─ Table\n" + 21309 " │ ├─ name: \n" + 21310 " │ ├─ columns: []\n" + 21311 " │ ├─ colSet: ()\n" + 21312 " │ └─ tableId: 0\n" + 21313 " └─ SubqueryAlias\n" + 21314 " ├─ name: a\n" + 21315 " ├─ outerVisibility: false\n" + 21316 " ├─ isLateral: false\n" + 21317 " ├─ cacheable: true\n" + 21318 " ├─ colSet: (2)\n" + 21319 " ├─ tableId: 1\n" + 21320 " └─ Project\n" + 21321 " ├─ columns: [1 (tinyint)]\n" + 21322 " └─ Table\n" + 21323 " ├─ name: \n" + 21324 " ├─ columns: []\n" + 21325 " ├─ colSet: ()\n" + 21326 " └─ tableId: 0\n" + 21327 "", 21328 ExpectedEstimates: "Union distinct\n" + 21329 " ├─ sortFields: [k]\n" + 21330 " ├─ limit: 1\n" + 21331 " ├─ Union distinct\n" + 21332 " │ ├─ Project\n" + 21333 " │ │ ├─ columns: [t1.j as k]\n" + 21334 " │ │ └─ HashJoin\n" + 21335 " │ │ ├─ (t1.j = t2.j)\n" + 21336 " │ │ ├─ SubqueryAlias\n" + 21337 " │ │ │ ├─ name: t1\n" + 21338 " │ │ │ ├─ outerVisibility: false\n" + 21339 " │ │ │ ├─ isLateral: false\n" + 21340 " │ │ │ ├─ cacheable: true\n" + 21341 " │ │ │ └─ Project\n" + 21342 " │ │ │ ├─ columns: [1]\n" + 21343 " │ │ │ └─ Table\n" + 21344 " │ │ │ └─ name: \n" + 21345 " │ │ └─ HashLookup\n" + 21346 " │ │ ├─ left-key: (t1.j)\n" + 21347 " │ │ ├─ right-key: (t2.j)\n" + 21348 " │ │ └─ SubqueryAlias\n" + 21349 " │ │ ├─ name: t2\n" + 21350 " │ │ ├─ outerVisibility: false\n" + 21351 " │ │ ├─ isLateral: false\n" + 21352 " │ │ ├─ cacheable: true\n" + 21353 " │ │ └─ Project\n" + 21354 " │ │ ├─ columns: [1]\n" + 21355 " │ │ └─ Table\n" + 21356 " │ │ └─ name: \n" + 21357 " │ └─ SubqueryAlias\n" + 21358 " │ ├─ name: b\n" + 21359 " │ ├─ outerVisibility: false\n" + 21360 " │ ├─ isLateral: false\n" + 21361 " │ ├─ cacheable: true\n" + 21362 " │ └─ Project\n" + 21363 " │ ├─ columns: [2]\n" + 21364 " │ └─ Table\n" + 21365 " │ └─ name: \n" + 21366 " └─ SubqueryAlias\n" + 21367 " ├─ name: a\n" + 21368 " ├─ outerVisibility: false\n" + 21369 " ├─ isLateral: false\n" + 21370 " ├─ cacheable: true\n" + 21371 " └─ Project\n" + 21372 " ├─ columns: [1]\n" + 21373 " └─ Table\n" + 21374 " └─ name: \n" + 21375 "", 21376 ExpectedAnalysis: "Union distinct\n" + 21377 " ├─ sortFields: [k]\n" + 21378 " ├─ limit: 1\n" + 21379 " ├─ Union distinct\n" + 21380 " │ ├─ Project\n" + 21381 " │ │ ├─ columns: [t1.j as k]\n" + 21382 " │ │ └─ HashJoin\n" + 21383 " │ │ ├─ (t1.j = t2.j)\n" + 21384 " │ │ ├─ SubqueryAlias\n" + 21385 " │ │ │ ├─ name: t1\n" + 21386 " │ │ │ ├─ outerVisibility: false\n" + 21387 " │ │ │ ├─ isLateral: false\n" + 21388 " │ │ │ ├─ cacheable: true\n" + 21389 " │ │ │ └─ Project\n" + 21390 " │ │ │ ├─ columns: [1]\n" + 21391 " │ │ │ └─ Table\n" + 21392 " │ │ │ └─ name: \n" + 21393 " │ │ └─ HashLookup\n" + 21394 " │ │ ├─ left-key: (t1.j)\n" + 21395 " │ │ ├─ right-key: (t2.j)\n" + 21396 " │ │ └─ SubqueryAlias\n" + 21397 " │ │ ├─ name: t2\n" + 21398 " │ │ ├─ outerVisibility: false\n" + 21399 " │ │ ├─ isLateral: false\n" + 21400 " │ │ ├─ cacheable: true\n" + 21401 " │ │ └─ Project\n" + 21402 " │ │ ├─ columns: [1]\n" + 21403 " │ │ └─ Table\n" + 21404 " │ │ └─ name: \n" + 21405 " │ └─ SubqueryAlias\n" + 21406 " │ ├─ name: b\n" + 21407 " │ ├─ outerVisibility: false\n" + 21408 " │ ├─ isLateral: false\n" + 21409 " │ ├─ cacheable: true\n" + 21410 " │ └─ Project\n" + 21411 " │ ├─ columns: [2]\n" + 21412 " │ └─ Table\n" + 21413 " │ └─ name: \n" + 21414 " └─ SubqueryAlias\n" + 21415 " ├─ name: a\n" + 21416 " ├─ outerVisibility: false\n" + 21417 " ├─ isLateral: false\n" + 21418 " ├─ cacheable: true\n" + 21419 " └─ Project\n" + 21420 " ├─ columns: [1]\n" + 21421 " └─ Table\n" + 21422 " └─ name: \n" + 21423 "", 21424 }, 21425 { 21426 Query: `with a(j) as (select 1 union select 2 union select 3), b(i) as (select 2 union select 3) (select t1.j as k from a t1 join a t2 on t1.j = t2.j union select i from b order by k desc limit 2) union select j from a;`, 21427 ExpectedPlan: "Union distinct\n" + 21428 " ├─ sortFields: k:0!null\n" + 21429 " ├─ limit: 2\n" + 21430 " ├─ Union distinct\n" + 21431 " │ ├─ Project\n" + 21432 " │ │ ├─ columns: [t1.j:0!null as k]\n" + 21433 " │ │ └─ HashJoin\n" + 21434 " │ │ ├─ Eq\n" + 21435 " │ │ │ ├─ t1.j:0!null\n" + 21436 " │ │ │ └─ t2.j:1!null\n" + 21437 " │ │ ├─ SubqueryAlias\n" + 21438 " │ │ │ ├─ name: t1\n" + 21439 " │ │ │ ├─ outerVisibility: false\n" + 21440 " │ │ │ ├─ isLateral: false\n" + 21441 " │ │ │ ├─ cacheable: true\n" + 21442 " │ │ │ ├─ colSet: (8)\n" + 21443 " │ │ │ ├─ tableId: 8\n" + 21444 " │ │ │ └─ Union distinct\n" + 21445 " │ │ │ ├─ Union distinct\n" + 21446 " │ │ │ │ ├─ Project\n" + 21447 " │ │ │ │ │ ├─ columns: [1 (tinyint)]\n" + 21448 " │ │ │ │ │ └─ Table\n" + 21449 " │ │ │ │ │ ├─ name: \n" + 21450 " │ │ │ │ │ ├─ columns: []\n" + 21451 " │ │ │ │ │ ├─ colSet: ()\n" + 21452 " │ │ │ │ │ └─ tableId: 0\n" + 21453 " │ │ │ │ └─ Project\n" + 21454 " │ │ │ │ ├─ columns: [2 (tinyint)]\n" + 21455 " │ │ │ │ └─ Table\n" + 21456 " │ │ │ │ ├─ name: \n" + 21457 " │ │ │ │ ├─ columns: []\n" + 21458 " │ │ │ │ ├─ colSet: ()\n" + 21459 " │ │ │ │ └─ tableId: 0\n" + 21460 " │ │ │ └─ Project\n" + 21461 " │ │ │ ├─ columns: [3 (tinyint)]\n" + 21462 " │ │ │ └─ Table\n" + 21463 " │ │ │ ├─ name: \n" + 21464 " │ │ │ ├─ columns: []\n" + 21465 " │ │ │ ├─ colSet: ()\n" + 21466 " │ │ │ └─ tableId: 0\n" + 21467 " │ │ └─ HashLookup\n" + 21468 " │ │ ├─ left-key: TUPLE(t1.j:0!null)\n" + 21469 " │ │ ├─ right-key: TUPLE(t2.j:0!null)\n" + 21470 " │ │ └─ SubqueryAlias\n" + 21471 " │ │ ├─ name: t2\n" + 21472 " │ │ ├─ outerVisibility: false\n" + 21473 " │ │ ├─ isLateral: false\n" + 21474 " │ │ ├─ cacheable: true\n" + 21475 " │ │ ├─ colSet: (9)\n" + 21476 " │ │ ├─ tableId: 9\n" + 21477 " │ │ └─ Union distinct\n" + 21478 " │ │ ├─ Union distinct\n" + 21479 " │ │ │ ├─ Project\n" + 21480 " │ │ │ │ ├─ columns: [1 (tinyint)]\n" + 21481 " │ │ │ │ └─ Table\n" + 21482 " │ │ │ │ ├─ name: \n" + 21483 " │ │ │ │ ├─ columns: []\n" + 21484 " │ │ │ │ ├─ colSet: ()\n" + 21485 " │ │ │ │ └─ tableId: 0\n" + 21486 " │ │ │ └─ Project\n" + 21487 " │ │ │ ├─ columns: [2 (tinyint)]\n" + 21488 " │ │ │ └─ Table\n" + 21489 " │ │ │ ├─ name: \n" + 21490 " │ │ │ ├─ columns: []\n" + 21491 " │ │ │ ├─ colSet: ()\n" + 21492 " │ │ │ └─ tableId: 0\n" + 21493 " │ │ └─ Project\n" + 21494 " │ │ ├─ columns: [3 (tinyint)]\n" + 21495 " │ │ └─ Table\n" + 21496 " │ │ ├─ name: \n" + 21497 " │ │ ├─ columns: []\n" + 21498 " │ │ ├─ colSet: ()\n" + 21499 " │ │ └─ tableId: 0\n" + 21500 " │ └─ SubqueryAlias\n" + 21501 " │ ├─ name: b\n" + 21502 " │ ├─ outerVisibility: false\n" + 21503 " │ ├─ isLateral: false\n" + 21504 " │ ├─ cacheable: true\n" + 21505 " │ ├─ colSet: (7)\n" + 21506 " │ ├─ tableId: 6\n" + 21507 " │ └─ Union distinct\n" + 21508 " │ ├─ Project\n" + 21509 " │ │ ├─ columns: [2 (tinyint)]\n" + 21510 " │ │ └─ Table\n" + 21511 " │ │ ├─ name: \n" + 21512 " │ │ ├─ columns: []\n" + 21513 " │ │ ├─ colSet: ()\n" + 21514 " │ │ └─ tableId: 0\n" + 21515 " │ └─ Project\n" + 21516 " │ ├─ columns: [3 (tinyint)]\n" + 21517 " │ └─ Table\n" + 21518 " │ ├─ name: \n" + 21519 " │ ├─ columns: []\n" + 21520 " │ ├─ colSet: ()\n" + 21521 " │ └─ tableId: 0\n" + 21522 " └─ SubqueryAlias\n" + 21523 " ├─ name: a\n" + 21524 " ├─ outerVisibility: false\n" + 21525 " ├─ isLateral: false\n" + 21526 " ├─ cacheable: true\n" + 21527 " ├─ colSet: (4)\n" + 21528 " ├─ tableId: 3\n" + 21529 " └─ Union distinct\n" + 21530 " ├─ Union distinct\n" + 21531 " │ ├─ Project\n" + 21532 " │ │ ├─ columns: [1 (tinyint)]\n" + 21533 " │ │ └─ Table\n" + 21534 " │ │ ├─ name: \n" + 21535 " │ │ ├─ columns: []\n" + 21536 " │ │ ├─ colSet: ()\n" + 21537 " │ │ └─ tableId: 0\n" + 21538 " │ └─ Project\n" + 21539 " │ ├─ columns: [2 (tinyint)]\n" + 21540 " │ └─ Table\n" + 21541 " │ ├─ name: \n" + 21542 " │ ├─ columns: []\n" + 21543 " │ ├─ colSet: ()\n" + 21544 " │ └─ tableId: 0\n" + 21545 " └─ Project\n" + 21546 " ├─ columns: [3 (tinyint)]\n" + 21547 " └─ Table\n" + 21548 " ├─ name: \n" + 21549 " ├─ columns: []\n" + 21550 " ├─ colSet: ()\n" + 21551 " └─ tableId: 0\n" + 21552 "", 21553 ExpectedEstimates: "Union distinct\n" + 21554 " ├─ sortFields: [k]\n" + 21555 " ├─ limit: 2\n" + 21556 " ├─ Union distinct\n" + 21557 " │ ├─ Project\n" + 21558 " │ │ ├─ columns: [t1.j as k]\n" + 21559 " │ │ └─ HashJoin\n" + 21560 " │ │ ├─ (t1.j = t2.j)\n" + 21561 " │ │ ├─ SubqueryAlias\n" + 21562 " │ │ │ ├─ name: t1\n" + 21563 " │ │ │ ├─ outerVisibility: false\n" + 21564 " │ │ │ ├─ isLateral: false\n" + 21565 " │ │ │ ├─ cacheable: true\n" + 21566 " │ │ │ └─ Union distinct\n" + 21567 " │ │ │ ├─ Union distinct\n" + 21568 " │ │ │ │ ├─ Project\n" + 21569 " │ │ │ │ │ ├─ columns: [1]\n" + 21570 " │ │ │ │ │ └─ Table\n" + 21571 " │ │ │ │ │ └─ name: \n" + 21572 " │ │ │ │ └─ Project\n" + 21573 " │ │ │ │ ├─ columns: [2]\n" + 21574 " │ │ │ │ └─ Table\n" + 21575 " │ │ │ │ └─ name: \n" + 21576 " │ │ │ └─ Project\n" + 21577 " │ │ │ ├─ columns: [3]\n" + 21578 " │ │ │ └─ Table\n" + 21579 " │ │ │ └─ name: \n" + 21580 " │ │ └─ HashLookup\n" + 21581 " │ │ ├─ left-key: (t1.j)\n" + 21582 " │ │ ├─ right-key: (t2.j)\n" + 21583 " │ │ └─ SubqueryAlias\n" + 21584 " │ │ ├─ name: t2\n" + 21585 " │ │ ├─ outerVisibility: false\n" + 21586 " │ │ ├─ isLateral: false\n" + 21587 " │ │ ├─ cacheable: true\n" + 21588 " │ │ └─ Union distinct\n" + 21589 " │ │ ├─ Union distinct\n" + 21590 " │ │ │ ├─ Project\n" + 21591 " │ │ │ │ ├─ columns: [1]\n" + 21592 " │ │ │ │ └─ Table\n" + 21593 " │ │ │ │ └─ name: \n" + 21594 " │ │ │ └─ Project\n" + 21595 " │ │ │ ├─ columns: [2]\n" + 21596 " │ │ │ └─ Table\n" + 21597 " │ │ │ └─ name: \n" + 21598 " │ │ └─ Project\n" + 21599 " │ │ ├─ columns: [3]\n" + 21600 " │ │ └─ Table\n" + 21601 " │ │ └─ name: \n" + 21602 " │ └─ SubqueryAlias\n" + 21603 " │ ├─ name: b\n" + 21604 " │ ├─ outerVisibility: false\n" + 21605 " │ ├─ isLateral: false\n" + 21606 " │ ├─ cacheable: true\n" + 21607 " │ └─ Union distinct\n" + 21608 " │ ├─ Project\n" + 21609 " │ │ ├─ columns: [2]\n" + 21610 " │ │ └─ Table\n" + 21611 " │ │ └─ name: \n" + 21612 " │ └─ Project\n" + 21613 " │ ├─ columns: [3]\n" + 21614 " │ └─ Table\n" + 21615 " │ └─ name: \n" + 21616 " └─ SubqueryAlias\n" + 21617 " ├─ name: a\n" + 21618 " ├─ outerVisibility: false\n" + 21619 " ├─ isLateral: false\n" + 21620 " ├─ cacheable: true\n" + 21621 " └─ Union distinct\n" + 21622 " ├─ Union distinct\n" + 21623 " │ ├─ Project\n" + 21624 " │ │ ├─ columns: [1]\n" + 21625 " │ │ └─ Table\n" + 21626 " │ │ └─ name: \n" + 21627 " │ └─ Project\n" + 21628 " │ ├─ columns: [2]\n" + 21629 " │ └─ Table\n" + 21630 " │ └─ name: \n" + 21631 " └─ Project\n" + 21632 " ├─ columns: [3]\n" + 21633 " └─ Table\n" + 21634 " └─ name: \n" + 21635 "", 21636 ExpectedAnalysis: "Union distinct\n" + 21637 " ├─ sortFields: [k]\n" + 21638 " ├─ limit: 2\n" + 21639 " ├─ Union distinct\n" + 21640 " │ ├─ Project\n" + 21641 " │ │ ├─ columns: [t1.j as k]\n" + 21642 " │ │ └─ HashJoin\n" + 21643 " │ │ ├─ (t1.j = t2.j)\n" + 21644 " │ │ ├─ SubqueryAlias\n" + 21645 " │ │ │ ├─ name: t1\n" + 21646 " │ │ │ ├─ outerVisibility: false\n" + 21647 " │ │ │ ├─ isLateral: false\n" + 21648 " │ │ │ ├─ cacheable: true\n" + 21649 " │ │ │ └─ Union distinct\n" + 21650 " │ │ │ ├─ Union distinct\n" + 21651 " │ │ │ │ ├─ Project\n" + 21652 " │ │ │ │ │ ├─ columns: [1]\n" + 21653 " │ │ │ │ │ └─ Table\n" + 21654 " │ │ │ │ │ └─ name: \n" + 21655 " │ │ │ │ └─ Project\n" + 21656 " │ │ │ │ ├─ columns: [2]\n" + 21657 " │ │ │ │ └─ Table\n" + 21658 " │ │ │ │ └─ name: \n" + 21659 " │ │ │ └─ Project\n" + 21660 " │ │ │ ├─ columns: [3]\n" + 21661 " │ │ │ └─ Table\n" + 21662 " │ │ │ └─ name: \n" + 21663 " │ │ └─ HashLookup\n" + 21664 " │ │ ├─ left-key: (t1.j)\n" + 21665 " │ │ ├─ right-key: (t2.j)\n" + 21666 " │ │ └─ SubqueryAlias\n" + 21667 " │ │ ├─ name: t2\n" + 21668 " │ │ ├─ outerVisibility: false\n" + 21669 " │ │ ├─ isLateral: false\n" + 21670 " │ │ ├─ cacheable: true\n" + 21671 " │ │ └─ Union distinct\n" + 21672 " │ │ ├─ Union distinct\n" + 21673 " │ │ │ ├─ Project\n" + 21674 " │ │ │ │ ├─ columns: [1]\n" + 21675 " │ │ │ │ └─ Table\n" + 21676 " │ │ │ │ └─ name: \n" + 21677 " │ │ │ └─ Project\n" + 21678 " │ │ │ ├─ columns: [2]\n" + 21679 " │ │ │ └─ Table\n" + 21680 " │ │ │ └─ name: \n" + 21681 " │ │ └─ Project\n" + 21682 " │ │ ├─ columns: [3]\n" + 21683 " │ │ └─ Table\n" + 21684 " │ │ └─ name: \n" + 21685 " │ └─ SubqueryAlias\n" + 21686 " │ ├─ name: b\n" + 21687 " │ ├─ outerVisibility: false\n" + 21688 " │ ├─ isLateral: false\n" + 21689 " │ ├─ cacheable: true\n" + 21690 " │ └─ Union distinct\n" + 21691 " │ ├─ Project\n" + 21692 " │ │ ├─ columns: [2]\n" + 21693 " │ │ └─ Table\n" + 21694 " │ │ └─ name: \n" + 21695 " │ └─ Project\n" + 21696 " │ ├─ columns: [3]\n" + 21697 " │ └─ Table\n" + 21698 " │ └─ name: \n" + 21699 " └─ SubqueryAlias\n" + 21700 " ├─ name: a\n" + 21701 " ├─ outerVisibility: false\n" + 21702 " ├─ isLateral: false\n" + 21703 " ├─ cacheable: true\n" + 21704 " └─ Union distinct\n" + 21705 " ├─ Union distinct\n" + 21706 " │ ├─ Project\n" + 21707 " │ │ ├─ columns: [1]\n" + 21708 " │ │ └─ Table\n" + 21709 " │ │ └─ name: \n" + 21710 " │ └─ Project\n" + 21711 " │ ├─ columns: [2]\n" + 21712 " │ └─ Table\n" + 21713 " │ └─ name: \n" + 21714 " └─ Project\n" + 21715 " ├─ columns: [3]\n" + 21716 " └─ Table\n" + 21717 " └─ name: \n" + 21718 "", 21719 }, 21720 { 21721 Query: `with a(j) as (select 1), b(i) as (select 2) (select j from a union select i from b order by j desc limit 1) union select j from a;`, 21722 ExpectedPlan: "Union distinct\n" + 21723 " ├─ sortFields: a.j:0!null\n" + 21724 " ├─ limit: 1\n" + 21725 " ├─ Union distinct\n" + 21726 " │ ├─ SubqueryAlias\n" + 21727 " │ │ ├─ name: a\n" + 21728 " │ │ ├─ outerVisibility: false\n" + 21729 " │ │ ├─ isLateral: false\n" + 21730 " │ │ ├─ cacheable: true\n" + 21731 " │ │ ├─ colSet: (2)\n" + 21732 " │ │ ├─ tableId: 1\n" + 21733 " │ │ └─ Project\n" + 21734 " │ │ ├─ columns: [1 (tinyint)]\n" + 21735 " │ │ └─ Table\n" + 21736 " │ │ ├─ name: \n" + 21737 " │ │ ├─ columns: []\n" + 21738 " │ │ ├─ colSet: ()\n" + 21739 " │ │ └─ tableId: 0\n" + 21740 " │ └─ SubqueryAlias\n" + 21741 " │ ├─ name: b\n" + 21742 " │ ├─ outerVisibility: false\n" + 21743 " │ ├─ isLateral: false\n" + 21744 " │ ├─ cacheable: true\n" + 21745 " │ ├─ colSet: (4)\n" + 21746 " │ ├─ tableId: 3\n" + 21747 " │ └─ Project\n" + 21748 " │ ├─ columns: [2 (tinyint)]\n" + 21749 " │ └─ Table\n" + 21750 " │ ├─ name: \n" + 21751 " │ ├─ columns: []\n" + 21752 " │ ├─ colSet: ()\n" + 21753 " │ └─ tableId: 0\n" + 21754 " └─ SubqueryAlias\n" + 21755 " ├─ name: a\n" + 21756 " ├─ outerVisibility: false\n" + 21757 " ├─ isLateral: false\n" + 21758 " ├─ cacheable: true\n" + 21759 " ├─ colSet: (2)\n" + 21760 " ├─ tableId: 1\n" + 21761 " └─ Project\n" + 21762 " ├─ columns: [1 (tinyint)]\n" + 21763 " └─ Table\n" + 21764 " ├─ name: \n" + 21765 " ├─ columns: []\n" + 21766 " ├─ colSet: ()\n" + 21767 " └─ tableId: 0\n" + 21768 "", 21769 ExpectedEstimates: "Union distinct\n" + 21770 " ├─ sortFields: [a.j]\n" + 21771 " ├─ limit: 1\n" + 21772 " ├─ Union distinct\n" + 21773 " │ ├─ SubqueryAlias\n" + 21774 " │ │ ├─ name: a\n" + 21775 " │ │ ├─ outerVisibility: false\n" + 21776 " │ │ ├─ isLateral: false\n" + 21777 " │ │ ├─ cacheable: true\n" + 21778 " │ │ └─ Project\n" + 21779 " │ │ ├─ columns: [1]\n" + 21780 " │ │ └─ Table\n" + 21781 " │ │ └─ name: \n" + 21782 " │ └─ SubqueryAlias\n" + 21783 " │ ├─ name: b\n" + 21784 " │ ├─ outerVisibility: false\n" + 21785 " │ ├─ isLateral: false\n" + 21786 " │ ├─ cacheable: true\n" + 21787 " │ └─ Project\n" + 21788 " │ ├─ columns: [2]\n" + 21789 " │ └─ Table\n" + 21790 " │ └─ name: \n" + 21791 " └─ SubqueryAlias\n" + 21792 " ├─ name: a\n" + 21793 " ├─ outerVisibility: false\n" + 21794 " ├─ isLateral: false\n" + 21795 " ├─ cacheable: true\n" + 21796 " └─ Project\n" + 21797 " ├─ columns: [1]\n" + 21798 " └─ Table\n" + 21799 " └─ name: \n" + 21800 "", 21801 ExpectedAnalysis: "Union distinct\n" + 21802 " ├─ sortFields: [a.j]\n" + 21803 " ├─ limit: 1\n" + 21804 " ├─ Union distinct\n" + 21805 " │ ├─ SubqueryAlias\n" + 21806 " │ │ ├─ name: a\n" + 21807 " │ │ ├─ outerVisibility: false\n" + 21808 " │ │ ├─ isLateral: false\n" + 21809 " │ │ ├─ cacheable: true\n" + 21810 " │ │ └─ Project\n" + 21811 " │ │ ├─ columns: [1]\n" + 21812 " │ │ └─ Table\n" + 21813 " │ │ └─ name: \n" + 21814 " │ └─ SubqueryAlias\n" + 21815 " │ ├─ name: b\n" + 21816 " │ ├─ outerVisibility: false\n" + 21817 " │ ├─ isLateral: false\n" + 21818 " │ ├─ cacheable: true\n" + 21819 " │ └─ Project\n" + 21820 " │ ├─ columns: [2]\n" + 21821 " │ └─ Table\n" + 21822 " │ └─ name: \n" + 21823 " └─ SubqueryAlias\n" + 21824 " ├─ name: a\n" + 21825 " ├─ outerVisibility: false\n" + 21826 " ├─ isLateral: false\n" + 21827 " ├─ cacheable: true\n" + 21828 " └─ Project\n" + 21829 " ├─ columns: [1]\n" + 21830 " └─ Table\n" + 21831 " └─ name: \n" + 21832 "", 21833 }, 21834 { 21835 Query: `with a(j) as (select 1), b(i) as (select 2) (select j from a union select i from b order by 1 limit 1) union select j from a;`, 21836 ExpectedPlan: "Union distinct\n" + 21837 " ├─ sortFields: a.j:0!null\n" + 21838 " ├─ limit: 1\n" + 21839 " ├─ Union distinct\n" + 21840 " │ ├─ SubqueryAlias\n" + 21841 " │ │ ├─ name: a\n" + 21842 " │ │ ├─ outerVisibility: false\n" + 21843 " │ │ ├─ isLateral: false\n" + 21844 " │ │ ├─ cacheable: true\n" + 21845 " │ │ ├─ colSet: (2)\n" + 21846 " │ │ ├─ tableId: 1\n" + 21847 " │ │ └─ Project\n" + 21848 " │ │ ├─ columns: [1 (tinyint)]\n" + 21849 " │ │ └─ Table\n" + 21850 " │ │ ├─ name: \n" + 21851 " │ │ ├─ columns: []\n" + 21852 " │ │ ├─ colSet: ()\n" + 21853 " │ │ └─ tableId: 0\n" + 21854 " │ └─ SubqueryAlias\n" + 21855 " │ ├─ name: b\n" + 21856 " │ ├─ outerVisibility: false\n" + 21857 " │ ├─ isLateral: false\n" + 21858 " │ ├─ cacheable: true\n" + 21859 " │ ├─ colSet: (4)\n" + 21860 " │ ├─ tableId: 3\n" + 21861 " │ └─ Project\n" + 21862 " │ ├─ columns: [2 (tinyint)]\n" + 21863 " │ └─ Table\n" + 21864 " │ ├─ name: \n" + 21865 " │ ├─ columns: []\n" + 21866 " │ ├─ colSet: ()\n" + 21867 " │ └─ tableId: 0\n" + 21868 " └─ SubqueryAlias\n" + 21869 " ├─ name: a\n" + 21870 " ├─ outerVisibility: false\n" + 21871 " ├─ isLateral: false\n" + 21872 " ├─ cacheable: true\n" + 21873 " ├─ colSet: (2)\n" + 21874 " ├─ tableId: 1\n" + 21875 " └─ Project\n" + 21876 " ├─ columns: [1 (tinyint)]\n" + 21877 " └─ Table\n" + 21878 " ├─ name: \n" + 21879 " ├─ columns: []\n" + 21880 " ├─ colSet: ()\n" + 21881 " └─ tableId: 0\n" + 21882 "", 21883 ExpectedEstimates: "Union distinct\n" + 21884 " ├─ sortFields: [a.j]\n" + 21885 " ├─ limit: 1\n" + 21886 " ├─ Union distinct\n" + 21887 " │ ├─ SubqueryAlias\n" + 21888 " │ │ ├─ name: a\n" + 21889 " │ │ ├─ outerVisibility: false\n" + 21890 " │ │ ├─ isLateral: false\n" + 21891 " │ │ ├─ cacheable: true\n" + 21892 " │ │ └─ Project\n" + 21893 " │ │ ├─ columns: [1]\n" + 21894 " │ │ └─ Table\n" + 21895 " │ │ └─ name: \n" + 21896 " │ └─ SubqueryAlias\n" + 21897 " │ ├─ name: b\n" + 21898 " │ ├─ outerVisibility: false\n" + 21899 " │ ├─ isLateral: false\n" + 21900 " │ ├─ cacheable: true\n" + 21901 " │ └─ Project\n" + 21902 " │ ├─ columns: [2]\n" + 21903 " │ └─ Table\n" + 21904 " │ └─ name: \n" + 21905 " └─ SubqueryAlias\n" + 21906 " ├─ name: a\n" + 21907 " ├─ outerVisibility: false\n" + 21908 " ├─ isLateral: false\n" + 21909 " ├─ cacheable: true\n" + 21910 " └─ Project\n" + 21911 " ├─ columns: [1]\n" + 21912 " └─ Table\n" + 21913 " └─ name: \n" + 21914 "", 21915 ExpectedAnalysis: "Union distinct\n" + 21916 " ├─ sortFields: [a.j]\n" + 21917 " ├─ limit: 1\n" + 21918 " ├─ Union distinct\n" + 21919 " │ ├─ SubqueryAlias\n" + 21920 " │ │ ├─ name: a\n" + 21921 " │ │ ├─ outerVisibility: false\n" + 21922 " │ │ ├─ isLateral: false\n" + 21923 " │ │ ├─ cacheable: true\n" + 21924 " │ │ └─ Project\n" + 21925 " │ │ ├─ columns: [1]\n" + 21926 " │ │ └─ Table\n" + 21927 " │ │ └─ name: \n" + 21928 " │ └─ SubqueryAlias\n" + 21929 " │ ├─ name: b\n" + 21930 " │ ├─ outerVisibility: false\n" + 21931 " │ ├─ isLateral: false\n" + 21932 " │ ├─ cacheable: true\n" + 21933 " │ └─ Project\n" + 21934 " │ ├─ columns: [2]\n" + 21935 " │ └─ Table\n" + 21936 " │ └─ name: \n" + 21937 " └─ SubqueryAlias\n" + 21938 " ├─ name: a\n" + 21939 " ├─ outerVisibility: false\n" + 21940 " ├─ isLateral: false\n" + 21941 " ├─ cacheable: true\n" + 21942 " └─ Project\n" + 21943 " ├─ columns: [1]\n" + 21944 " └─ Table\n" + 21945 " └─ name: \n" + 21946 "", 21947 }, 21948 { 21949 Query: `with a(j) as (select 1), b(i) as (select 1) (select j from a union all select i from b) union select j from a;`, 21950 ExpectedPlan: "Union distinct\n" + 21951 " ├─ Union all\n" + 21952 " │ ├─ SubqueryAlias\n" + 21953 " │ │ ├─ name: a\n" + 21954 " │ │ ├─ outerVisibility: false\n" + 21955 " │ │ ├─ isLateral: false\n" + 21956 " │ │ ├─ cacheable: true\n" + 21957 " │ │ ├─ colSet: (2)\n" + 21958 " │ │ ├─ tableId: 1\n" + 21959 " │ │ └─ Project\n" + 21960 " │ │ ├─ columns: [1 (tinyint)]\n" + 21961 " │ │ └─ Table\n" + 21962 " │ │ ├─ name: \n" + 21963 " │ │ ├─ columns: []\n" + 21964 " │ │ ├─ colSet: ()\n" + 21965 " │ │ └─ tableId: 0\n" + 21966 " │ └─ SubqueryAlias\n" + 21967 " │ ├─ name: b\n" + 21968 " │ ├─ outerVisibility: false\n" + 21969 " │ ├─ isLateral: false\n" + 21970 " │ ├─ cacheable: true\n" + 21971 " │ ├─ colSet: (4)\n" + 21972 " │ ├─ tableId: 3\n" + 21973 " │ └─ Project\n" + 21974 " │ ├─ columns: [1 (tinyint)]\n" + 21975 " │ └─ Table\n" + 21976 " │ ├─ name: \n" + 21977 " │ ├─ columns: []\n" + 21978 " │ ├─ colSet: ()\n" + 21979 " │ └─ tableId: 0\n" + 21980 " └─ SubqueryAlias\n" + 21981 " ├─ name: a\n" + 21982 " ├─ outerVisibility: false\n" + 21983 " ├─ isLateral: false\n" + 21984 " ├─ cacheable: true\n" + 21985 " ├─ colSet: (2)\n" + 21986 " ├─ tableId: 1\n" + 21987 " └─ Project\n" + 21988 " ├─ columns: [1 (tinyint)]\n" + 21989 " └─ Table\n" + 21990 " ├─ name: \n" + 21991 " ├─ columns: []\n" + 21992 " ├─ colSet: ()\n" + 21993 " └─ tableId: 0\n" + 21994 "", 21995 ExpectedEstimates: "Union distinct\n" + 21996 " ├─ Union all\n" + 21997 " │ ├─ SubqueryAlias\n" + 21998 " │ │ ├─ name: a\n" + 21999 " │ │ ├─ outerVisibility: false\n" + 22000 " │ │ ├─ isLateral: false\n" + 22001 " │ │ ├─ cacheable: true\n" + 22002 " │ │ └─ Project\n" + 22003 " │ │ ├─ columns: [1]\n" + 22004 " │ │ └─ Table\n" + 22005 " │ │ └─ name: \n" + 22006 " │ └─ SubqueryAlias\n" + 22007 " │ ├─ name: b\n" + 22008 " │ ├─ outerVisibility: false\n" + 22009 " │ ├─ isLateral: false\n" + 22010 " │ ├─ cacheable: true\n" + 22011 " │ └─ Project\n" + 22012 " │ ├─ columns: [1]\n" + 22013 " │ └─ Table\n" + 22014 " │ └─ name: \n" + 22015 " └─ SubqueryAlias\n" + 22016 " ├─ name: a\n" + 22017 " ├─ outerVisibility: false\n" + 22018 " ├─ isLateral: false\n" + 22019 " ├─ cacheable: true\n" + 22020 " └─ Project\n" + 22021 " ├─ columns: [1]\n" + 22022 " └─ Table\n" + 22023 " └─ name: \n" + 22024 "", 22025 ExpectedAnalysis: "Union distinct\n" + 22026 " ├─ Union all\n" + 22027 " │ ├─ SubqueryAlias\n" + 22028 " │ │ ├─ name: a\n" + 22029 " │ │ ├─ outerVisibility: false\n" + 22030 " │ │ ├─ isLateral: false\n" + 22031 " │ │ ├─ cacheable: true\n" + 22032 " │ │ └─ Project\n" + 22033 " │ │ ├─ columns: [1]\n" + 22034 " │ │ └─ Table\n" + 22035 " │ │ └─ name: \n" + 22036 " │ └─ SubqueryAlias\n" + 22037 " │ ├─ name: b\n" + 22038 " │ ├─ outerVisibility: false\n" + 22039 " │ ├─ isLateral: false\n" + 22040 " │ ├─ cacheable: true\n" + 22041 " │ └─ Project\n" + 22042 " │ ├─ columns: [1]\n" + 22043 " │ └─ Table\n" + 22044 " │ └─ name: \n" + 22045 " └─ SubqueryAlias\n" + 22046 " ├─ name: a\n" + 22047 " ├─ outerVisibility: false\n" + 22048 " ├─ isLateral: false\n" + 22049 " ├─ cacheable: true\n" + 22050 " └─ Project\n" + 22051 " ├─ columns: [1]\n" + 22052 " └─ Table\n" + 22053 " └─ name: \n" + 22054 "", 22055 }, 22056 { 22057 Query: ` 22058 With c as ( 22059 select * from ( 22060 select a.s 22061 From mytable a 22062 Join ( 22063 Select t2.* 22064 From mytable t2 22065 Where t2.i in (1,2) 22066 ) b 22067 On a.i = b.i 22068 Join ( 22069 select t1.* 22070 from mytable t1 22071 Where t1.I in (2,3) 22072 ) e 22073 On b.I = e.i 22074 ) d 22075 ) select * from c;`, 22076 ExpectedPlan: "SubqueryAlias\n" + 22077 " ├─ name: c\n" + 22078 " ├─ outerVisibility: false\n" + 22079 " ├─ isLateral: false\n" + 22080 " ├─ cacheable: true\n" + 22081 " ├─ colSet: (12)\n" + 22082 " ├─ tableId: 7\n" + 22083 " └─ SubqueryAlias\n" + 22084 " ├─ name: d\n" + 22085 " ├─ outerVisibility: false\n" + 22086 " ├─ isLateral: false\n" + 22087 " ├─ cacheable: true\n" + 22088 " ├─ colSet: (11)\n" + 22089 " ├─ tableId: 6\n" + 22090 " └─ Project\n" + 22091 " ├─ columns: [a.s:3!null]\n" + 22092 " └─ HashJoin\n" + 22093 " ├─ Eq\n" + 22094 " │ ├─ b.I:0!null\n" + 22095 " │ └─ e.i:4!null\n" + 22096 " ├─ HashJoin\n" + 22097 " │ ├─ Eq\n" + 22098 " │ │ ├─ a.i:2!null\n" + 22099 " │ │ └─ b.i:0!null\n" + 22100 " │ ├─ SubqueryAlias\n" + 22101 " │ │ ├─ name: b\n" + 22102 " │ │ ├─ outerVisibility: false\n" + 22103 " │ │ ├─ isLateral: false\n" + 22104 " │ │ ├─ cacheable: true\n" + 22105 " │ │ ├─ colSet: (5,6)\n" + 22106 " │ │ ├─ tableId: 3\n" + 22107 " │ │ └─ Filter\n" + 22108 " │ │ ├─ HashIn\n" + 22109 " │ │ │ ├─ t2.i:0!null\n" + 22110 " │ │ │ └─ TUPLE(1 (tinyint), 2 (tinyint))\n" + 22111 " │ │ └─ TableAlias(t2)\n" + 22112 " │ │ └─ IndexedTableAccess(mytable)\n" + 22113 " │ │ ├─ index: [mytable.i]\n" + 22114 " │ │ ├─ static: [{[1, 1]}, {[2, 2]}]\n" + 22115 " │ │ ├─ colSet: (3,4)\n" + 22116 " │ │ ├─ tableId: 2\n" + 22117 " │ │ └─ Table\n" + 22118 " │ │ ├─ name: mytable\n" + 22119 " │ │ └─ columns: [i s]\n" + 22120 " │ └─ HashLookup\n" + 22121 " │ ├─ left-key: TUPLE(b.i:0!null)\n" + 22122 " │ ├─ right-key: TUPLE(a.i:0!null)\n" + 22123 " │ └─ TableAlias(a)\n" + 22124 " │ └─ Table\n" + 22125 " │ ├─ name: mytable\n" + 22126 " │ ├─ columns: [i s]\n" + 22127 " │ ├─ colSet: (1,2)\n" + 22128 " │ └─ tableId: 1\n" + 22129 " └─ HashLookup\n" + 22130 " ├─ left-key: TUPLE(b.I:0!null)\n" + 22131 " ├─ right-key: TUPLE(e.i:0!null)\n" + 22132 " └─ SubqueryAlias\n" + 22133 " ├─ name: e\n" + 22134 " ├─ outerVisibility: false\n" + 22135 " ├─ isLateral: false\n" + 22136 " ├─ cacheable: true\n" + 22137 " ├─ colSet: (9,10)\n" + 22138 " ├─ tableId: 5\n" + 22139 " └─ Filter\n" + 22140 " ├─ HashIn\n" + 22141 " │ ├─ t1.I:0!null\n" + 22142 " │ └─ TUPLE(2 (tinyint), 3 (tinyint))\n" + 22143 " └─ TableAlias(t1)\n" + 22144 " └─ IndexedTableAccess(mytable)\n" + 22145 " ├─ index: [mytable.i]\n" + 22146 " ├─ static: [{[2, 2]}, {[3, 3]}]\n" + 22147 " ├─ colSet: (7,8)\n" + 22148 " ├─ tableId: 4\n" + 22149 " └─ Table\n" + 22150 " ├─ name: mytable\n" + 22151 " └─ columns: [i s]\n" + 22152 "", 22153 ExpectedEstimates: "SubqueryAlias\n" + 22154 " ├─ name: c\n" + 22155 " ├─ outerVisibility: false\n" + 22156 " ├─ isLateral: false\n" + 22157 " ├─ cacheable: true\n" + 22158 " └─ SubqueryAlias\n" + 22159 " ├─ name: d\n" + 22160 " ├─ outerVisibility: false\n" + 22161 " ├─ isLateral: false\n" + 22162 " ├─ cacheable: true\n" + 22163 " └─ Project\n" + 22164 " ├─ columns: [a.s]\n" + 22165 " └─ HashJoin\n" + 22166 " ├─ (b.I = e.i)\n" + 22167 " ├─ HashJoin\n" + 22168 " │ ├─ (a.i = b.i)\n" + 22169 " │ ├─ SubqueryAlias\n" + 22170 " │ │ ├─ name: b\n" + 22171 " │ │ ├─ outerVisibility: false\n" + 22172 " │ │ ├─ isLateral: false\n" + 22173 " │ │ ├─ cacheable: true\n" + 22174 " │ │ └─ Filter\n" + 22175 " │ │ ├─ (t2.i HASH IN (1, 2))\n" + 22176 " │ │ └─ TableAlias(t2)\n" + 22177 " │ │ └─ IndexedTableAccess(mytable)\n" + 22178 " │ │ ├─ index: [mytable.i]\n" + 22179 " │ │ ├─ filters: [{[1, 1]}, {[2, 2]}]\n" + 22180 " │ │ └─ columns: [i s]\n" + 22181 " │ └─ HashLookup\n" + 22182 " │ ├─ left-key: (b.i)\n" + 22183 " │ ├─ right-key: (a.i)\n" + 22184 " │ └─ TableAlias(a)\n" + 22185 " │ └─ Table\n" + 22186 " │ ├─ name: mytable\n" + 22187 " │ └─ columns: [i s]\n" + 22188 " └─ HashLookup\n" + 22189 " ├─ left-key: (b.I)\n" + 22190 " ├─ right-key: (e.i)\n" + 22191 " └─ SubqueryAlias\n" + 22192 " ├─ name: e\n" + 22193 " ├─ outerVisibility: false\n" + 22194 " ├─ isLateral: false\n" + 22195 " ├─ cacheable: true\n" + 22196 " └─ Filter\n" + 22197 " ├─ (t1.I HASH IN (2, 3))\n" + 22198 " └─ TableAlias(t1)\n" + 22199 " └─ IndexedTableAccess(mytable)\n" + 22200 " ├─ index: [mytable.i]\n" + 22201 " ├─ filters: [{[2, 2]}, {[3, 3]}]\n" + 22202 " └─ columns: [i s]\n" + 22203 "", 22204 ExpectedAnalysis: "SubqueryAlias\n" + 22205 " ├─ name: c\n" + 22206 " ├─ outerVisibility: false\n" + 22207 " ├─ isLateral: false\n" + 22208 " ├─ cacheable: true\n" + 22209 " └─ SubqueryAlias\n" + 22210 " ├─ name: d\n" + 22211 " ├─ outerVisibility: false\n" + 22212 " ├─ isLateral: false\n" + 22213 " ├─ cacheable: true\n" + 22214 " └─ Project\n" + 22215 " ├─ columns: [a.s]\n" + 22216 " └─ HashJoin\n" + 22217 " ├─ (b.I = e.i)\n" + 22218 " ├─ HashJoin\n" + 22219 " │ ├─ (a.i = b.i)\n" + 22220 " │ ├─ SubqueryAlias\n" + 22221 " │ │ ├─ name: b\n" + 22222 " │ │ ├─ outerVisibility: false\n" + 22223 " │ │ ├─ isLateral: false\n" + 22224 " │ │ ├─ cacheable: true\n" + 22225 " │ │ └─ Filter\n" + 22226 " │ │ ├─ (t2.i HASH IN (1, 2))\n" + 22227 " │ │ └─ TableAlias(t2)\n" + 22228 " │ │ └─ IndexedTableAccess(mytable)\n" + 22229 " │ │ ├─ index: [mytable.i]\n" + 22230 " │ │ ├─ filters: [{[1, 1]}, {[2, 2]}]\n" + 22231 " │ │ └─ columns: [i s]\n" + 22232 " │ └─ HashLookup\n" + 22233 " │ ├─ left-key: (b.i)\n" + 22234 " │ ├─ right-key: (a.i)\n" + 22235 " │ └─ TableAlias(a)\n" + 22236 " │ └─ Table\n" + 22237 " │ ├─ name: mytable\n" + 22238 " │ └─ columns: [i s]\n" + 22239 " └─ HashLookup\n" + 22240 " ├─ left-key: (b.I)\n" + 22241 " ├─ right-key: (e.i)\n" + 22242 " └─ SubqueryAlias\n" + 22243 " ├─ name: e\n" + 22244 " ├─ outerVisibility: false\n" + 22245 " ├─ isLateral: false\n" + 22246 " ├─ cacheable: true\n" + 22247 " └─ Filter\n" + 22248 " ├─ (t1.I HASH IN (2, 3))\n" + 22249 " └─ TableAlias(t1)\n" + 22250 " └─ IndexedTableAccess(mytable)\n" + 22251 " ├─ index: [mytable.i]\n" + 22252 " ├─ filters: [{[2, 2]}, {[3, 3]}]\n" + 22253 " └─ columns: [i s]\n" + 22254 "", 22255 }, 22256 { 22257 Query: `SELECT i FROM (SELECT i FROM mytable LIMIT 1) sq WHERE i = 3;`, 22258 ExpectedPlan: "SubqueryAlias\n" + 22259 " ├─ name: sq\n" + 22260 " ├─ outerVisibility: false\n" + 22261 " ├─ isLateral: false\n" + 22262 " ├─ cacheable: true\n" + 22263 " ├─ colSet: (3)\n" + 22264 " ├─ tableId: 2\n" + 22265 " └─ Filter\n" + 22266 " ├─ Eq\n" + 22267 " │ ├─ mytable.i:0!null\n" + 22268 " │ └─ 3 (tinyint)\n" + 22269 " └─ Limit(1)\n" + 22270 " └─ Table\n" + 22271 " ├─ name: mytable\n" + 22272 " ├─ columns: [i]\n" + 22273 " ├─ colSet: (1,2)\n" + 22274 " └─ tableId: 1\n" + 22275 "", 22276 ExpectedEstimates: "SubqueryAlias\n" + 22277 " ├─ name: sq\n" + 22278 " ├─ outerVisibility: false\n" + 22279 " ├─ isLateral: false\n" + 22280 " ├─ cacheable: true\n" + 22281 " └─ Filter\n" + 22282 " ├─ (mytable.i = 3)\n" + 22283 " └─ Limit(1)\n" + 22284 " └─ Table\n" + 22285 " ├─ name: mytable\n" + 22286 " └─ columns: [i]\n" + 22287 "", 22288 ExpectedAnalysis: "SubqueryAlias\n" + 22289 " ├─ name: sq\n" + 22290 " ├─ outerVisibility: false\n" + 22291 " ├─ isLateral: false\n" + 22292 " ├─ cacheable: true\n" + 22293 " └─ Filter\n" + 22294 " ├─ (mytable.i = 3)\n" + 22295 " └─ Limit(1)\n" + 22296 " └─ Table\n" + 22297 " ├─ name: mytable\n" + 22298 " └─ columns: [i]\n" + 22299 "", 22300 }, 22301 { 22302 Query: `SELECT i FROM (SELECT i FROM (SELECT i FROM mytable LIMIT 1) sq1) sq2 WHERE i = 3;`, 22303 ExpectedPlan: "SubqueryAlias\n" + 22304 " ├─ name: sq2\n" + 22305 " ├─ outerVisibility: false\n" + 22306 " ├─ isLateral: false\n" + 22307 " ├─ cacheable: true\n" + 22308 " ├─ colSet: (4)\n" + 22309 " ├─ tableId: 3\n" + 22310 " └─ SubqueryAlias\n" + 22311 " ├─ name: sq1\n" + 22312 " ├─ outerVisibility: false\n" + 22313 " ├─ isLateral: false\n" + 22314 " ├─ cacheable: true\n" + 22315 " ├─ colSet: (3)\n" + 22316 " ├─ tableId: 2\n" + 22317 " └─ Filter\n" + 22318 " ├─ Eq\n" + 22319 " │ ├─ mytable.i:0!null\n" + 22320 " │ └─ 3 (tinyint)\n" + 22321 " └─ Limit(1)\n" + 22322 " └─ Table\n" + 22323 " ├─ name: mytable\n" + 22324 " ├─ columns: [i]\n" + 22325 " ├─ colSet: (1,2)\n" + 22326 " └─ tableId: 1\n" + 22327 "", 22328 ExpectedEstimates: "SubqueryAlias\n" + 22329 " ├─ name: sq2\n" + 22330 " ├─ outerVisibility: false\n" + 22331 " ├─ isLateral: false\n" + 22332 " ├─ cacheable: true\n" + 22333 " └─ SubqueryAlias\n" + 22334 " ├─ name: sq1\n" + 22335 " ├─ outerVisibility: false\n" + 22336 " ├─ isLateral: false\n" + 22337 " ├─ cacheable: true\n" + 22338 " └─ Filter\n" + 22339 " ├─ (mytable.i = 3)\n" + 22340 " └─ Limit(1)\n" + 22341 " └─ Table\n" + 22342 " ├─ name: mytable\n" + 22343 " └─ columns: [i]\n" + 22344 "", 22345 ExpectedAnalysis: "SubqueryAlias\n" + 22346 " ├─ name: sq2\n" + 22347 " ├─ outerVisibility: false\n" + 22348 " ├─ isLateral: false\n" + 22349 " ├─ cacheable: true\n" + 22350 " └─ SubqueryAlias\n" + 22351 " ├─ name: sq1\n" + 22352 " ├─ outerVisibility: false\n" + 22353 " ├─ isLateral: false\n" + 22354 " ├─ cacheable: true\n" + 22355 " └─ Filter\n" + 22356 " ├─ (mytable.i = 3)\n" + 22357 " └─ Limit(1)\n" + 22358 " └─ Table\n" + 22359 " ├─ name: mytable\n" + 22360 " └─ columns: [i]\n" + 22361 "", 22362 }, 22363 { 22364 Query: `SELECT i FROM (SELECT i FROM mytable ORDER BY i DESC LIMIT 1) sq WHERE i = 3;`, 22365 ExpectedPlan: "SubqueryAlias\n" + 22366 " ├─ name: sq\n" + 22367 " ├─ outerVisibility: false\n" + 22368 " ├─ isLateral: false\n" + 22369 " ├─ cacheable: true\n" + 22370 " ├─ colSet: (3)\n" + 22371 " ├─ tableId: 2\n" + 22372 " └─ Filter\n" + 22373 " ├─ Eq\n" + 22374 " │ ├─ mytable.i:0!null\n" + 22375 " │ └─ 3 (tinyint)\n" + 22376 " └─ Limit(1)\n" + 22377 " └─ IndexedTableAccess(mytable)\n" + 22378 " ├─ index: [mytable.i]\n" + 22379 " ├─ static: [{[NULL, ∞)}]\n" + 22380 " ├─ reverse: true\n" + 22381 " ├─ colSet: (1,2)\n" + 22382 " ├─ tableId: 1\n" + 22383 " └─ Table\n" + 22384 " ├─ name: mytable\n" + 22385 " └─ columns: [i]\n" + 22386 "", 22387 ExpectedEstimates: "SubqueryAlias\n" + 22388 " ├─ name: sq\n" + 22389 " ├─ outerVisibility: false\n" + 22390 " ├─ isLateral: false\n" + 22391 " ├─ cacheable: true\n" + 22392 " └─ Filter\n" + 22393 " ├─ (mytable.i = 3)\n" + 22394 " └─ Limit(1)\n" + 22395 " └─ IndexedTableAccess(mytable)\n" + 22396 " ├─ index: [mytable.i]\n" + 22397 " ├─ filters: [{[NULL, ∞)}]\n" + 22398 " ├─ columns: [i]\n" + 22399 " └─ reverse: true\n" + 22400 "", 22401 ExpectedAnalysis: "SubqueryAlias\n" + 22402 " ├─ name: sq\n" + 22403 " ├─ outerVisibility: false\n" + 22404 " ├─ isLateral: false\n" + 22405 " ├─ cacheable: true\n" + 22406 " └─ Filter\n" + 22407 " ├─ (mytable.i = 3)\n" + 22408 " └─ Limit(1)\n" + 22409 " └─ IndexedTableAccess(mytable)\n" + 22410 " ├─ index: [mytable.i]\n" + 22411 " ├─ filters: [{[NULL, ∞)}]\n" + 22412 " ├─ columns: [i]\n" + 22413 " └─ reverse: true\n" + 22414 "", 22415 }, 22416 { 22417 Query: `SELECT i FROM (SELECT i FROM (SELECT i FROM mytable ORDER BY i DESC LIMIT 1) sq1) sq2 WHERE i = 3;`, 22418 ExpectedPlan: "SubqueryAlias\n" + 22419 " ├─ name: sq2\n" + 22420 " ├─ outerVisibility: false\n" + 22421 " ├─ isLateral: false\n" + 22422 " ├─ cacheable: true\n" + 22423 " ├─ colSet: (4)\n" + 22424 " ├─ tableId: 3\n" + 22425 " └─ SubqueryAlias\n" + 22426 " ├─ name: sq1\n" + 22427 " ├─ outerVisibility: false\n" + 22428 " ├─ isLateral: false\n" + 22429 " ├─ cacheable: true\n" + 22430 " ├─ colSet: (3)\n" + 22431 " ├─ tableId: 2\n" + 22432 " └─ Filter\n" + 22433 " ├─ Eq\n" + 22434 " │ ├─ mytable.i:0!null\n" + 22435 " │ └─ 3 (tinyint)\n" + 22436 " └─ Limit(1)\n" + 22437 " └─ IndexedTableAccess(mytable)\n" + 22438 " ├─ index: [mytable.i]\n" + 22439 " ├─ static: [{[NULL, ∞)}]\n" + 22440 " ├─ reverse: true\n" + 22441 " ├─ colSet: (1,2)\n" + 22442 " ├─ tableId: 1\n" + 22443 " └─ Table\n" + 22444 " ├─ name: mytable\n" + 22445 " └─ columns: [i]\n" + 22446 "", 22447 ExpectedEstimates: "SubqueryAlias\n" + 22448 " ├─ name: sq2\n" + 22449 " ├─ outerVisibility: false\n" + 22450 " ├─ isLateral: false\n" + 22451 " ├─ cacheable: true\n" + 22452 " └─ SubqueryAlias\n" + 22453 " ├─ name: sq1\n" + 22454 " ├─ outerVisibility: false\n" + 22455 " ├─ isLateral: false\n" + 22456 " ├─ cacheable: true\n" + 22457 " └─ Filter\n" + 22458 " ├─ (mytable.i = 3)\n" + 22459 " └─ Limit(1)\n" + 22460 " └─ IndexedTableAccess(mytable)\n" + 22461 " ├─ index: [mytable.i]\n" + 22462 " ├─ filters: [{[NULL, ∞)}]\n" + 22463 " ├─ columns: [i]\n" + 22464 " └─ reverse: true\n" + 22465 "", 22466 ExpectedAnalysis: "SubqueryAlias\n" + 22467 " ├─ name: sq2\n" + 22468 " ├─ outerVisibility: false\n" + 22469 " ├─ isLateral: false\n" + 22470 " ├─ cacheable: true\n" + 22471 " └─ SubqueryAlias\n" + 22472 " ├─ name: sq1\n" + 22473 " ├─ outerVisibility: false\n" + 22474 " ├─ isLateral: false\n" + 22475 " ├─ cacheable: true\n" + 22476 " └─ Filter\n" + 22477 " ├─ (mytable.i = 3)\n" + 22478 " └─ Limit(1)\n" + 22479 " └─ IndexedTableAccess(mytable)\n" + 22480 " ├─ index: [mytable.i]\n" + 22481 " ├─ filters: [{[NULL, ∞)}]\n" + 22482 " ├─ columns: [i]\n" + 22483 " └─ reverse: true\n" + 22484 "", 22485 }, 22486 { 22487 Query: `SELECT i FROM (SELECT i FROM mytable WHERE i > 1) sq LIMIT 1;`, 22488 ExpectedPlan: "Limit(1)\n" + 22489 " └─ SubqueryAlias\n" + 22490 " ├─ name: sq\n" + 22491 " ├─ outerVisibility: false\n" + 22492 " ├─ isLateral: false\n" + 22493 " ├─ cacheable: true\n" + 22494 " ├─ colSet: (3)\n" + 22495 " ├─ tableId: 2\n" + 22496 " └─ IndexedTableAccess(mytable)\n" + 22497 " ├─ index: [mytable.i]\n" + 22498 " ├─ static: [{(1, ∞)}]\n" + 22499 " ├─ colSet: (1,2)\n" + 22500 " ├─ tableId: 1\n" + 22501 " └─ Table\n" + 22502 " ├─ name: mytable\n" + 22503 " └─ columns: [i]\n" + 22504 "", 22505 ExpectedEstimates: "Limit(1)\n" + 22506 " └─ SubqueryAlias\n" + 22507 " ├─ name: sq\n" + 22508 " ├─ outerVisibility: false\n" + 22509 " ├─ isLateral: false\n" + 22510 " ├─ cacheable: true\n" + 22511 " └─ IndexedTableAccess(mytable)\n" + 22512 " ├─ index: [mytable.i]\n" + 22513 " ├─ filters: [{(1, ∞)}]\n" + 22514 " └─ columns: [i]\n" + 22515 "", 22516 ExpectedAnalysis: "Limit(1)\n" + 22517 " └─ SubqueryAlias\n" + 22518 " ├─ name: sq\n" + 22519 " ├─ outerVisibility: false\n" + 22520 " ├─ isLateral: false\n" + 22521 " ├─ cacheable: true\n" + 22522 " └─ IndexedTableAccess(mytable)\n" + 22523 " ├─ index: [mytable.i]\n" + 22524 " ├─ filters: [{(1, ∞)}]\n" + 22525 " └─ columns: [i]\n" + 22526 "", 22527 }, 22528 { 22529 Query: `SELECT i FROM (SELECT i FROM (SELECT i FROM mytable WHERE i > 1) sq1) sq2 LIMIT 1;`, 22530 ExpectedPlan: "Limit(1)\n" + 22531 " └─ SubqueryAlias\n" + 22532 " ├─ name: sq2\n" + 22533 " ├─ outerVisibility: false\n" + 22534 " ├─ isLateral: false\n" + 22535 " ├─ cacheable: true\n" + 22536 " ├─ colSet: (4)\n" + 22537 " ├─ tableId: 3\n" + 22538 " └─ SubqueryAlias\n" + 22539 " ├─ name: sq1\n" + 22540 " ├─ outerVisibility: false\n" + 22541 " ├─ isLateral: false\n" + 22542 " ├─ cacheable: true\n" + 22543 " ├─ colSet: (3)\n" + 22544 " ├─ tableId: 2\n" + 22545 " └─ IndexedTableAccess(mytable)\n" + 22546 " ├─ index: [mytable.i]\n" + 22547 " ├─ static: [{(1, ∞)}]\n" + 22548 " ├─ colSet: (1,2)\n" + 22549 " ├─ tableId: 1\n" + 22550 " └─ Table\n" + 22551 " ├─ name: mytable\n" + 22552 " └─ columns: [i]\n" + 22553 "", 22554 ExpectedEstimates: "Limit(1)\n" + 22555 " └─ SubqueryAlias\n" + 22556 " ├─ name: sq2\n" + 22557 " ├─ outerVisibility: false\n" + 22558 " ├─ isLateral: false\n" + 22559 " ├─ cacheable: true\n" + 22560 " └─ SubqueryAlias\n" + 22561 " ├─ name: sq1\n" + 22562 " ├─ outerVisibility: false\n" + 22563 " ├─ isLateral: false\n" + 22564 " ├─ cacheable: true\n" + 22565 " └─ IndexedTableAccess(mytable)\n" + 22566 " ├─ index: [mytable.i]\n" + 22567 " ├─ filters: [{(1, ∞)}]\n" + 22568 " └─ columns: [i]\n" + 22569 "", 22570 ExpectedAnalysis: "Limit(1)\n" + 22571 " └─ SubqueryAlias\n" + 22572 " ├─ name: sq2\n" + 22573 " ├─ outerVisibility: false\n" + 22574 " ├─ isLateral: false\n" + 22575 " ├─ cacheable: true\n" + 22576 " └─ SubqueryAlias\n" + 22577 " ├─ name: sq1\n" + 22578 " ├─ outerVisibility: false\n" + 22579 " ├─ isLateral: false\n" + 22580 " ├─ cacheable: true\n" + 22581 " └─ IndexedTableAccess(mytable)\n" + 22582 " ├─ index: [mytable.i]\n" + 22583 " ├─ filters: [{(1, ∞)}]\n" + 22584 " └─ columns: [i]\n" + 22585 "", 22586 }, 22587 { 22588 Query: `SELECT i FROM (SELECT i FROM (SELECT i FROM mytable) sq1 WHERE i > 1) sq2 LIMIT 1;`, 22589 ExpectedPlan: "Limit(1)\n" + 22590 " └─ SubqueryAlias\n" + 22591 " ├─ name: sq2\n" + 22592 " ├─ outerVisibility: false\n" + 22593 " ├─ isLateral: false\n" + 22594 " ├─ cacheable: true\n" + 22595 " ├─ colSet: (4)\n" + 22596 " ├─ tableId: 3\n" + 22597 " └─ SubqueryAlias\n" + 22598 " ├─ name: sq1\n" + 22599 " ├─ outerVisibility: false\n" + 22600 " ├─ isLateral: false\n" + 22601 " ├─ cacheable: true\n" + 22602 " ├─ colSet: (3)\n" + 22603 " ├─ tableId: 2\n" + 22604 " └─ IndexedTableAccess(mytable)\n" + 22605 " ├─ index: [mytable.i]\n" + 22606 " ├─ static: [{(1, ∞)}]\n" + 22607 " ├─ colSet: (1,2)\n" + 22608 " ├─ tableId: 1\n" + 22609 " └─ Table\n" + 22610 " ├─ name: mytable\n" + 22611 " └─ columns: [i]\n" + 22612 "", 22613 ExpectedEstimates: "Limit(1)\n" + 22614 " └─ SubqueryAlias\n" + 22615 " ├─ name: sq2\n" + 22616 " ├─ outerVisibility: false\n" + 22617 " ├─ isLateral: false\n" + 22618 " ├─ cacheable: true\n" + 22619 " └─ SubqueryAlias\n" + 22620 " ├─ name: sq1\n" + 22621 " ├─ outerVisibility: false\n" + 22622 " ├─ isLateral: false\n" + 22623 " ├─ cacheable: true\n" + 22624 " └─ IndexedTableAccess(mytable)\n" + 22625 " ├─ index: [mytable.i]\n" + 22626 " ├─ filters: [{(1, ∞)}]\n" + 22627 " └─ columns: [i]\n" + 22628 "", 22629 ExpectedAnalysis: "Limit(1)\n" + 22630 " └─ SubqueryAlias\n" + 22631 " ├─ name: sq2\n" + 22632 " ├─ outerVisibility: false\n" + 22633 " ├─ isLateral: false\n" + 22634 " ├─ cacheable: true\n" + 22635 " └─ SubqueryAlias\n" + 22636 " ├─ name: sq1\n" + 22637 " ├─ outerVisibility: false\n" + 22638 " ├─ isLateral: false\n" + 22639 " ├─ cacheable: true\n" + 22640 " └─ IndexedTableAccess(mytable)\n" + 22641 " ├─ index: [mytable.i]\n" + 22642 " ├─ filters: [{(1, ∞)}]\n" + 22643 " └─ columns: [i]\n" + 22644 "", 22645 }, 22646 { 22647 Query: `SELECT i FROM (SELECT i FROM (SELECT i FROM mytable LIMIT 1) sq1 WHERE i > 1) sq2 LIMIT 10;`, 22648 ExpectedPlan: "Limit(10)\n" + 22649 " └─ SubqueryAlias\n" + 22650 " ├─ name: sq2\n" + 22651 " ├─ outerVisibility: false\n" + 22652 " ├─ isLateral: false\n" + 22653 " ├─ cacheable: true\n" + 22654 " ├─ colSet: (4)\n" + 22655 " ├─ tableId: 3\n" + 22656 " └─ SubqueryAlias\n" + 22657 " ├─ name: sq1\n" + 22658 " ├─ outerVisibility: false\n" + 22659 " ├─ isLateral: false\n" + 22660 " ├─ cacheable: true\n" + 22661 " ├─ colSet: (3)\n" + 22662 " ├─ tableId: 2\n" + 22663 " └─ Filter\n" + 22664 " ├─ GreaterThan\n" + 22665 " │ ├─ mytable.i:0!null\n" + 22666 " │ └─ 1 (tinyint)\n" + 22667 " └─ Limit(1)\n" + 22668 " └─ Table\n" + 22669 " ├─ name: mytable\n" + 22670 " ├─ columns: [i]\n" + 22671 " ├─ colSet: (1,2)\n" + 22672 " └─ tableId: 1\n" + 22673 "", 22674 ExpectedEstimates: "Limit(10)\n" + 22675 " └─ SubqueryAlias\n" + 22676 " ├─ name: sq2\n" + 22677 " ├─ outerVisibility: false\n" + 22678 " ├─ isLateral: false\n" + 22679 " ├─ cacheable: true\n" + 22680 " └─ SubqueryAlias\n" + 22681 " ├─ name: sq1\n" + 22682 " ├─ outerVisibility: false\n" + 22683 " ├─ isLateral: false\n" + 22684 " ├─ cacheable: true\n" + 22685 " └─ Filter\n" + 22686 " ├─ (mytable.i > 1)\n" + 22687 " └─ Limit(1)\n" + 22688 " └─ Table\n" + 22689 " ├─ name: mytable\n" + 22690 " └─ columns: [i]\n" + 22691 "", 22692 ExpectedAnalysis: "Limit(10)\n" + 22693 " └─ SubqueryAlias\n" + 22694 " ├─ name: sq2\n" + 22695 " ├─ outerVisibility: false\n" + 22696 " ├─ isLateral: false\n" + 22697 " ├─ cacheable: true\n" + 22698 " └─ SubqueryAlias\n" + 22699 " ├─ name: sq1\n" + 22700 " ├─ outerVisibility: false\n" + 22701 " ├─ isLateral: false\n" + 22702 " ├─ cacheable: true\n" + 22703 " └─ Filter\n" + 22704 " ├─ (mytable.i > 1)\n" + 22705 " └─ Limit(1)\n" + 22706 " └─ Table\n" + 22707 " ├─ name: mytable\n" + 22708 " └─ columns: [i]\n" + 22709 "", 22710 }, 22711 { 22712 Query: `SELECT * FROM (SELECT a.pk, b.i FROM one_pk a JOIN mytable b ORDER BY a.pk ASC, b.i ASC LIMIT 1) sq WHERE i != 0`, 22713 ExpectedPlan: "SubqueryAlias\n" + 22714 " ├─ name: sq\n" + 22715 " ├─ outerVisibility: false\n" + 22716 " ├─ isLateral: false\n" + 22717 " ├─ cacheable: true\n" + 22718 " ├─ colSet: (9,10)\n" + 22719 " ├─ tableId: 3\n" + 22720 " └─ Filter\n" + 22721 " ├─ NOT\n" + 22722 " │ └─ Eq\n" + 22723 " │ ├─ b.i:1!null\n" + 22724 " │ └─ 0 (tinyint)\n" + 22725 " └─ Limit(1)\n" + 22726 " └─ Project\n" + 22727 " ├─ columns: [a.pk:1!null, b.i:0!null]\n" + 22728 " └─ Sort(a.pk:1!null ASC nullsFirst, b.i:0!null ASC nullsFirst)\n" + 22729 " └─ CrossJoin\n" + 22730 " ├─ TableAlias(b)\n" + 22731 " │ └─ Table\n" + 22732 " │ ├─ name: mytable\n" + 22733 " │ ├─ columns: [i]\n" + 22734 " │ ├─ colSet: (7,8)\n" + 22735 " │ └─ tableId: 2\n" + 22736 " └─ TableAlias(a)\n" + 22737 " └─ Table\n" + 22738 " ├─ name: one_pk\n" + 22739 " ├─ columns: [pk]\n" + 22740 " ├─ colSet: (1-6)\n" + 22741 " └─ tableId: 1\n" + 22742 "", 22743 ExpectedEstimates: "SubqueryAlias\n" + 22744 " ├─ name: sq\n" + 22745 " ├─ outerVisibility: false\n" + 22746 " ├─ isLateral: false\n" + 22747 " ├─ cacheable: true\n" + 22748 " └─ Filter\n" + 22749 " ├─ (NOT((b.i = 0)))\n" + 22750 " └─ Limit(1)\n" + 22751 " └─ Project\n" + 22752 " ├─ columns: [a.pk, b.i]\n" + 22753 " └─ Sort(a.pk ASC, b.i ASC)\n" + 22754 " └─ CrossJoin\n" + 22755 " ├─ TableAlias(b)\n" + 22756 " │ └─ Table\n" + 22757 " │ ├─ name: mytable\n" + 22758 " │ └─ columns: [i]\n" + 22759 " └─ TableAlias(a)\n" + 22760 " └─ Table\n" + 22761 " ├─ name: one_pk\n" + 22762 " └─ columns: [pk]\n" + 22763 "", 22764 ExpectedAnalysis: "SubqueryAlias\n" + 22765 " ├─ name: sq\n" + 22766 " ├─ outerVisibility: false\n" + 22767 " ├─ isLateral: false\n" + 22768 " ├─ cacheable: true\n" + 22769 " └─ Filter\n" + 22770 " ├─ (NOT((b.i = 0)))\n" + 22771 " └─ Limit(1)\n" + 22772 " └─ Project\n" + 22773 " ├─ columns: [a.pk, b.i]\n" + 22774 " └─ Sort(a.pk ASC, b.i ASC)\n" + 22775 " └─ CrossJoin\n" + 22776 " ├─ TableAlias(b)\n" + 22777 " │ └─ Table\n" + 22778 " │ ├─ name: mytable\n" + 22779 " │ └─ columns: [i]\n" + 22780 " └─ TableAlias(a)\n" + 22781 " └─ Table\n" + 22782 " ├─ name: one_pk\n" + 22783 " └─ columns: [pk]\n" + 22784 "", 22785 }, 22786 { 22787 Query: `SELECT * FROM (SELECT a.pk, b.i FROM one_pk a JOIN mytable b ORDER BY a.pk DESC, b.i DESC LIMIT 1) sq WHERE i != 0`, 22788 ExpectedPlan: "SubqueryAlias\n" + 22789 " ├─ name: sq\n" + 22790 " ├─ outerVisibility: false\n" + 22791 " ├─ isLateral: false\n" + 22792 " ├─ cacheable: true\n" + 22793 " ├─ colSet: (9,10)\n" + 22794 " ├─ tableId: 3\n" + 22795 " └─ Filter\n" + 22796 " ├─ NOT\n" + 22797 " │ └─ Eq\n" + 22798 " │ ├─ b.i:1!null\n" + 22799 " │ └─ 0 (tinyint)\n" + 22800 " └─ Limit(1)\n" + 22801 " └─ Project\n" + 22802 " ├─ columns: [a.pk:1!null, b.i:0!null]\n" + 22803 " └─ Sort(a.pk:1!null DESC nullsFirst, b.i:0!null DESC nullsFirst)\n" + 22804 " └─ CrossJoin\n" + 22805 " ├─ TableAlias(b)\n" + 22806 " │ └─ Table\n" + 22807 " │ ├─ name: mytable\n" + 22808 " │ ├─ columns: [i]\n" + 22809 " │ ├─ colSet: (7,8)\n" + 22810 " │ └─ tableId: 2\n" + 22811 " └─ TableAlias(a)\n" + 22812 " └─ Table\n" + 22813 " ├─ name: one_pk\n" + 22814 " ├─ columns: [pk]\n" + 22815 " ├─ colSet: (1-6)\n" + 22816 " └─ tableId: 1\n" + 22817 "", 22818 ExpectedEstimates: "SubqueryAlias\n" + 22819 " ├─ name: sq\n" + 22820 " ├─ outerVisibility: false\n" + 22821 " ├─ isLateral: false\n" + 22822 " ├─ cacheable: true\n" + 22823 " └─ Filter\n" + 22824 " ├─ (NOT((b.i = 0)))\n" + 22825 " └─ Limit(1)\n" + 22826 " └─ Project\n" + 22827 " ├─ columns: [a.pk, b.i]\n" + 22828 " └─ Sort(a.pk DESC, b.i DESC)\n" + 22829 " └─ CrossJoin\n" + 22830 " ├─ TableAlias(b)\n" + 22831 " │ └─ Table\n" + 22832 " │ ├─ name: mytable\n" + 22833 " │ └─ columns: [i]\n" + 22834 " └─ TableAlias(a)\n" + 22835 " └─ Table\n" + 22836 " ├─ name: one_pk\n" + 22837 " └─ columns: [pk]\n" + 22838 "", 22839 ExpectedAnalysis: "SubqueryAlias\n" + 22840 " ├─ name: sq\n" + 22841 " ├─ outerVisibility: false\n" + 22842 " ├─ isLateral: false\n" + 22843 " ├─ cacheable: true\n" + 22844 " └─ Filter\n" + 22845 " ├─ (NOT((b.i = 0)))\n" + 22846 " └─ Limit(1)\n" + 22847 " └─ Project\n" + 22848 " ├─ columns: [a.pk, b.i]\n" + 22849 " └─ Sort(a.pk DESC, b.i DESC)\n" + 22850 " └─ CrossJoin\n" + 22851 " ├─ TableAlias(b)\n" + 22852 " │ └─ Table\n" + 22853 " │ ├─ name: mytable\n" + 22854 " │ └─ columns: [i]\n" + 22855 " └─ TableAlias(a)\n" + 22856 " └─ Table\n" + 22857 " ├─ name: one_pk\n" + 22858 " └─ columns: [pk]\n" + 22859 "", 22860 }, 22861 { 22862 Query: `SELECT * FROM (SELECT pk FROM one_pk WHERE pk < 2 LIMIT 1) a JOIN (SELECT i FROM mytable WHERE i > 1 LIMIT 1) b WHERE pk >= 2;`, 22863 ExpectedPlan: "CrossHashJoin\n" + 22864 " ├─ SubqueryAlias\n" + 22865 " │ ├─ name: a\n" + 22866 " │ ├─ outerVisibility: false\n" + 22867 " │ ├─ isLateral: false\n" + 22868 " │ ├─ cacheable: true\n" + 22869 " │ ├─ colSet: (7)\n" + 22870 " │ ├─ tableId: 2\n" + 22871 " │ └─ Filter\n" + 22872 " │ ├─ GreaterThanOrEqual\n" + 22873 " │ │ ├─ one_pk.pk:0!null\n" + 22874 " │ │ └─ 2 (tinyint)\n" + 22875 " │ └─ Limit(1)\n" + 22876 " │ └─ IndexedTableAccess(one_pk)\n" + 22877 " │ ├─ index: [one_pk.pk]\n" + 22878 " │ ├─ static: [{(NULL, 2)}]\n" + 22879 " │ ├─ colSet: (1-6)\n" + 22880 " │ ├─ tableId: 1\n" + 22881 " │ └─ Table\n" + 22882 " │ ├─ name: one_pk\n" + 22883 " │ └─ columns: [pk]\n" + 22884 " └─ HashLookup\n" + 22885 " ├─ left-key: TUPLE()\n" + 22886 " ├─ right-key: TUPLE()\n" + 22887 " └─ SubqueryAlias\n" + 22888 " ├─ name: b\n" + 22889 " ├─ outerVisibility: false\n" + 22890 " ├─ isLateral: false\n" + 22891 " ├─ cacheable: true\n" + 22892 " ├─ colSet: (10)\n" + 22893 " ├─ tableId: 4\n" + 22894 " └─ Limit(1)\n" + 22895 " └─ IndexedTableAccess(mytable)\n" + 22896 " ├─ index: [mytable.i]\n" + 22897 " ├─ static: [{(1, ∞)}]\n" + 22898 " ├─ colSet: (8,9)\n" + 22899 " ├─ tableId: 3\n" + 22900 " └─ Table\n" + 22901 " ├─ name: mytable\n" + 22902 " └─ columns: [i]\n" + 22903 "", 22904 ExpectedEstimates: "CrossHashJoin (estimated cost=402.250 rows=125)\n" + 22905 " ├─ SubqueryAlias\n" + 22906 " │ ├─ name: a\n" + 22907 " │ ├─ outerVisibility: false\n" + 22908 " │ ├─ isLateral: false\n" + 22909 " │ ├─ cacheable: true\n" + 22910 " │ └─ Filter\n" + 22911 " │ ├─ (one_pk.pk >= 2)\n" + 22912 " │ └─ Limit(1)\n" + 22913 " │ └─ IndexedTableAccess(one_pk)\n" + 22914 " │ ├─ index: [one_pk.pk]\n" + 22915 " │ ├─ filters: [{(NULL, 2)}]\n" + 22916 " │ └─ columns: [pk]\n" + 22917 " └─ HashLookup\n" + 22918 " ├─ left-key: ()\n" + 22919 " ├─ right-key: ()\n" + 22920 " └─ SubqueryAlias\n" + 22921 " ├─ name: b\n" + 22922 " ├─ outerVisibility: false\n" + 22923 " ├─ isLateral: false\n" + 22924 " ├─ cacheable: true\n" + 22925 " └─ Limit(1)\n" + 22926 " └─ IndexedTableAccess(mytable)\n" + 22927 " ├─ index: [mytable.i]\n" + 22928 " ├─ filters: [{(1, ∞)}]\n" + 22929 " └─ columns: [i]\n" + 22930 "", 22931 ExpectedAnalysis: "CrossHashJoin (estimated cost=402.250 rows=125) (actual rows=0 loops=1)\n" + 22932 " ├─ SubqueryAlias\n" + 22933 " │ ├─ name: a\n" + 22934 " │ ├─ outerVisibility: false\n" + 22935 " │ ├─ isLateral: false\n" + 22936 " │ ├─ cacheable: true\n" + 22937 " │ └─ Filter\n" + 22938 " │ ├─ (one_pk.pk >= 2)\n" + 22939 " │ └─ Limit(1)\n" + 22940 " │ └─ IndexedTableAccess(one_pk)\n" + 22941 " │ ├─ index: [one_pk.pk]\n" + 22942 " │ ├─ filters: [{(NULL, 2)}]\n" + 22943 " │ └─ columns: [pk]\n" + 22944 " └─ HashLookup\n" + 22945 " ├─ left-key: ()\n" + 22946 " ├─ right-key: ()\n" + 22947 " └─ SubqueryAlias\n" + 22948 " ├─ name: b\n" + 22949 " ├─ outerVisibility: false\n" + 22950 " ├─ isLateral: false\n" + 22951 " ├─ cacheable: true\n" + 22952 " └─ Limit(1)\n" + 22953 " └─ IndexedTableAccess(mytable)\n" + 22954 " ├─ index: [mytable.i]\n" + 22955 " ├─ filters: [{(1, ∞)}]\n" + 22956 " └─ columns: [i]\n" + 22957 "", 22958 }, 22959 { 22960 Query: ` 22961 SELECT COUNT(*) 22962 FROM keyless 22963 WHERE keyless.c0 IN ( 22964 WITH RECURSIVE cte(depth, i, j) AS ( 22965 SELECT 0, T1.c0, T1.c1 22966 FROM keyless T1 22967 WHERE T1.c0 = 0 22968 22969 UNION ALL 22970 22971 SELECT cte.depth + 1, cte.i, T2.c1 + 1 22972 FROM cte, keyless T2 22973 WHERE cte.depth = T2.c0 22974 ) 22975 22976 SELECT U0.c0 22977 FROM keyless U0, cte 22978 WHERE cte.j = keyless.c0 22979 );`, 22980 ExpectedPlan: "Project\n" + 22981 " ├─ columns: [count(1):0!null as COUNT(*)]\n" + 22982 " └─ GroupBy\n" + 22983 " ├─ select: COUNT(1 (bigint))\n" + 22984 " ├─ group: \n" + 22985 " └─ Filter\n" + 22986 " ├─ InSubquery\n" + 22987 " │ ├─ left: keyless.c0:0\n" + 22988 " │ └─ right: Subquery\n" + 22989 " │ ├─ cacheable: false\n" + 22990 " │ ├─ alias-string: with recursive cte (depth, i, j) as (select 0, T1.c0, T1.c1 from keyless as T1 where T1.c0 = 0 union all select cte.depth + 1, cte.i, T2.c1 + 1 from cte, keyless as T2 where cte.depth = T2.c0) select U0.c0 from keyless as U0, cte where cte.j = keyless.c0\n" + 22991 " │ └─ Project\n" + 22992 " │ ├─ columns: [u0.c0:5]\n" + 22993 " │ └─ Filter\n" + 22994 " │ ├─ Eq\n" + 22995 " │ │ ├─ cte.j:4\n" + 22996 " │ │ └─ keyless.c0:0\n" + 22997 " │ └─ CrossHashJoin\n" + 22998 " │ ├─ SubqueryAlias\n" + 22999 " │ │ ├─ name: cte\n" + 23000 " │ │ ├─ outerVisibility: true\n" + 23001 " │ │ ├─ isLateral: false\n" + 23002 " │ │ ├─ cacheable: true\n" + 23003 " │ │ ├─ colSet: (6-8)\n" + 23004 " │ │ ├─ tableId: 3\n" + 23005 " │ │ └─ RecursiveCTE\n" + 23006 " │ │ └─ Union all\n" + 23007 " │ │ ├─ Project\n" + 23008 " │ │ │ ├─ columns: [0 (tinyint), t1.c0:2, t1.c1:3]\n" + 23009 " │ │ │ └─ Filter\n" + 23010 " │ │ │ ├─ Eq\n" + 23011 " │ │ │ │ ├─ t1.c0:2\n" + 23012 " │ │ │ │ └─ 0 (tinyint)\n" + 23013 " │ │ │ └─ TableAlias(t1)\n" + 23014 " │ │ │ └─ Table\n" + 23015 " │ │ │ ├─ name: keyless\n" + 23016 " │ │ │ ├─ columns: [c0 c1]\n" + 23017 " │ │ │ ├─ colSet: (3,4)\n" + 23018 " │ │ │ └─ tableId: 2\n" + 23019 " │ │ └─ Project\n" + 23020 " │ │ ├─ columns: [(cte.depth:2!null + 1 (tinyint)) as cte.depth + 1, cte.i:3, (t2.c1:6 + 1 (tinyint)) as T2.c1 + 1]\n" + 23021 " │ │ └─ HashJoin\n" + 23022 " │ │ ├─ Eq\n" + 23023 " │ │ │ ├─ cte.depth:2!null\n" + 23024 " │ │ │ └─ t2.c0:5\n" + 23025 " │ │ ├─ RecursiveTable(cte)\n" + 23026 " │ │ └─ HashLookup\n" + 23027 " │ │ ├─ left-key: TUPLE(cte.depth:2!null)\n" + 23028 " │ │ ├─ right-key: TUPLE(t2.c0:2)\n" + 23029 " │ │ └─ TableAlias(t2)\n" + 23030 " │ │ └─ Table\n" + 23031 " │ │ ├─ name: keyless\n" + 23032 " │ │ ├─ columns: [c0 c1]\n" + 23033 " │ │ ├─ colSet: (9,10)\n" + 23034 " │ │ └─ tableId: 5\n" + 23035 " │ └─ HashLookup\n" + 23036 " │ ├─ left-key: TUPLE()\n" + 23037 " │ ├─ right-key: TUPLE()\n" + 23038 " │ └─ TableAlias(u0)\n" + 23039 " │ └─ Table\n" + 23040 " │ ├─ name: keyless\n" + 23041 " │ ├─ columns: [c0]\n" + 23042 " │ ├─ colSet: (11,12)\n" + 23043 " │ └─ tableId: 7\n" + 23044 " └─ ProcessTable\n" + 23045 " └─ Table\n" + 23046 " ├─ name: keyless\n" + 23047 " └─ columns: [c0 c1]\n" + 23048 "", 23049 ExpectedEstimates: "Project\n" + 23050 " ├─ columns: [count(1) as COUNT(*)]\n" + 23051 " └─ GroupBy\n" + 23052 " ├─ SelectedExprs(COUNT(1))\n" + 23053 " ├─ Grouping()\n" + 23054 " └─ Filter\n" + 23055 " ├─ InSubquery\n" + 23056 " │ ├─ left: keyless.c0\n" + 23057 " │ └─ right: Subquery\n" + 23058 " │ ├─ cacheable: false\n" + 23059 " │ └─ Project\n" + 23060 " │ ├─ columns: [u0.c0]\n" + 23061 " │ └─ Filter\n" + 23062 " │ ├─ (cte.j = keyless.c0)\n" + 23063 " │ └─ CrossHashJoin\n" + 23064 " │ ├─ SubqueryAlias\n" + 23065 " │ │ ├─ name: cte\n" + 23066 " │ │ ├─ outerVisibility: true\n" + 23067 " │ │ ├─ isLateral: false\n" + 23068 " │ │ ├─ cacheable: true\n" + 23069 " │ │ └─ RecursiveCTE\n" + 23070 " │ │ └─ Union all\n" + 23071 " │ │ ├─ Project\n" + 23072 " │ │ │ ├─ columns: [0, t1.c0, t1.c1]\n" + 23073 " │ │ │ └─ Filter\n" + 23074 " │ │ │ ├─ (t1.c0 = 0)\n" + 23075 " │ │ │ └─ TableAlias(t1)\n" + 23076 " │ │ │ └─ Table\n" + 23077 " │ │ │ ├─ name: keyless\n" + 23078 " │ │ │ └─ columns: [c0 c1]\n" + 23079 " │ │ └─ Project\n" + 23080 " │ │ ├─ columns: [(cte.depth + 1) as cte.depth + 1, cte.i, (t2.c1 + 1) as T2.c1 + 1]\n" + 23081 " │ │ └─ HashJoin\n" + 23082 " │ │ ├─ (cte.depth = t2.c0)\n" + 23083 " │ │ ├─ RecursiveTable(cte)\n" + 23084 " │ │ └─ HashLookup\n" + 23085 " │ │ ├─ left-key: (cte.depth)\n" + 23086 " │ │ ├─ right-key: (t2.c0)\n" + 23087 " │ │ └─ TableAlias(t2)\n" + 23088 " │ │ └─ Table\n" + 23089 " │ │ ├─ name: keyless\n" + 23090 " │ │ └─ columns: [c0 c1]\n" + 23091 " │ └─ HashLookup\n" + 23092 " │ ├─ left-key: ()\n" + 23093 " │ ├─ right-key: ()\n" + 23094 " │ └─ TableAlias(u0)\n" + 23095 " │ └─ Table\n" + 23096 " │ ├─ name: keyless\n" + 23097 " │ └─ columns: [c0]\n" + 23098 " └─ Table\n" + 23099 " └─ name: keyless\n" + 23100 "", 23101 ExpectedAnalysis: "Project\n" + 23102 " ├─ columns: [count(1) as COUNT(*)]\n" + 23103 " └─ GroupBy\n" + 23104 " ├─ SelectedExprs(COUNT(1))\n" + 23105 " ├─ Grouping()\n" + 23106 " └─ Filter\n" + 23107 " ├─ InSubquery\n" + 23108 " │ ├─ left: keyless.c0\n" + 23109 " │ └─ right: Subquery\n" + 23110 " │ ├─ cacheable: false\n" + 23111 " │ └─ Project\n" + 23112 " │ ├─ columns: [u0.c0]\n" + 23113 " │ └─ Filter\n" + 23114 " │ ├─ (cte.j = keyless.c0)\n" + 23115 " │ └─ CrossHashJoin\n" + 23116 " │ ├─ SubqueryAlias\n" + 23117 " │ │ ├─ name: cte\n" + 23118 " │ │ ├─ outerVisibility: true\n" + 23119 " │ │ ├─ isLateral: false\n" + 23120 " │ │ ├─ cacheable: true\n" + 23121 " │ │ └─ RecursiveCTE\n" + 23122 " │ │ └─ Union all\n" + 23123 " │ │ ├─ Project\n" + 23124 " │ │ │ ├─ columns: [0, t1.c0, t1.c1]\n" + 23125 " │ │ │ └─ Filter\n" + 23126 " │ │ │ ├─ (t1.c0 = 0)\n" + 23127 " │ │ │ └─ TableAlias(t1)\n" + 23128 " │ │ │ └─ Table\n" + 23129 " │ │ │ ├─ name: keyless\n" + 23130 " │ │ │ └─ columns: [c0 c1]\n" + 23131 " │ │ └─ Project\n" + 23132 " │ │ ├─ columns: [(cte.depth + 1) as cte.depth + 1, cte.i, (t2.c1 + 1) as T2.c1 + 1]\n" + 23133 " │ │ └─ HashJoin\n" + 23134 " │ │ ├─ (cte.depth = t2.c0)\n" + 23135 " │ │ ├─ RecursiveTable(cte)\n" + 23136 " │ │ └─ HashLookup\n" + 23137 " │ │ ├─ left-key: (cte.depth)\n" + 23138 " │ │ ├─ right-key: (t2.c0)\n" + 23139 " │ │ └─ TableAlias(t2)\n" + 23140 " │ │ └─ Table\n" + 23141 " │ │ ├─ name: keyless\n" + 23142 " │ │ └─ columns: [c0 c1]\n" + 23143 " │ └─ HashLookup\n" + 23144 " │ ├─ left-key: ()\n" + 23145 " │ ├─ right-key: ()\n" + 23146 " │ └─ TableAlias(u0)\n" + 23147 " │ └─ Table\n" + 23148 " │ ├─ name: keyless\n" + 23149 " │ └─ columns: [c0]\n" + 23150 " └─ Table\n" + 23151 " └─ name: keyless\n" + 23152 "", 23153 }, 23154 { 23155 Query: ` 23156 SELECT COUNT(*) 23157 FROM keyless 23158 WHERE keyless.c0 IN ( 23159 WITH RECURSIVE cte(depth, i, j) AS ( 23160 SELECT 0, T1.c0, T1.c1 23161 FROM keyless T1 23162 WHERE T1.c0 = 0 23163 23164 UNION ALL 23165 23166 SELECT cte.depth + 1, cte.i, T2.c1 + 1 23167 FROM cte, keyless T2 23168 WHERE cte.depth = T2.c0 23169 ) 23170 23171 SELECT U0.c0 23172 FROM cte, keyless U0 23173 WHERE cte.j = keyless.c0 23174 );`, 23175 ExpectedPlan: "Project\n" + 23176 " ├─ columns: [count(1):0!null as COUNT(*)]\n" + 23177 " └─ GroupBy\n" + 23178 " ├─ select: COUNT(1 (bigint))\n" + 23179 " ├─ group: \n" + 23180 " └─ Filter\n" + 23181 " ├─ InSubquery\n" + 23182 " │ ├─ left: keyless.c0:0\n" + 23183 " │ └─ right: Subquery\n" + 23184 " │ ├─ cacheable: false\n" + 23185 " │ ├─ alias-string: with recursive cte (depth, i, j) as (select 0, T1.c0, T1.c1 from keyless as T1 where T1.c0 = 0 union all select cte.depth + 1, cte.i, T2.c1 + 1 from cte, keyless as T2 where cte.depth = T2.c0) select U0.c0 from cte, keyless as U0 where cte.j = keyless.c0\n" + 23186 " │ └─ Project\n" + 23187 " │ ├─ columns: [u0.c0:5]\n" + 23188 " │ └─ Filter\n" + 23189 " │ ├─ Eq\n" + 23190 " │ │ ├─ cte.j:4\n" + 23191 " │ │ └─ keyless.c0:0\n" + 23192 " │ └─ CrossHashJoin\n" + 23193 " │ ├─ SubqueryAlias\n" + 23194 " │ │ ├─ name: cte\n" + 23195 " │ │ ├─ outerVisibility: true\n" + 23196 " │ │ ├─ isLateral: false\n" + 23197 " │ │ ├─ cacheable: true\n" + 23198 " │ │ ├─ colSet: (6-8)\n" + 23199 " │ │ ├─ tableId: 3\n" + 23200 " │ │ └─ RecursiveCTE\n" + 23201 " │ │ └─ Union all\n" + 23202 " │ │ ├─ Project\n" + 23203 " │ │ │ ├─ columns: [0 (tinyint), t1.c0:2, t1.c1:3]\n" + 23204 " │ │ │ └─ Filter\n" + 23205 " │ │ │ ├─ Eq\n" + 23206 " │ │ │ │ ├─ t1.c0:2\n" + 23207 " │ │ │ │ └─ 0 (tinyint)\n" + 23208 " │ │ │ └─ TableAlias(t1)\n" + 23209 " │ │ │ └─ Table\n" + 23210 " │ │ │ ├─ name: keyless\n" + 23211 " │ │ │ ├─ columns: [c0 c1]\n" + 23212 " │ │ │ ├─ colSet: (3,4)\n" + 23213 " │ │ │ └─ tableId: 2\n" + 23214 " │ │ └─ Project\n" + 23215 " │ │ ├─ columns: [(cte.depth:2!null + 1 (tinyint)) as cte.depth + 1, cte.i:3, (t2.c1:6 + 1 (tinyint)) as T2.c1 + 1]\n" + 23216 " │ │ └─ HashJoin\n" + 23217 " │ │ ├─ Eq\n" + 23218 " │ │ │ ├─ cte.depth:2!null\n" + 23219 " │ │ │ └─ t2.c0:5\n" + 23220 " │ │ ├─ RecursiveTable(cte)\n" + 23221 " │ │ └─ HashLookup\n" + 23222 " │ │ ├─ left-key: TUPLE(cte.depth:2!null)\n" + 23223 " │ │ ├─ right-key: TUPLE(t2.c0:2)\n" + 23224 " │ │ └─ TableAlias(t2)\n" + 23225 " │ │ └─ Table\n" + 23226 " │ │ ├─ name: keyless\n" + 23227 " │ │ ├─ columns: [c0 c1]\n" + 23228 " │ │ ├─ colSet: (9,10)\n" + 23229 " │ │ └─ tableId: 5\n" + 23230 " │ └─ HashLookup\n" + 23231 " │ ├─ left-key: TUPLE()\n" + 23232 " │ ├─ right-key: TUPLE()\n" + 23233 " │ └─ TableAlias(u0)\n" + 23234 " │ └─ Table\n" + 23235 " │ ├─ name: keyless\n" + 23236 " │ ├─ columns: [c0]\n" + 23237 " │ ├─ colSet: (11,12)\n" + 23238 " │ └─ tableId: 7\n" + 23239 " └─ ProcessTable\n" + 23240 " └─ Table\n" + 23241 " ├─ name: keyless\n" + 23242 " └─ columns: [c0 c1]\n" + 23243 "", 23244 ExpectedEstimates: "Project\n" + 23245 " ├─ columns: [count(1) as COUNT(*)]\n" + 23246 " └─ GroupBy\n" + 23247 " ├─ SelectedExprs(COUNT(1))\n" + 23248 " ├─ Grouping()\n" + 23249 " └─ Filter\n" + 23250 " ├─ InSubquery\n" + 23251 " │ ├─ left: keyless.c0\n" + 23252 " │ └─ right: Subquery\n" + 23253 " │ ├─ cacheable: false\n" + 23254 " │ └─ Project\n" + 23255 " │ ├─ columns: [u0.c0]\n" + 23256 " │ └─ Filter\n" + 23257 " │ ├─ (cte.j = keyless.c0)\n" + 23258 " │ └─ CrossHashJoin\n" + 23259 " │ ├─ SubqueryAlias\n" + 23260 " │ │ ├─ name: cte\n" + 23261 " │ │ ├─ outerVisibility: true\n" + 23262 " │ │ ├─ isLateral: false\n" + 23263 " │ │ ├─ cacheable: true\n" + 23264 " │ │ └─ RecursiveCTE\n" + 23265 " │ │ └─ Union all\n" + 23266 " │ │ ├─ Project\n" + 23267 " │ │ │ ├─ columns: [0, t1.c0, t1.c1]\n" + 23268 " │ │ │ └─ Filter\n" + 23269 " │ │ │ ├─ (t1.c0 = 0)\n" + 23270 " │ │ │ └─ TableAlias(t1)\n" + 23271 " │ │ │ └─ Table\n" + 23272 " │ │ │ ├─ name: keyless\n" + 23273 " │ │ │ └─ columns: [c0 c1]\n" + 23274 " │ │ └─ Project\n" + 23275 " │ │ ├─ columns: [(cte.depth + 1) as cte.depth + 1, cte.i, (t2.c1 + 1) as T2.c1 + 1]\n" + 23276 " │ │ └─ HashJoin\n" + 23277 " │ │ ├─ (cte.depth = t2.c0)\n" + 23278 " │ │ ├─ RecursiveTable(cte)\n" + 23279 " │ │ └─ HashLookup\n" + 23280 " │ │ ├─ left-key: (cte.depth)\n" + 23281 " │ │ ├─ right-key: (t2.c0)\n" + 23282 " │ │ └─ TableAlias(t2)\n" + 23283 " │ │ └─ Table\n" + 23284 " │ │ ├─ name: keyless\n" + 23285 " │ │ └─ columns: [c0 c1]\n" + 23286 " │ └─ HashLookup\n" + 23287 " │ ├─ left-key: ()\n" + 23288 " │ ├─ right-key: ()\n" + 23289 " │ └─ TableAlias(u0)\n" + 23290 " │ └─ Table\n" + 23291 " │ ├─ name: keyless\n" + 23292 " │ └─ columns: [c0]\n" + 23293 " └─ Table\n" + 23294 " └─ name: keyless\n" + 23295 "", 23296 ExpectedAnalysis: "Project\n" + 23297 " ├─ columns: [count(1) as COUNT(*)]\n" + 23298 " └─ GroupBy\n" + 23299 " ├─ SelectedExprs(COUNT(1))\n" + 23300 " ├─ Grouping()\n" + 23301 " └─ Filter\n" + 23302 " ├─ InSubquery\n" + 23303 " │ ├─ left: keyless.c0\n" + 23304 " │ └─ right: Subquery\n" + 23305 " │ ├─ cacheable: false\n" + 23306 " │ └─ Project\n" + 23307 " │ ├─ columns: [u0.c0]\n" + 23308 " │ └─ Filter\n" + 23309 " │ ├─ (cte.j = keyless.c0)\n" + 23310 " │ └─ CrossHashJoin\n" + 23311 " │ ├─ SubqueryAlias\n" + 23312 " │ │ ├─ name: cte\n" + 23313 " │ │ ├─ outerVisibility: true\n" + 23314 " │ │ ├─ isLateral: false\n" + 23315 " │ │ ├─ cacheable: true\n" + 23316 " │ │ └─ RecursiveCTE\n" + 23317 " │ │ └─ Union all\n" + 23318 " │ │ ├─ Project\n" + 23319 " │ │ │ ├─ columns: [0, t1.c0, t1.c1]\n" + 23320 " │ │ │ └─ Filter\n" + 23321 " │ │ │ ├─ (t1.c0 = 0)\n" + 23322 " │ │ │ └─ TableAlias(t1)\n" + 23323 " │ │ │ └─ Table\n" + 23324 " │ │ │ ├─ name: keyless\n" + 23325 " │ │ │ └─ columns: [c0 c1]\n" + 23326 " │ │ └─ Project\n" + 23327 " │ │ ├─ columns: [(cte.depth + 1) as cte.depth + 1, cte.i, (t2.c1 + 1) as T2.c1 + 1]\n" + 23328 " │ │ └─ HashJoin\n" + 23329 " │ │ ├─ (cte.depth = t2.c0)\n" + 23330 " │ │ ├─ RecursiveTable(cte)\n" + 23331 " │ │ └─ HashLookup\n" + 23332 " │ │ ├─ left-key: (cte.depth)\n" + 23333 " │ │ ├─ right-key: (t2.c0)\n" + 23334 " │ │ └─ TableAlias(t2)\n" + 23335 " │ │ └─ Table\n" + 23336 " │ │ ├─ name: keyless\n" + 23337 " │ │ └─ columns: [c0 c1]\n" + 23338 " │ └─ HashLookup\n" + 23339 " │ ├─ left-key: ()\n" + 23340 " │ ├─ right-key: ()\n" + 23341 " │ └─ TableAlias(u0)\n" + 23342 " │ └─ Table\n" + 23343 " │ ├─ name: keyless\n" + 23344 " │ └─ columns: [c0]\n" + 23345 " └─ Table\n" + 23346 " └─ name: keyless\n" + 23347 "", 23348 }, 23349 { 23350 Query: `SELECT s,i FROM mytable as a order by i;`, 23351 ExpectedPlan: "Project\n" + 23352 " ├─ columns: [a.s:1!null, a.i:0!null]\n" + 23353 " └─ TableAlias(a)\n" + 23354 " └─ IndexedTableAccess(mytable)\n" + 23355 " ├─ index: [mytable.i]\n" + 23356 " ├─ static: [{[NULL, ∞)}]\n" + 23357 " ├─ colSet: (1,2)\n" + 23358 " ├─ tableId: 1\n" + 23359 " └─ Table\n" + 23360 " ├─ name: mytable\n" + 23361 " └─ columns: [i s]\n" + 23362 "", 23363 ExpectedEstimates: "Project\n" + 23364 " ├─ columns: [a.s, a.i]\n" + 23365 " └─ TableAlias(a)\n" + 23366 " └─ IndexedTableAccess(mytable)\n" + 23367 " ├─ index: [mytable.i]\n" + 23368 " ├─ filters: [{[NULL, ∞)}]\n" + 23369 " └─ columns: [i s]\n" + 23370 "", 23371 ExpectedAnalysis: "Project\n" + 23372 " ├─ columns: [a.s, a.i]\n" + 23373 " └─ TableAlias(a)\n" + 23374 " └─ IndexedTableAccess(mytable)\n" + 23375 " ├─ index: [mytable.i]\n" + 23376 " ├─ filters: [{[NULL, ∞)}]\n" + 23377 " └─ columns: [i s]\n" + 23378 "", 23379 }, 23380 { 23381 Query: `SELECT s,i FROM mytable order by i DESC;`, 23382 ExpectedPlan: "Project\n" + 23383 " ├─ columns: [mytable.s:1!null, mytable.i:0!null]\n" + 23384 " └─ IndexedTableAccess(mytable)\n" + 23385 " ├─ index: [mytable.i]\n" + 23386 " ├─ static: [{[NULL, ∞)}]\n" + 23387 " ├─ reverse: true\n" + 23388 " ├─ colSet: (1,2)\n" + 23389 " ├─ tableId: 1\n" + 23390 " └─ Table\n" + 23391 " ├─ name: mytable\n" + 23392 " └─ columns: [i s]\n" + 23393 "", 23394 ExpectedEstimates: "Project\n" + 23395 " ├─ columns: [mytable.s, mytable.i]\n" + 23396 " └─ IndexedTableAccess(mytable)\n" + 23397 " ├─ index: [mytable.i]\n" + 23398 " ├─ filters: [{[NULL, ∞)}]\n" + 23399 " ├─ columns: [i s]\n" + 23400 " └─ reverse: true\n" + 23401 "", 23402 ExpectedAnalysis: "Project\n" + 23403 " ├─ columns: [mytable.s, mytable.i]\n" + 23404 " └─ IndexedTableAccess(mytable)\n" + 23405 " ├─ index: [mytable.i]\n" + 23406 " ├─ filters: [{[NULL, ∞)}]\n" + 23407 " ├─ columns: [i s]\n" + 23408 " └─ reverse: true\n" + 23409 "", 23410 }, 23411 { 23412 Query: `SELECT pk1, pk2 FROM two_pk order by pk1 asc, pk2 asc;`, 23413 ExpectedPlan: "IndexedTableAccess(two_pk)\n" + 23414 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 23415 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 23416 " ├─ colSet: (1-7)\n" + 23417 " ├─ tableId: 1\n" + 23418 " └─ Table\n" + 23419 " ├─ name: two_pk\n" + 23420 " └─ columns: [pk1 pk2]\n" + 23421 "", 23422 ExpectedEstimates: "IndexedTableAccess(two_pk)\n" + 23423 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 23424 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 23425 " └─ columns: [pk1 pk2]\n" + 23426 "", 23427 ExpectedAnalysis: "IndexedTableAccess(two_pk)\n" + 23428 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 23429 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 23430 " └─ columns: [pk1 pk2]\n" + 23431 "", 23432 }, 23433 { 23434 Query: `SELECT pk1, pk2 FROM two_pk order by pk1 asc, pk2 desc;`, 23435 ExpectedPlan: "Sort(two_pk.pk1:0!null ASC nullsFirst, two_pk.pk2:1!null DESC nullsFirst)\n" + 23436 " └─ ProcessTable\n" + 23437 " └─ Table\n" + 23438 " ├─ name: two_pk\n" + 23439 " └─ columns: [pk1 pk2]\n" + 23440 "", 23441 ExpectedEstimates: "Sort(two_pk.pk1 ASC, two_pk.pk2 DESC)\n" + 23442 " └─ Table\n" + 23443 " ├─ name: two_pk\n" + 23444 " └─ columns: [pk1 pk2]\n" + 23445 "", 23446 ExpectedAnalysis: "Sort(two_pk.pk1 ASC, two_pk.pk2 DESC)\n" + 23447 " └─ Table\n" + 23448 " ├─ name: two_pk\n" + 23449 " └─ columns: [pk1 pk2]\n" + 23450 "", 23451 }, 23452 { 23453 Query: `SELECT pk1, pk2 FROM two_pk order by pk1 desc, pk2 desc;`, 23454 ExpectedPlan: "IndexedTableAccess(two_pk)\n" + 23455 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 23456 " ├─ static: [{[NULL, ∞), [NULL, ∞)}]\n" + 23457 " ├─ reverse: true\n" + 23458 " ├─ colSet: (1-7)\n" + 23459 " ├─ tableId: 1\n" + 23460 " └─ Table\n" + 23461 " ├─ name: two_pk\n" + 23462 " └─ columns: [pk1 pk2]\n" + 23463 "", 23464 ExpectedEstimates: "IndexedTableAccess(two_pk)\n" + 23465 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 23466 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 23467 " ├─ columns: [pk1 pk2]\n" + 23468 " └─ reverse: true\n" + 23469 "", 23470 ExpectedAnalysis: "IndexedTableAccess(two_pk)\n" + 23471 " ├─ index: [two_pk.pk1,two_pk.pk2]\n" + 23472 " ├─ filters: [{[NULL, ∞), [NULL, ∞)}]\n" + 23473 " ├─ columns: [pk1 pk2]\n" + 23474 " └─ reverse: true\n" + 23475 "", 23476 }, 23477 { 23478 Query: `SELECT pk1, pk2 FROM two_pk group by pk1, pk2 order by pk1, pk2;`, 23479 ExpectedPlan: "Sort(two_pk.pk1:0!null ASC nullsFirst, two_pk.pk2:1!null ASC nullsFirst)\n" + 23480 " └─ GroupBy\n" + 23481 " ├─ select: two_pk.pk1:0!null, two_pk.pk2:1!null\n" + 23482 " ├─ group: two_pk.pk1:0!null, two_pk.pk2:1!null\n" + 23483 " └─ ProcessTable\n" + 23484 " └─ Table\n" + 23485 " ├─ name: two_pk\n" + 23486 " └─ columns: [pk1 pk2]\n" + 23487 "", 23488 ExpectedEstimates: "Sort(two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 23489 " └─ GroupBy\n" + 23490 " ├─ SelectedExprs(two_pk.pk1, two_pk.pk2)\n" + 23491 " ├─ Grouping(two_pk.pk1, two_pk.pk2)\n" + 23492 " └─ Table\n" + 23493 " ├─ name: two_pk\n" + 23494 " └─ columns: [pk1 pk2]\n" + 23495 "", 23496 ExpectedAnalysis: "Sort(two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 23497 " └─ GroupBy\n" + 23498 " ├─ SelectedExprs(two_pk.pk1, two_pk.pk2)\n" + 23499 " ├─ Grouping(two_pk.pk1, two_pk.pk2)\n" + 23500 " └─ Table\n" + 23501 " ├─ name: two_pk\n" + 23502 " └─ columns: [pk1 pk2]\n" + 23503 "", 23504 }, 23505 { 23506 Query: `SELECT pk1, pk2 FROM two_pk group by pk1, pk2 order by pk1 desc, pk2 desc;`, 23507 ExpectedPlan: "Sort(two_pk.pk1:0!null DESC nullsFirst, two_pk.pk2:1!null DESC nullsFirst)\n" + 23508 " └─ GroupBy\n" + 23509 " ├─ select: two_pk.pk1:0!null, two_pk.pk2:1!null\n" + 23510 " ├─ group: two_pk.pk1:0!null, two_pk.pk2:1!null\n" + 23511 " └─ ProcessTable\n" + 23512 " └─ Table\n" + 23513 " ├─ name: two_pk\n" + 23514 " └─ columns: [pk1 pk2]\n" + 23515 "", 23516 ExpectedEstimates: "Sort(two_pk.pk1 DESC, two_pk.pk2 DESC)\n" + 23517 " └─ GroupBy\n" + 23518 " ├─ SelectedExprs(two_pk.pk1, two_pk.pk2)\n" + 23519 " ├─ Grouping(two_pk.pk1, two_pk.pk2)\n" + 23520 " └─ Table\n" + 23521 " ├─ name: two_pk\n" + 23522 " └─ columns: [pk1 pk2]\n" + 23523 "", 23524 ExpectedAnalysis: "Sort(two_pk.pk1 DESC, two_pk.pk2 DESC)\n" + 23525 " └─ GroupBy\n" + 23526 " ├─ SelectedExprs(two_pk.pk1, two_pk.pk2)\n" + 23527 " ├─ Grouping(two_pk.pk1, two_pk.pk2)\n" + 23528 " └─ Table\n" + 23529 " ├─ name: two_pk\n" + 23530 " └─ columns: [pk1 pk2]\n" + 23531 "", 23532 }, 23533 { 23534 Query: `select pk1, pk2, row_number() over (partition by pk1 order by c1 desc) from two_pk order by 1,2;`, 23535 ExpectedPlan: "Project\n" + 23536 " ├─ columns: [two_pk.pk1:1!null, two_pk.pk2:2!null, row_number() over ( partition by two_pk.pk1 order by two_pk.c1 desc):0!null as row_number() over (partition by pk1 order by c1 desc)]\n" + 23537 " └─ Sort(two_pk.pk1:1!null ASC nullsFirst, two_pk.pk2:2!null ASC nullsFirst)\n" + 23538 " └─ Window\n" + 23539 " ├─ row_number() over ( partition by two_pk.pk1 order by two_pk.c1 DESC)\n" + 23540 " ├─ two_pk.pk1:0!null\n" + 23541 " ├─ two_pk.pk2:1!null\n" + 23542 " └─ ProcessTable\n" + 23543 " └─ Table\n" + 23544 " ├─ name: two_pk\n" + 23545 " └─ columns: [pk1 pk2 c1]\n" + 23546 "", 23547 ExpectedEstimates: "Project\n" + 23548 " ├─ columns: [two_pk.pk1, two_pk.pk2, row_number() over ( partition by two_pk.pk1 order by two_pk.c1 desc) as row_number() over (partition by pk1 order by c1 desc)]\n" + 23549 " └─ Sort(two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 23550 " └─ Window(row_number() over ( partition by two_pk.pk1 order by two_pk.c1 DESC), two_pk.pk1, two_pk.pk2)\n" + 23551 " └─ Table\n" + 23552 " ├─ name: two_pk\n" + 23553 " └─ columns: [pk1 pk2 c1]\n" + 23554 "", 23555 ExpectedAnalysis: "Project\n" + 23556 " ├─ columns: [two_pk.pk1, two_pk.pk2, row_number() over ( partition by two_pk.pk1 order by two_pk.c1 desc) as row_number() over (partition by pk1 order by c1 desc)]\n" + 23557 " └─ Sort(two_pk.pk1 ASC, two_pk.pk2 ASC)\n" + 23558 " └─ Window(row_number() over ( partition by two_pk.pk1 order by two_pk.c1 DESC), two_pk.pk1, two_pk.pk2)\n" + 23559 " └─ Table\n" + 23560 " ├─ name: two_pk\n" + 23561 " └─ columns: [pk1 pk2 c1]\n" + 23562 "", 23563 }, 23564 { 23565 Query: `SELECT * FROM one_pk ORDER BY pk LIMIT 0, 10;`, 23566 ExpectedPlan: "Limit(10)\n" + 23567 " └─ IndexedTableAccess(one_pk)\n" + 23568 " ├─ index: [one_pk.pk]\n" + 23569 " ├─ static: [{[NULL, ∞)}]\n" + 23570 " ├─ colSet: (1-6)\n" + 23571 " ├─ tableId: 1\n" + 23572 " └─ Table\n" + 23573 " ├─ name: one_pk\n" + 23574 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 23575 "", 23576 ExpectedEstimates: "Limit(10)\n" + 23577 " └─ IndexedTableAccess(one_pk)\n" + 23578 " ├─ index: [one_pk.pk]\n" + 23579 " ├─ filters: [{[NULL, ∞)}]\n" + 23580 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 23581 "", 23582 ExpectedAnalysis: "Limit(10)\n" + 23583 " └─ IndexedTableAccess(one_pk)\n" + 23584 " ├─ index: [one_pk.pk]\n" + 23585 " ├─ filters: [{[NULL, ∞)}]\n" + 23586 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 23587 "", 23588 }, 23589 { 23590 Query: `SELECT * FROM one_pk ORDER BY pk LIMIT 5, 10;`, 23591 ExpectedPlan: "Limit(10)\n" + 23592 " └─ Offset(5)\n" + 23593 " └─ IndexedTableAccess(one_pk)\n" + 23594 " ├─ index: [one_pk.pk]\n" + 23595 " ├─ filters: [{[NULL, ∞)}]\n" + 23596 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 23597 "", 23598 ExpectedEstimates: "Limit(10)\n" + 23599 " └─ Offset(5)\n" + 23600 " └─ IndexedTableAccess(one_pk)\n" + 23601 " ├─ index: [one_pk.pk]\n" + 23602 " ├─ filters: [{[NULL, ∞)}]\n" + 23603 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 23604 "", 23605 ExpectedAnalysis: "Limit(10)\n" + 23606 " └─ Offset(5)\n" + 23607 " └─ IndexedTableAccess(one_pk)\n" + 23608 " ├─ index: [one_pk.pk]\n" + 23609 " ├─ filters: [{[NULL, ∞)}]\n" + 23610 " └─ columns: [pk c1 c2 c3 c4 c5]\n" + 23611 "", 23612 }, 23613 { 23614 Query: `select x, u from xy, lateral (select * from uv where y = u) uv;`, 23615 ExpectedPlan: "Project\n" + 23616 " ├─ columns: [xy.x:0!null, uv.u:2!null]\n" + 23617 " └─ LateralCrossJoin\n" + 23618 " ├─ ProcessTable\n" + 23619 " │ └─ Table\n" + 23620 " │ ├─ name: xy\n" + 23621 " │ └─ columns: [x y]\n" + 23622 " └─ SubqueryAlias\n" + 23623 " ├─ name: uv\n" + 23624 " ├─ outerVisibility: false\n" + 23625 " ├─ isLateral: true\n" + 23626 " ├─ cacheable: false\n" + 23627 " ├─ colSet: (5,6)\n" + 23628 " ├─ tableId: 3\n" + 23629 " └─ Filter\n" + 23630 " ├─ Eq\n" + 23631 " │ ├─ xy.y:1\n" + 23632 " │ └─ uv.u:2!null\n" + 23633 " └─ Table\n" + 23634 " ├─ name: uv\n" + 23635 " ├─ columns: [u v]\n" + 23636 " ├─ colSet: (3,4)\n" + 23637 " └─ tableId: 2\n" + 23638 "", 23639 ExpectedEstimates: "Project\n" + 23640 " ├─ columns: [xy.x, uv.u]\n" + 23641 " └─ LateralCrossJoin (estimated cost=100999.000 rows=125)\n" + 23642 " ├─ Table\n" + 23643 " │ └─ name: xy\n" + 23644 " └─ SubqueryAlias\n" + 23645 " ├─ name: uv\n" + 23646 " ├─ outerVisibility: false\n" + 23647 " ├─ isLateral: true\n" + 23648 " ├─ cacheable: false\n" + 23649 " └─ Filter\n" + 23650 " ├─ (xy.y = uv.u)\n" + 23651 " └─ Table\n" + 23652 " ├─ name: uv\n" + 23653 " └─ columns: [u v]\n" + 23654 "", 23655 ExpectedAnalysis: "Project\n" + 23656 " ├─ columns: [xy.x, uv.u]\n" + 23657 " └─ LateralCrossJoin (estimated cost=100999.000 rows=125) (actual rows=4 loops=1)\n" + 23658 " ├─ Table\n" + 23659 " │ └─ name: xy\n" + 23660 " └─ SubqueryAlias\n" + 23661 " ├─ name: uv\n" + 23662 " ├─ outerVisibility: false\n" + 23663 " ├─ isLateral: true\n" + 23664 " ├─ cacheable: false\n" + 23665 " └─ Filter\n" + 23666 " ├─ (xy.y = uv.u)\n" + 23667 " └─ Table\n" + 23668 " ├─ name: uv\n" + 23669 " └─ columns: [u v]\n" + 23670 "", 23671 }, 23672 { 23673 Query: `select x from xy where x > 0 and x <= 2 order by x`, 23674 ExpectedPlan: "IndexedTableAccess(xy)\n" + 23675 " ├─ index: [xy.x]\n" + 23676 " ├─ static: [{(0, 2]}]\n" + 23677 " ├─ colSet: (1,2)\n" + 23678 " ├─ tableId: 1\n" + 23679 " └─ Table\n" + 23680 " ├─ name: xy\n" + 23681 " └─ columns: [x]\n" + 23682 "", 23683 ExpectedEstimates: "IndexedTableAccess(xy)\n" + 23684 " ├─ index: [xy.x]\n" + 23685 " ├─ filters: [{(0, 2]}]\n" + 23686 " └─ columns: [x]\n" + 23687 "", 23688 ExpectedAnalysis: "IndexedTableAccess(xy)\n" + 23689 " ├─ index: [xy.x]\n" + 23690 " ├─ filters: [{(0, 2]}]\n" + 23691 " └─ columns: [x]\n" + 23692 "", 23693 }, 23694 { 23695 Query: `select * from xy where y < 1 or y > 2 order by y`, 23696 ExpectedPlan: "IndexedTableAccess(xy)\n" + 23697 " ├─ index: [xy.y]\n" + 23698 " ├─ static: [{(NULL, 1)}, {(2, ∞)}]\n" + 23699 " ├─ colSet: (1,2)\n" + 23700 " ├─ tableId: 1\n" + 23701 " └─ Table\n" + 23702 " ├─ name: xy\n" + 23703 " └─ columns: [x y]\n" + 23704 "", 23705 ExpectedEstimates: "IndexedTableAccess(xy)\n" + 23706 " ├─ index: [xy.y]\n" + 23707 " ├─ filters: [{(NULL, 1)}, {(2, ∞)}]\n" + 23708 " └─ columns: [x y]\n" + 23709 "", 23710 ExpectedAnalysis: "IndexedTableAccess(xy)\n" + 23711 " ├─ index: [xy.y]\n" + 23712 " ├─ filters: [{(NULL, 1)}, {(2, ∞)}]\n" + 23713 " └─ columns: [x y]\n" + 23714 "", 23715 }, 23716 { 23717 Query: `select * from xy where y < 1 or y > 2 order by y desc`, 23718 ExpectedPlan: "IndexedTableAccess(xy)\n" + 23719 " ├─ index: [xy.y]\n" + 23720 " ├─ static: [{(2, ∞)}, {(NULL, 1)}]\n" + 23721 " ├─ reverse: true\n" + 23722 " ├─ colSet: (1,2)\n" + 23723 " ├─ tableId: 1\n" + 23724 " └─ Table\n" + 23725 " ├─ name: xy\n" + 23726 " └─ columns: [x y]\n" + 23727 "", 23728 ExpectedEstimates: "IndexedTableAccess(xy)\n" + 23729 " ├─ index: [xy.y]\n" + 23730 " ├─ filters: [{(2, ∞)}, {(NULL, 1)}]\n" + 23731 " ├─ columns: [x y]\n" + 23732 " └─ reverse: true\n" + 23733 "", 23734 ExpectedAnalysis: "IndexedTableAccess(xy)\n" + 23735 " ├─ index: [xy.y]\n" + 23736 " ├─ filters: [{(2, ∞)}, {(NULL, 1)}]\n" + 23737 " ├─ columns: [x y]\n" + 23738 " └─ reverse: true\n" + 23739 "", 23740 }, 23741 { 23742 Query: `select * from xy where x in (3, 0, 1) order by x`, 23743 ExpectedPlan: "Filter\n" + 23744 " ├─ HashIn\n" + 23745 " │ ├─ xy.x:0!null\n" + 23746 " │ └─ TUPLE(3 (tinyint), 0 (tinyint), 1 (tinyint))\n" + 23747 " └─ IndexedTableAccess(xy)\n" + 23748 " ├─ index: [xy.x]\n" + 23749 " ├─ static: [{[0, 0]}, {[1, 1]}, {[3, 3]}]\n" + 23750 " ├─ colSet: (1,2)\n" + 23751 " ├─ tableId: 1\n" + 23752 " └─ Table\n" + 23753 " ├─ name: xy\n" + 23754 " └─ columns: [x y]\n" + 23755 "", 23756 ExpectedEstimates: "Filter\n" + 23757 " ├─ (xy.x HASH IN (3, 0, 1))\n" + 23758 " └─ IndexedTableAccess(xy)\n" + 23759 " ├─ index: [xy.x]\n" + 23760 " ├─ filters: [{[0, 0]}, {[1, 1]}, {[3, 3]}]\n" + 23761 " └─ columns: [x y]\n" + 23762 "", 23763 ExpectedAnalysis: "Filter\n" + 23764 " ├─ (xy.x HASH IN (3, 0, 1))\n" + 23765 " └─ IndexedTableAccess(xy)\n" + 23766 " ├─ index: [xy.x]\n" + 23767 " ├─ filters: [{[0, 0]}, {[1, 1]}, {[3, 3]}]\n" + 23768 " └─ columns: [x y]\n" + 23769 "", 23770 }, 23771 { 23772 Query: `select * from xy where x in (3, 0, 1) order by x desc`, 23773 ExpectedPlan: "Filter\n" + 23774 " ├─ HashIn\n" + 23775 " │ ├─ xy.x:0!null\n" + 23776 " │ └─ TUPLE(3 (tinyint), 0 (tinyint), 1 (tinyint))\n" + 23777 " └─ IndexedTableAccess(xy)\n" + 23778 " ├─ index: [xy.x]\n" + 23779 " ├─ static: [{[3, 3]}, {[1, 1]}, {[0, 0]}]\n" + 23780 " ├─ reverse: true\n" + 23781 " ├─ colSet: (1,2)\n" + 23782 " ├─ tableId: 1\n" + 23783 " └─ Table\n" + 23784 " ├─ name: xy\n" + 23785 " └─ columns: [x y]\n" + 23786 "", 23787 ExpectedEstimates: "Filter\n" + 23788 " ├─ (xy.x HASH IN (3, 0, 1))\n" + 23789 " └─ IndexedTableAccess(xy)\n" + 23790 " ├─ index: [xy.x]\n" + 23791 " ├─ filters: [{[3, 3]}, {[1, 1]}, {[0, 0]}]\n" + 23792 " ├─ columns: [x y]\n" + 23793 " └─ reverse: true\n" + 23794 "", 23795 ExpectedAnalysis: "Filter\n" + 23796 " ├─ (xy.x HASH IN (3, 0, 1))\n" + 23797 " └─ IndexedTableAccess(xy)\n" + 23798 " ├─ index: [xy.x]\n" + 23799 " ├─ filters: [{[3, 3]}, {[1, 1]}, {[0, 0]}]\n" + 23800 " ├─ columns: [x y]\n" + 23801 " └─ reverse: true\n" + 23802 "", 23803 }, 23804 { 23805 Query: `select * from xy where y in (3, 0, 1) order by y`, 23806 ExpectedPlan: "Filter\n" + 23807 " ├─ HashIn\n" + 23808 " │ ├─ xy.y:1\n" + 23809 " │ └─ TUPLE(3 (tinyint), 0 (tinyint), 1 (tinyint))\n" + 23810 " └─ IndexedTableAccess(xy)\n" + 23811 " ├─ index: [xy.y]\n" + 23812 " ├─ static: [{[0, 0]}, {[1, 1]}, {[3, 3]}]\n" + 23813 " ├─ colSet: (1,2)\n" + 23814 " ├─ tableId: 1\n" + 23815 " └─ Table\n" + 23816 " ├─ name: xy\n" + 23817 " └─ columns: [x y]\n" + 23818 "", 23819 ExpectedEstimates: "Filter\n" + 23820 " ├─ (xy.y HASH IN (3, 0, 1))\n" + 23821 " └─ IndexedTableAccess(xy)\n" + 23822 " ├─ index: [xy.y]\n" + 23823 " ├─ filters: [{[0, 0]}, {[1, 1]}, {[3, 3]}]\n" + 23824 " └─ columns: [x y]\n" + 23825 "", 23826 ExpectedAnalysis: "Filter\n" + 23827 " ├─ (xy.y HASH IN (3, 0, 1))\n" + 23828 " └─ IndexedTableAccess(xy)\n" + 23829 " ├─ index: [xy.y]\n" + 23830 " ├─ filters: [{[0, 0]}, {[1, 1]}, {[3, 3]}]\n" + 23831 " └─ columns: [x y]\n" + 23832 "", 23833 }, 23834 { 23835 Query: `select * from xy where y in (3, 0, 1) order by y desc`, 23836 ExpectedPlan: "Filter\n" + 23837 " ├─ HashIn\n" + 23838 " │ ├─ xy.y:1\n" + 23839 " │ └─ TUPLE(3 (tinyint), 0 (tinyint), 1 (tinyint))\n" + 23840 " └─ IndexedTableAccess(xy)\n" + 23841 " ├─ index: [xy.y]\n" + 23842 " ├─ static: [{[3, 3]}, {[1, 1]}, {[0, 0]}]\n" + 23843 " ├─ reverse: true\n" + 23844 " ├─ colSet: (1,2)\n" + 23845 " ├─ tableId: 1\n" + 23846 " └─ Table\n" + 23847 " ├─ name: xy\n" + 23848 " └─ columns: [x y]\n" + 23849 "", 23850 ExpectedEstimates: "Filter\n" + 23851 " ├─ (xy.y HASH IN (3, 0, 1))\n" + 23852 " └─ IndexedTableAccess(xy)\n" + 23853 " ├─ index: [xy.y]\n" + 23854 " ├─ filters: [{[3, 3]}, {[1, 1]}, {[0, 0]}]\n" + 23855 " ├─ columns: [x y]\n" + 23856 " └─ reverse: true\n" + 23857 "", 23858 ExpectedAnalysis: "Filter\n" + 23859 " ├─ (xy.y HASH IN (3, 0, 1))\n" + 23860 " └─ IndexedTableAccess(xy)\n" + 23861 " ├─ index: [xy.y]\n" + 23862 " ├─ filters: [{[3, 3]}, {[1, 1]}, {[0, 0]}]\n" + 23863 " ├─ columns: [x y]\n" + 23864 " └─ reverse: true\n" + 23865 "", 23866 }, 23867 { 23868 Query: `select * from xy_hasnull_idx order by y`, 23869 ExpectedPlan: "IndexedTableAccess(xy_hasnull_idx)\n" + 23870 " ├─ index: [xy_hasnull_idx.y]\n" + 23871 " ├─ static: [{[NULL, ∞)}]\n" + 23872 " ├─ colSet: (1,2)\n" + 23873 " ├─ tableId: 1\n" + 23874 " └─ Table\n" + 23875 " ├─ name: xy_hasnull_idx\n" + 23876 " └─ columns: [x y]\n" + 23877 "", 23878 ExpectedEstimates: "IndexedTableAccess(xy_hasnull_idx)\n" + 23879 " ├─ index: [xy_hasnull_idx.y]\n" + 23880 " ├─ filters: [{[NULL, ∞)}]\n" + 23881 " └─ columns: [x y]\n" + 23882 "", 23883 ExpectedAnalysis: "IndexedTableAccess(xy_hasnull_idx)\n" + 23884 " ├─ index: [xy_hasnull_idx.y]\n" + 23885 " ├─ filters: [{[NULL, ∞)}]\n" + 23886 " └─ columns: [x y]\n" + 23887 "", 23888 }, 23889 { 23890 Query: `select * from xy_hasnull_idx order by y desc`, 23891 ExpectedPlan: "IndexedTableAccess(xy_hasnull_idx)\n" + 23892 " ├─ index: [xy_hasnull_idx.y]\n" + 23893 " ├─ static: [{[NULL, ∞)}]\n" + 23894 " ├─ reverse: true\n" + 23895 " ├─ colSet: (1,2)\n" + 23896 " ├─ tableId: 1\n" + 23897 " └─ Table\n" + 23898 " ├─ name: xy_hasnull_idx\n" + 23899 " └─ columns: [x y]\n" + 23900 "", 23901 ExpectedEstimates: "IndexedTableAccess(xy_hasnull_idx)\n" + 23902 " ├─ index: [xy_hasnull_idx.y]\n" + 23903 " ├─ filters: [{[NULL, ∞)}]\n" + 23904 " ├─ columns: [x y]\n" + 23905 " └─ reverse: true\n" + 23906 "", 23907 ExpectedAnalysis: "IndexedTableAccess(xy_hasnull_idx)\n" + 23908 " ├─ index: [xy_hasnull_idx.y]\n" + 23909 " ├─ filters: [{[NULL, ∞)}]\n" + 23910 " ├─ columns: [x y]\n" + 23911 " └─ reverse: true\n" + 23912 "", 23913 }, 23914 { 23915 Query: `select * from xy_hasnull_idx where y < 1 or y > 1 order by y desc`, 23916 ExpectedPlan: "IndexedTableAccess(xy_hasnull_idx)\n" + 23917 " ├─ index: [xy_hasnull_idx.y]\n" + 23918 " ├─ static: [{(1, ∞)}, {(NULL, 1)}]\n" + 23919 " ├─ reverse: true\n" + 23920 " ├─ colSet: (1,2)\n" + 23921 " ├─ tableId: 1\n" + 23922 " └─ Table\n" + 23923 " ├─ name: xy_hasnull_idx\n" + 23924 " └─ columns: [x y]\n" + 23925 "", 23926 ExpectedEstimates: "IndexedTableAccess(xy_hasnull_idx)\n" + 23927 " ├─ index: [xy_hasnull_idx.y]\n" + 23928 " ├─ filters: [{(1, ∞)}, {(NULL, 1)}]\n" + 23929 " ├─ columns: [x y]\n" + 23930 " └─ reverse: true\n" + 23931 "", 23932 ExpectedAnalysis: "IndexedTableAccess(xy_hasnull_idx)\n" + 23933 " ├─ index: [xy_hasnull_idx.y]\n" + 23934 " ├─ filters: [{(1, ∞)}, {(NULL, 1)}]\n" + 23935 " ├─ columns: [x y]\n" + 23936 " └─ reverse: true\n" + 23937 "", 23938 }, 23939 { 23940 Query: `select * from xy_hasnull_idx where y < 1 or y > 1 or y is null order by y desc`, 23941 ExpectedPlan: "IndexedTableAccess(xy_hasnull_idx)\n" + 23942 " ├─ index: [xy_hasnull_idx.y]\n" + 23943 " ├─ static: [{(1, ∞)}, {[NULL, 1)}]\n" + 23944 " ├─ reverse: true\n" + 23945 " ├─ colSet: (1,2)\n" + 23946 " ├─ tableId: 1\n" + 23947 " └─ Table\n" + 23948 " ├─ name: xy_hasnull_idx\n" + 23949 " └─ columns: [x y]\n" + 23950 "", 23951 ExpectedEstimates: "IndexedTableAccess(xy_hasnull_idx)\n" + 23952 " ├─ index: [xy_hasnull_idx.y]\n" + 23953 " ├─ filters: [{(1, ∞)}, {[NULL, 1)}]\n" + 23954 " ├─ columns: [x y]\n" + 23955 " └─ reverse: true\n" + 23956 "", 23957 ExpectedAnalysis: "IndexedTableAccess(xy_hasnull_idx)\n" + 23958 " ├─ index: [xy_hasnull_idx.y]\n" + 23959 " ├─ filters: [{(1, ∞)}, {[NULL, 1)}]\n" + 23960 " ├─ columns: [x y]\n" + 23961 " └─ reverse: true\n" + 23962 "", 23963 }, 23964 { 23965 Query: `select * from xy_hasnull_idx where y in (0, 2) or y is null order by y`, 23966 ExpectedPlan: "Filter\n" + 23967 " ├─ Or\n" + 23968 " │ ├─ HashIn\n" + 23969 " │ │ ├─ xy_hasnull_idx.y:1\n" + 23970 " │ │ └─ TUPLE(0 (tinyint), 2 (tinyint))\n" + 23971 " │ └─ xy_hasnull_idx.y:1 IS NULL\n" + 23972 " └─ IndexedTableAccess(xy_hasnull_idx)\n" + 23973 " ├─ index: [xy_hasnull_idx.y]\n" + 23974 " ├─ static: [{[NULL, NULL]}, {[0, 0]}, {[2, 2]}]\n" + 23975 " ├─ colSet: (1,2)\n" + 23976 " ├─ tableId: 1\n" + 23977 " └─ Table\n" + 23978 " ├─ name: xy_hasnull_idx\n" + 23979 " └─ columns: [x y]\n" + 23980 "", 23981 ExpectedEstimates: "Filter\n" + 23982 " ├─ ((xy_hasnull_idx.y HASH IN (0, 2)) OR xy_hasnull_idx.y IS NULL)\n" + 23983 " └─ IndexedTableAccess(xy_hasnull_idx)\n" + 23984 " ├─ index: [xy_hasnull_idx.y]\n" + 23985 " ├─ filters: [{[NULL, NULL]}, {[0, 0]}, {[2, 2]}]\n" + 23986 " └─ columns: [x y]\n" + 23987 "", 23988 ExpectedAnalysis: "Filter\n" + 23989 " ├─ ((xy_hasnull_idx.y HASH IN (0, 2)) OR xy_hasnull_idx.y IS NULL)\n" + 23990 " └─ IndexedTableAccess(xy_hasnull_idx)\n" + 23991 " ├─ index: [xy_hasnull_idx.y]\n" + 23992 " ├─ filters: [{[NULL, NULL]}, {[0, 0]}, {[2, 2]}]\n" + 23993 " └─ columns: [x y]\n" + 23994 "", 23995 }, 23996 { 23997 Query: `select x as xx, y as yy from xy_hasnull_idx order by yy desc`, 23998 ExpectedPlan: "Project\n" + 23999 " ├─ columns: [xy_hasnull_idx.x:0!null as xx, xy_hasnull_idx.y:1 as yy]\n" + 24000 " └─ Project\n" + 24001 " ├─ columns: [xy_hasnull_idx.x:0!null, xy_hasnull_idx.y:1, xy_hasnull_idx.x:0!null as xx, xy_hasnull_idx.y:1 as yy]\n" + 24002 " └─ IndexedTableAccess(xy_hasnull_idx)\n" + 24003 " ├─ index: [xy_hasnull_idx.y]\n" + 24004 " ├─ static: [{[NULL, ∞)}]\n" + 24005 " ├─ reverse: true\n" + 24006 " ├─ colSet: (1,2)\n" + 24007 " ├─ tableId: 1\n" + 24008 " └─ Table\n" + 24009 " ├─ name: xy_hasnull_idx\n" + 24010 " └─ columns: [x y]\n" + 24011 "", 24012 ExpectedEstimates: "Project\n" + 24013 " ├─ columns: [xy_hasnull_idx.x as xx, xy_hasnull_idx.y as yy]\n" + 24014 " └─ Project\n" + 24015 " ├─ columns: [xy_hasnull_idx.x, xy_hasnull_idx.y, xy_hasnull_idx.x as xx, xy_hasnull_idx.y as yy]\n" + 24016 " └─ IndexedTableAccess(xy_hasnull_idx)\n" + 24017 " ├─ index: [xy_hasnull_idx.y]\n" + 24018 " ├─ filters: [{[NULL, ∞)}]\n" + 24019 " ├─ columns: [x y]\n" + 24020 " └─ reverse: true\n" + 24021 "", 24022 ExpectedAnalysis: "Project\n" + 24023 " ├─ columns: [xy_hasnull_idx.x as xx, xy_hasnull_idx.y as yy]\n" + 24024 " └─ Project\n" + 24025 " ├─ columns: [xy_hasnull_idx.x, xy_hasnull_idx.y, xy_hasnull_idx.x as xx, xy_hasnull_idx.y as yy]\n" + 24026 " └─ IndexedTableAccess(xy_hasnull_idx)\n" + 24027 " ├─ index: [xy_hasnull_idx.y]\n" + 24028 " ├─ filters: [{[NULL, ∞)}]\n" + 24029 " ├─ columns: [x y]\n" + 24030 " └─ reverse: true\n" + 24031 "", 24032 }, 24033 { 24034 Query: `select x as xx, y as yy from xy_hasnull_idx order by YY desc`, 24035 ExpectedPlan: "Project\n" + 24036 " ├─ columns: [xy_hasnull_idx.x:0!null as xx, xy_hasnull_idx.y:1 as yy]\n" + 24037 " └─ Project\n" + 24038 " ├─ columns: [xy_hasnull_idx.x:0!null, xy_hasnull_idx.y:1, xy_hasnull_idx.x:0!null as xx, xy_hasnull_idx.y:1 as yy]\n" + 24039 " └─ IndexedTableAccess(xy_hasnull_idx)\n" + 24040 " ├─ index: [xy_hasnull_idx.y]\n" + 24041 " ├─ static: [{[NULL, ∞)}]\n" + 24042 " ├─ reverse: true\n" + 24043 " ├─ colSet: (1,2)\n" + 24044 " ├─ tableId: 1\n" + 24045 " └─ Table\n" + 24046 " ├─ name: xy_hasnull_idx\n" + 24047 " └─ columns: [x y]\n" + 24048 "", 24049 ExpectedEstimates: "Project\n" + 24050 " ├─ columns: [xy_hasnull_idx.x as xx, xy_hasnull_idx.y as yy]\n" + 24051 " └─ Project\n" + 24052 " ├─ columns: [xy_hasnull_idx.x, xy_hasnull_idx.y, xy_hasnull_idx.x as xx, xy_hasnull_idx.y as yy]\n" + 24053 " └─ IndexedTableAccess(xy_hasnull_idx)\n" + 24054 " ├─ index: [xy_hasnull_idx.y]\n" + 24055 " ├─ filters: [{[NULL, ∞)}]\n" + 24056 " ├─ columns: [x y]\n" + 24057 " └─ reverse: true\n" + 24058 "", 24059 ExpectedAnalysis: "Project\n" + 24060 " ├─ columns: [xy_hasnull_idx.x as xx, xy_hasnull_idx.y as yy]\n" + 24061 " └─ Project\n" + 24062 " ├─ columns: [xy_hasnull_idx.x, xy_hasnull_idx.y, xy_hasnull_idx.x as xx, xy_hasnull_idx.y as yy]\n" + 24063 " └─ IndexedTableAccess(xy_hasnull_idx)\n" + 24064 " ├─ index: [xy_hasnull_idx.y]\n" + 24065 " ├─ filters: [{[NULL, ∞)}]\n" + 24066 " ├─ columns: [x y]\n" + 24067 " └─ reverse: true\n" + 24068 "", 24069 }, 24070 { 24071 Query: `select * from xy_hasnull_idx order by Y desc`, 24072 ExpectedPlan: "IndexedTableAccess(xy_hasnull_idx)\n" + 24073 " ├─ index: [xy_hasnull_idx.y]\n" + 24074 " ├─ static: [{[NULL, ∞)}]\n" + 24075 " ├─ reverse: true\n" + 24076 " ├─ colSet: (1,2)\n" + 24077 " ├─ tableId: 1\n" + 24078 " └─ Table\n" + 24079 " ├─ name: xy_hasnull_idx\n" + 24080 " └─ columns: [x y]\n" + 24081 "", 24082 ExpectedEstimates: "IndexedTableAccess(xy_hasnull_idx)\n" + 24083 " ├─ index: [xy_hasnull_idx.y]\n" + 24084 " ├─ filters: [{[NULL, ∞)}]\n" + 24085 " ├─ columns: [x y]\n" + 24086 " └─ reverse: true\n" + 24087 "", 24088 ExpectedAnalysis: "IndexedTableAccess(xy_hasnull_idx)\n" + 24089 " ├─ index: [xy_hasnull_idx.y]\n" + 24090 " ├─ filters: [{[NULL, ∞)}]\n" + 24091 " ├─ columns: [x y]\n" + 24092 " └─ reverse: true\n" + 24093 "", 24094 }, 24095 { 24096 Query: `select max(x) from xy`, 24097 ExpectedPlan: "Limit(1)\n" + 24098 " └─ Project\n" + 24099 " ├─ columns: [xy.x:0!null as max(x)]\n" + 24100 " └─ IndexedTableAccess(xy)\n" + 24101 " ├─ index: [xy.x]\n" + 24102 " ├─ static: [{[NULL, ∞)}]\n" + 24103 " ├─ reverse: true\n" + 24104 " ├─ colSet: (1,2)\n" + 24105 " ├─ tableId: 1\n" + 24106 " └─ Table\n" + 24107 " ├─ name: xy\n" + 24108 " └─ columns: [x]\n" + 24109 "", 24110 ExpectedEstimates: "Limit(1)\n" + 24111 " └─ Project\n" + 24112 " ├─ columns: [xy.x as max(x)]\n" + 24113 " └─ IndexedTableAccess(xy)\n" + 24114 " ├─ index: [xy.x]\n" + 24115 " ├─ filters: [{[NULL, ∞)}]\n" + 24116 " ├─ columns: [x]\n" + 24117 " └─ reverse: true\n" + 24118 "", 24119 ExpectedAnalysis: "Limit(1)\n" + 24120 " └─ Project\n" + 24121 " ├─ columns: [xy.x as max(x)]\n" + 24122 " └─ IndexedTableAccess(xy)\n" + 24123 " ├─ index: [xy.x]\n" + 24124 " ├─ filters: [{[NULL, ∞)}]\n" + 24125 " ├─ columns: [x]\n" + 24126 " └─ reverse: true\n" + 24127 "", 24128 }, 24129 { 24130 Query: `select min(x) from xy`, 24131 ExpectedPlan: "Limit(1)\n" + 24132 " └─ Project\n" + 24133 " ├─ columns: [xy.x:0!null as min(x)]\n" + 24134 " └─ IndexedTableAccess(xy)\n" + 24135 " ├─ index: [xy.x]\n" + 24136 " ├─ static: [{[NULL, ∞)}]\n" + 24137 " ├─ colSet: (1,2)\n" + 24138 " ├─ tableId: 1\n" + 24139 " └─ Table\n" + 24140 " ├─ name: xy\n" + 24141 " └─ columns: [x]\n" + 24142 "", 24143 ExpectedEstimates: "Limit(1)\n" + 24144 " └─ Project\n" + 24145 " ├─ columns: [xy.x as min(x)]\n" + 24146 " └─ IndexedTableAccess(xy)\n" + 24147 " ├─ index: [xy.x]\n" + 24148 " ├─ filters: [{[NULL, ∞)}]\n" + 24149 " └─ columns: [x]\n" + 24150 "", 24151 ExpectedAnalysis: "Limit(1)\n" + 24152 " └─ Project\n" + 24153 " ├─ columns: [xy.x as min(x)]\n" + 24154 " └─ IndexedTableAccess(xy)\n" + 24155 " ├─ index: [xy.x]\n" + 24156 " ├─ filters: [{[NULL, ∞)}]\n" + 24157 " └─ columns: [x]\n" + 24158 "", 24159 }, 24160 { 24161 Query: `select max(y) from xy`, 24162 ExpectedPlan: "Project\n" + 24163 " ├─ columns: [max(xy.y):0!null as max(y)]\n" + 24164 " └─ GroupBy\n" + 24165 " ├─ select: MAX(xy.y:0)\n" + 24166 " ├─ group: \n" + 24167 " └─ ProcessTable\n" + 24168 " └─ Table\n" + 24169 " ├─ name: xy\n" + 24170 " └─ columns: [y]\n" + 24171 "", 24172 ExpectedEstimates: "Project\n" + 24173 " ├─ columns: [max(xy.y) as max(y)]\n" + 24174 " └─ GroupBy\n" + 24175 " ├─ SelectedExprs(MAX(xy.y))\n" + 24176 " ├─ Grouping()\n" + 24177 " └─ Table\n" + 24178 " ├─ name: xy\n" + 24179 " └─ columns: [y]\n" + 24180 "", 24181 ExpectedAnalysis: "Project\n" + 24182 " ├─ columns: [max(xy.y) as max(y)]\n" + 24183 " └─ GroupBy\n" + 24184 " ├─ SelectedExprs(MAX(xy.y))\n" + 24185 " ├─ Grouping()\n" + 24186 " └─ Table\n" + 24187 " ├─ name: xy\n" + 24188 " └─ columns: [y]\n" + 24189 "", 24190 }, 24191 { 24192 Query: `select max(x)+100 from xy`, 24193 ExpectedPlan: "Limit(1)\n" + 24194 " └─ Project\n" + 24195 " ├─ columns: [(xy.x:0!null + 100 (tinyint)) as max(x)+100]\n" + 24196 " └─ IndexedTableAccess(xy)\n" + 24197 " ├─ index: [xy.x]\n" + 24198 " ├─ static: [{[NULL, ∞)}]\n" + 24199 " ├─ reverse: true\n" + 24200 " ├─ colSet: (1,2)\n" + 24201 " ├─ tableId: 1\n" + 24202 " └─ Table\n" + 24203 " ├─ name: xy\n" + 24204 " └─ columns: [x]\n" + 24205 "", 24206 ExpectedEstimates: "Limit(1)\n" + 24207 " └─ Project\n" + 24208 " ├─ columns: [(xy.x + 100) as max(x)+100]\n" + 24209 " └─ IndexedTableAccess(xy)\n" + 24210 " ├─ index: [xy.x]\n" + 24211 " ├─ filters: [{[NULL, ∞)}]\n" + 24212 " ├─ columns: [x]\n" + 24213 " └─ reverse: true\n" + 24214 "", 24215 ExpectedAnalysis: "Limit(1)\n" + 24216 " └─ Project\n" + 24217 " ├─ columns: [(xy.x + 100) as max(x)+100]\n" + 24218 " └─ IndexedTableAccess(xy)\n" + 24219 " ├─ index: [xy.x]\n" + 24220 " ├─ filters: [{[NULL, ∞)}]\n" + 24221 " ├─ columns: [x]\n" + 24222 " └─ reverse: true\n" + 24223 "", 24224 }, 24225 { 24226 Query: `select max(x) as xx from xy`, 24227 ExpectedPlan: "Limit(1)\n" + 24228 " └─ Project\n" + 24229 " ├─ columns: [xy.x:0!null as xx]\n" + 24230 " └─ IndexedTableAccess(xy)\n" + 24231 " ├─ index: [xy.x]\n" + 24232 " ├─ static: [{[NULL, ∞)}]\n" + 24233 " ├─ reverse: true\n" + 24234 " ├─ colSet: (1,2)\n" + 24235 " ├─ tableId: 1\n" + 24236 " └─ Table\n" + 24237 " ├─ name: xy\n" + 24238 " └─ columns: [x]\n" + 24239 "", 24240 ExpectedEstimates: "Limit(1)\n" + 24241 " └─ Project\n" + 24242 " ├─ columns: [xy.x as xx]\n" + 24243 " └─ IndexedTableAccess(xy)\n" + 24244 " ├─ index: [xy.x]\n" + 24245 " ├─ filters: [{[NULL, ∞)}]\n" + 24246 " ├─ columns: [x]\n" + 24247 " └─ reverse: true\n" + 24248 "", 24249 ExpectedAnalysis: "Limit(1)\n" + 24250 " └─ Project\n" + 24251 " ├─ columns: [xy.x as xx]\n" + 24252 " └─ IndexedTableAccess(xy)\n" + 24253 " ├─ index: [xy.x]\n" + 24254 " ├─ filters: [{[NULL, ∞)}]\n" + 24255 " ├─ columns: [x]\n" + 24256 " └─ reverse: true\n" + 24257 "", 24258 }, 24259 { 24260 Query: `select 1, 2.0, '3', max(x) from xy`, 24261 ExpectedPlan: "Limit(1)\n" + 24262 " └─ Project\n" + 24263 " ├─ columns: [1 (tinyint), 2 (decimal(2,1)), 3 (longtext) as 3, xy.x:0!null as max(x)]\n" + 24264 " └─ IndexedTableAccess(xy)\n" + 24265 " ├─ index: [xy.x]\n" + 24266 " ├─ static: [{[NULL, ∞)}]\n" + 24267 " ├─ reverse: true\n" + 24268 " ├─ colSet: (1,2)\n" + 24269 " ├─ tableId: 1\n" + 24270 " └─ Table\n" + 24271 " ├─ name: xy\n" + 24272 " └─ columns: [x]\n" + 24273 "", 24274 ExpectedEstimates: "Limit(1)\n" + 24275 " └─ Project\n" + 24276 " ├─ columns: [1, 2.0, '3' as 3, xy.x as max(x)]\n" + 24277 " └─ IndexedTableAccess(xy)\n" + 24278 " ├─ index: [xy.x]\n" + 24279 " ├─ filters: [{[NULL, ∞)}]\n" + 24280 " ├─ columns: [x]\n" + 24281 " └─ reverse: true\n" + 24282 "", 24283 ExpectedAnalysis: "Limit(1)\n" + 24284 " └─ Project\n" + 24285 " ├─ columns: [1, 2.0, '3' as 3, xy.x as max(x)]\n" + 24286 " └─ IndexedTableAccess(xy)\n" + 24287 " ├─ index: [xy.x]\n" + 24288 " ├─ filters: [{[NULL, ∞)}]\n" + 24289 " ├─ columns: [x]\n" + 24290 " └─ reverse: true\n" + 24291 "", 24292 }, 24293 { 24294 Query: `select min(x) from xy where x > 0`, 24295 ExpectedPlan: "Limit(1)\n" + 24296 " └─ Project\n" + 24297 " ├─ columns: [xy.x:0!null as min(x)]\n" + 24298 " └─ IndexedTableAccess(xy)\n" + 24299 " ├─ index: [xy.x]\n" + 24300 " ├─ static: [{(0, ∞)}]\n" + 24301 " ├─ colSet: (1,2)\n" + 24302 " ├─ tableId: 1\n" + 24303 " └─ Table\n" + 24304 " ├─ name: xy\n" + 24305 " └─ columns: [x]\n" + 24306 "", 24307 ExpectedEstimates: "Limit(1)\n" + 24308 " └─ Project\n" + 24309 " ├─ columns: [xy.x as min(x)]\n" + 24310 " └─ IndexedTableAccess(xy)\n" + 24311 " ├─ index: [xy.x]\n" + 24312 " ├─ filters: [{(0, ∞)}]\n" + 24313 " └─ columns: [x]\n" + 24314 "", 24315 ExpectedAnalysis: "Limit(1)\n" + 24316 " └─ Project\n" + 24317 " ├─ columns: [xy.x as min(x)]\n" + 24318 " └─ IndexedTableAccess(xy)\n" + 24319 " ├─ index: [xy.x]\n" + 24320 " ├─ filters: [{(0, ∞)}]\n" + 24321 " └─ columns: [x]\n" + 24322 "", 24323 }, 24324 { 24325 Query: `select max(x) from xy where x < 3`, 24326 ExpectedPlan: "Limit(1)\n" + 24327 " └─ Project\n" + 24328 " ├─ columns: [xy.x:0!null as max(x)]\n" + 24329 " └─ IndexedTableAccess(xy)\n" + 24330 " ├─ index: [xy.x]\n" + 24331 " ├─ static: [{(NULL, 3)}]\n" + 24332 " ├─ reverse: true\n" + 24333 " ├─ colSet: (1,2)\n" + 24334 " ├─ tableId: 1\n" + 24335 " └─ Table\n" + 24336 " ├─ name: xy\n" + 24337 " └─ columns: [x]\n" + 24338 "", 24339 ExpectedEstimates: "Limit(1)\n" + 24340 " └─ Project\n" + 24341 " ├─ columns: [xy.x as max(x)]\n" + 24342 " └─ IndexedTableAccess(xy)\n" + 24343 " ├─ index: [xy.x]\n" + 24344 " ├─ filters: [{(NULL, 3)}]\n" + 24345 " ├─ columns: [x]\n" + 24346 " └─ reverse: true\n" + 24347 "", 24348 ExpectedAnalysis: "Limit(1)\n" + 24349 " └─ Project\n" + 24350 " ├─ columns: [xy.x as max(x)]\n" + 24351 " └─ IndexedTableAccess(xy)\n" + 24352 " ├─ index: [xy.x]\n" + 24353 " ├─ filters: [{(NULL, 3)}]\n" + 24354 " ├─ columns: [x]\n" + 24355 " └─ reverse: true\n" + 24356 "", 24357 }, 24358 { 24359 Query: `select min(x) from xy where y > 0`, 24360 ExpectedPlan: "Project\n" + 24361 " ├─ columns: [min(xy.x):0!null as min(x)]\n" + 24362 " └─ GroupBy\n" + 24363 " ├─ select: MIN(xy.x:0!null)\n" + 24364 " ├─ group: \n" + 24365 " └─ IndexedTableAccess(xy)\n" + 24366 " ├─ index: [xy.y]\n" + 24367 " ├─ static: [{(0, ∞)}]\n" + 24368 " ├─ colSet: (1,2)\n" + 24369 " ├─ tableId: 1\n" + 24370 " └─ Table\n" + 24371 " ├─ name: xy\n" + 24372 " └─ columns: [x y]\n" + 24373 "", 24374 ExpectedEstimates: "Project\n" + 24375 " ├─ columns: [min(xy.x) as min(x)]\n" + 24376 " └─ GroupBy\n" + 24377 " ├─ SelectedExprs(MIN(xy.x))\n" + 24378 " ├─ Grouping()\n" + 24379 " └─ IndexedTableAccess(xy)\n" + 24380 " ├─ index: [xy.y]\n" + 24381 " ├─ filters: [{(0, ∞)}]\n" + 24382 " └─ columns: [x y]\n" + 24383 "", 24384 ExpectedAnalysis: "Project\n" + 24385 " ├─ columns: [min(xy.x) as min(x)]\n" + 24386 " └─ GroupBy\n" + 24387 " ├─ SelectedExprs(MIN(xy.x))\n" + 24388 " ├─ Grouping()\n" + 24389 " └─ IndexedTableAccess(xy)\n" + 24390 " ├─ index: [xy.y]\n" + 24391 " ├─ filters: [{(0, ∞)}]\n" + 24392 " └─ columns: [x y]\n" + 24393 "", 24394 }, 24395 { 24396 Query: `select max(x) from xy where y < 3`, 24397 ExpectedPlan: "Project\n" + 24398 " ├─ columns: [max(xy.x):0!null as max(x)]\n" + 24399 " └─ GroupBy\n" + 24400 " ├─ select: MAX(xy.x:0!null)\n" + 24401 " ├─ group: \n" + 24402 " └─ IndexedTableAccess(xy)\n" + 24403 " ├─ index: [xy.y]\n" + 24404 " ├─ static: [{(NULL, 3)}]\n" + 24405 " ├─ colSet: (1,2)\n" + 24406 " ├─ tableId: 1\n" + 24407 " └─ Table\n" + 24408 " ├─ name: xy\n" + 24409 " └─ columns: [x y]\n" + 24410 "", 24411 ExpectedEstimates: "Project\n" + 24412 " ├─ columns: [max(xy.x) as max(x)]\n" + 24413 " └─ GroupBy\n" + 24414 " ├─ SelectedExprs(MAX(xy.x))\n" + 24415 " ├─ Grouping()\n" + 24416 " └─ IndexedTableAccess(xy)\n" + 24417 " ├─ index: [xy.y]\n" + 24418 " ├─ filters: [{(NULL, 3)}]\n" + 24419 " └─ columns: [x y]\n" + 24420 "", 24421 ExpectedAnalysis: "Project\n" + 24422 " ├─ columns: [max(xy.x) as max(x)]\n" + 24423 " └─ GroupBy\n" + 24424 " ├─ SelectedExprs(MAX(xy.x))\n" + 24425 " ├─ Grouping()\n" + 24426 " └─ IndexedTableAccess(xy)\n" + 24427 " ├─ index: [xy.y]\n" + 24428 " ├─ filters: [{(NULL, 3)}]\n" + 24429 " └─ columns: [x y]\n" + 24430 "", 24431 }, 24432 { 24433 Query: `select * from (select max(x) from xy) sq`, 24434 ExpectedPlan: "SubqueryAlias\n" + 24435 " ├─ name: sq\n" + 24436 " ├─ outerVisibility: false\n" + 24437 " ├─ isLateral: false\n" + 24438 " ├─ cacheable: true\n" + 24439 " ├─ colSet: (4)\n" + 24440 " ├─ tableId: 2\n" + 24441 " └─ Limit(1)\n" + 24442 " └─ Project\n" + 24443 " ├─ columns: [xy.x:0!null as max(x)]\n" + 24444 " └─ IndexedTableAccess(xy)\n" + 24445 " ├─ index: [xy.x]\n" + 24446 " ├─ static: [{[NULL, ∞)}]\n" + 24447 " ├─ reverse: true\n" + 24448 " ├─ colSet: (1,2)\n" + 24449 " ├─ tableId: 1\n" + 24450 " └─ Table\n" + 24451 " ├─ name: xy\n" + 24452 " └─ columns: [x]\n" + 24453 "", 24454 ExpectedEstimates: "SubqueryAlias\n" + 24455 " ├─ name: sq\n" + 24456 " ├─ outerVisibility: false\n" + 24457 " ├─ isLateral: false\n" + 24458 " ├─ cacheable: true\n" + 24459 " └─ Limit(1)\n" + 24460 " └─ Project\n" + 24461 " ├─ columns: [xy.x as max(x)]\n" + 24462 " └─ IndexedTableAccess(xy)\n" + 24463 " ├─ index: [xy.x]\n" + 24464 " ├─ filters: [{[NULL, ∞)}]\n" + 24465 " ├─ columns: [x]\n" + 24466 " └─ reverse: true\n" + 24467 "", 24468 ExpectedAnalysis: "SubqueryAlias\n" + 24469 " ├─ name: sq\n" + 24470 " ├─ outerVisibility: false\n" + 24471 " ├─ isLateral: false\n" + 24472 " ├─ cacheable: true\n" + 24473 " └─ Limit(1)\n" + 24474 " └─ Project\n" + 24475 " ├─ columns: [xy.x as max(x)]\n" + 24476 " └─ IndexedTableAccess(xy)\n" + 24477 " ├─ index: [xy.x]\n" + 24478 " ├─ filters: [{[NULL, ∞)}]\n" + 24479 " ├─ columns: [x]\n" + 24480 " └─ reverse: true\n" + 24481 "", 24482 }, 24483 { 24484 Query: `with cte(i) as (select max(x) from xy) select i + 100 from cte`, 24485 ExpectedPlan: "Project\n" + 24486 " ├─ columns: [(cte.i:0!null + 100 (tinyint)) as i + 100]\n" + 24487 " └─ SubqueryAlias\n" + 24488 " ├─ name: cte\n" + 24489 " ├─ outerVisibility: false\n" + 24490 " ├─ isLateral: false\n" + 24491 " ├─ cacheable: true\n" + 24492 " ├─ colSet: (4)\n" + 24493 " ├─ tableId: 2\n" + 24494 " └─ Limit(1)\n" + 24495 " └─ Project\n" + 24496 " ├─ columns: [xy.x:0!null as max(x)]\n" + 24497 " └─ IndexedTableAccess(xy)\n" + 24498 " ├─ index: [xy.x]\n" + 24499 " ├─ static: [{[NULL, ∞)}]\n" + 24500 " ├─ reverse: true\n" + 24501 " ├─ colSet: (1,2)\n" + 24502 " ├─ tableId: 1\n" + 24503 " └─ Table\n" + 24504 " ├─ name: xy\n" + 24505 " └─ columns: [x]\n" + 24506 "", 24507 ExpectedEstimates: "Project\n" + 24508 " ├─ columns: [(cte.i + 100) as i + 100]\n" + 24509 " └─ SubqueryAlias\n" + 24510 " ├─ name: cte\n" + 24511 " ├─ outerVisibility: false\n" + 24512 " ├─ isLateral: false\n" + 24513 " ├─ cacheable: true\n" + 24514 " └─ Limit(1)\n" + 24515 " └─ Project\n" + 24516 " ├─ columns: [xy.x as max(x)]\n" + 24517 " └─ IndexedTableAccess(xy)\n" + 24518 " ├─ index: [xy.x]\n" + 24519 " ├─ filters: [{[NULL, ∞)}]\n" + 24520 " ├─ columns: [x]\n" + 24521 " └─ reverse: true\n" + 24522 "", 24523 ExpectedAnalysis: "Project\n" + 24524 " ├─ columns: [(cte.i + 100) as i + 100]\n" + 24525 " └─ SubqueryAlias\n" + 24526 " ├─ name: cte\n" + 24527 " ├─ outerVisibility: false\n" + 24528 " ├─ isLateral: false\n" + 24529 " ├─ cacheable: true\n" + 24530 " └─ Limit(1)\n" + 24531 " └─ Project\n" + 24532 " ├─ columns: [xy.x as max(x)]\n" + 24533 " └─ IndexedTableAccess(xy)\n" + 24534 " ├─ index: [xy.x]\n" + 24535 " ├─ filters: [{[NULL, ∞)}]\n" + 24536 " ├─ columns: [x]\n" + 24537 " └─ reverse: true\n" + 24538 "", 24539 }, 24540 { 24541 Query: `with cte(i) as (select x from xy) select max(i) from cte`, 24542 ExpectedPlan: "Project\n" + 24543 " ├─ columns: [max(cte.i):0!null as max(i)]\n" + 24544 " └─ GroupBy\n" + 24545 " ├─ select: MAX(cte.i:0!null)\n" + 24546 " ├─ group: \n" + 24547 " └─ SubqueryAlias\n" + 24548 " ├─ name: cte\n" + 24549 " ├─ outerVisibility: false\n" + 24550 " ├─ isLateral: false\n" + 24551 " ├─ cacheable: true\n" + 24552 " ├─ colSet: (3)\n" + 24553 " ├─ tableId: 2\n" + 24554 " └─ Table\n" + 24555 " ├─ name: xy\n" + 24556 " ├─ columns: [x]\n" + 24557 " ├─ colSet: (1,2)\n" + 24558 " └─ tableId: 1\n" + 24559 "", 24560 ExpectedEstimates: "Project\n" + 24561 " ├─ columns: [max(cte.i) as max(i)]\n" + 24562 " └─ GroupBy\n" + 24563 " ├─ SelectedExprs(MAX(cte.i))\n" + 24564 " ├─ Grouping()\n" + 24565 " └─ SubqueryAlias\n" + 24566 " ├─ name: cte\n" + 24567 " ├─ outerVisibility: false\n" + 24568 " ├─ isLateral: false\n" + 24569 " ├─ cacheable: true\n" + 24570 " └─ Table\n" + 24571 " ├─ name: xy\n" + 24572 " └─ columns: [x]\n" + 24573 "", 24574 ExpectedAnalysis: "Project\n" + 24575 " ├─ columns: [max(cte.i) as max(i)]\n" + 24576 " └─ GroupBy\n" + 24577 " ├─ SelectedExprs(MAX(cte.i))\n" + 24578 " ├─ Grouping()\n" + 24579 " └─ SubqueryAlias\n" + 24580 " ├─ name: cte\n" + 24581 " ├─ outerVisibility: false\n" + 24582 " ├─ isLateral: false\n" + 24583 " ├─ cacheable: true\n" + 24584 " └─ Table\n" + 24585 " ├─ name: xy\n" + 24586 " └─ columns: [x]\n" + 24587 "", 24588 }, 24589 { 24590 Query: `select max(x) from xy group by y`, 24591 ExpectedPlan: "Project\n" + 24592 " ├─ columns: [max(xy.x):0!null as max(x)]\n" + 24593 " └─ GroupBy\n" + 24594 " ├─ select: MAX(xy.x:0!null)\n" + 24595 " ├─ group: xy.y:1\n" + 24596 " └─ ProcessTable\n" + 24597 " └─ Table\n" + 24598 " ├─ name: xy\n" + 24599 " └─ columns: [x y]\n" + 24600 "", 24601 ExpectedEstimates: "Project\n" + 24602 " ├─ columns: [max(xy.x) as max(x)]\n" + 24603 " └─ GroupBy\n" + 24604 " ├─ SelectedExprs(MAX(xy.x))\n" + 24605 " ├─ Grouping(xy.y)\n" + 24606 " └─ Table\n" + 24607 " ├─ name: xy\n" + 24608 " └─ columns: [x y]\n" + 24609 "", 24610 ExpectedAnalysis: "Project\n" + 24611 " ├─ columns: [max(xy.x) as max(x)]\n" + 24612 " └─ GroupBy\n" + 24613 " ├─ SelectedExprs(MAX(xy.x))\n" + 24614 " ├─ Grouping(xy.y)\n" + 24615 " └─ Table\n" + 24616 " ├─ name: xy\n" + 24617 " └─ columns: [x y]\n" + 24618 "", 24619 }, 24620 { 24621 Query: `select max(x) from xy join uv where x = u`, 24622 ExpectedPlan: "Project\n" + 24623 " ├─ columns: [max(xy.x):0!null as max(x)]\n" + 24624 " └─ GroupBy\n" + 24625 " ├─ select: MAX(xy.x:1!null)\n" + 24626 " ├─ group: \n" + 24627 " └─ LookupJoin\n" + 24628 " ├─ ProcessTable\n" + 24629 " │ └─ Table\n" + 24630 " │ ├─ name: uv\n" + 24631 " │ └─ columns: [u]\n" + 24632 " └─ IndexedTableAccess(xy)\n" + 24633 " ├─ index: [xy.x]\n" + 24634 " ├─ keys: [uv.u:0!null]\n" + 24635 " ├─ colSet: (1,2)\n" + 24636 " ├─ tableId: 1\n" + 24637 " └─ Table\n" + 24638 " ├─ name: xy\n" + 24639 " └─ columns: [x]\n" + 24640 "", 24641 ExpectedEstimates: "Project\n" + 24642 " ├─ columns: [max(xy.x) as max(x)]\n" + 24643 " └─ GroupBy\n" + 24644 " ├─ SelectedExprs(MAX(xy.x))\n" + 24645 " ├─ Grouping()\n" + 24646 " └─ LookupJoin\n" + 24647 " ├─ Table\n" + 24648 " │ ├─ name: uv\n" + 24649 " │ └─ columns: [u]\n" + 24650 " └─ IndexedTableAccess(xy)\n" + 24651 " ├─ index: [xy.x]\n" + 24652 " ├─ columns: [x]\n" + 24653 " └─ keys: uv.u\n" + 24654 "", 24655 ExpectedAnalysis: "Project\n" + 24656 " ├─ columns: [max(xy.x) as max(x)]\n" + 24657 " └─ GroupBy\n" + 24658 " ├─ SelectedExprs(MAX(xy.x))\n" + 24659 " ├─ Grouping()\n" + 24660 " └─ LookupJoin\n" + 24661 " ├─ Table\n" + 24662 " │ ├─ name: uv\n" + 24663 " │ └─ columns: [u]\n" + 24664 " └─ IndexedTableAccess(xy)\n" + 24665 " ├─ index: [xy.x]\n" + 24666 " ├─ columns: [x]\n" + 24667 " └─ keys: uv.u\n" + 24668 "", 24669 }, 24670 { 24671 Query: ` 24672 select * from mytable, 24673 lateral ( 24674 with recursive cte(a) as ( 24675 select y from xy 24676 union 24677 select x from cte 24678 join 24679 xy 24680 on x = a 24681 ) 24682 select * from cte 24683 ) sqa 24684 where i = a 24685 order by i;`, 24686 ExpectedPlan: "Sort(mytable.i:0!null ASC nullsFirst)\n" + 24687 " └─ Filter\n" + 24688 " ├─ Eq\n" + 24689 " │ ├─ mytable.i:0!null\n" + 24690 " │ └─ sqa.a:2\n" + 24691 " └─ LateralCrossJoin\n" + 24692 " ├─ ProcessTable\n" + 24693 " │ └─ Table\n" + 24694 " │ ├─ name: mytable\n" + 24695 " │ └─ columns: [i s]\n" + 24696 " └─ SubqueryAlias\n" + 24697 " ├─ name: sqa\n" + 24698 " ├─ outerVisibility: false\n" + 24699 " ├─ isLateral: true\n" + 24700 " ├─ cacheable: true\n" + 24701 " ├─ colSet: (8)\n" + 24702 " ├─ tableId: 7\n" + 24703 " └─ SubqueryAlias\n" + 24704 " ├─ name: cte\n" + 24705 " ├─ outerVisibility: false\n" + 24706 " ├─ isLateral: true\n" + 24707 " ├─ cacheable: true\n" + 24708 " ├─ colSet: (5)\n" + 24709 " ├─ tableId: 3\n" + 24710 " └─ RecursiveCTE\n" + 24711 " └─ Union distinct\n" + 24712 " ├─ Table\n" + 24713 " │ ├─ name: xy\n" + 24714 " │ ├─ columns: [y]\n" + 24715 " │ ├─ colSet: (3,4)\n" + 24716 " │ └─ tableId: 2\n" + 24717 " └─ Project\n" + 24718 " ├─ columns: [xy.x:3!null]\n" + 24719 " └─ LookupJoin\n" + 24720 " ├─ RecursiveTable(cte)\n" + 24721 " └─ IndexedTableAccess(xy)\n" + 24722 " ├─ index: [xy.x]\n" + 24723 " ├─ keys: [cte.a:2]\n" + 24724 " ├─ colSet: (6,7)\n" + 24725 " ├─ tableId: 5\n" + 24726 " └─ Table\n" + 24727 " ├─ name: xy\n" + 24728 " └─ columns: [x]\n" + 24729 "", 24730 ExpectedEstimates: "Sort(mytable.i ASC)\n" + 24731 " └─ Filter\n" + 24732 " ├─ (mytable.i = sqa.a)\n" + 24733 " └─ LateralCrossJoin\n" + 24734 " ├─ Table\n" + 24735 " │ └─ name: mytable\n" + 24736 " └─ SubqueryAlias\n" + 24737 " ├─ name: sqa\n" + 24738 " ├─ outerVisibility: false\n" + 24739 " ├─ isLateral: true\n" + 24740 " ├─ cacheable: true\n" + 24741 " └─ SubqueryAlias\n" + 24742 " ├─ name: cte\n" + 24743 " ├─ outerVisibility: false\n" + 24744 " ├─ isLateral: true\n" + 24745 " ├─ cacheable: true\n" + 24746 " └─ RecursiveCTE\n" + 24747 " └─ Union distinct\n" + 24748 " ├─ Table\n" + 24749 " │ ├─ name: xy\n" + 24750 " │ └─ columns: [y]\n" + 24751 " └─ Project\n" + 24752 " ├─ columns: [xy.x]\n" + 24753 " └─ LookupJoin\n" + 24754 " ├─ RecursiveTable(cte)\n" + 24755 " └─ IndexedTableAccess(xy)\n" + 24756 " ├─ index: [xy.x]\n" + 24757 " ├─ columns: [x]\n" + 24758 " └─ keys: cte.a\n" + 24759 "", 24760 ExpectedAnalysis: "Sort(mytable.i ASC)\n" + 24761 " └─ Filter\n" + 24762 " ├─ (mytable.i = sqa.a)\n" + 24763 " └─ LateralCrossJoin\n" + 24764 " ├─ Table\n" + 24765 " │ └─ name: mytable\n" + 24766 " └─ SubqueryAlias\n" + 24767 " ├─ name: sqa\n" + 24768 " ├─ outerVisibility: false\n" + 24769 " ├─ isLateral: true\n" + 24770 " ├─ cacheable: true\n" + 24771 " └─ SubqueryAlias\n" + 24772 " ├─ name: cte\n" + 24773 " ├─ outerVisibility: false\n" + 24774 " ├─ isLateral: true\n" + 24775 " ├─ cacheable: true\n" + 24776 " └─ RecursiveCTE\n" + 24777 " └─ Union distinct\n" + 24778 " ├─ Table\n" + 24779 " │ ├─ name: xy\n" + 24780 " │ └─ columns: [y]\n" + 24781 " └─ Project\n" + 24782 " ├─ columns: [xy.x]\n" + 24783 " └─ LookupJoin\n" + 24784 " ├─ RecursiveTable(cte)\n" + 24785 " └─ IndexedTableAccess(xy)\n" + 24786 " ├─ index: [xy.x]\n" + 24787 " ├─ columns: [x]\n" + 24788 " └─ keys: cte.a\n" + 24789 "", 24790 }, 24791 { 24792 Query: ` 24793 select * from mytable, 24794 lateral ( 24795 with recursive cte(a) as ( 24796 select y from xy 24797 union 24798 select x from cte 24799 join 24800 ( 24801 select * 24802 from xy 24803 where x = 1 24804 ) sqa1 24805 on x = a 24806 limit 3 24807 ) 24808 select * from cte 24809 ) sqa2 24810 where i = a 24811 order by i;`, 24812 ExpectedPlan: "Sort(mytable.i:0!null ASC nullsFirst)\n" + 24813 " └─ Filter\n" + 24814 " ├─ Eq\n" + 24815 " │ ├─ mytable.i:0!null\n" + 24816 " │ └─ sqa2.a:2\n" + 24817 " └─ LateralCrossJoin\n" + 24818 " ├─ ProcessTable\n" + 24819 " │ └─ Table\n" + 24820 " │ ├─ name: mytable\n" + 24821 " │ └─ columns: [i s]\n" + 24822 " └─ SubqueryAlias\n" + 24823 " ├─ name: sqa2\n" + 24824 " ├─ outerVisibility: false\n" + 24825 " ├─ isLateral: true\n" + 24826 " ├─ cacheable: true\n" + 24827 " ├─ colSet: (10)\n" + 24828 " ├─ tableId: 8\n" + 24829 " └─ SubqueryAlias\n" + 24830 " ├─ name: cte\n" + 24831 " ├─ outerVisibility: false\n" + 24832 " ├─ isLateral: true\n" + 24833 " ├─ cacheable: true\n" + 24834 " ├─ colSet: (5)\n" + 24835 " ├─ tableId: 3\n" + 24836 " └─ RecursiveCTE\n" + 24837 " └─ Union distinct\n" + 24838 " ├─ limit: 3\n" + 24839 " ├─ Table\n" + 24840 " │ ├─ name: xy\n" + 24841 " │ ├─ columns: [y]\n" + 24842 " │ ├─ colSet: (3,4)\n" + 24843 " │ └─ tableId: 2\n" + 24844 " └─ Project\n" + 24845 " ├─ columns: [sqa1.x:3!null]\n" + 24846 " └─ HashJoin\n" + 24847 " ├─ Eq\n" + 24848 " │ ├─ sqa1.x:3!null\n" + 24849 " │ └─ cte.a:2\n" + 24850 " ├─ RecursiveTable(cte)\n" + 24851 " └─ HashLookup\n" + 24852 " ├─ left-key: TUPLE(cte.a:2)\n" + 24853 " ├─ right-key: TUPLE(sqa1.x:2!null)\n" + 24854 " └─ SubqueryAlias\n" + 24855 " ├─ name: sqa1\n" + 24856 " ├─ outerVisibility: false\n" + 24857 " ├─ isLateral: true\n" + 24858 " ├─ cacheable: true\n" + 24859 " ├─ colSet: (8,9)\n" + 24860 " ├─ tableId: 6\n" + 24861 " └─ IndexedTableAccess(xy)\n" + 24862 " ├─ index: [xy.x]\n" + 24863 " ├─ static: [{[1, 1]}]\n" + 24864 " ├─ colSet: (6,7)\n" + 24865 " ├─ tableId: 5\n" + 24866 " └─ Table\n" + 24867 " ├─ name: xy\n" + 24868 " └─ columns: [x y]\n" + 24869 "", 24870 ExpectedEstimates: "Sort(mytable.i ASC)\n" + 24871 " └─ Filter\n" + 24872 " ├─ (mytable.i = sqa2.a)\n" + 24873 " └─ LateralCrossJoin\n" + 24874 " ├─ Table\n" + 24875 " │ └─ name: mytable\n" + 24876 " └─ SubqueryAlias\n" + 24877 " ├─ name: sqa2\n" + 24878 " ├─ outerVisibility: false\n" + 24879 " ├─ isLateral: true\n" + 24880 " ├─ cacheable: true\n" + 24881 " └─ SubqueryAlias\n" + 24882 " ├─ name: cte\n" + 24883 " ├─ outerVisibility: false\n" + 24884 " ├─ isLateral: true\n" + 24885 " ├─ cacheable: true\n" + 24886 " └─ RecursiveCTE\n" + 24887 " └─ Union distinct\n" + 24888 " ├─ limit: 3\n" + 24889 " ├─ Table\n" + 24890 " │ ├─ name: xy\n" + 24891 " │ └─ columns: [y]\n" + 24892 " └─ Project\n" + 24893 " ├─ columns: [sqa1.x]\n" + 24894 " └─ HashJoin\n" + 24895 " ├─ (sqa1.x = cte.a)\n" + 24896 " ├─ RecursiveTable(cte)\n" + 24897 " └─ HashLookup\n" + 24898 " ├─ left-key: (cte.a)\n" + 24899 " ├─ right-key: (sqa1.x)\n" + 24900 " └─ SubqueryAlias\n" + 24901 " ├─ name: sqa1\n" + 24902 " ├─ outerVisibility: false\n" + 24903 " ├─ isLateral: true\n" + 24904 " ├─ cacheable: true\n" + 24905 " └─ IndexedTableAccess(xy)\n" + 24906 " ├─ index: [xy.x]\n" + 24907 " ├─ filters: [{[1, 1]}]\n" + 24908 " └─ columns: [x y]\n" + 24909 "", 24910 ExpectedAnalysis: "Sort(mytable.i ASC)\n" + 24911 " └─ Filter\n" + 24912 " ├─ (mytable.i = sqa2.a)\n" + 24913 " └─ LateralCrossJoin\n" + 24914 " ├─ Table\n" + 24915 " │ └─ name: mytable\n" + 24916 " └─ SubqueryAlias\n" + 24917 " ├─ name: sqa2\n" + 24918 " ├─ outerVisibility: false\n" + 24919 " ├─ isLateral: true\n" + 24920 " ├─ cacheable: true\n" + 24921 " └─ SubqueryAlias\n" + 24922 " ├─ name: cte\n" + 24923 " ├─ outerVisibility: false\n" + 24924 " ├─ isLateral: true\n" + 24925 " ├─ cacheable: true\n" + 24926 " └─ RecursiveCTE\n" + 24927 " └─ Union distinct\n" + 24928 " ├─ limit: 3\n" + 24929 " ├─ Table\n" + 24930 " │ ├─ name: xy\n" + 24931 " │ └─ columns: [y]\n" + 24932 " └─ Project\n" + 24933 " ├─ columns: [sqa1.x]\n" + 24934 " └─ HashJoin\n" + 24935 " ├─ (sqa1.x = cte.a)\n" + 24936 " ├─ RecursiveTable(cte)\n" + 24937 " └─ HashLookup\n" + 24938 " ├─ left-key: (cte.a)\n" + 24939 " ├─ right-key: (sqa1.x)\n" + 24940 " └─ SubqueryAlias\n" + 24941 " ├─ name: sqa1\n" + 24942 " ├─ outerVisibility: false\n" + 24943 " ├─ isLateral: true\n" + 24944 " ├─ cacheable: true\n" + 24945 " └─ IndexedTableAccess(xy)\n" + 24946 " ├─ index: [xy.x]\n" + 24947 " ├─ filters: [{[1, 1]}]\n" + 24948 " └─ columns: [x y]\n" + 24949 "", 24950 }, 24951 { 24952 Query: ` 24953 select * 24954 from xy inner join uv 24955 on xy.x = uv.u and uv.v = (select max(v) from uv where xy.x = uv.u) 24956 order by xy.x, xy.y, uv.u, uv.v;`, 24957 ExpectedPlan: "Project\n" + 24958 " ├─ columns: [xy.x:2!null, xy.y:3, uv.u:0!null, uv.v:1]\n" + 24959 " └─ Sort(xy.x:2!null ASC nullsFirst, xy.y:3 ASC nullsFirst, uv.u:0!null ASC nullsFirst, uv.v:1 ASC nullsFirst)\n" + 24960 " └─ LookupJoin\n" + 24961 " ├─ Eq\n" + 24962 " │ ├─ uv.v:1\n" + 24963 " │ └─ Subquery\n" + 24964 " │ ├─ cacheable: false\n" + 24965 " │ ├─ alias-string: select max(v) from uv where xy.x = uv.u\n" + 24966 " │ └─ Project\n" + 24967 " │ ├─ columns: [max(uv.v):4!null as max(v)]\n" + 24968 " │ └─ GroupBy\n" + 24969 " │ ├─ select: MAX(uv.v:5)\n" + 24970 " │ ├─ group: \n" + 24971 " │ └─ Filter\n" + 24972 " │ ├─ Eq\n" + 24973 " │ │ ├─ xy.x:2!null\n" + 24974 " │ │ └─ uv.u:4!null\n" + 24975 " │ └─ IndexedTableAccess(uv)\n" + 24976 " │ ├─ index: [uv.u]\n" + 24977 " │ ├─ keys: [xy.x:2!null]\n" + 24978 " │ ├─ colSet: (5,6)\n" + 24979 " │ ├─ tableId: 3\n" + 24980 " │ └─ Table\n" + 24981 " │ ├─ name: uv\n" + 24982 " │ └─ columns: [u v]\n" + 24983 " ├─ ProcessTable\n" + 24984 " │ └─ Table\n" + 24985 " │ ├─ name: uv\n" + 24986 " │ └─ columns: [u v]\n" + 24987 " └─ IndexedTableAccess(xy)\n" + 24988 " ├─ index: [xy.x]\n" + 24989 " ├─ keys: [uv.u:0!null]\n" + 24990 " ├─ colSet: (1,2)\n" + 24991 " ├─ tableId: 1\n" + 24992 " └─ Table\n" + 24993 " ├─ name: xy\n" + 24994 " └─ columns: [x y]\n" + 24995 "", 24996 ExpectedEstimates: "Project\n" + 24997 " ├─ columns: [xy.x, xy.y, uv.u, uv.v]\n" + 24998 " └─ Sort(xy.x ASC, xy.y ASC, uv.u ASC, uv.v ASC)\n" + 24999 " └─ LookupJoin\n" + 25000 " ├─ (uv.v = Subquery\n" + 25001 " │ ├─ cacheable: false\n" + 25002 " │ └─ Project\n" + 25003 " │ ├─ columns: [max(uv.v) as max(v)]\n" + 25004 " │ └─ GroupBy\n" + 25005 " │ ├─ SelectedExprs(MAX(uv.v))\n" + 25006 " │ ├─ Grouping()\n" + 25007 " │ └─ Filter\n" + 25008 " │ ├─ (xy.x = uv.u)\n" + 25009 " │ └─ IndexedTableAccess(uv)\n" + 25010 " │ ├─ index: [uv.u]\n" + 25011 " │ ├─ columns: [u v]\n" + 25012 " │ └─ keys: xy.x\n" + 25013 " │ )\n" + 25014 " ├─ Table\n" + 25015 " │ └─ name: uv\n" + 25016 " └─ IndexedTableAccess(xy)\n" + 25017 " ├─ index: [xy.x]\n" + 25018 " └─ keys: uv.u\n" + 25019 "", 25020 ExpectedAnalysis: "Project\n" + 25021 " ├─ columns: [xy.x, xy.y, uv.u, uv.v]\n" + 25022 " └─ Sort(xy.x ASC, xy.y ASC, uv.u ASC, uv.v ASC)\n" + 25023 " └─ LookupJoin\n" + 25024 " ├─ (uv.v = Subquery\n" + 25025 " │ ├─ cacheable: false\n" + 25026 " │ └─ Project\n" + 25027 " │ ├─ columns: [max(uv.v) as max(v)]\n" + 25028 " │ └─ GroupBy\n" + 25029 " │ ├─ SelectedExprs(MAX(uv.v))\n" + 25030 " │ ├─ Grouping()\n" + 25031 " │ └─ Filter\n" + 25032 " │ ├─ (xy.x = uv.u)\n" + 25033 " │ └─ IndexedTableAccess(uv)\n" + 25034 " │ ├─ index: [uv.u]\n" + 25035 " │ ├─ columns: [u v]\n" + 25036 " │ └─ keys: xy.x\n" + 25037 " │ )\n" + 25038 " ├─ Table\n" + 25039 " │ └─ name: uv\n" + 25040 " └─ IndexedTableAccess(xy)\n" + 25041 " ├─ index: [xy.x]\n" + 25042 " └─ keys: uv.u\n" + 25043 "", 25044 }, 25045 { 25046 Query: ` 25047 select a, b 25048 from ab as ab2 25049 where exists ( 25050 select * 25051 from ab 25052 where ab.b = ( 25053 select max(v) 25054 from uv 25055 where uv.v = ab2.a and uv.v = ab.a 25056 ) 25057 );`, 25058 ExpectedPlan: "SemiJoin\n" + 25059 " ├─ Eq\n" + 25060 " │ ├─ ab.b:3\n" + 25061 " │ └─ Subquery\n" + 25062 " │ ├─ cacheable: false\n" + 25063 " │ ├─ alias-string: select max(v) from uv where uv.v = ab2.a and uv.v = ab.a\n" + 25064 " │ └─ Project\n" + 25065 " │ ├─ columns: [max(uv.v):4!null as max(v)]\n" + 25066 " │ └─ GroupBy\n" + 25067 " │ ├─ select: MAX(uv.v:4)\n" + 25068 " │ ├─ group: \n" + 25069 " │ └─ Filter\n" + 25070 " │ ├─ AND\n" + 25071 " │ │ ├─ Eq\n" + 25072 " │ │ │ ├─ uv.v:4\n" + 25073 " │ │ │ └─ ab2.a:0!null\n" + 25074 " │ │ └─ Eq\n" + 25075 " │ │ ├─ uv.v:4\n" + 25076 " │ │ └─ ab.a:2!null\n" + 25077 " │ └─ Table\n" + 25078 " │ ├─ name: uv\n" + 25079 " │ ├─ columns: [v]\n" + 25080 " │ ├─ colSet: (5,6)\n" + 25081 " │ └─ tableId: 3\n" + 25082 " ├─ TableAlias(ab2)\n" + 25083 " │ └─ ProcessTable\n" + 25084 " │ └─ Table\n" + 25085 " │ ├─ name: ab\n" + 25086 " │ └─ columns: [a b]\n" + 25087 " └─ Table\n" + 25088 " ├─ name: ab\n" + 25089 " ├─ columns: [a b]\n" + 25090 " ├─ colSet: (3,4)\n" + 25091 " └─ tableId: 2\n" + 25092 "", 25093 ExpectedEstimates: "SemiJoin (estimated cost=506000.000 rows=1250)\n" + 25094 " ├─ (ab.b = Subquery\n" + 25095 " │ ├─ cacheable: false\n" + 25096 " │ └─ Project\n" + 25097 " │ ├─ columns: [max(uv.v) as max(v)]\n" + 25098 " │ └─ GroupBy\n" + 25099 " │ ├─ SelectedExprs(MAX(uv.v))\n" + 25100 " │ ├─ Grouping()\n" + 25101 " │ └─ Filter\n" + 25102 " │ ├─ ((uv.v = ab2.a) AND (uv.v = ab.a))\n" + 25103 " │ └─ Table\n" + 25104 " │ ├─ name: uv\n" + 25105 " │ └─ columns: [v]\n" + 25106 " │ )\n" + 25107 " ├─ TableAlias(ab2)\n" + 25108 " │ └─ Table\n" + 25109 " │ └─ name: ab\n" + 25110 " └─ Table\n" + 25111 " └─ name: ab\n" + 25112 "", 25113 ExpectedAnalysis: "SemiJoin (estimated cost=506000.000 rows=1250) (actual rows=1 loops=1)\n" + 25114 " ├─ (ab.b = Subquery\n" + 25115 " │ ├─ cacheable: false\n" + 25116 " │ └─ Project\n" + 25117 " │ ├─ columns: [max(uv.v) as max(v)]\n" + 25118 " │ └─ GroupBy\n" + 25119 " │ ├─ SelectedExprs(MAX(uv.v))\n" + 25120 " │ ├─ Grouping()\n" + 25121 " │ └─ Filter\n" + 25122 " │ ├─ ((uv.v = ab2.a) AND (uv.v = ab.a))\n" + 25123 " │ └─ Table\n" + 25124 " │ ├─ name: uv\n" + 25125 " │ └─ columns: [v]\n" + 25126 " │ )\n" + 25127 " ├─ TableAlias(ab2)\n" + 25128 " │ └─ Table\n" + 25129 " │ └─ name: ab\n" + 25130 " └─ Table\n" + 25131 " └─ name: ab\n" + 25132 "", 25133 }, 25134 { 25135 Query: ` 25136 select x, y 25137 from xy as xy2 25138 where exists ( 25139 select * 25140 from xy 25141 where xy.y = ( 25142 select max(v) 25143 from uv 25144 where uv.v = xy2.x and uv.v = xy.x 25145 ) 25146 ) 25147 order by x, y; 25148 `, 25149 ExpectedPlan: "Sort(xy2.x:0!null ASC nullsFirst, xy2.y:1 ASC nullsFirst)\n" + 25150 " └─ SemiJoin\n" + 25151 " ├─ Eq\n" + 25152 " │ ├─ xy.y:3\n" + 25153 " │ └─ Subquery\n" + 25154 " │ ├─ cacheable: false\n" + 25155 " │ ├─ alias-string: select max(v) from uv where uv.v = xy2.x and uv.v = xy.x\n" + 25156 " │ └─ Project\n" + 25157 " │ ├─ columns: [max(uv.v):4!null as max(v)]\n" + 25158 " │ └─ GroupBy\n" + 25159 " │ ├─ select: MAX(uv.v:4)\n" + 25160 " │ ├─ group: \n" + 25161 " │ └─ Filter\n" + 25162 " │ ├─ AND\n" + 25163 " │ │ ├─ Eq\n" + 25164 " │ │ │ ├─ uv.v:4\n" + 25165 " │ │ │ └─ xy2.x:0!null\n" + 25166 " │ │ └─ Eq\n" + 25167 " │ │ ├─ uv.v:4\n" + 25168 " │ │ └─ xy.x:2!null\n" + 25169 " │ └─ Table\n" + 25170 " │ ├─ name: uv\n" + 25171 " │ ├─ columns: [v]\n" + 25172 " │ ├─ colSet: (5,6)\n" + 25173 " │ └─ tableId: 3\n" + 25174 " ├─ TableAlias(xy2)\n" + 25175 " │ └─ ProcessTable\n" + 25176 " │ └─ Table\n" + 25177 " │ ├─ name: xy\n" + 25178 " │ └─ columns: [x y]\n" + 25179 " └─ Table\n" + 25180 " ├─ name: xy\n" + 25181 " ├─ columns: [x y]\n" + 25182 " ├─ colSet: (3,4)\n" + 25183 " └─ tableId: 2\n" + 25184 "", 25185 ExpectedEstimates: "Sort(xy2.x ASC, xy2.y ASC)\n" + 25186 " └─ SemiJoin\n" + 25187 " ├─ (xy.y = Subquery\n" + 25188 " │ ├─ cacheable: false\n" + 25189 " │ └─ Project\n" + 25190 " │ ├─ columns: [max(uv.v) as max(v)]\n" + 25191 " │ └─ GroupBy\n" + 25192 " │ ├─ SelectedExprs(MAX(uv.v))\n" + 25193 " │ ├─ Grouping()\n" + 25194 " │ └─ Filter\n" + 25195 " │ ├─ ((uv.v = xy2.x) AND (uv.v = xy.x))\n" + 25196 " │ └─ Table\n" + 25197 " │ ├─ name: uv\n" + 25198 " │ └─ columns: [v]\n" + 25199 " │ )\n" + 25200 " ├─ TableAlias(xy2)\n" + 25201 " │ └─ Table\n" + 25202 " │ └─ name: xy\n" + 25203 " └─ Table\n" + 25204 " └─ name: xy\n" + 25205 "", 25206 ExpectedAnalysis: "Sort(xy2.x ASC, xy2.y ASC)\n" + 25207 " └─ SemiJoin\n" + 25208 " ├─ (xy.y = Subquery\n" + 25209 " │ ├─ cacheable: false\n" + 25210 " │ └─ Project\n" + 25211 " │ ├─ columns: [max(uv.v) as max(v)]\n" + 25212 " │ └─ GroupBy\n" + 25213 " │ ├─ SelectedExprs(MAX(uv.v))\n" + 25214 " │ ├─ Grouping()\n" + 25215 " │ └─ Filter\n" + 25216 " │ ├─ ((uv.v = xy2.x) AND (uv.v = xy.x))\n" + 25217 " │ └─ Table\n" + 25218 " │ ├─ name: uv\n" + 25219 " │ └─ columns: [v]\n" + 25220 " │ )\n" + 25221 " ├─ TableAlias(xy2)\n" + 25222 " │ └─ Table\n" + 25223 " │ └─ name: xy\n" + 25224 " └─ Table\n" + 25225 " └─ name: xy\n" + 25226 "", 25227 }, 25228 { 25229 Query: `select * from (select 'k' as k) sq join bigtable on t = k join xy where x between n and n;`, 25230 ExpectedPlan: "Project\n" + 25231 " ├─ columns: [sq.k:0!null, bigtable.t:3!null, bigtable.n:4, xy.x:1!null, xy.y:2]\n" + 25232 " └─ HashJoin\n" + 25233 " ├─ Eq\n" + 25234 " │ ├─ bigtable.t:3!null\n" + 25235 " │ └─ sq.k:0!null\n" + 25236 " ├─ SubqueryAlias\n" + 25237 " │ ├─ name: sq\n" + 25238 " │ ├─ outerVisibility: false\n" + 25239 " │ ├─ isLateral: false\n" + 25240 " │ ├─ cacheable: true\n" + 25241 " │ ├─ colSet: (2)\n" + 25242 " │ ├─ tableId: 1\n" + 25243 " │ └─ Project\n" + 25244 " │ ├─ columns: [k (longtext) as k]\n" + 25245 " │ └─ Table\n" + 25246 " │ ├─ name: \n" + 25247 " │ ├─ columns: []\n" + 25248 " │ ├─ colSet: ()\n" + 25249 " │ └─ tableId: 0\n" + 25250 " └─ HashLookup\n" + 25251 " ├─ left-key: TUPLE(sq.k:0!null)\n" + 25252 " ├─ right-key: TUPLE(bigtable.t:2!null)\n" + 25253 " └─ RangeHeapJoin\n" + 25254 " ├─ AND\n" + 25255 " │ ├─ GreaterThanOrEqual\n" + 25256 " │ │ ├─ xy.x:1!null\n" + 25257 " │ │ └─ bigtable.n:4\n" + 25258 " │ └─ LessThanOrEqual\n" + 25259 " │ ├─ xy.x:1!null\n" + 25260 " │ └─ bigtable.n:4\n" + 25261 " ├─ IndexedTableAccess(xy)\n" + 25262 " │ ├─ index: [xy.x]\n" + 25263 " │ ├─ static: [{[NULL, ∞)}]\n" + 25264 " │ ├─ colSet: (5,6)\n" + 25265 " │ ├─ tableId: 3\n" + 25266 " │ └─ Table\n" + 25267 " │ ├─ name: xy\n" + 25268 " │ └─ columns: [x y]\n" + 25269 " └─ Sort(bigtable.n:1 ASC nullsFirst)\n" + 25270 " └─ ProcessTable\n" + 25271 " └─ Table\n" + 25272 " ├─ name: bigtable\n" + 25273 " └─ columns: [t n]\n" + 25274 "", 25275 ExpectedEstimates: "Project\n" + 25276 " ├─ columns: [sq.k, bigtable.t, bigtable.n, xy.x, xy.y]\n" + 25277 " └─ HashJoin (estimated cost=153.250 rows=125)\n" + 25278 " ├─ (bigtable.t = sq.k)\n" + 25279 " ├─ SubqueryAlias\n" + 25280 " │ ├─ name: sq\n" + 25281 " │ ├─ outerVisibility: false\n" + 25282 " │ ├─ isLateral: false\n" + 25283 " │ ├─ cacheable: true\n" + 25284 " │ └─ Project\n" + 25285 " │ ├─ columns: ['k' as k]\n" + 25286 " │ └─ Table\n" + 25287 " │ └─ name: \n" + 25288 " └─ HashLookup\n" + 25289 " ├─ left-key: (sq.k)\n" + 25290 " ├─ right-key: (bigtable.t)\n" + 25291 " └─ RangeHeapJoin\n" + 25292 " ├─ ((xy.x >= bigtable.n) AND (xy.x <= bigtable.n))\n" + 25293 " ├─ IndexedTableAccess(xy)\n" + 25294 " │ ├─ index: [xy.x]\n" + 25295 " │ ├─ filters: [{[NULL, ∞)}]\n" + 25296 " │ └─ columns: [x y]\n" + 25297 " └─ Sort(bigtable.n ASC)\n" + 25298 " └─ Table\n" + 25299 " ├─ name: bigtable\n" + 25300 " └─ columns: [t n]\n" + 25301 "", 25302 ExpectedAnalysis: "Project\n" + 25303 " ├─ columns: [sq.k, bigtable.t, bigtable.n, xy.x, xy.y]\n" + 25304 " └─ HashJoin (estimated cost=153.250 rows=125) (actual rows=1 loops=1)\n" + 25305 " ├─ (bigtable.t = sq.k)\n" + 25306 " ├─ SubqueryAlias\n" + 25307 " │ ├─ name: sq\n" + 25308 " │ ├─ outerVisibility: false\n" + 25309 " │ ├─ isLateral: false\n" + 25310 " │ ├─ cacheable: true\n" + 25311 " │ └─ Project\n" + 25312 " │ ├─ columns: ['k' as k]\n" + 25313 " │ └─ Table\n" + 25314 " │ └─ name: \n" + 25315 " └─ HashLookup\n" + 25316 " ├─ left-key: (sq.k)\n" + 25317 " ├─ right-key: (bigtable.t)\n" + 25318 " └─ RangeHeapJoin\n" + 25319 " ├─ ((xy.x >= bigtable.n) AND (xy.x <= bigtable.n))\n" + 25320 " ├─ IndexedTableAccess(xy)\n" + 25321 " │ ├─ index: [xy.x]\n" + 25322 " │ ├─ filters: [{[NULL, ∞)}]\n" + 25323 " │ └─ columns: [x y]\n" + 25324 " └─ Sort(bigtable.n ASC)\n" + 25325 " └─ Table\n" + 25326 " ├─ name: bigtable\n" + 25327 " └─ columns: [t n]\n" + 25328 "", 25329 }, 25330 { 25331 Query: `select * from one_pk_two_idx where v1 < 4 and v2 < 2 or v2 > 3 order by v1`, 25332 ExpectedPlan: "Sort(one_pk_two_idx.v1:1 ASC nullsFirst)\n" + 25333 " └─ IndexedTableAccess(one_pk_two_idx)\n" + 25334 " ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 25335 " ├─ static: [{[NULL, ∞), (3, ∞)}, {(NULL, 4), (NULL, 2)}]\n" + 25336 " ├─ colSet: (1-3)\n" + 25337 " ├─ tableId: 1\n" + 25338 " └─ Table\n" + 25339 " ├─ name: one_pk_two_idx\n" + 25340 " └─ columns: [pk v1 v2]\n" + 25341 "", 25342 ExpectedEstimates: "Sort(one_pk_two_idx.v1 ASC)\n" + 25343 " └─ IndexedTableAccess(one_pk_two_idx)\n" + 25344 " ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 25345 " ├─ filters: [{[NULL, ∞), (3, ∞)}, {(NULL, 4), (NULL, 2)}]\n" + 25346 " └─ columns: [pk v1 v2]\n" + 25347 "", 25348 ExpectedAnalysis: "Sort(one_pk_two_idx.v1 ASC)\n" + 25349 " └─ IndexedTableAccess(one_pk_two_idx)\n" + 25350 " ├─ index: [one_pk_two_idx.v1,one_pk_two_idx.v2]\n" + 25351 " ├─ filters: [{[NULL, ∞), (3, ∞)}, {(NULL, 4), (NULL, 2)}]\n" + 25352 " └─ columns: [pk v1 v2]\n" + 25353 "", 25354 }, 25355 { 25356 Query: `SELECT /*+ LOOKUP_JOIN(xy,mytable) JOIN_ORDER(xy,mytable) */ * FROM xy INNER JOIN mytable ON ((xy.x)=(mytable.s));`, 25357 ExpectedPlan: "LookupJoin\n" + 25358 " ├─ ProcessTable\n" + 25359 " │ └─ Table\n" + 25360 " │ ├─ name: xy\n" + 25361 " │ └─ columns: [x y]\n" + 25362 " └─ IndexedTableAccess(mytable)\n" + 25363 " ├─ index: [mytable.s]\n" + 25364 " ├─ keys: [xy.x:0!null]\n" + 25365 " ├─ colSet: (3,4)\n" + 25366 " ├─ tableId: 2\n" + 25367 " └─ Table\n" + 25368 " ├─ name: mytable\n" + 25369 " └─ columns: [i s]\n" + 25370 "", 25371 ExpectedEstimates: "LookupJoin (estimated cost=1006.900 rows=3)\n" + 25372 " ├─ Table\n" + 25373 " │ ├─ name: xy\n" + 25374 " │ └─ columns: [x y]\n" + 25375 " └─ IndexedTableAccess(mytable)\n" + 25376 " ├─ index: [mytable.s]\n" + 25377 " ├─ columns: [i s]\n" + 25378 " └─ keys: xy.x\n" + 25379 "", 25380 ExpectedAnalysis: "LookupJoin (estimated cost=1006.900 rows=3) (actual rows=0 loops=1)\n" + 25381 " ├─ Table\n" + 25382 " │ ├─ name: xy\n" + 25383 " │ └─ columns: [x y]\n" + 25384 " └─ IndexedTableAccess(mytable)\n" + 25385 " ├─ index: [mytable.s]\n" + 25386 " ├─ columns: [i s]\n" + 25387 " └─ keys: xy.x\n" + 25388 "", 25389 }, 25390 }