upsert-modification-after.td 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. # Update 5K records
  24. $ kafka-ingest format=avro topic=upsert-modification key-format=avro key-schema=${keyschema} schema=${schema} start-iteration=2500 repeat=5000
  25. {"f1": ${kafka-ingest.iteration}} {"f2": "a${kafka-ingest.iteration}"}
  26. > SELECT COUNT(*), MIN(f1), MAX(f1) FROM upsert_modification_tbl;
  27. 10000 0 9999
  28. > SELECT MIN(f1), MAX(f1), COUNT(*) FROM upsert_modification_tbl WHERE f2 LIKE 'a%';
  29. 2500 7499 5000
  30. $ kafka-ingest format=bytes topic=textbytes key-format=bytes key-terminator=:
  31. bírdmore:géese
  32. mammalmore:moose
  33. mammal1:
  34. mammal1:mouse
  35. > select * from texttext_tbl
  36. key text kafka_partition mz_offset
  37. ----------------------------------------------
  38. fish fish 0 0
  39. bírdmore géese 0 5
  40. mammal1 mouse 0 8
  41. mammalmore moose 0 6
  42. > select * from textbytes_tbl
  43. key data kafka_partition mz_offset
  44. -------------------------------------------------------
  45. fish fish 0 0
  46. bírdmore g\xc3\xa9ese 0 5
  47. mammal1 mouse 0 8
  48. mammalmore moose 0 6
  49. > select * from bytestext_tbl
  50. key text kafka_partition mz_offset
  51. ------------------------------------------------
  52. fish fish 0 0
  53. b\xc3\xadrdmore géese 0 5
  54. mammal1 mouse 0 8
  55. mammalmore moose 0 6
  56. > select * from bytesbytes_tbl
  57. key data kafka_partition mz_offset
  58. -------------------------------------------------------------
  59. fish fish 0 0
  60. b\xc3\xadrdmore g\xc3\xa9ese 0 5
  61. mammal1 mouse 0 8
  62. mammalmore moose 0 6