QiangCai commented on a change in pull request #3912:
URL: https://github.com/apache/carbondata/pull/3912#discussion_r514043536



##########
File path: 
integration/spark/src/main/scala/org/apache/carbondata/spark/load/DataLoadProcessBuilderOnSpark.scala
##########
@@ -93,6 +94,7 @@ object DataLoadProcessBuilderOnSpark {
     val convertStepRowCounter = sc.longAccumulator("Convert Processor 
Accumulator")
     val sortStepRowCounter = sc.longAccumulator("Sort Processor Accumulator")
     val writeStepRowCounter = sc.longAccumulator("Write Processor Accumulator")
+    val defaultMaxSplitBytes = 
sessionState(sparkSession).conf.filesMaxPartitionBytes

Review comment:
       move to line 156

##########
File path: 
integration/spark/src/main/scala/org/apache/carbondata/spark/load/DataLoadProcessBuilderOnSpark.scala
##########
@@ -227,9 +236,17 @@ object DataLoadProcessBuilderOnSpark {
     // 2. sort
     var numPartitions = CarbonDataProcessorUtil.getGlobalSortPartitions(
       
configuration.getDataLoadProperty(CarbonCommonConstants.LOAD_GLOBAL_SORT_PARTITIONS))
+
+    // if numPartitions user does not specify and not specified in config then 
dynamically calculate
+    if (numPartitions <= 0) {
+      numPartitions = Math.ceil(SizeEstimator.estimate(originRDD) / 
defaultMaxSplitBytes).toInt

Review comment:
       SizeEstimator.estimate(originRDD).toDouble
   
   and move to line 247

##########
File path: 
integration/spark/src/main/scala/org/apache/carbondata/spark/load/DataLoadProcessBuilderOnSpark.scala
##########
@@ -143,10 +145,16 @@ object DataLoadProcessBuilderOnSpark {
 
     var numPartitions = CarbonDataProcessorUtil.getGlobalSortPartitions(
       
configuration.getDataLoadProperty(CarbonCommonConstants.LOAD_GLOBAL_SORT_PARTITIONS))
+
+    // if numPartitions user does not specify and not specified in config then 
dynamically calculate
+    if (numPartitions == 0) {
+      numPartitions = Math.ceil(model.getTotalSize.toDouble / 
defaultMaxSplitBytes).toInt
+    }
+
+    // after calculation based on size if still zero then take the partition 
number
     if (numPartitions <= 0) {
       numPartitions = convertRDD.partitions.length

Review comment:
       Math.min(convertRDD.partitions.length, dynamic partition number)

##########
File path: 
integration/spark/src/main/scala/org/apache/carbondata/spark/load/DataLoadProcessBuilderOnSpark.scala
##########
@@ -227,9 +236,17 @@ object DataLoadProcessBuilderOnSpark {
     // 2. sort
     var numPartitions = CarbonDataProcessorUtil.getGlobalSortPartitions(
       
configuration.getDataLoadProperty(CarbonCommonConstants.LOAD_GLOBAL_SORT_PARTITIONS))
+
+    // if numPartitions user does not specify and not specified in config then 
dynamically calculate
+    if (numPartitions <= 0) {
+      numPartitions = Math.ceil(SizeEstimator.estimate(originRDD) / 
defaultMaxSplitBytes).toInt
+    }
+
+    // after calculation based on size if still zero then take the partition 
number
     if (numPartitions <= 0) {
       numPartitions = originRDD.partitions.length

Review comment:
       numPartitions = Math.min(originRDD.partitions.length, dynamic partition 
number)

##########
File path: 
integration/spark/src/main/scala/org/apache/carbondata/spark/load/DataLoadProcessBuilderOnSpark.scala
##########
@@ -202,6 +210,7 @@ object DataLoadProcessBuilderOnSpark {
     val partialSuccessAccum = sc.longAccumulator("Partial Success Accumulator")
     val sortStepRowCounter = sc.longAccumulator("Sort Processor Accumulator")
     val writeStepRowCounter = sc.longAccumulator("Write Processor Accumulator")
+    val defaultMaxSplitBytes = 
sessionState(sparkSession).conf.filesMaxPartitionBytes

Review comment:
       move to line 247

##########
File path: 
integration/spark/src/main/scala/org/apache/carbondata/spark/load/DataLoadProcessBuilderOnSpark.scala
##########
@@ -143,10 +145,16 @@ object DataLoadProcessBuilderOnSpark {
 
     var numPartitions = CarbonDataProcessorUtil.getGlobalSortPartitions(
       
configuration.getDataLoadProperty(CarbonCommonConstants.LOAD_GLOBAL_SORT_PARTITIONS))
+
+    // if numPartitions user does not specify and not specified in config then 
dynamically calculate
+    if (numPartitions == 0) {
+      numPartitions = Math.ceil(model.getTotalSize.toDouble / 
defaultMaxSplitBytes).toInt

Review comment:
       move to 156




----------------------------------------------------------------
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:
[email protected]


Reply via email to