解决方案 »
- openstack的迷惑
- OpenStack keystone创建租户的时候报错
- cloudfoundry curl命令访问问题
- containers 占空间么 需要每次都删掉么
- wget: command not found 刚刚已经安装来wget 。退出容器后再进去怎么这个wget又没了
- ping ec2的虚拟服务器时请求超 时是什么原因?
- 安装cf-uaac报错 ERROR: Failed to build gem native extension
- 现在那个运服务器比较不错一些呢
- docker本地如何安装???
- docker启动不了:docker-containerd.sock: timeout
- Swift应用的案例
- 云服务:增长迅速,运营商可发展泛终端、富媒体经营模式
This is where the magic happened - let’s look at that class again.static class KeyBasedMultipleTextOutputFormat extends MultipleTextOutputFormat<Text, Text> {
@Override
protected String generateFileNameForKeyValue(Text key, Text value, String name) {
return key.toString() + "/" + name;
}
}
You are working with text, which is why you extended MultipleTextOutputFormat, a class that in turn extends MultipleOutputFormat. MultipleTextOutputFormat is a simple class which instructs the MultipleOutputFormat to use TextOutputFormat as the underlying output format for writing out the records. If you were to use MultipleOutputFormat as-is it behaves as if you were using the regular TextOutputFormat, which is to say that it’ll only write to a single output file. To write data to multiple files you had to extend it, as with the example above.The generateFileNameForKeyValue method allows you to return the output path for an input record. The third argument, name, is the original FileOutputFormat-created filename, which is in the form “part-NNNNN”, where “NNNNN” is the task index, to ensure uniqueness. To avoid file collisions, it’s a good idea to make sure your generated output paths are unique, and leveraging the original output file is certainly a good way of doing this. In our example we’re using the key as the directory name, and then writing to the original FileOutputFormat filename within that directory.