From 42f7e04c42715d34b2b311bdb6b1204d6be845d4 Mon Sep 17 00:00:00 2001 From: Mouli Mukherjee Date: Thu, 21 Sep 2023 15:06:44 -0700 Subject: [PATCH] moar test --- test/testdrive/kafka-avro-sinks-defaults.td | 38 +++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/testdrive/kafka-avro-sinks-defaults.td b/test/testdrive/kafka-avro-sinks-defaults.td index 32a4453e283f8..0fd32541f495c 100644 --- a/test/testdrive/kafka-avro-sinks-defaults.td +++ b/test/testdrive/kafka-avro-sinks-defaults.td @@ -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 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) @@ -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"}]}