Skip to content

Commit

Permalink
moar test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mouli Mukherjee committed Sep 21, 2023
1 parent c857006 commit 42f7e04
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/testdrive/kafka-avro-sinks-defaults.td
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ $ kafka-ingest format=avro topic=upsert-avro key-format=avro key-schema=${upsert
FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
ENVELOPE UPSERT

> SELECT * FROM upsert_input;
fisch 42 <null> 1000
fish 2 fish 1000

# Checking all combination of NULL DEFAULTS with and without values

> CREATE SINK upsert_input_sink1 FROM upsert_input
INTO KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-upsert-input-sink1-${testdrive.seed}')
KEY (key1, key2)
Expand Down Expand Up @@ -98,3 +104,35 @@ $ schema-registry-verify schema-type=avro subject=testdrive-upsert-input-sink3-$

$ schema-registry-verify schema-type=avro subject=testdrive-upsert-input-sink4-${testdrive.seed}-value
{"type":"record","name":"envelope","fields":[{"name":"key1","type":"string"},{"name":"key2","type":["null","long"]},{"name":"f1","type":["null","string"]},{"name":"f2","type":["null","long"]}]}

# Different types of columns
> CREATE TYPE point AS (x integer, y integer);

> CREATE TABLE t (c1 point, c2 text NOT NULL);
> INSERT INTO t SELECT ROW(1, 1)::point AS c1, 'text' AS c2;

> CREATE MATERIALIZED VIEW v AS SELECT * from t;

> CREATE SINK sink1 FROM v
INTO KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-sink1-${testdrive.seed}')
KEY (c2) NOT ENFORCED
FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
(
NULL DEFAULTS
)
ENVELOPE UPSERT

$ schema-registry-verify schema-type=avro subject=testdrive-sink1-${testdrive.seed}-value
{"type":"record","name":"envelope","fields":[{"name":"c1","type":["null",{"type":"record","name":"record0","namespace":"com.materialize.sink","fields":[{"name":"x","type":["null","int"],"default":"null"},{"name":"y","type":["null","int"],"default":"null"}]}],"default":"null"},{"name":"c2","type":"string"}]}

> CREATE SINK sink2 FROM v
INTO KAFKA CONNECTION kafka_conn (TOPIC 'testdrive-sink1-${testdrive.seed}')
KEY (c2) NOT ENFORCED
FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
(
NULL DEFAULTS FALSE
)
ENVELOPE UPSERT

$ schema-registry-verify schema-type=avro subject=testdrive-sink1-${testdrive.seed}-value
{"type":"record","name":"envelope","fields":[{"name":"c1","type":["null",{"type":"record","name":"record0","namespace":"com.materialize.sink","fields":[{"name":"x","type":["null","int"]},{"name":"y","type":["null","int"]}]}]},{"name":"c2","type":"string"}]}

0 comments on commit 42f7e04

Please sign in to comment.