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

feat: message_as_jsonb to handle circle dep in protobuf #19935

Merged
merged 22 commits into from
Dec 31, 2024

Conversation

tabVersion
Copy link
Contributor

@tabVersion tabVersion commented Dec 25, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

resolve #19915
following #18380

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

add a new field messages_as_jsonb dedicated to encode protobuf, it lists fields should be seen as jsonb type and we can leverage this to handle recursive types

for example,

message A {
  int32 int_value,
  string string_value,
}

If not set in messages_as_jsonb, the type in RW should be A struct<int_value int, string_value varchar>.
If messages_as_jsonb='some_pkg.A', the type in RW should be A jsonb.


When finding a recursive def in proto, we will display the circular dep relation and prevent creating the source/table.

Users can refer the error message and adding the types to messages_as_jsonb

circular reference detected: parent(recursive.ComplexRecursiveMessage.parent)->siblings(recursive.ComplexRecursiveMessage.Parent.siblings), conflict with parent(recursive.ComplexRecursiveMessage.parent), kind recursive.ComplexRecursiveMessage.Parent. Adding recursive.ComplexRecursiveMessage.Parent to "messages_as_jsonb" may help.

@xiangjinwu xiangjinwu marked this pull request as draft December 26, 2024 05:15
Copy link
Contributor

@xiangjinwu xiangjinwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure the PR is incomplete and untested so I converted it back to draft. You will notice the missing pieces when you start testing (in addition to the ci failure).

src/connector/src/parser/config.rs Outdated Show resolved Hide resolved
src/connector/src/parser/protobuf/parser.rs Outdated Show resolved Hide resolved
src/connector/codec/src/decoder/protobuf/parser.rs Outdated Show resolved Hide resolved
@tabVersion tabVersion marked this pull request as ready for review December 30, 2024 03:26
@graphite-app graphite-app bot requested a review from a team December 31, 2024 06:59
int32_value_field(#37): Struct { value: Int32 }, type_name: google.protobuf.Int32Value, field_descs: [value(#36): Int32],
string_value_field(#39): Struct { value: Varchar }, type_name: google.protobuf.StringValue, field_descs: [value(#38): Varchar],
map_struct_field(#44): Map(Varchar,Struct { id: Int32, name: Varchar }), type_name: all_types.AllTypes.MapStructFieldEntry, field_descs: [key(#40): Varchar, value(#43): Struct {
any_field(#33): Jsonb,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentional bug fix

@xiangjinwu xiangjinwu enabled auto-merge December 31, 2024 08:08
@tabVersion
Copy link
Contributor Author

tabVersion commented Jan 2, 2025

cherry pick to release 2.1 #19992

github-merge-queue bot pushed a commit that referenced this pull request Jan 2, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jan 2, 2025
…19987)

Signed-off-by: tabversion <[email protected]>
Co-authored-by: Bohan Zhang <[email protected]>
Co-authored-by: tabversion <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support circular reference of protobuf
2 participants