我有一个map-reduce java程序,我尝试只压缩mapper输出但不压缩reducer输出.我认为这可以通过在Configuration实例中设置以下属性来实现,如下所示.但是,当我运行我的作业时,reducer生成的输出仍然被压缩,因为生成的文件是:part-r-00000.gz.有没有人成功地压缩了映射器数据而不是缩减器?这甚至可能吗?
//压缩映射器输出
conf.setBoolean("mapred.output.compress", true);
conf.set("mapred.output.compression.type", CompressionType.BLOCK.toString());
conf.setClass("mapred.output.compression.codec", GzipCodec.class, CompressionCodec.class);
Run Code Online (Sandbox Code Playgroud) 有没有人使用GenericData.Record过Avro和嵌套的地图记录.给出以下架构,我正在努力填充GenericData.Record地图:
{"name": "log_data", "type":
[ "null",
{ "type": "map", "values":
{ "type": "record",
"name": "TypeValuePair",
"fields": [
{"name": "type", "type": "string"},
{"name": "value", "type": ["null", "string"]}
]
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
java代码:
Schema mapSchema = schema.getField("log_data").schema().getTypes().get(1);
//The code below fails
GenericRecord typeValuePair =
new GenericData.Record(mapSchema.getField("TypeValuePair").schema());
Run Code Online (Sandbox Code Playgroud)
有:
org.apache.avro.AvroRuntimeException: Not a record..
Run Code Online (Sandbox Code Playgroud)
知道我应该如何在avro架构中构建一个包含类型记录值的地图?