Open harsha273 opened 8 years ago
Actually problem is in WordCountTopology we were not passing source(spout) so what I do to overcome this...
public void execute(TridentTuple tuple, TridentCollector collector) {
// TODO Auto-generated method stub
for(String word: tuple.getString(0).split(" ")) {
if(word.length() > 0) {
String[] sourceAndWord=word.split(":");
collector.emit(new Values(sourceAndWord[0],sourceAndWord[1]));
}
}
}
TridentState wordCounts = topology.newStream("spout1", spout1) .each(new Fields("sentence"), new Split(), new Fields("word")) .groupBy(new Fields("word", "source")) .persistentAggregate(CassandraCqlMapState.nonTransactional(new WordCountAndSourceMapper()), new IntegerCount(), new Fields("count")) .parallelismHint(6); topology.newDRPCStream("words", drpc).each(new Fields("args"), new MultiSplit(), new Fields("word", "source")) .groupBy(new Fields("word", "source")) .stateQuery(wordCounts, new Fields("word", "source"), new MapGet(), new Fields("count")) .each(new Fields("count"), new FilterNull()) .aggregate(new Fields("count"), new Sum(), new Fields("sum"));
4,. And last change in WordCountAndSourceMapper as i change the indexes of where clause
@Override
public Statement retrieve(List
so this will definately resolves the issue. All the best
Guys,
I am quite new to trident and cassandra. While trying to run the wordcount example , am getting this exception midway through the run. Any ideas please?