github-31878.slt 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. mode cockroach
  10. statement ok
  11. create table t1(x int, y int);
  12. query T multiline
  13. EXPLAIN OPTIMIZED PLAN WITH (humanized expressions, column names) AS VERBOSE TEXT FOR
  14. select sum(x) + 5 as s from t1;
  15. ----
  16. Explained Query:
  17. With
  18. cte l0 =
  19. Reduce aggregates=[sum(#0{x})] // { column_names: "(sum_x)" }
  20. Project (#0{x}) // { column_names: "(x)" }
  21. ReadStorage materialize.public.t1 // { column_names: "(x, y)" }
  22. Return // { column_names: "(#0)" }
  23. Project (#1) // { column_names: "(#0)" }
  24. Map ((#0{sum_x} + 5)) // { column_names: "(sum_x, #1)" }
  25. Union // { column_names: "(sum_x)" }
  26. Get l0 // { column_names: "(sum_x)" }
  27. Map (null) // { column_names: "(#0)" }
  28. Union // { column_names: "()" }
  29. Negate // { column_names: "()" }
  30. Project () // { column_names: "()" }
  31. Get l0 // { column_names: "(sum_x)" }
  32. Constant // { column_names: "()" }
  33. - ()
  34. Source materialize.public.t1
  35. Target cluster: quickstart
  36. EOF
  37. query T multiline
  38. EXPLAIN OPTIMIZED PLAN WITH (humanized expressions) AS VERBOSE TEXT FOR
  39. select sum(x) + 5 as s from t1;
  40. ----
  41. Explained Query:
  42. With
  43. cte l0 =
  44. Reduce aggregates=[sum(#0{x})]
  45. Project (#0{x})
  46. ReadStorage materialize.public.t1
  47. Return
  48. Project (#1)
  49. Map ((#0{sum_x} + 5))
  50. Union
  51. Get l0
  52. Map (null)
  53. Union
  54. Negate
  55. Project ()
  56. Get l0
  57. Constant
  58. - ()
  59. Source materialize.public.t1
  60. Target cluster: quickstart
  61. EOF
  62. # NB no humanized expressions means we won't infer any column names
  63. # but we _will_ get to keep the annotated names (for better or worse)
  64. query T multiline
  65. EXPLAIN OPTIMIZED PLAN WITH (humanized expressions = false) AS VERBOSE TEXT FOR
  66. select sum(x) + 5 as s from t1;
  67. ----
  68. Explained Query:
  69. With
  70. cte l0 =
  71. Reduce aggregates=[sum(#0{x})]
  72. Project (#0)
  73. ReadStorage materialize.public.t1
  74. Return
  75. Project (#1)
  76. Map ((#0{"?column?"} + 5))
  77. Union
  78. Get l0
  79. Map (null)
  80. Union
  81. Negate
  82. Project ()
  83. Get l0
  84. Constant
  85. - ()
  86. Source materialize.public.t1
  87. Target cluster: quickstart
  88. EOF