You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.
I'm trying to run the following method in a databricks scala notebook: val tweetsSentimentList = tweetsSentimentsRdd.collect()
after runnig this mehod: val tweetsSentimentsRdd = sc.textFile("/FileStore/tables/tweets-30.04.21.txt").filter(removeHttpLines).map(x=>requestFormatter(x)).map(y=>sendPostRequest("myUrl","myKey",y))
def sendPostRequest(textAnalyticsUrl:String,subscriptionKey:String,requestBody:String):String={
import scalaj.http.Http
Thread.sleep(3000)
val result = Http(textAnalyticsUrl).postData(requestBody)
.header("Content-Type", "application/json")
.header("Ocp-Apim-Subscription-Key", subscriptionKey).asString
result.body
}
def removeHttpLines(textLine:String):Boolean={
import scala.util.matching.Regex
val pattern = "^http".r
pattern.findFirstIn(textLine) match {
case Some(x)=>false
case _ => true
}
}
`
I get this error:
org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 1.0 failed 1 times, most recent failure: Lost task 0.0 in stage 1.0 (TID 2, localhost, executor driver): java.lang.NoClassDefFoundError: Could not initialize class scalaj.http.DefaultConnectFunc$
i have installed on my cluster the spark maven package scalaj-http_2.12-2.3.0 because using a newer verion i got a version error expected 5, found 5.2
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello,
I'm trying to run the following method in a databricks scala notebook:
val tweetsSentimentList = tweetsSentimentsRdd.collect()
after runnig this mehod:
val tweetsSentimentsRdd = sc.textFile("/FileStore/tables/tweets-30.04.21.txt").filter(removeHttpLines).map(x=>requestFormatter(x)).map(y=>sendPostRequest("myUrl","myKey",y))
after runnig these three methods:
`def requestFormatter(givenTweet:String):String={
s"""{
"documents":[
{
"language":"en",
"id":1,
"text":"${givenTweet}"
}
]
}"""
}
def sendPostRequest(textAnalyticsUrl:String,subscriptionKey:String,requestBody:String):String={
import scalaj.http.Http
Thread.sleep(3000)
val result = Http(textAnalyticsUrl).postData(requestBody)
.header("Content-Type", "application/json")
.header("Ocp-Apim-Subscription-Key", subscriptionKey).asString
result.body
}
def removeHttpLines(textLine:String):Boolean={
import scala.util.matching.Regex
val pattern = "^http".r
pattern.findFirstIn(textLine) match {
case Some(x)=>false
case _ => true
}
}
`
I get this error:
org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 1.0 failed 1 times, most recent failure: Lost task 0.0 in stage 1.0 (TID 2, localhost, executor driver): java.lang.NoClassDefFoundError: Could not initialize class scalaj.http.DefaultConnectFunc$
i have installed on my cluster the spark maven package scalaj-http_2.12-2.3.0 because using a newer verion i got a version error expected 5, found 5.2
The text was updated successfully, but these errors were encountered: