carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jackylk <...@git.apache.org>
Subject [GitHub] carbondata pull request #1192: [CARBONDATA-940] alter table add/split partit...
Date Thu, 03 Aug 2017 06:05:49 GMT
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1192#discussion_r131059444
  
    --- Diff: integration/spark2/src/main/scala/org/apache/carbondata/spark/rdd/CarbonDataRDDFactory.scala
---
    @@ -345,6 +365,65 @@ object CarbonDataRDDFactory {
         compactionThread.run()
       }
     
    +  case class SplitThread(sqlContext: SQLContext,
    +      carbonLoadModel: CarbonLoadModel,
    +      executor: ExecutorService,
    +      storePath: String,
    +      segmentId: String,
    +      partitionId: String,
    +      oldPartitionIdList: List[Int]) extends Thread {
    +      override def run(): Unit = {
    +        try {
    +          DataManagementFunc.executePartitionSplit(sqlContext,
    +            carbonLoadModel, executor, storePath, segmentId, partitionId,
    +            oldPartitionIdList)
    +        } catch {
    +          case e: Exception =>
    +            LOGGER.error(s"Exception in partition split thread: ${ e.getMessage } }")
    +        }
    +      }
    +  }
    +
    +  def startSplitThreads(sqlContext: SQLContext,
    +      carbonLoadModel: CarbonLoadModel,
    +      storePath: String,
    +      partitionId: String,
    +      oldPartitionIdList: List[Int]): Unit = {
    +    val numberOfCores = CarbonProperties.getInstance()
    +      .getProperty(CarbonCommonConstants.NUM_CORES_ALT_PARTITION,
    +        CarbonCommonConstants.DEFAULT_NUMBER_CORES)
    +    val executor : ExecutorService = Executors.newFixedThreadPool(numberOfCores.toInt)
    +    try {
    +      val carbonTable = carbonLoadModel.getCarbonDataLoadSchema.getCarbonTable
    +      val absoluteTableIdentifier = carbonTable.getAbsoluteTableIdentifier
    +      val segmentStatusManager = new SegmentStatusManager(absoluteTableIdentifier)
    +      val validSegments = segmentStatusManager.getValidAndInvalidSegments.getValidSegments.asScala
    +      val threadArray: Array[SplitThread] = new Array[SplitThread](validSegments.size)
    +      var i = 0
    +      for (segmentId: String <- validSegments) {
    --- End diff --
    
    use `map` or `forEach`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message