akashrn5 commented on a change in pull request #3386: [WIP] : Pre-priming cache
URL:
https://github.com/apache/carbondata/pull/3386#discussion_r326516249
##########
File path: integration/spark2/src/main/scala/org/apache/carbondata/indexserver/IndexServer.scala
##########
@@ -103,18 +112,35 @@ object IndexServer extends ServerInterface {
})
}
+ private def submitAsyncTask[T](t: => Unit): Unit = {
+ indexServerExecutorService.get.submit(new Runnable {
+ override def run(): Unit = {
+ t
+ }
+ })
+ }
+
def getCount(request: DistributableDataMapFormat): LongWritable = {
doAs {
- if (!request.isFallbackJob) {
- sparkSession.sparkContext.setLocalProperty("spark.jobGroup.id", request.getTaskGroupId)
- sparkSession.sparkContext
- .setLocalProperty("spark.job.description", request.getTaskGroupDesc)
+ lazy val getCountTask = {
+ if (!request.isFallbackJob) {
+ sparkSession.sparkContext.setLocalProperty("spark.jobGroup.id", request.getTaskGroupId)
+ sparkSession.sparkContext
+ .setLocalProperty("spark.job.description", request.getTaskGroupDesc)
+ }
+ val splits = new DistributedCountRDD(sparkSession, request).collect()
+ if (!request.isFallbackJob) {
+ DistributedRDDUtils.updateExecutorCacheSize(splits.map(_._1).toSet)
+ }
+ new LongWritable(splits.map(_._2.toLong).sum)
}
- val splits = new DistributedCountRDD(sparkSession, request).collect()
- if (!request.isFallbackJob) {
- DistributedRDDUtils.updateExecutorCacheSize(splits.map(_._1).toSet)
+ if (request.isAsyncCall) {
+ submitAsyncTask(getCountTask)
+ new LongWritable(0)
+ }
Review comment:
correct the checkstyle
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[hidden email]
With regards,
Apache Git Services