SubhamSinghal commented on code in PR #47927:
URL: https://github.com/apache/spark/pull/47927#discussion_r1774453858
##########
connector/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/KafkaOffsetRangeCalculator.scala:
##########
@@ -80,21 +83,39 @@ private[kafka010] class KafkaOffsetRangeCalculator(val
minPartitions: Option[Int
} else {
getPartCount(size, splitRangeTotalSize, splitRangeMinPartitions)
}
- var remaining = size
- var startOffset = range.fromOffset
- (0 until parts).map { part =>
- // Fine to do integer division. Last partition will consume all the
round off errors
- val thisPartition = remaining / (parts - part)
- remaining -= thisPartition
- val endOffset = math.min(startOffset + thisPartition,
range.untilOffset)
- val offsetRange = KafkaOffsetRange(tp, startOffset, endOffset, None)
- startOffset = endOffset
- offsetRange
- }
+ getDividedPartition(parts, range)
+ }.filter(_.size > 0)
+ } else {
+ val avgMessageSize = 1 // Todo estimate row size
Review Comment:
I am using `maxRecordsPerPartition` to dynamically increase partitions.
PTAL. Thanks
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]