Errore durante: creazione di un flusso di tweet in Spark utilizzando Scala e Twitter4j. Di seguito è riportato un frammento del mio codice:
scala> val ssc = new StreamingContext(sc, Seconds(10))
scala> val cb = new ConfigurationBuilder
scala>cb.setDebugEnabled(true).setOAuthConsumerKey("**********").setOAuthConsume
scala> val auth = new OAuthAuthorization(cb.build)
scala> val tweets = TwitterUtils.createStream(ssc,auth)
errore: valore del metodo sovraccarico createStream con alternative: (jssc: org.apache.spaark.streaming.api.java.JavaStreamingContext, twitterAuth: twitter4j.auth.Authorization) org.apache.spark.streaming.api.java.JavaReceiverInputDStream [twitter4j.Status] (JSSC: org.apache.spark.streaming.api.java.JavaStreamingContext, filtri: Array [String]) org.apache.spark.streaming.api.java.JavaReceiverInputDStream [twitter4j.Status] (Ssc: org.apache.spark.streaming.StreamingContext, twitterAuth: Opzione [twitter4j.auth.Authorization], filtri: Seq [String], storageLevel: org.apache.spark.storage.StorageLevel) org.apache.spark.streaming.dstream.ReceiverInputDStream [twitter4j.Status] non può essere applicato a (org.apache.spark.streaming.StreamingContext, twitter4j.auth.OAuthAuthorization)
risposte:
2 per risposta № 1Il sovraccarico che stai utilizzando si aspetta un StreamingContext
e un Option[Authorization]
, non un Authorization
.
Questo dovrebbe funzionare:
val tweets = TwitterUtils.createStream(ssc, Some(auth))