HeartSaVioR commented on a change in pull request #32609:
URL: https://github.com/apache/spark/pull/32609#discussion_r638374368
##########
File path:
external/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/KafkaSourceProvider.scala
##########
@@ -564,20 +575,38 @@ private[kafka010] object KafkaSourceProvider extends
Logging {
def getKafkaOffsetRangeLimit(
params: CaseInsensitiveMap[String],
+ globalOffsetTimestampOptionKey: String,
offsetByTimestampOptionKey: String,
offsetOptionKey: String,
defaultOffsets: KafkaOffsetRangeLimit): KafkaOffsetRangeLimit = {
- params.get(offsetByTimestampOptionKey).map(_.trim) match {
- case Some(json) =>
SpecificTimestampRangeLimit(JsonUtils.partitionTimestamps(json))
- case None =>
- params.get(offsetOptionKey).map(_.trim) match {
- case Some(offset) if offset.toLowerCase(Locale.ROOT) == "latest" =>
- LatestOffsetRangeLimit
- case Some(offset) if offset.toLowerCase(Locale.ROOT) == "earliest" =>
- EarliestOffsetRangeLimit
- case Some(json) =>
SpecificOffsetRangeLimit(JsonUtils.partitionOffsets(json))
- case None => defaultOffsets
- }
+ // The order below represents "preferences"
Review comment:
Yeah I changed the test a bit to cover two cases: all options /
timestamp per partition vs offset. Thanks for the suggestion.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]