草庐IT

Cipher-Text

全部标签

java - hadoop:预期 org.apache.hadoop.io.LongWritable,收到 org.apache.hadoop.io.Text

这个问题在这里已经有了答案:Hadooperrorinexecution:Typemismatchinkeyfrommap:expectedorg.apache.hadoop.io.Text,recievedorg.apache.hadoop.io.LongWritable(1个回答)关闭9年前。我是hadoop的新手,正在尝试运行书中的示例程序。我正面临错误java.io.IOException:映射中的键类型不匹配:预期org.apache.hadoop.io.LongWritable,收到org.apache.hadoop.io.Text请帮我解决这个错误。下面是代码import

text - Hadoop...Text.toString()转换问题

我正在为我的项目编写一个简单的程序来枚举有向图中的三角形。首先,对于每个输入弧(例如ab、bc、ca,注意:制表符用作分隔符)我希望我的map函数输出以下对([a,to_b],[b,from_a],[a_b,-1]):publicvoidmap(LongWritablekey,Textvalue,OutputCollectoroutput,Reporterreporter)throwsIOException{Stringline=value.toString();String[]tokens=line.split("");output.collect(newText(tokens[0]

text - map 减少每个文本文件的实现

我需要计算每个文档中每个单词的词频,所以我想为每个文本文件实现mapreduce函数。如何为每个文本文件实现map()和reduce()?Map-Reduce中的另一个问题是Map-Reduce将reduce的输出写入单个文件/user/output/part-0000而project需要将每个文件处理后的输出写入不同的文本文件,如何实现? 最佳答案 按照下面提到的步骤:在作业文件中计算输入文件的数量设置numreducers等于输入文件的数量将数字0到n-1分配给文件并将此信息传递给分布式缓存在映射器的setup()方法中获取文件

java - Hadoop:错误:java.io.IOException:映射中的键类型不匹配:预期的 org.apache.hadoop.io.Text,收到 org.apache.hadoop.io.LongWritable

我正在尝试编写一个用于倒排索引计算的mapreduce程序。我的map代码是publicclassInvertdIdxMapperextendsMapper{publicvoidmap(LongWritableikey,Textivalue,Contextcontext,Reporterreporter)throwsIOException,InterruptedException{Textword=newText();Textlocation=newText();FileSplitfilespilt=(FileSplit)reporter.getInputSplit();Stringf

java - 如何将数组中的字符串附加到 mapreduce 中的 Text()

我有一个数组中的字符串。我需要将基于索引的数组的所有元素附加到mapreduce中的Text()。我需要将值作为字符串附加到Text()例如:Strings="12,23";String[]array=s.split(",");Textt1=newText();for(inti=0;i 最佳答案 您可以这样做而不需要拆分字符串数组:Stringstr="12,23";StringnewStr=str.replace(",","");//orreplacewithanycharacterorstringyouwantbetweenth

java - Hadoop,mapreduce java.io.IOException : Type mismatch in value from map: expected org. apache.hadoop.io.Text,收到 org.apache.hadoop.io.IntWritable

我正在尝试使用两个映射器和一个缩减器。我收到以下错误:我想组合几个键,我希望得到基于每个键的求和输出。我不知道哪一部分是错的。如果您能为我的代码找到一些错误,我们将不胜感激。java.io.IOException:Typemismatchinvaluefrommap:expectedorg.apache.hadoop.io.Text,recievedorg.apache.hadoop.io.IntWritableatorg.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:896)atorg.apache

hadoop - ClassCastException : org. apache.hadoop.io.Text 无法在 K-Means 聚类 Mahout 中转换为 org.apache.hadoop.io.IntWritable

我正在使用Mahout命令进行K均值聚类,输入文件是“KMeansData.csv”,数据是这种格式,John,M,30,Pepsi,USJack,M,25,Coke,USDavid,M,34,Pepsi,UKTed,M,37,Limca,CANRobert,M,23,Limca,USAdrian,M,31,Pepsi,USCraig,M,37,Coke,UKKatie,F,23,Limca,UKNancy,F,32,Pepsi,UK我能够成功完成以下步骤,它们是,./mahoutseqdirectory-i/root/Mahout/Clustering/-o/root/Mahout/

java - 在 hadoop 中将 String 对象转换为 TEXT 对象

如何在不使用构造函数的情况下将字符串对象转换为hadoop中的文本对象?有可用的TexttoString方法,但我找不到StringtoText方法。 最佳答案 Texttext=newText("your-string");或Texttext=newText();text.set("your-string"); 关于java-在hadoop中将String对象转换为TEXT对象,我们在StackOverflow上找到一个类似的问题: https://stac

java - 如何在 Mapreduce 程序中遍历 Text 值的迭代器两次?

在我的MapReduce程序中,我有一个reducer函数,它计算文本值迭代器中的项目数,然后对于迭代器中的每个项目,将项目输出为键,将计数输出为值。因此我需要使用迭代器两次。但是一旦迭代器到达终点,我就无法从第一个迭代器开始迭代。我该如何解决这个问题?我为我的reduce函数尝试了以下代码:publicstaticclassReduceAextendsMapReduceBaseimplementsReducer{publicvoidreduce(Textkey,Iteratorvalues,OutputCollectoroutput,Reporterreporter)throwsIO

hadoop - Caused by : java. lang.ClassCastException : org. apache.hadoop.io.LongWritable cannot be cast to org.apache.hadoop.io.Text

我正在尝试编译以下github项目https://github.com/DigitalPebble/behemoth/tree/master/uima我收到以下错误java.lang.ClassCastException:org.apache.hadoop.io.LongWritablecannotbecasttoorg.apache.hadoop.io.Text代码定义了以下输出键和值类。其中BehemothDocument是定义的自定义类job.setInputFormat(SequenceFileInputFormat.class);job.setOutputFormat(Seq