def main(args: Array[String]): Unit = {
val res = fetchFromDruid()// res comes as null here
}
def fetchFromDruid(): GroupByResponse {
implicit val executionContext = ExecutionContext.Implicits.global
val client = DruidClient("http://localhost:8082")
val query = GroupByQuery(
source = "wikipedia",
interval = new Interval(new DateTime().minusMonths(60), new DateTime()),
dimensions = Seq("countryName"),
descending = true,
granularity = Granularity.All,
aggregate = Seq(
DSL.count("row_count")
),
postAggregate = Seq(
),
limit = Some(100)
)
client(query).onComplete {
case Success(resp) =>
resp.data.foreach { row =>
println(row)
}return resp
println("none")
//System.exit(0)
case Failure(ex) =>
ex.printStackTrace()return null
//System.exit(0)
}
}
But somehow I am not able to return the response to the caller; i.e the main function. What could be the issue?
Thanks,
Tushar
--
You received this message because you are subscribed to the Google Groups "scala-functional" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-function...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/scala-functional/8bc53b5e-729d-497d-89bd-ab2568674cc7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
def main(args: Array[String]): Unit = {
val res = fetchData()
// res comes as null here
}
So my "res" in "main" method does not hold any results after the call is done. But when I try to print the "resp" in "success" it prints all the fetched data.def fetchData():Any {
client(query).onComplete {
case Success(resp) =>return resp
case Failure(ex) =>
ex.printStackTrace()return null
}
}
To unsubscribe from this group and stop receiving emails from it, send an email to scala-fu...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-function...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/scala-functional/c8a0dac0-5163-4de9-a389-e63767b4b4f6%40googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/scala-functional/CAN3nywCUdLBwfPUfVXHnsT0ds2_MgaK3JE6%3DNnZTkOLFYoJdNw%40mail.gmail.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/scala-functional/c8a0dac0-5163-4de9-a389-e63767b4b4f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "scala-functional" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-fu...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-function...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/scala-functional/e65ceeae-5107-4de4-bbb3-922e121d0be5%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-function...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/scala-functional/e65ceeae-5107-4de4-bbb3-922e121d0be5%40googlegroups.com.
I'm just curious if we could apply this approach to other problems. Like "I want this code decrypted right away, not 1000 years from now. Can Scala do that, instead of making me wait?
Thanks,
-Vlad
To view this discussion on the web, visit https://groups.google.com/d/msgid/scala-functional/CAFhNTo_fRm5-aiCzzi5YE9QHvyYT99cbVAG%3DttDkeepd_rSiKA%40mail.gmail.com.