|
| 1 | +# Copyright Materialize, Inc. and contributors. All rights reserved. |
| 2 | +# |
| 3 | +# Use of this software is governed by the Business Source License |
| 4 | +# included in the LICENSE file at the root of this repository. |
| 5 | +# |
| 6 | +# As of the Change Date specified in that file, in accordance with |
| 7 | +# the Business Source License, use of this software will be governed |
| 8 | +# by the Apache License, Version 2.0. |
| 9 | + |
| 10 | +mode cockroach |
| 11 | + |
| 12 | +statement ok |
| 13 | +create table t1(x int, y int); |
| 14 | + |
| 15 | +query T multiline |
| 16 | +EXPLAIN OPTIMIZED PLAN WITH (humanized expressions, column names) AS VERBOSE TEXT FOR |
| 17 | +select sum(x) + 5 as s from t1; |
| 18 | +---- |
| 19 | +Explained Query: |
| 20 | + With |
| 21 | + cte l0 = |
| 22 | + Reduce aggregates=[sum(#0{x})] // { column_names: "(sum_x)" } |
| 23 | + Project (#0{x}) // { column_names: "(x)" } |
| 24 | + ReadStorage materialize.public.t1 // { column_names: "(x, y)" } |
| 25 | + Return // { column_names: "(#0)" } |
| 26 | + Project (#1) // { column_names: "(#0)" } |
| 27 | + Map ((#0{sum_x} + 5)) // { column_names: "(sum_x, #1)" } |
| 28 | + Union // { column_names: "(sum_x)" } |
| 29 | + Get l0 // { column_names: "(sum_x)" } |
| 30 | + Map (null) // { column_names: "(#0)" } |
| 31 | + Union // { column_names: "()" } |
| 32 | + Negate // { column_names: "()" } |
| 33 | + Project () // { column_names: "()" } |
| 34 | + Get l0 // { column_names: "(sum_x)" } |
| 35 | + Constant // { column_names: "()" } |
| 36 | + - () |
| 37 | + |
| 38 | +Source materialize.public.t1 |
| 39 | + |
| 40 | +Target cluster: quickstart |
| 41 | + |
| 42 | +EOF |
| 43 | + |
| 44 | +query T multiline |
| 45 | +EXPLAIN OPTIMIZED PLAN WITH (humanized expressions) AS VERBOSE TEXT FOR |
| 46 | +select sum(x) + 5 as s from t1; |
| 47 | +---- |
| 48 | +Explained Query: |
| 49 | + With |
| 50 | + cte l0 = |
| 51 | + Reduce aggregates=[sum(#0{x})] |
| 52 | + Project (#0{x}) |
| 53 | + ReadStorage materialize.public.t1 |
| 54 | + Return |
| 55 | + Project (#1) |
| 56 | + Map ((#0{sum_x} + 5)) |
| 57 | + Union |
| 58 | + Get l0 |
| 59 | + Map (null) |
| 60 | + Union |
| 61 | + Negate |
| 62 | + Project () |
| 63 | + Get l0 |
| 64 | + Constant |
| 65 | + - () |
| 66 | + |
| 67 | +Source materialize.public.t1 |
| 68 | + |
| 69 | +Target cluster: quickstart |
| 70 | + |
| 71 | +EOF |
| 72 | + |
| 73 | +# NB no humanized expressions means we won't infer any column names |
| 74 | +# but we _will_ get to keep the annotated names (for better or worse) |
| 75 | + |
| 76 | +query T multiline |
| 77 | +EXPLAIN OPTIMIZED PLAN WITH (humanized expressions = false) AS VERBOSE TEXT FOR |
| 78 | +select sum(x) + 5 as s from t1; |
| 79 | +---- |
| 80 | +Explained Query: |
| 81 | + With |
| 82 | + cte l0 = |
| 83 | + Reduce aggregates=[sum(#0{x})] |
| 84 | + Project (#0) |
| 85 | + ReadStorage materialize.public.t1 |
| 86 | + Return |
| 87 | + Project (#1) |
| 88 | + Map ((#0{"?column?"} + 5)) |
| 89 | + Union |
| 90 | + Get l0 |
| 91 | + Map (null) |
| 92 | + Union |
| 93 | + Negate |
| 94 | + Project () |
| 95 | + Get l0 |
| 96 | + Constant |
| 97 | + - () |
| 98 | + |
| 99 | +Source materialize.public.t1 |
| 100 | + |
| 101 | +Target cluster: quickstart |
| 102 | + |
| 103 | +EOF |
0 commit comments