Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21961#discussion_r210800762
  
    --- Diff: 
external/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/KafkaSourceProvider.scala
 ---
    @@ -231,7 +231,13 @@ private[kafka010] class KafkaSourceProvider extends 
DataSourceRegister
           parameters: Map[String, String],
           partitionColumns: Seq[String],
           outputMode: OutputMode): Sink = {
    -    val defaultTopic = parameters.get(TOPIC_OPTION_KEY).map(_.trim)
    +    // Picks the defaulttopicname from "path" key, an entry in 
"parameters" Map,
    +    // if no topic key is present in the "parameters" Map and is provided 
with key "path".
    +    val defaultTopic = parameters.get(TOPIC_OPTION_KEY) match {
    --- End diff --
    
    Isn't this simpler as something like
    
    ```
    val defaultTopic = parameters.getOrElse(TOPIC_OPTION_KEY, 
parameters.get(PATH_OPTION_KEY)).map(_.trim)
    ```


---

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

Reply via email to