avro-resolution-types.td 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #
  11. # Make sure that we reject changes of basic column types even if the schema registry reports that the two
  12. # schemas are compatible. It is up to Materialize to reject the value
  13. #
  14. $ set int-col={"type": "record", "name": "schema_int_double", "fields": [ {"name": "f1", "type": "int"} ] }
  15. $ set double-col={"type": "record", "name": "schema_int_double", "fields": [ {"name": "f1", "type": "double"} ] }
  16. $ kafka-create-topic topic=resolution-int2double
  17. $ kafka-ingest format=avro topic=resolution-int2double schema=${int-col} timestamp=1
  18. {"f1": 123}
  19. > CREATE CONNECTION IF NOT EXISTS csr_conn TO CONFLUENT SCHEMA REGISTRY (
  20. URL '${testdrive.schema-registry-url}'
  21. );
  22. > CREATE CONNECTION kafka_conn
  23. TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
  24. > CREATE SOURCE resolution_int2double
  25. IN CLUSTER ${arg.single-replica-cluster}
  26. FROM KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-resolution-int2double-${testdrive.seed}')
  27. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  28. ENVELOPE NONE
  29. $ kafka-ingest format=avro topic=resolution-int2double schema=${double-col} timestamp=2
  30. {"f1": 234.456}
  31. ! SELECT * FROM resolution_int2double
  32. contains:Writer schema has type `Double`, but reader schema has type `Int` for field `schema_int_double.f1`
  33. ! SELECT * FROM resolution_int2double
  34. contains:failed to resolve Avro schema (id =