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



##########
File path: 
integration/spark/src/main/scala/org/apache/carbondata/spark/load/DataLoadProcessBuilderOnSpark.scala
##########
@@ -227,9 +235,19 @@ object DataLoadProcessBuilderOnSpark {
     // 2. sort
     var numPartitions = CarbonDataProcessorUtil.getGlobalSortPartitions(
       
configuration.getDataLoadProperty(CarbonCommonConstants.LOAD_GLOBAL_SORT_PARTITIONS))
-    if (numPartitions <= 0) {
+
+    // if numPartitions user does not specify then dynamically calculate
+    if (numPartitions == 0) {
+      // get the size in bytes and convert to size in MB
+      val sizeOfDataFrame = SizeEstimator.estimate(rdd)/1000000
+      // data frame size can not be more than Int size
+      numPartitions = sizeOfDataFrame.toInt/rdd.getNumPartitions

Review comment:
       @maheshrajus can you please explain the logic used to determine the 
partitions in the comment.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to