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