http://stackoverflow.com/questions/7693324/converting-string-to-long-in-java
On Wed, Dec 18, 2013 at 5:25 PM, Adrian Mocanu <[email protected]>wrote: > Hi > > I have a quick question about sending data of different types from a spout. > > > > I need to emit a string, double and long from a spout (all at once as a > tuple). > > Unfortunately Values c’tor takes arguments of the same type so I decided > to convert all of these to Strings. > > > > _collector.emit(new Values(myNameAsString, myDouble.toString, > myLong.toString )) > > > > When the tuple is received in the bolt it cannot convert the long back > into a long. > > > > java.lang.ClassCastException: java.lang.String cannot be cast to > java.lang.Long > > > > I looked at the value and it is a valid long: 61345076523000 > > The bolt code that does the str2int conversion is *val > tupleTimestampAsLong: Long= tuple.getString(2).toLong* > > > > The question, how to emit multiple values of different types from > spout/bolt at once? (or at least how to convert a string into a long). > > > > Thanks a lot! > > -Adrian > > >
