keys.slt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. # Keys should be detected for constants with
  10. # no duplicates in a column.
  11. query T multiline
  12. EXPLAIN OPTIMIZED PLAN WITH(keys, no fast path, humanized expressions) AS VERBOSE TEXT FOR (VALUES (1, 1), (1, 2))
  13. ----
  14. Explained Query:
  15. Constant // { keys: "([1])" }
  16. - (1, 1)
  17. - (1, 2)
  18. Target cluster: quickstart
  19. EOF
  20. # A global primary key should be detected for constants with fewer than two rows.
  21. query T multiline
  22. EXPLAIN OPTIMIZED PLAN WITH(keys, no fast path, humanized expressions) AS VERBOSE TEXT FOR (VALUES (1, 2, 3))
  23. ----
  24. Explained Query:
  25. Constant // { keys: "([])" }
  26. - (1, 2, 3)
  27. Target cluster: quickstart
  28. EOF
  29. # Each detected-unique column belongs in a separate key.
  30. query T multiline
  31. EXPLAIN OPTIMIZED PLAN WITH(keys, no fast path, humanized expressions) AS VERBOSE TEXT FOR (VALUES (1, 1, 1), (2, 2, 1), (3, 3, 1))
  32. ----
  33. Explained Query:
  34. Constant // { keys: "([0], [1])" }
  35. - (1, 1, 1)
  36. - (2, 2, 1)
  37. - (3, 3, 1)
  38. Target cluster: quickstart
  39. EOF