Conversion
RisingWave converts well-known types from the protobuf library to specific types in RisingWave. The conversion is as follows:Nested messages
The nested fields are transformed into columns within a struct type. For example, a Protobuf message with the following structure:Example
struct<id int, name varchar> in RisingWave.
Handle recursive definitions
When detecting a recursive definition in the protobuf, RisingWave will reject the statement and show the circular dependency. Adding dependency items tomessages_as_jsonb with full type name separated by comma can solve the case. For example:
Field presence
RisingWave correctly handles protobuf field presence to distinguish between missing fields and fields explicitly set to their default values. The handling depends on the field type:Regular primitive fields
Regular primitive fields (without theoptional keyword) receive their default values when absent from the protobuf message:
Example
Optional fields
Fields marked with theoptional keyword are set to NULL when absent:
Example
Message fields
Message fields (nested messages) are set toNULL when absent:
Example
Oneof fields
Fields within aoneof group are set to NULL when the oneof is not set or a different field in the group is set:
Example
oneof can be non-NULL at a time.