[jira] [Commented] (CARBONDATA-328) Improve Code and Fix Warnings

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

[jira] [Commented] (CARBONDATA-328) Improve Code and Fix Warnings

Akash R Nilugal (Jira)

    [ https://issues.apache.org/jira/browse/CARBONDATA-328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15601915#comment-15601915 ]

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_r84681004
 
    --- Diff: integration/spark/src/main/scala/org/apache/carbondata/spark/rdd/CarbonDataLoadRDD.scala ---
    @@ -196,30 +195,28 @@ class DataFileLoaderRDD[K, V](
       sc.setLocalProperty("spark.scheduler.pool", "DDL")
     
       override def getPartitions: Array[Partition] = {
    -    isTableSplitPartition match {
    -      case true =>
    -        // for table split partition
    -        var splits = Array[TableSplit]()
    -        if (carbonLoadModel.isDirectLoad) {
    -          splits = CarbonQueryUtil.getTableSplitsForDirectLoad(carbonLoadModel.getFactFilePath,
    -            partitioner.nodeList, partitioner.partitionCount)
    -        }
    -        else {
    -          splits = CarbonQueryUtil.getTableSplits(carbonLoadModel.getDatabaseName,
    -            carbonLoadModel.getTableName, null, partitioner)
    -        }
    +    if (isTableSplitPartition) {
    +      // for table split partition
    +      var splits = Array[TableSplit]()
    +      if (carbonLoadModel.isDirectLoad) {
    +        splits = CarbonQueryUtil.getTableSplitsForDirectLoad(carbonLoadModel.getFactFilePath,
    +          partitioner.nodeList, partitioner.partitionCount)
    +      } else {
    +        splits = CarbonQueryUtil.getTableSplits(carbonLoadModel.getDatabaseName,
    +          carbonLoadModel.getTableName, null, partitioner)
    +      }
     
    -        splits.zipWithIndex.map {s =>
    -          // filter the same partition unique id, because only one will match, so get 0 element
    -          val blocksDetails: Array[BlockDetails] = blocksGroupBy.filter(p =>
    -            p._1 == s._1.getPartition.getUniqueID)(0)._2
    -          new CarbonTableSplitPartition(id, s._2, s._1, blocksDetails)
    -        }
    -      case false =>
    -        // for node partition
    -        blocksGroupBy.zipWithIndex.map{b =>
    -          new CarbonNodePartition(id, b._2, b._1._1, b._1._2)
    -        }
    +      splits.zipWithIndex.map { s =>
    --- End diff --
   
    instead of `s`, please give a more meaningful name, like `case (split, index)`


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