[
https://issues.apache.org/jira/browse/CARBONDATA-328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15593472#comment-15593472
]
ASF GitHub Bot commented on CARBONDATA-328:
-------------------------------------------
Github user jackylk commented on a diff in the pull request:
https://github.com/apache/incubator-carbondata/pull/248#discussion_r84400885
--- Diff:
integration/spark/src/main/scala/org/apache/carbondata/spark/rdd/CarbonDataLoadRDD.scala
---
@@ -439,42 +436,42 @@ class DataFileLoaderRDD[K, V](
}
override def getPreferredLocations(split: Partition): Seq[String] = {
- isTableSplitPartition match {
- case true =>
- // for table split partition
- val theSplit = split.asInstanceOf[CarbonTableSplitPartition]
- val location =
theSplit.serializableHadoopSplit.value.getLocations.asScala
- location
- case false =>
- // for node partition
- val theSplit = split.asInstanceOf[CarbonNodePartition]
- val firstOptionLocation: Seq[String] =
List(theSplit.serializableHadoopSplit)
- logInfo("Preferred Location for split : " + firstOptionLocation(0))
- val blockMap = new util.LinkedHashMap[String, Integer]()
- val tableBlocks = theSplit.blocksDetails
- tableBlocks.foreach(tableBlock => tableBlock.getLocations.foreach(
- location => {
- if (!firstOptionLocation.exists(location.equalsIgnoreCase(_)))
{
- val currentCount = blockMap.get(location)
- if (currentCount == null) {
- blockMap.put(location, 1)
- } else {
- blockMap.put(location, currentCount + 1)
- }
+ if (isTableSplitPartition) {
+ // for table split partition
+ val theSplit = split.asInstanceOf[CarbonTableSplitPartition]
+ val location =
theSplit.serializableHadoopSplit.value.getLocations.asScala
+ location
+ } else {
+ // for node partition
+ val theSplit = split.asInstanceOf[CarbonNodePartition]
+ val firstOptionLocation: Seq[String] =
List(theSplit.serializableHadoopSplit)
+ logInfo("Preferred Location for split : " + firstOptionLocation.head)
+ val blockMap = new util.LinkedHashMap[String, Integer]()
+ val tableBlocks = theSplit.blocksDetails
+ tableBlocks.foreach(tableBlock => tableBlock.getLocations.foreach(
+ location => {
+ if (!firstOptionLocation.exists(location.equalsIgnoreCase)) {
+ val currentCount = blockMap.get(location)
+ if (currentCount == null) {
+ blockMap.put(location, 1)
+ } else {
+ blockMap.put(location, currentCount + 1)
}
}
- )
- )
-
- val sortedList =
blockMap.entrySet().asScala.toSeq.sortWith((nodeCount1, nodeCount2) => {
- nodeCount1.getValue > nodeCount2.getValue
}
- )
+ )
+ )
--- End diff --
indentation is not correct
> Improve Code and Fix Warnings
> -----------------------------
>
> Key: CARBONDATA-328
> URL: https://issues.apache.org/jira/browse/CARBONDATA-328
> Project: CarbonData
> Issue Type: Improvement
> Reporter: Prabhat Kashyap
> Priority: Trivial
>
> Remove compiler warning and improve the existing code according to the
> standards.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)