exec_merge_join.slt 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # Copyright 2015 - 2019 The Cockroach Authors. All rights reserved.
  2. # Copyright Materialize, Inc. and contributors. All rights reserved.
  3. #
  4. # Use of this software is governed by the Business Source License
  5. # included in the LICENSE file at the root of this repository.
  6. #
  7. # As of the Change Date specified in that file, in accordance with
  8. # the Business Source License, use of this software will be governed
  9. # by the Apache License, Version 2.0.
  10. #
  11. # This file is derived from the logic test suite in CockroachDB. The
  12. # original file was retrieved on June 10, 2019 from:
  13. #
  14. # https://github.com/cockroachdb/cockroach/blob/d2f7fbf5dd1fc1a099bbad790a2e1f7c60a66cc3/pkg/sql/logictest/testdata/logic_test/exec_merge_join
  15. #
  16. # The original source code is subject to the terms of the Apache
  17. # 2.0 license, a copy of which can be found in the LICENSE file at the
  18. # root of this repository.
  19. mode cockroach
  20. simple conn=mz_system,user=mz_system
  21. ALTER SYSTEM SET unsafe_enable_table_keys = true
  22. ----
  23. COMPLETE 0
  24. # Basic tables, no nulls
  25. statement ok
  26. CREATE TABLE t1 (k INT PRIMARY KEY, v INT)
  27. statement ok
  28. INSERT INTO t1 VALUES (-1, -1), (0, 4), (2, 1), (3, 4), (5, 4)
  29. statement ok
  30. CREATE TABLE t2 (x INT, y INT, INDEX x (x))
  31. statement ok
  32. INSERT INTO t2 VALUES (0, 5), (1, 3), (1, 4), (3, 2), (3, 3), (4, 6)
  33. query IIII
  34. SELECT k, v, x, y FROM t1 INNER MERGE JOIN t2 ON k = x
  35. ----
  36. 0 4 0 5
  37. 3 4 3 2
  38. 3 4 3 3
  39. statement ok
  40. DROP TABLE t1
  41. statement ok
  42. DROP TABLE t2
  43. # Basic tables with nulls
  44. statement ok
  45. CREATE TABLE t1 (k INT, INDEX k(k))
  46. statement ok
  47. INSERT INTO t1 VALUES (0), (null)
  48. statement ok
  49. CREATE TABLE t2 (x INT, INDEX x (x))
  50. statement ok
  51. INSERT INTO t2 VALUES (0), (null)
  52. query II
  53. SELECT k, x FROM t1 INNER MERGE JOIN t2 ON k = x
  54. ----
  55. 0 0