Its hard to help without any stacktrace associated with UnsupportedOperationException.
On Thu, Oct 15, 2015 at 10:40 PM, Chandra Mohan, Ananda Vel Murugan < ananda.muru...@honeywell.com> wrote: > One of my co-worker(Yogesh) was trying to get this posted in spark mailing > and it seems it did not get posted. So I am reposting it here. Please help. > > > > > > Hi, > > I am new to Spark and was trying to do some experiments with it. > > > > I had a JavaPairDStream<String, List<String>> RDD. > > I want to get the list of string from its previous state. For that I use > updateStateByKey function as follows: > > > > final Function2<List<String>, Optional<List<String>>, > Optional<List<String>>> updateFunc = > > new Function2<List<String>, Optional<List<String>>, > > Optional<List<String>>>() { > > > > public Optional<List<String>> call(List<String> arg0, > Optional<List<String>> arg1) throws Exception { > > // TODO Auto-generated method stub > > if(arg1.toString()==null) > > return Optional.of(arg0); > > else { > > arg0.add(arg1.toString()); > > return Optional.of(arg0); > > } > > } > > }; > > > > I want the function to append the new list of string to the previous list > and return the new list. But I am not able to do so. I am getting the " > java.lang.UnsupportedOperationException" error. > > Can anyone which help me out in getting the desired output? > > >