Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(source): resolve avro Ref during access without hack #19746

Merged
merged 4 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading
Loading