gpt4 book ai didi

xml - 为什么hadoop不提供XmlInputFormat?

转载 作者:可可西里 更新时间:2023-11-01 14:53:10 26 4
gpt4 key购买 nike

我正在使用 hadoop map-reduce。我必须处理来自 .xml 文件的数据,解析它并将输出存储到数据库中。

当我需要将我的 xml 传递给映射器时,我发现 hadoop 默认不提供 XmlInputFormat.class,我们必须使用 ma​​hout 的 XmlInputFormat 为之。

我想知道什么时候 Xml 被广泛使用,为什么 hadoop 没有为此提供 XmlInputFormat 而不是显式创建自定义 XmlInputFormat 再扩展 TextInputFormat

最佳答案

虽然 xml 被广泛使用,但为技术提供具有特殊功能的框架可能不是一个好主意。这可能就像一种背书。在高层次上,Mapreduce 旨在接受不同的格式。事实上,由于与 xml 相比,json 的大小特征,这些天 json 被广泛使用。甚至我也有类似的问题。

但是由用户决定 map reduce 的输入并可以使用不同的解析器(Jackson 或 gson 用于 json,JAXB 用于 xml)如果它们在一行中或像上面那样使用 RecordReader 实现

关于xml - 为什么hadoop不提供XmlInputFormat?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31073211/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com