kafka-upsert-sources-key-decode-error.td 1.8 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-arg-default single-replica-cluster=quickstart
  10. $ set keyschema-1-int-key={
  11. "type": "record",
  12. "name": "Key",
  13. "fields": [
  14. {"name": "key", "type": "int"}
  15. ]
  16. }
  17. $ set keyschema-1-long-key={
  18. "type": "record",
  19. "name": "Key",
  20. "fields": [
  21. {"name": "key", "type": "long"}
  22. ]
  23. }
  24. $ set schema={
  25. "type" : "record",
  26. "name" : "test",
  27. "fields" : [
  28. {"name":"nokey", "type":"string"}
  29. ]
  30. }
  31. $ kafka-create-topic topic=int2long
  32. $ kafka-ingest format=avro topic=int2long key-format=avro key-schema=${keyschema-1-int-key} schema=${schema}
  33. {"key": 1234} {"nokey": "nokey1"}
  34. > CREATE CONNECTION IF NOT EXISTS csr_conn TO CONFLUENT SCHEMA REGISTRY (
  35. URL '${testdrive.schema-registry-url}'
  36. );
  37. > CREATE CONNECTION kafka_conn
  38. TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
  39. > CREATE SOURCE int2long
  40. IN CLUSTER ${arg.single-replica-cluster}
  41. FROM KAFKA CONNECTION kafka_conn (TOPIC
  42. 'testdrive-int2long-${testdrive.seed}')
  43. > CREATE TABLE int2long_tbl FROM SOURCE int2long (REFERENCE "testdrive-int2long-${testdrive.seed}")
  44. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  45. ENVELOPE UPSERT
  46. $ kafka-ingest format=avro topic=int2long key-format=avro key-schema=${keyschema-1-long-key} schema=${schema}
  47. {"key": 999999999999} {"nokey": "nokey1"}
  48. ! SELECT * FROM int2long_tbl
  49. contains:Writer schema has type `Long`, but reader schema has type `Int` for field `Key.key`