Parquet/parquet-mr — pull request #180 by davidzchen (2013-09-28 00:50:48+00:00)
Title: Support writing Avro records with maps with Utf8 keys

When converting a test data set from Avro to Parquet, I encountered the following exception:

13/09/27 17:46:10 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Exception in thread "main" java.lang.ClassCastException: org.apache.avro.util.Utf8 cannot be cast to java.lang.String
at parquet.avro.AvroWriteSupport.writeMap(AvroWriteSupport.java:139)
at parquet.avro.AvroWriteSupport.writeValue(AvroWriteSupport.java:207)
at parquet.avro.AvroWriteSupport.writeRecordFields(AvroWriteSupport.java:105)
at parquet.avro.AvroWriteSupport.write(AvroWriteSupport.java:80)
at parquet.avro.AvroWriteSupport.write(AvroWriteSupport.java:43)
at parquet.hadoop.InternalParquetRecordWriter.write(InternalParquetRecordWriter.java:105)
at parquet.hadoop.ParquetWriter.write(ParquetWriter.java:102)
at com.linkedin.column.performance.AvroParquetConverter.convert(AvroParquetConverter.java:45)
at com.linkedin.column.performance.AvroParquetConverter.main(AvroParquetConverter.java:74)

I found that the GenericRecord that I read from the Avro file and was passing to the AvroParquetWriter used the Avro Utf8 type for map keys rather than String keys because Avro uses Utf8 instead of String internally.

This PR contains a fix to allow AvroWriteSupport to support map keys that are Utf8 in addition to String.