Skip to main content

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
Will be converted to 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 to messages_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 the optional keyword) receive their default values when absent from the protobuf message:
Example

Optional fields

Fields marked with the optional keyword are set to NULL when absent:
Example

Message fields

Message fields (nested messages) are set to NULL when absent:
Example

Oneof fields

Fields within a oneof group are set to NULL when the oneof is not set or a different field in the group is set:
Example
Only one field within a oneof can be non-NULL at a time.