Hadoop-mapreduce org.apache.hadoop.io.LongWritable cannot be cast to org.apache.hadoop.io.Text错误
2017-08-02 09:57
1111 查看
java.lang.Exception: java.lang.ClassCastException: org.apache.hadoop.io.LongWritable cannot be cast to org.apache.hadoop.io.Text
(Hadoop的输入LongWritable不能转变为Text)
When you read a file with a M/R program, the input key of your mapper should be the index of the line in the file, while the input value will be the full line.So here what's happening is that
you're trying to have the line index as a Text object which is wrong, and you need an LongWritable instead so that Hadoop doesn't
complain about type.
当你用MapReduce程序读入文件是,mapper的输入key值应该是文件当前行的索引值,文件当前行的所有内容会被当做mapper的输入value值。所以Mapper程序的第一个参数(Mapper类的输入Key值)不可以具体化为LongWritable,可以用Text或者Object类。
(Hadoop的输入LongWritable不能转变为Text)
When you read a file with a M/R program, the input key of your mapper should be the index of the line in the file, while the input value will be the full line.So here what's happening is that
you're trying to have the line index as a Text object which is wrong, and you need an LongWritable instead so that Hadoop doesn't
complain about type.
当你用MapReduce程序读入文件是,mapper的输入key值应该是文件当前行的索引值,文件当前行的所有内容会被当做mapper的输入value值。所以Mapper程序的第一个参数(Mapper类的输入Key值)不可以具体化为LongWritable,可以用Text或者Object类。
相关文章推荐
- MapReduce——LongWritable cannot be cast to org.apache.hadoop.io.Text 错误原因
- Hadoop: LongWritable cannot be cast to org.apache.hadoop.io.IntWritable
- TaggedInputSplit cannot be cast to org.apache.hadoop.mapreduce.lib.input.FileSplit
- Java 向Hbase表插入数据报(org.apache.hadoop.hbase.client.HTablePool$PooledHTable cannot be cast to org.apac
- Java 向Hbase表插入数据报错(org.apache.hadoop.hbase.client.HTablePool$PooledHTable cannot be cast to org.apa)
- Java 向Hbase表插入数据异常org.apache.hadoop.hbase.client.HTablePool$PooledHTable cannot be cast to org.apache.client.HTable
- org.apache.hadoop.hive.metastore.api.InvalidOperationException cannot be cast to java.lang.RuntimeEx
- Java 向Hbase表插入数据报(org.apache.hadoop.hbase.client.HTablePool$PooledHTable cannot be cast to org.apac)
- 解决kylin报错 ClassCastException org.apache.hadoop.hive.ql.exec.ConditionalTask cannot be cast to org.apache.hadoop.hive.ql.exec.mr.MapRedTask
- 用java运行Hadoop程序报错:org.apache.hadoop.fs.LocalFileSystem cannot be cast to org.apache.
- Java 向Hbase表插入数据报(org.apache.hadoop.hbase.client.HTablePool$PooledHTable cannot be cast to org.apac
- Java 向Hbase表插入数据报(org.apache.hadoop.hbase.client.HTablePool$PooledHTable cannot be cast to org.apac)
- org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcesso
- org.apache.catalina.connector.RequestFacade cannot be cast to org.springframewor
- org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to javax.xml.parsers.DocumentBuilde
- org.apache.shiro.web.servlet.ShiroHttpServletRequest cannot be cast to org.springframwork.web.mult..
- org.apache.shiro.web.servlet.ShiroHttpServletRequest cannot be cast to org.springframwork.web.mult..
- Validator问题及解决办法——java.lang.ClassCastException: org.apache.struts.validator.ValidatorForm cannot be cast to forms.RegisterForm
- org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache