multipart-key-after.td 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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": "string"},
  14. {"name": "f2", "type": "string"}
  15. ]
  16. }
  17. $ set schema={
  18. "type" : "record",
  19. "name" : "test",
  20. "fields" : [
  21. {"name":"f3", "type":"string"},
  22. {"name":"f4", "type":"string"}
  23. ]
  24. }
  25. > SELECT COUNT(*), COUNT(DISTINCT f2), COUNT(DISTINCT f4) FROM multipart_key_tbl WHERE f1 = 'KEY1';
  26. 10000 10000 10000
  27. > SELECT COUNT(*), COUNT(DISTINCT f1), COUNT(DISTINCT f3) FROM multipart_key_tbl WHERE f2 = 'KEY2';
  28. 10000 10000 10000
  29. # Delete all rows
  30. $ kafka-ingest format=avro topic=multipart-key key-format=avro key-schema=${keyschema} schema=${schema} repeat=10000
  31. {"f1": "KEY1", "f2": "${kafka-ingest.iteration}"}
  32. {"f1": "${kafka-ingest.iteration}", "f2": "KEY2"}
  33. > SELECT COUNT(*) FROM multipart_key_tbl;
  34. 0