reduce_fusion.slt 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. statement ok
  10. CREATE TABLE t (f0 int, f1 int, f2 int)
  11. query T multiline
  12. EXPLAIN OPTIMIZED PLAN WITH(humanized expressions, arity, join implementations) AS VERBOSE TEXT FOR SELECT DISTINCT * FROM t GROUP BY f1, f2, f0
  13. ----
  14. Explained Query:
  15. Distinct project=[#0{f0}..=#2{f2}] // { arity: 3 }
  16. ReadStorage materialize.public.t // { arity: 3 }
  17. Source materialize.public.t
  18. Target cluster: quickstart
  19. EOF
  20. query T multiline
  21. EXPLAIN OPTIMIZED PLAN WITH(humanized expressions, arity, join implementations) AS VERBOSE TEXT FOR SELECT DISTINCT r0 FROM (SELECT DISTINCT f1 + 1 as r0, f0 FROM t)
  22. ----
  23. Explained Query:
  24. Distinct project=[(#0{f1} + 1)] // { arity: 1 }
  25. Project (#1{f1}) // { arity: 1 }
  26. ReadStorage materialize.public.t // { arity: 3 }
  27. Source materialize.public.t
  28. Target cluster: quickstart
  29. EOF
  30. query T multiline
  31. EXPLAIN OPTIMIZED PLAN WITH(humanized expressions, arity, join implementations) AS VERBOSE TEXT FOR SELECT DISTINCT f1 FROM (SELECT DISTINCT f0, f1 FROM t)
  32. ----
  33. Explained Query:
  34. Distinct project=[#0{f1}] // { arity: 1 }
  35. Project (#1{f1}) // { arity: 1 }
  36. ReadStorage materialize.public.t // { arity: 3 }
  37. Source materialize.public.t
  38. Target cluster: quickstart
  39. EOF
  40. query T multiline
  41. EXPLAIN OPTIMIZED PLAN WITH(humanized expressions, arity, join implementations) AS VERBOSE TEXT FOR SELECT DISTINCT FROM (SELECT DISTINCT f0, f1 FROM t)
  42. ----
  43. Explained Query:
  44. Distinct project=[] // { arity: 0 }
  45. Project () // { arity: 0 }
  46. ReadStorage materialize.public.t // { arity: 3 }
  47. Source materialize.public.t
  48. Target cluster: quickstart
  49. EOF
  50. query T multiline
  51. EXPLAIN OPTIMIZED PLAN WITH(humanized expressions, arity, join implementations) AS VERBOSE TEXT FOR SELECT DISTINCT FROM (SELECT DISTINCT f0 FROM (SELECT DISTINCT f0, f1 FROM t));
  52. ----
  53. Explained Query:
  54. Distinct project=[] // { arity: 0 }
  55. Project () // { arity: 0 }
  56. ReadStorage materialize.public.t // { arity: 3 }
  57. Source materialize.public.t
  58. Target cluster: quickstart
  59. EOF
  60. query T multiline
  61. EXPLAIN OPTIMIZED PLAN WITH(humanized expressions, arity, join implementations) AS VERBOSE TEXT FOR SELECT f0 FROM (SELECT f0 FROM t GROUP BY f1 / 10, f0) GROUP BY f0;
  62. ----
  63. Explained Query:
  64. Distinct project=[#0{f0}] // { arity: 1 }
  65. Project (#0{f0}) // { arity: 1 }
  66. ReadStorage materialize.public.t // { arity: 3 }
  67. Source materialize.public.t
  68. Target cluster: quickstart
  69. EOF
  70. query T multiline
  71. EXPLAIN OPTIMIZED PLAN WITH(humanized expressions, arity, join implementations) AS VERBOSE TEXT FOR SELECT f0 / 20 FROM (SELECT f0 / 10 AS f0 FROM t GROUP BY f0 / 10) GROUP BY f0 / 20;
  72. ----
  73. Explained Query:
  74. Distinct project=[((#0{f0} / 10) / 20)] // { arity: 1 }
  75. Project (#0{f0}) // { arity: 1 }
  76. ReadStorage materialize.public.t // { arity: 3 }
  77. Source materialize.public.t
  78. Target cluster: quickstart
  79. EOF