GitHub user uncleGen opened a pull request:

    https://github.com/apache/spark/pull/17209

    [SPARK-19853][SS] uppercase kafka topics fail when startingOffsets are 
SpecificOffsets

    ## What changes were proposed in this pull request?
    
    When using the KafkaSource with Structured Streaming, consumer assignments 
are not what the user expects if startingOffsets is set to an explicit set of 
topics/partitions in JSON where the topic(s) happen to have uppercase 
characters. When StartingOffsets is constructed, the original string value from 
options is transformed toLowerCase to make matching on "earliest" and "latest" 
case insensitive. However, the toLowerCase JSON is passed to SpecificOffsets 
for the terminal condition, so topic names may not be what the user intended by 
the time assignments are made with the underlying KafkaConsumer.
    
    KafkaSourceProvider.scala:
    ```
    val startingOffsets = 
caseInsensitiveParams.get(STARTING_OFFSETS_OPTION_KEY).map(_.trim.toLowerCase) 
match {
        case Some("latest") => LatestOffsets
        case Some("earliest") => EarliestOffsets
        case Some(json) => SpecificOffsets(JsonUtils.partitionOffsets(json))
        case None => LatestOffsets
      }
    ```
    
    ## How was this patch tested?
    
    Jenkins


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/uncleGen/spark SPARK-19853

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/17209.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #17209
    
----
commit e2a26bf8fb8554fb030e7f5bd2197befb9ed55e2
Author: uncleGen <husty...@gmail.com>
Date:   2017-03-08T11:59:17Z

    Uppercase Kafka topics fail when startingOffsets are SpecificOffsets

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to