github-5717.slt 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. # Regression test for database-issues#5717 and database-issues#5722.
  10. # The query from database-issues#5717.
  11. statement ok
  12. CREATE SOURCE tpch
  13. FROM LOAD GENERATOR TPCH (SCALE FACTOR 0.00001);
  14. statement ok
  15. CREATE TABLE customer FROM SOURCE tpch (REFERENCE customer);
  16. statement ok
  17. CREATE TABLE lineitem FROM SOURCE tpch (REFERENCE lineitem);
  18. statement ok
  19. CREATE TABLE nation FROM SOURCE tpch (REFERENCE nation);
  20. statement ok
  21. CREATE TABLE orders FROM SOURCE tpch (REFERENCE orders);
  22. statement ok
  23. CREATE TABLE part FROM SOURCE tpch (REFERENCE part);
  24. statement ok
  25. CREATE TABLE partsupp FROM SOURCE tpch (REFERENCE partsupp);
  26. statement ok
  27. CREATE TABLE region FROM SOURCE tpch (REFERENCE region);
  28. statement ok
  29. CREATE TABLE supplier FROM SOURCE tpch (REFERENCE supplier);
  30. statement ok
  31. SET cluster_replica = r1
  32. statement ok
  33. select
  34. subq_0."c2" as c0,
  35. (select "id" from mz_introspection.mz_records_per_dataflow limit 1 offset 62)
  36. as c1,
  37. subq_0."c2" as c2
  38. from
  39. (select
  40. ref_0."id" as c0,
  41. ref_0."name" as c1,
  42. (select "count" from mz_introspection.mz_scheduling_parks_histogram_per_worker limit 1 offset 3)
  43. as c2,
  44. ref_0."name" as c3,
  45. ref_0."records" as c4,
  46. ref_0."batches" as c5
  47. from
  48. mz_introspection.mz_dataflow_arrangement_sizes as ref_0
  49. where pg_catalog.date(
  50. CAST((select "updated_at" from mz_internal.mz_cluster_replica_statuses limit 1 offset 5)
  51. as timestamptz)) < (select "o_orderdate" from public.orders limit 1 offset 1)
  52. limit 140) as subq_0
  53. where subq_0."c5" > subq_0."c5"
  54. limit 21;
  55. # The query from database-issues#5722.
  56. statement ok
  57. CREATE TABLE t (a int, b int);
  58. statement ok
  59. select
  60. 96 as c0,
  61. subq_0."c1" as c1
  62. from
  63. (select
  64. ref_0."name" as c0,
  65. 21 as c1
  66. from
  67. mz_introspection.mz_dataflow_operator_dataflows as ref_0
  68. where (select pg_catalog.count("batches") from mz_introspection.mz_arrangement_sizes_per_worker)
  69. = cast(coalesce((select "a" from public.t limit 1 offset 6)
  70. ,
  71. pg_catalog.pg_backend_pid()) as int4)) as subq_0
  72. where (subq_0."c1" <= subq_0."c1")
  73. or (pg_catalog.mod(
  74. CAST(cast(null as uint2) as uint2),
  75. CAST(pg_catalog.mod(
  76. CAST(pg_catalog.mod(
  77. CAST(cast(nullif(cast(null as uint2),
  78. cast(null as uint2)) as uint2) as uint2),
  79. CAST(cast(nullif(cast(null as uint2),
  80. cast(null as uint2)) as uint2) as uint2)) as uint2),
  81. CAST(pg_catalog.mod(
  82. CAST(case when (cast(null as uuid) <= (select "id" from mz_introspection.mz_active_peeks limit 1 offset 1)
  83. )
  84. or ((false)
  85. and (subq_0."c1" is not NULL)) then cast(null as uint2) else cast(null as uint2) end
  86. as uint2),
  87. CAST(cast(null as uint2) as uint2)) as uint2)) as uint2)) <> cast(nullif(cast(nullif(cast(null as uint2),
  88. pg_catalog.mod(
  89. CAST(case when (select "count" from mz_introspection.mz_compute_operator_durations_histogram limit 1 offset 6)
  90. > cast(null as numeric) then cast(null as uint2) else cast(null as uint2) end
  91. as uint2),
  92. CAST(cast(null as uint2) as uint2))) as uint2),
  93. cast(null as uint2)) as uint2))
  94. limit 99;