Github user kunal642 commented on a diff in the pull request: https://github.com/apache/carbondata/pull/2261#discussion_r186055186 --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestNonTransactionalCarbonTable.scala --- @@ -750,7 +750,93 @@ class TestNonTransactionalCarbonTable extends QueryTest with BeforeAndAfterAll { buildAvroTestData(3, null) } - test("Read sdk writer Avro output ") { + def buildAvroTestDataArrayType(rows: Int, options: util.Map[String, String]): Any = { + FileUtils.deleteDirectory(new File(writerPath)) + /** + * * + * { + * "name": "address", + * "type": "record", + * "fields": [ + * { + * "name": "name", + * "type": "string" + * }, + * { + * "name": "age", + * "type": "int" + * }, + * { + * "name": "address", + * "type": { + * "type": "array", + * "items": { + * "name": "street", + * "type": "string" + * } + * } + * } + * ] + * } + **/ + val mySchema = "{\n" + "\t\"name\": \"address\",\n" + "\t\"type\": \"record\",\n" + + "\t\"fields\": [\n" + "\t\t{\n" + "\t\t\t\"name\": \"name\",\n" + + "\t\t\t\"type\": \"string\"\n" + "\t\t},\n" + "\t\t{\n" + + "\t\t\t\"name\": \"age\",\n" + "\t\t\t\"type\": \"int\"\n" + "\t\t},\n" + + "\t\t{\n" + "\t\t\t\"name\": \"address\",\n" + "\t\t\t\"type\": {\n" + + "\t\t\t\t\"type\": \"array\",\n" + "\t\t\t\t\"items\": {\n" + + "\t\t\t\t\t\"name\": \"street\",\n" + + "\t\t\t\t\t\"type\": \"string\"\n" + "\t\t\t\t}\n" + "\t\t\t}\n" + + "\t\t}\n" + "\t]\n" + "}" + /** + * { + * "name": "bob", + * "age": 10, + * "address": [ + * "abc", "def" + * ] + * } + **/ + val json: String = "{\n" + "\t\"name\": \"bob\",\n" + "\t\"age\": 10,\n" + + "\t\"address\": [\n" + "\t\t\"abc\", \"defg\"\n" + "\t]\n" + "}" + // conversion to GenericData.Record + val nn = new org.apache.avro.Schema.Parser().parse(mySchema) + val converter = new JsonAvroConverter + val record = converter + .convertToGenericDataRecord(json.getBytes(CharEncoding.UTF_8), nn) + val fields = new Array[Field](3) + fields(0) = new Field("name", DataTypes.STRING) + fields(1) = new Field("age", DataTypes.INT) + // fields[1] = new Field("age", DataTypes.INT); --- End diff -- remove commented code
---