Skip to content

Improve error message in Kafka connector when parsing recursive protobuf schemas#15724

Merged
hashhar merged 5 commits intotrinodb:masterfrom
hashhar:hashhar/kafka-avoid-schema-parsing-loop
Feb 9, 2023
Merged

Improve error message in Kafka connector when parsing recursive protobuf schemas#15724
hashhar merged 5 commits intotrinodb:masterfrom
hashhar:hashhar/kafka-avoid-schema-parsing-loop

Conversation

@hashhar
Copy link
Copy Markdown
Member

@hashhar hashhar commented Jan 16, 2023

Description

Kafka connector throws a StackOverflowError when the protobuf schema
includes self referenced object types.
To improve user experience the schema parsing now throws TrinoException
saying that the type is unsupported.

Release notes

(x) Release notes are required, with the following suggested text:

# Section
* Improve error message in Kafka connector when parsing recursive protobuf schemas. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Jan 16, 2023
@hashhar
Copy link
Copy Markdown
Member Author

hashhar commented Jan 16, 2023

This is resubmission of #15312 with conflicts and review comments addressed.

@hashhar hashhar force-pushed the hashhar/kafka-avoid-schema-parsing-loop branch 3 times, most recently from a38b4ec to 2e72ce1 Compare January 17, 2023 15:37
Copy link
Copy Markdown
Member

@nevillelyh nevillelyh left a comment

Choose a reason for hiding this comment

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

LGTM with minor comments

Copy link
Copy Markdown
Member

@Praveen2112 Praveen2112 left a comment

Choose a reason for hiding this comment

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

Looks good to me after applying @nevillelyh 's comment.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Can we add a issue to remove this workaround on generating the code ? The way we invoke parser should support it out of the box, I have a rough fix for it and will be working on a PR for the same.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sure, I'll create an issue + add TODO.

cc: @adamjshook regarding some schema parser improvements Praveen plans to make which might be relevant for you.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yup, that'd be relevant as I am using the same plugin. I'll keep an eye out for it.

@hashhar hashhar force-pushed the hashhar/kafka-avoid-schema-parsing-loop branch from 2e72ce1 to fb3b330 Compare February 8, 2023 09:08
@hashhar
Copy link
Copy Markdown
Member Author

hashhar commented Feb 8, 2023

@nevillelyh / @Praveen2112 PTAL at the fixup which improves error message and also stops relying on ImmutableSet's insertion order iteration.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This error message goes to user, they are not much aware of trino java packages. Should use field names from protobuf schema?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

mx123 and others added 2 commits February 9, 2023 10:49
Kafka protobuf schema cannot be translated to a Trino type when the
protobuf schema uses recursive reference to some types.

Co-authored-by: Maxim Lukyanenko <mlukyanenko@gmail.com>
Co-authored-by: Ashhar Hasan <ashhar.hasan@starburstdata.com>
Writing protobuf messages using TestingKafka throws
NullPointerException if the schema uses an `import` directive.

Co-authored-by: Maxim Lukyanenko <mlukyanenko@gmail.com>
Co-authored-by: Ashhar Hasan <ashhar.hasan@starburstdata.com>
hashhar and others added 2 commits February 9, 2023 10:49
Co-authored-by: Maxim Lukyanenko <mlukyanenko@gmail.com>
Co-authored-by: Ashhar Hasan <ashhar.hasan@starburstdata.com>
@hashhar hashhar force-pushed the hashhar/kafka-avoid-schema-parsing-loop branch from fb3b330 to 35a8d05 Compare February 9, 2023 05:47
@hashhar
Copy link
Copy Markdown
Member Author

hashhar commented Feb 9, 2023

auto-squashed, will merge once CI is done.

Kafka connector throws a StackOverflowError when the protobuf schema
includes self referenced object types.
To improve user experience the schema parsing now throws TrinoException
saying that the type is unsupported.

Co-authored-by: Maxim Lukyanenko <mlukyanenko@gmail.com>
Co-authored-by: Ashhar Hasan <ashhar.hasan@starburstdata.com>
@hashhar hashhar force-pushed the hashhar/kafka-avoid-schema-parsing-loop branch from 35a8d05 to 24d3033 Compare February 9, 2023 06:03
@hashhar hashhar changed the title Fix failure in Kafka connector when parsing recursive protobuf schemas Improve error message in Kafka connector when parsing recursive protobuf schemas Feb 9, 2023
@hashhar hashhar merged commit 2aaba53 into trinodb:master Feb 9, 2023
@hashhar hashhar deleted the hashhar/kafka-avoid-schema-parsing-loop branch February 9, 2023 11:08
<!-- TODO: Instead of using this plugin to generate classes we should invoke the parser directly (https://github.com/trinodb/trino/issues/16039) -->
<plugin>
<groupId>com.github.os72</groupId>
<artifactId>protoc-jar-maven-plugin</artifactId>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's use a specific version of this plugin - #16043

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thank you.

@github-actions github-actions bot added this to the 407 milestone Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

7 participants