Protobuf supports recursive schemes - but note that each object is separate (it 
is a tree, not a graph). For example, descriptor.proto includes the 
self-referential "DescriptorProto" (which is a "message" in language terms)

// Describes a message type.
message DescriptorProto {
  optional string name = 1;

  repeated FieldDescriptorProto field = 2;
  repeated FieldDescriptorProto extension = 6;

  repeated DescriptorProto nested_type = 3;
  repeated EnumDescriptorProto enum_type = 4;

  message ExtensionRange {
    optional int32 start = 1;
    optional int32 end = 2;
  }
  repeated ExtensionRange extension_range = 5;

  optional MessageOptions options = 7;
}

Marc

On 20 Jul 2013, at 00:41, pbjson <[email protected]> wrote:

> 
> Hello,
> 
> Has anyone seen the following structure in protobuffer?
> 
> 
> message KeyValue{
> 
>  required string key=1;
>  optional string  value=2;
>  optional KeyValue key_value=10;
> 
> }
> 
> this is a circular reference and how would you resolve this if you have 
> convert this to a flat structure of primitives for eg: to be converted to a 
> hive schema.
> 
> eg: keyvalue<key:string,value string, key_value:string>
> 
> Has anyone come across such a situation and any better way to do this?
> 
> Thanks in advance.
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to