Created 03-27-2016 04:43 AM
Greetings!
I was trying to write some sample Avro schemas, and was unable to create one for an array of array.
{
  "testarray":[[1,2,3][4,5,6] ... ]
}								{
  "name": "testarray",
  "type": {
    "type":"array",
    "items": {
      "type": {
        "type":"array",
        "items": {
          "name": "temp",
          "type":"long"
        }
      }
    }
  }
}But the schema parser throws this error -
---
Exception in thread "main" org.apache.avro.SchemaParseException: No type: {"name":"testarray","type":{"type":"array","items":{"type":{"type":"array","items":{"name":"temp","type":"long"}}}}}
at org.apache.avro.Schema.getRequiredText(Schema.java:1372)
at org.apache.avro.Schema.parse(Schema.java:1231)
at org.apache.avro.Schema$Parser.parse(Schema.java:1031)
at org.apache.avro.Schema$Parser.parse(Schema.java:996)
at com.flipkart.de.App.main(App.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Process finished with exit code 1Created 03-31-2016 05:44 PM
Try this format:
{
"name": "testarray"
"type": "array", 
"items": {
	"name": "Record1Array”, 
	"type": "record", 
	"fields" : [{
		“name": "Array1Value”, 
		"type": {
			"type": "array", 
			"items": {
				"name": "Record2Array”,
				"type":"record", 
				"fields" : [{
						"name”:”Array2Value”, 
						"type": "string"
					   }]
				  }
			}
		  }]
	}
}
Also, when dealing with Avro use Avro IDL; It makes writing/testing schemas easier.
Created 04-07-2016 10:46 AM
This schema corresponds to an array of records (which in turn has arrays), but not an array of array?