[ 
https://issues.apache.org/jira/browse/FLINK-34620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17824443#comment-17824443
 ] 

Artem commented on FLINK-34620:
-------------------------------

Opened a PR https://github.com/apache/flink/pull/24466

> Process recursive protobuf schemas in PbToRowTypeUtil
> -----------------------------------------------------
>
>                 Key: FLINK-34620
>                 URL: https://issues.apache.org/jira/browse/FLINK-34620
>             Project: Flink
>          Issue Type: Improvement
>          Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile)
>            Reporter: Artem
>            Priority: Major
>              Labels: pull-request-available
>
> The current version of _PbToRowTypeUtil.generateRowType_ doesn't support 
> recursive protobuf schemas like
> {code:java}
> message RecursiveMessage {
> int32 id = 1;
> RecursiveMessage message = 2;
> } {code}
> It throws _java.lang.StackOverflowError._
> This could be implemented by trimming the recursion. Same approach is used in 
> Apache Spark, for example. 
> [GitHub|https://github.com/apache/spark/blob/master/connector/protobuf/src/main/scala/org/apache/spark/sql/protobuf/utils/SchemaConverters.scala#L178]
>  
> then output Table schemas for the above proto-schema will be like this:
> {code:java}
> recursiveFieldMaxDepth=0: message: ROW< id: INTEGER > 
> recursiveFieldMaxDepth=1: message: ROW< id: INTEGER, message: ROW< id: 
> INTEGER > > recursiveFieldMaxDepth=2: message: ROW< id: INTEGER, message: 
> ROW< id: INTEGER, message: ROW< id: INTEGER > > > {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to