timestamp-interval.td 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. $ set-arg-default single-replica-cluster=quickstart
  10. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  11. ALTER SYSTEM SET min_timestamp_interval = '500ms'
  12. ! CREATE SOURCE foo
  13. IN CLUSTER ${arg.single-replica-cluster}
  14. FROM LOAD GENERATOR COUNTER with (TIMESTAMP INTERVAL '100ms')
  15. contains:invalid timestamp interval of 100ms, must be in the range [500ms, 1000ms]
  16. > CREATE SOURCE quick_counter
  17. IN CLUSTER ${arg.single-replica-cluster}
  18. FROM LOAD GENERATOR COUNTER with (TIMESTAMP INTERVAL '500ms')
  19. > SELECT c1=c2 from (SELECT COUNT(*) as c1 from quick_counter), (SELECT COUNT(*) as c2 from quick_counter)
  20. true
  21. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  22. ALTER SYSTEM SET max_timestamp_interval = '2s'
  23. > CREATE SOURCE slow_counter
  24. IN CLUSTER ${arg.single-replica-cluster}
  25. FROM LOAD GENERATOR COUNTER with (TIMESTAMP INTERVAL '2s')
  26. > SELECT c1=c2 from (SELECT COUNT(*) as c1 from slow_counter), (SELECT COUNT(*) as c2 from slow_counter)
  27. true
  28. $ set schema={"type": "record", "name": "schema", "fields": [ {"name": "f1", "type": ["int", "null"]} , {"name": "f2", "type": ["int", "null"]}] }
  29. $ kafka-create-topic topic=top1
  30. $ kafka-ingest format=avro topic=top1 schema=${schema} timestamp=1
  31. > CREATE CONNECTION IF NOT EXISTS csr_conn TO CONFLUENT SCHEMA REGISTRY (
  32. URL '${testdrive.schema-registry-url}'
  33. );
  34. > CREATE CONNECTION kafka_conn
  35. TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
  36. > CREATE SOURCE t1
  37. IN CLUSTER ${arg.single-replica-cluster}
  38. FROM KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-top1-${testdrive.seed}')
  39. WITH (TIMESTAMP INTERVAL '500ms')
  40. > CREATE TABLE t1_tbl FROM SOURCE t1 (REFERENCE "testdrive-top1-${testdrive.seed}")
  41. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  42. ENVELOPE NONE
  43. > DROP SOURCE quick_counter CASCADE
  44. > DROP SOURCE slow_counter CASCADE