Login  Register

[GitHub] [carbondata] QiangCai commented on a change in pull request #3912: [CARBONDATA-3977] Global sort partitions should be determined dynamically

Posted by GitBox on Oct 23, 2020; 2:25am
URL: http://apache-carbondata-dev-mailing-list-archive.168.s1.nabble.com/GitHub-carbondata-maheshrajus-opened-a-new-pull-request-3912-WIP-Global-sort-partitions-should-be-dey-tp99835p102665.html


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



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

Review comment:
       it should be   numberOfParitions = totalSize/partitionSize




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