gpt4 book ai didi

java - 不能在 Java 中使用 XmlInputFormat extends TextInputFormat

转载 作者:可可西里 更新时间:2023-11-01 16:20:09 24 4
gpt4 key购买 nike

我正在尝试使用 Hadoop 进行 WordCount。我想使用 XmlInputFormat.class 根据 XML 标记拆分文件。 XmlInputFormat.class 是 here

XmlInputFormat.class 继承自 TextInputFormat.class

 Job job = new Job(getConf());
job.setInputFormatClass(XmlInputFormat.class);

显示错误

The method setInputFormatClass(Class) in the type Job is not applicable for the arguments (Class)

但是我用的时候没问题

Job job = new Job(getConf());
job.setInputFormatClass(TextInputFormat.class);

为什么我们不能使用 extends 呢?还是我做错了什么?

最佳答案

这看起来像是您的 Hadoop 版本的问题。您是否检查过您使用的 XMLInputFormat 类实际上是否适合您的 Hadoop 版本?

关于java - 不能在 Java 中使用 XmlInputFormat extends TextInputFormat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9714937/

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