use of org.apache.hadoop.hive.serde2.typeinfo.MapTypeInfo in project cdap by caskdata.
the class ObjectDeserializer method deserializeMap.
@SuppressWarnings("unchecked")
private Object deserializeMap(Object mapField, MapTypeInfo typeInfo, Map.Entry<Schema, Schema> mapSchema) throws NoSuchFieldException, IllegalAccessException {
Map<Object, Object> ourMap = (Map) mapField;
TypeInfo keyType = typeInfo.getMapKeyTypeInfo();
TypeInfo valType = typeInfo.getMapValueTypeInfo();
Schema keySchema = mapSchema.getKey();
Schema valSchema = mapSchema.getValue();
Map translatedMap = Maps.newHashMap();
for (Map.Entry entry : ourMap.entrySet()) {
translatedMap.put(deserializeField(entry.getKey(), keyType, keySchema), deserializeField(entry.getValue(), valType, valSchema));
}
return translatedMap;
}
Aggregations