non_null_requirements.slt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. # Test various cases of literal lifting
  11. #
  12. mode cockroach
  13. statement ok
  14. CREATE TABLE t1 (f1 INTEGER, f2 INTEGER);
  15. # WITH MUTUALLY RECURSIVE support
  16. # -------------------------------
  17. # Simplify non-nullable trees with multiple non-recursive bindings defined under
  18. # a single`WITH MUTUALLY RECURSIVE` block
  19. # As of materialize#27389 this no longer tests what it used to test.
  20. # Issue database-issues#8294 tracks tests that may not be serving their intended
  21. # purpose; perhaps we can remove the test if we remove the
  22. # non_null_requirements transform.
  23. query T multiline
  24. EXPLAIN OPTIMIZED PLAN WITH(humanized expressions, arity, join implementations) AS VERBOSE TEXT FOR
  25. WITH MUTUALLY RECURSIVE
  26. c0(x INT, y INT, z INT) AS (
  27. SELECT *, null::int FROM t1
  28. ),
  29. c1(x INT, y INT, z INT) AS (
  30. SELECT * FROM c0 WHERE z > 0 UNION SELECT x, y, 42 FROM c1
  31. ),
  32. c2(x INT, y INT, z INT) AS (
  33. SELECT y, x, z FROM c0
  34. )
  35. SELECT * FROM (SELECT * FROM c1 UNION ALL SELECT * FROM c2) WHERE z > 0
  36. ----
  37. Explained Query (fast path):
  38. Constant <empty>
  39. Target cluster: quickstart
  40. EOF