Here is my schema, I am not able to read the full schema with generic record,

{
  "type" : "record",
  "name" : "avro_schema",
  "namespace" : "avro",
  "doc" : "The generic avro schema used by publishers to publish events to
the enterprise streaming service",
  "fields" : [ 
  
          {"name" : "event", 
                                        "type" : {
                         "type" : "record",
                         "name" : "event_meta_data",
                         "fields" : [
                            {"name" : "event_name", 
                             "type" : "string", 
                             "doc" : "The name of the event.  In the CDC,
this field is populated with the name of the data base table or segment."},

                            {"name" : "operation_type", 
                             "type" : "string", 
                            "doc": "The operation or action that triggered
the event.  e.g., Insert, Update, Delete, etc."},

                            {"name" : "transaction_identifier", 
                             "type" : "string", 
                             "default" : "NONE",
                            "doc" : "A unique identifier that identifies a
unit or work or transaction.  Useful in relating multiple events
together."},

                            {"name" : "event_publication_timestamp_millis", 
                             "type" : "string", 
                            "doc": "timestamp when the event was
published"},
                            
                            {"name" : "event_publisher", 
                             "type" : "string", 
                            "doc" : "The system or application that
published the event"},
                            
                            {"name" : "event_publisher_identity",
                            "type": "string",
                            "default" : "NONE",
                            "doc": "The identity (user) of the system or
application that published the event"},
                            
                             {"name" : "event_timestamp_millis", 
                             "type" : "string",
                             "default" : "NONE",
                            "doc": "timestamp when the event occured"},
                            
                            {"name": "event_initiator",
                            "type": "string",
                            "default" : "NONE",
                            "doc" : "The system or application that
initiated the event"},
                            
                            {"name": "event_initiator_identity",
                            "type" : "string",
                            "default" : "NONE",
                            "doc": "The system id or application id that
initiated the event" }
                            
                            
                          ]},
                          "doc" : "The data about the published event"
          },
          { "name" : "contents",
                                        "type" : {
                                                "name": "data_field_groups",
                                                "type": "array",
                                                "items": {
                                                        "type": "record",
                                                        "name": 
"data_field_group",
                                                        "fields" : [
                                                                {"name": 
"data_group_name",
                                                                 "type": 
"string"
                                                                },
                                                                {
                                                                "name": 
"data_fields",
                                                                "type": {
                                                                        "type": 
"array",
                                                                        
"items": {
                                                                                
"name": "data_field",
                                                                                
"type":  "record",
                                                                                
"fields":[
                                                                                
        {"name" : "data_field_name",
                                                                                
          "type" : "string",
                                                                                
          "doc" : "The field name"},  
                                                         
                                                                                
        {"name": "data_field_type",
                                                                                
        "type": "string",
                                                                                
        "doc" : "The data type is one of the following values: string,
boolean, int, long, float, double or bytes"},
                                                          
                                                                                
        {"name" : "data_field_value",
                                                                                
         "type" : "string",
                                                                                
          "doc" : "The value"}
                                                                                
]
                                                                        }
                                                                
                                                                }
                                                        
                                                        }
                                                ]
                                        }
                                        },
                                        "doc" : "The datafields for the for the 
published event"
          } 
  ]
}


Here is my code to read above schema: I can only read event part of it, how
to get the contents 


                Schema schema = new           
 
Schema.Parser().parse(newFile("resources/edm_generic_publisher_avro_schema_v2.avsc"));
                GenericRecord AvroRec = new GenericData.Record(schema);
                GenericRecord event = new
GenericData.Record(schema.getField("event").schema());






--
Sent from: http://apache-avro.679487.n3.nabble.com/Avro-Users-f679479.html

Reply via email to