-
Notifications
You must be signed in to change notification settings - Fork 595
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…19987) Signed-off-by: tabversion <[email protected]> Co-authored-by: Bohan Zhang <[email protected]> Co-authored-by: tabversion <[email protected]>
- Loading branch information
1 parent
336bbea
commit b364088
Showing
10 changed files
with
304 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
control substitution on | ||
|
||
system ok | ||
rpk registry schema create "opentelemetry_common.proto" --schema "/risingwave/src/connector/codec/tests/test_data/opentelemetry_common.proto" | ||
|
||
system ok | ||
rpk registry schema create "opentelemetry_test-value" --schema "/dev/stdin" --references opentelemetry_common.proto:opentelemetry_common.proto:1 --type protobuf << EOF | ||
syntax = "proto3"; | ||
package opentelemetry_test; | ||
import "opentelemetry_common.proto"; | ||
message OTLPTestMessage { | ||
opentelemetry.proto.common.v1.AnyValue any_value = 1; | ||
opentelemetry.proto.common.v1.KeyValueList key_value_list = 2; | ||
opentelemetry.proto.common.v1.InstrumentationScope instrumentation_scope = 3; | ||
} | ||
EOF | ||
|
||
|
||
system ok | ||
echo '{"any_value":{"string_value":"example"},"key_value_list":{"values":[{"key":"key1","value":{"string_value":"value1"}},{"key":"key2","value":{"int_value":42}}]},"instrumentation_scope":{"name":"test-scope","version":"1.0"}}' | rpk topic produce "opentelemetry_test" --schema-id=topic --schema-type="opentelemetry_test.OTLPTestMessage" --allow-auto-topic-creation | ||
|
||
statement ok | ||
create table opentelemetry_test with ( ${RISEDEV_KAFKA_WITH_OPTIONS_COMMON}, topic = 'opentelemetry_test' ) format plain encode protobuf ( schema.registry = '${RISEDEV_SCHEMA_REGISTRY_URL}', message = 'opentelemetry_test.OTLPTestMessage', messages_as_jsonb = 'opentelemetry.proto.common.v1.ArrayValue,opentelemetry.proto.common.v1.KeyValueList,opentelemetry.proto.common.v1.AnyValue'); | ||
|
||
statement ok | ||
flush; | ||
|
||
sleep 1s | ||
|
||
query T | ||
select count(*) from opentelemetry_test; | ||
---- | ||
1 | ||
|
||
query TTT | ||
select any_value, key_value_list, instrumentation_scope from opentelemetry_test; | ||
---- | ||
{"stringValue": "example"} {"values": [{"key": "key1", "value": {"stringValue": "value1"}}, {"key": "key2", "value": {"intValue": "42"}}]} (test-scope,1.0,{},0) | ||
|
||
# ==== clean up ==== | ||
|
||
statement ok | ||
drop table opentelemetry_test; | ||
|
||
system ok | ||
rpk topic delete opentelemetry_test; | ||
|
||
system ok | ||
rpk registry subject delete "opentelemetry_test-value" | ||
|
||
system ok | ||
rpk registry subject delete "opentelemetry_common.proto" |
41 changes: 41 additions & 0 deletions
41
e2e_test/source_inline/kafka/protobuf/recursive_overflow.slt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
control substitution on | ||
|
||
system ok | ||
rpk registry schema create "recursive_complex-value" --schema "/dev/stdin" --type protobuf << EOF | ||
syntax = "proto3"; | ||
// a recursive complex type can cause stack overflow in the frontend when inferring the schema | ||
package recursive_complex; | ||
message AnyValue { | ||
oneof value { | ||
string string_value = 1; | ||
int32 int_value = 2; | ||
double double_value = 3; | ||
bool bool_value = 4; | ||
ArrayValue array_value = 5; | ||
} | ||
} | ||
message ArrayValue { | ||
AnyValue value1 = 1; | ||
AnyValue value2 = 2; | ||
ArrayValue array_value = 3; | ||
} | ||
EOF | ||
|
||
|
||
system ok | ||
echo '{"array_value":{"value1":{"string_value":"This is a string value"},"value2":{"int_value":42},"array_value":{"value1":{"double_value":3.14159},"value2":{"bool_value":true},"array_value":{"value1":{"string_value":"Deeply nested string"},"value2":{"int_value":100}}}}}' | rpk topic produce "recursive_complex" --schema-id=topic --schema-type="recursive_complex.AnyValue" --allow-auto-topic-creation | ||
|
||
# the test just make sure the table can finish create process | ||
statement ok | ||
create table recursive_complex with ( ${RISEDEV_KAFKA_WITH_OPTIONS_COMMON}, topic = 'recursive_complex' ) format plain encode protobuf ( schema.registry = '${RISEDEV_SCHEMA_REGISTRY_URL}', message = 'recursive_complex.AnyValue', messages_as_jsonb = 'recursive_complex.AnyValue,recursive_complex.ArrayValue'); | ||
|
||
# ==== clean up ==== | ||
|
||
statement ok | ||
drop table recursive_complex; | ||
|
||
system ok | ||
rpk topic delete recursive_complex; | ||
|
||
system ok | ||
rpk registry subject delete "recursive_complex-value" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.