topic-compaction-before.td 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 keyschema={
  10. "type": "record",
  11. "name": "Key",
  12. "fields": [
  13. {"name": "f1", "type": "long"}
  14. ]
  15. }
  16. $ set schema={
  17. "type" : "record",
  18. "name" : "test",
  19. "fields" : [
  20. {"name":"f2", "type":"string"}
  21. ]
  22. }
  23. $ kafka-create-topic topic=topic-compaction compaction=true
  24. $ kafka-ingest format=avro topic=topic-compaction key-format=avro key-schema=${keyschema} schema=${schema} repeat=1000
  25. {"f1": ${kafka-ingest.iteration}} {"f2": "A${kafka-ingest.iteration}"}
  26. {"f1": ${kafka-ingest.iteration}} {"f2": "B${kafka-ingest.iteration}"}
  27. {"f1": ${kafka-ingest.iteration}} {"f2": "C${kafka-ingest.iteration}"}
  28. > CREATE CONNECTION IF NOT EXISTS csr_conn TO CONFLUENT SCHEMA REGISTRY (
  29. URL '${testdrive.schema-registry-url}'
  30. );
  31. > CREATE CONNECTION IF NOT EXISTS kafka_conn TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
  32. > CREATE SOURCE topic_compaction
  33. FROM KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-topic-compaction-${testdrive.seed}');
  34. > CREATE TABLE topic_compaction_tbl FROM SOURCE topic_compaction (REFERENCE "testdrive-topic-compaction-${testdrive.seed}")
  35. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  36. ENVELOPE UPSERT;
  37. > SELECT COUNT(*) > 0 FROM topic_compaction_tbl;
  38. true