Anybody any luck? I am also trying to set NONE to delete key from state, will
null help? how to use scala none in java
My code goes this way
public static class ScalaLang {
public static <T> Option<T> none() {
return (Option<T>) None$.MODULE$;
}
}
Function2<List<Double>, Optional<Double>, Optional<Double>>
updateFunction =
new Function2<List<Double>,
Optional<Double>,
Optional<Double>>() {
@Override public Optional<Double>
call(List<Double> values,
Optional<Double> state) {
Double newSum = state.or(0D);
if(values.isEmpty()){
System.out.println("empty value");
return null; I WANT TO RETURN NONE
TO DELETE KEY but when i
set ScalaLang.<>none(); it shows error
}else{
for (double i : values) {
newSum += i;
}
return Optional.of(newSum);
}
}
};
--
View this message in context:
http://apache-spark-user-list.1001560.n3.nabble.com/Spark-Streaming-getOrCreate-tp18060p18139.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]