repeated-source-rendering-before.td 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 schema={
  10. "type" : "record",
  11. "name" : "test",
  12. "fields" : [
  13. {"name":"f1", "type":"long"}
  14. ]
  15. }
  16. $ kafka-create-topic topic=re-created partitions=1
  17. # Make sure that we can render a source (by creating an indexed view), drop
  18. # it, and render it again.
  19. $ kafka-ingest format=avro topic=re-created schema=${schema} repeat=10
  20. {"f1": ${kafka-ingest.iteration}}
  21. > CREATE CONNECTION IF NOT EXISTS csr_conn TO CONFLUENT SCHEMA REGISTRY (
  22. URL '${testdrive.schema-registry-url}'
  23. );
  24. > CREATE CONNECTION IF NOT EXISTS kafka_conn TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
  25. > CREATE SOURCE re_created
  26. FROM KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-re-created-${testdrive.seed}')
  27. > CREATE TABLE re_created_tbl FROM SOURCE re_created (REFERENCE "testdrive-re-created-${testdrive.seed}")
  28. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  29. INCLUDE PARTITION AS kafka_partition, OFFSET AS mz_offset
  30. ENVELOPE NONE
  31. > CREATE VIEW a_view AS SELECT * FROM re_created_tbl;
  32. > CREATE DEFAULT INDEX ON a_view;
  33. > SELECT COUNT(*) FROM a_view;
  34. 10
  35. > DROP VIEW a_view;
  36. > CREATE VIEW a_view AS SELECT * FROM re_created_tbl;
  37. > CREATE DEFAULT INDEX ON a_view;
  38. > SELECT COUNT(*) FROM a_view;
  39. 10
  40. # Same with DROP INDEX
  41. > DROP INDEX a_view_primary_idx;
  42. > CREATE DEFAULT INDEX ON a_view;
  43. > SELECT COUNT(*) FROM a_view;
  44. 10