1_numbers_dataflow.slt 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. # use mode cockroach because it "respects the scale of a Decimal type and the precision of a floating point number"
  10. # even though mode standard would allow easier file comparisons with the other computation mode
  11. mode cockroach
  12. # -------------------------------
  13. # very small numbers
  14. # -------------------------------
  15. statement ok
  16. CREATE TABLE t_using_dataflow_rendering (real1 REAL, double1 DOUBLE PRECISION, numeric1 NUMERIC);
  17. statement ok
  18. INSERT INTO t_using_dataflow_rendering VALUES (1e-39::real, 1e-39::double, 1e-39::numeric);
  19. # DIFF TO CONSTANT FOLDING (SELECT on types [REAL, DOUBLE])!
  20. # to be addressed with https://github.com/MaterializeInc/database-issues/issues/4341
  21. query RRR
  22. SELECT * FROM t_using_dataflow_rendering
  23. UNION ALL
  24. SELECT SUM(real1), SUM(double1), SUM(numeric1)
  25. FROM t_using_dataflow_rendering;
  26. ----
  27. 0 0 0.000000000000000000000000000000000000001
  28. 0.000000000000000000000000000000000000001 0.000000000000000000000000000000000000001 0.000000000000000000000000000000000000001
  29. query T multiline
  30. EXPLAIN OPTIMIZED PLAN WITH (humanized expressions) AS VERBOSE TEXT FOR SELECT * FROM t_using_dataflow_rendering;
  31. ----
  32. Explained Query:
  33. ReadStorage materialize.public.t_using_dataflow_rendering
  34. Source materialize.public.t_using_dataflow_rendering
  35. Target cluster: quickstart
  36. EOF
  37. # -------------------------------
  38. # very big numbers
  39. # -------------------------------
  40. statement ok
  41. DELETE FROM t_using_dataflow_rendering;
  42. statement ok
  43. INSERT INTO t_using_dataflow_rendering VALUES (1e38::real, 1e38::double, 1e38::numeric);
  44. # DIFF TO CONSTANT FOLDING (SELECT on types [REAL, DOUBLE])!
  45. # to be addressed with https://github.com/MaterializeInc/database-issues/issues/4341
  46. query RRR
  47. SELECT * FROM t_using_dataflow_rendering
  48. UNION ALL
  49. SELECT SUM(real1), SUM(double1), SUM(numeric1)
  50. FROM t_using_dataflow_rendering;
  51. ----
  52. 10141205000000000000000000000000 10141204801825835000000000000000 100000000000000000000000000000000000000
  53. 100000000000000000000000000000000000000 100000000000000000000000000000000000000 100000000000000000000000000000000000000
  54. query T multiline
  55. EXPLAIN OPTIMIZED PLAN WITH (humanized expressions) AS VERBOSE TEXT FOR SELECT * FROM t_using_dataflow_rendering;
  56. ----
  57. Explained Query:
  58. ReadStorage materialize.public.t_using_dataflow_rendering
  59. Source materialize.public.t_using_dataflow_rendering
  60. Target cluster: quickstart
  61. EOF