Skip to content

Commit

Permalink
e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangjinwu committed Dec 10, 2024
1 parent 0279bf0 commit 4a938b1
Showing 1 changed file with 95 additions and 4 deletions.
99 changes: 95 additions & 4 deletions e2e_test/source_inline/kafka/avro/ref.slt
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,102 @@ select
(bar).b.y
from s;
----
3 4 5 6 NULL NULL NULL NULL
3 4 5 6 6 5 4 3

# Parsing of column `bar` fails even with ints because now `schema` is required.
# This will be fully supported in the next PR
# 3 4 5 6 6 5 4 3

statement ok
drop source s;


system ok
curl -X DELETE "${RISEDEV_SCHEMA_REGISTRY_URL}/subjects/avro-ref-value"


system ok
curl -X DELETE "${RISEDEV_SCHEMA_REGISTRY_URL}/subjects/avro-ref-value?permanent=true"


system ok
rpk topic delete 'avro-ref'


system ok
rpk topic create avro-ref


system ok
sr_register avro-ref-value AVRO <<EOF
{
"type": "record",
"name": "Root",
"fields": [
{
"name": "foo",
"type": {
"type": "record",
"name": "Seg",
"fields": [
{
"name": "a",
"type": {
"type": "record",
"name": "Point",
"fields": [
{
"name": "x",
"type": {
"type": "bytes",
"logicalType": "decimal",
"precision": 4,
"scale": 2
}
},
{
"name": "y",
"type": "int"
}
]
}
},
{
"name": "b",
"type": "Point"
}
]
}
},
{
"name": "bar",
"type": "Seg"
}
]
}
EOF


statement ok
create source s WITH (${RISEDEV_KAFKA_WITH_OPTIONS_COMMON}, topic = 'avro-ref') FORMAT PLAIN ENCODE AVRO (schema.registry = '${RISEDEV_SCHEMA_REGISTRY_URL}');


system ok
rpk topic produce avro-ref --schema-id=topic <<EOF
{"foo":{"a":{"x":"\u0001\u002c","y":4},"b":{"x":"\u0001\u00f4","y":6}},"bar":{"a":{"x":"\u0002\u0058","y":5},"b":{"x":"\u0001\u0090","y":3}}}
EOF


query RIRIRIRI
select
(foo).a.x,
(foo).a.y,
(foo).b.x,
(foo).b.y,
(bar).a.x,
(bar).a.y,
(bar).b.x,
(bar).b.y
from s;
----
3.00 4 5.00 6 6.00 5 4.00 3


statement ok
Expand Down

0 comments on commit 4a938b1

Please sign in to comment.