[GitHub] [carbondata] kunal642 commented on a change in pull request #3177: [CARBONDATA-3337][CARBONDATA-3306] Distributed index server

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] kunal642 commented on a change in pull request #3177: [CARBONDATA-3337][CARBONDATA-3306] Distributed index server

GitBox
kunal642 commented on a change in pull request #3177: [CARBONDATA-3337][CARBONDATA-3306] Distributed index server
URL: https://github.com/apache/carbondata/pull/3177#discussion_r278262646
 
 

 ##########
 File path: integration/spark2/src/main/scala/org/apache/carbondata/indexserver/DistributedRDDUtils.scala
 ##########
 @@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.carbondata.indexserver
+
+import java.util.concurrent.ConcurrentHashMap
+
+import scala.collection.JavaConverters._
+
+import org.apache.commons.lang.StringUtils
+import org.apache.hadoop.mapreduce.InputSplit
+import org.apache.spark.Partition
+
+import org.apache.carbondata.core.datamap.Segment
+import org.apache.carbondata.core.datamap.dev.expr.DataMapDistributableWrapper
+
+object DistributedRDDUtils {
+  // Segment number to executorNode mapping
+  val segmentToExecutorMapping: java.util.Map[String, String] =
+    new ConcurrentHashMap[String, String]()
+
+  // executorNode to segmentSize mapping
+  val executorToCacheSizeMapping: java.util.Map[String, Long] =
+    new ConcurrentHashMap[String, Long]()
+
+  def getExecutors(segment: Array[InputSplit], executorsList : Set[String],
+      tableUniqueName: String, rddId: Int): Seq[Partition] = {
+    // sort the partitions in increasing order of index size.
+    val (segments, legacySegments) = segment.span(split => StringUtils
+      .isNotEmpty(split
+      .asInstanceOf[DataMapDistributableWrapper].getDistributable.getSegment.getIndexSize))
+    val sortedPartitions = segments.sortWith(_.asInstanceOf[DataMapDistributableWrapper]
+                                              .getDistributable.getSegment.getIndexSize >
+                                            _.asInstanceOf[DataMapDistributableWrapper]
+                                              .getDistributable.getSegment.getIndexSize)
 
 Review comment:
   span will not sort the collection. As far as i can tell it will just divide the collection based on the predicate

----------------------------------------------------------------
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