spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sivarani <whitefeathers...@gmail.com>
Subject Re: Spark Streaming getOrCreate
Date Wed, 05 Nov 2014 05:25:07 GMT
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&lt;Double>, Optional<Double>, Optional<Double>>
updateFunction =
		    		  new Function2<List&lt;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: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


Mime
View raw message