forked from MaterializeInc/materialize
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathavro-resolution-types-array.td
More file actions
41 lines (31 loc) · 1.63 KB
/
Copy pathavro-resolution-types-array.td
File metadata and controls
41 lines (31 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
# by the Apache License, Version 2.0.
#
# Make sure that schema incompatibility issues within arrays are detected and reported
#
$ set array-double={"type": "record", "name": "schema_array", "fields": [ {"name": "f1", "type": { "type": "array", "items": "double" } } ] }
$ set array-int={"type": "record", "name": "schema_array", "fields": [ {"name": "f1", "type": { "type": "array", "items": "int" } } ] }
$ kafka-create-topic topic=resolution-arrays
$ kafka-ingest format=avro topic=resolution-arrays schema=${array-int} timestamp=1
{"f1": [ 123 ] }
> CREATE CONNECTION IF NOT EXISTS csr_conn TO CONFLUENT SCHEMA REGISTRY (
URL '${testdrive.schema-registry-url}'
);
> CREATE CONNECTION kafka_conn
TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
> CREATE SOURCE resolution_arrays
FROM KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-resolution-arrays-${testdrive.seed}')
FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
ENVELOPE NONE
$ kafka-ingest format=avro topic=resolution-arrays schema=${array-double} timestamp=2
{"f1": [ 234.345 ] }
! SELECT f1[0] FROM resolution_arrays
contains:Writer schema has type `Double`, but reader schema has type `Int` for field `schema_array.f1`
! SELECT f1[0] FROM resolution_arrays
contains:failed to resolve Avro schema (id =