Parquet/parquet-mr — pull request #169 by davidzchen (2013-09-13 21:24:04+00:00)
Title: Fix avro empty maps arrays

This is a fix for Issue #162. When writing an Avro record out as Parquet, if the Avro schema has maps and /or arrays, writing a record where a map or array is empty would result in an exception thrown: "ParquetEncodingException: empty fields are illegal." This is due to the fact that recordConsumer.endField is called after no field was written because startField for the first map key or the first array element is being written even when the map or array is empty.

This fix adds a check to AvroWriteSupport.writeArray and AvroSupport.writeMap so that startField and endField for array/map elements are not written if empty, similar to what is done in parquet.thrift.ParquetWriteProtocol.ListWriteProtocol and .MapWriteProtocol.