//(Mumbai,20,Applied Math,UAH,Indians,4468)
//(Praj,54,RMX,Champaign,LNU,0)
//(Pune,60,Astrophysics,UTA,Warriors,5466)
//(Rajsathan,20,Biochemistry,Stanford,Royals,1378)
Data data = resetData(pigServerLocal);
String output= outbasedir + "testMultipleSchemasWithDefaultValue";
deleteDirectory(new File(output));
String expected = basedir + "expected_testMultipleSchemasWithDefaultValue.avro";
String [] queries = {
" a = LOAD '" + testMultipleSchemasWithDefaultValue +
"' USING org.apache.pig.piggybank.storage.avro.AvroStorage ('multiple_schemas');",
" b = foreach a generate name,age,dept,office,lastname,salary;",
" c = filter b by age < 40 ;",
" d = order c by name;",
" STORE d INTO '" + output+ "' using mock.Storage();"
};
testAvroStorage(queries);
List<Tuple> out = data.get(output);
assertEquals(out + " size", 5, out.size());
assertEquals(
schema("name: chararray,age: int,dept: chararray,office: chararray,lastname: chararray,salary: int"),
data.getSchema(output));
assertEquals(tuple("Asmya", 34, "PQ", "OU", "LNU", 0), out.get(0));
assertEquals(tuple("Baljit", 23, "RS", "OU", "LNU", 0), out.get(1));
assertEquals(tuple("Milo", 30, "DH", "OU", "LNU", 0), out.get(2));
assertEquals(tuple("Mumbai", 20, "Applied Math", "UAH", "Indians", 4468), out.get(3));
assertEquals(tuple("Rajsathan", 20, "Biochemistry", "Stanford", "Royals", 1378), out.get(4));