应继承scala类型不匹配错误 [英] scala type mismatch error should be inherited

查看:211
本文介绍了应继承scala类型不匹配错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我一直在努力让我的机器上运行hadoop / scala桥梁,当我设置这个工作时,我从编译器中得到以下错误。

  [error] found:java.lang.Class [org.apache.hadoop.mapred.TextInputFormat(classOf [org.apache.hadoop.mapred.TextInputFormat])
[error] required:java.lang.Class [_<:org.apache.hadoop.mapred.InputFormat]
[error] conf setInputFormat classOf [TextInputFormat]

由于TextInputFormat实际上实现了InputFormat,所以我不确定如何继续。



(请参阅: http://hadoop.apache.org/mapreduce/docs/current/api/org/apache/hadoop/mapred/TextInputFormat.html



有没有可能这不是原始类型问题的b / c,TextInputFormat通过一组特定的参数实现了InputFormat?



感谢您提供的任何帮助。

编辑:另外,对于违规的代码行,conf是一个JobConf,是其中的一个 http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/ mapred / JobConf.html

解决方案

这看起来像Java-Scala中的一个已知错误, SI 4603 ,现在固定在主干上。你可以用Scala 每晚构建来测试你的代码,看看问题是解决?



另见:


I've been working on getting a hadoop / scala bridge working on my machine and when I'm setting up the job I am getting the following error from the compiler.

[error]  found   : java.lang.Class[org.apache.hadoop.mapred.TextInputFormat (classOf[org.apache.hadoop.mapred.TextInputFormat])
[error]  required: java.lang.Class[_ <: org.apache.hadoop.mapred.InputFormat]
[error]     conf setInputFormat classOf[TextInputFormat]

I'm not sure how to proceed here given that TextInputFormat does in fact implement InputFormat.

(See: http://hadoop.apache.org/mapreduce/docs/current/api/org/apache/hadoop/mapred/TextInputFormat.html)

Is there a possibility that this isn't working b/c of a raw type issue where TextInputFormat implements InputFormat with a specific set of parameters?

Thanks for any help you can provide.

EDIT: also, for the offending line of code, conf is a JobConf, is one of these http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/mapred/JobConf.html

解决方案

This looks like a known bug in Java-Scala interop with raw types, Issue SI 4603, which is now fixed in trunk. Could you try your code with a Scala nightly build and see if the issue is resolved?

See also: How does one implement a Hadoop Mapper in Scala 2.9.0?

这篇关于应继承scala类型不匹配错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆