Skip to content

Nested recursive proto message definitions result in RecursionError. #7

@abhishekrb19

Description

@abhishekrb19

Hello,

I have a nested recursive proto message of the form (a simplified example) shown below:

message Abc {
	string  id        = 1;
	Abc     abc_msg   = 2;
}

When I do the following:

from protodf import schema_for
schema = schema_for(Abc().DESCRIPTOR)`

The function throws a RecursionError. Looks like the nested recursive structure definition throws the schema_for function. I am not sure how to fix this - thoughts, @aroch @eldandev? Perhaps, we terminate and return at some depth? Thanks!

Please see a snippet of the stacktrace below:

  File "/Users/abhishek/projects/protodf-py/src/protodf/__init__.py", line 14, in <lambda>
    11: lambda t: schema_for(t.message_type),
  File "/Users/abhishek/projects/protodf-py/src/protodf/__init__.py", line 30, in schema_for
    __type_for(field_descriptor),
  File "/Users/abhishek/projects/protodf-py/src/protodf/__init__.py", line 40, in __type_for
    return ArrayType(get_type(field_descriptor))
  File "/Users/abhishek/projects/protodf-py/src/protodf/__init__.py", line 14, in <lambda>
    11: lambda t: schema_for(t.message_type),
  File "/Users/abhishek/projects/protodf-py/src/protodf/__init__.py", line 26, in schema_for
    struct_type = StructType()
  File "/Users/abhishek/spark/python/lib/pyspark.zip/pyspark/sql/types.py", line 496, in __init__
RecursionError: maximum recursion depth exceeded

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions