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

    https://github.com/apache/spark/pull/17043#discussion_r103043531
  
    --- Diff: 
external/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/KafkaSourceProvider.scala
 ---
    @@ -152,6 +157,56 @@ private[kafka010] class KafkaSourceProvider extends 
DataSourceRegister with Stre
           endingRelationOffsets)
       }
     
    +  override def createSink(
    +      sqlContext: SQLContext,
    +      parameters: Map[String, String],
    +      partitionColumns: Seq[String],
    +      outputMode: OutputMode): Sink = {
    +    val caseInsensitiveParams = parameters.map { case (k, v) => 
(k.toLowerCase, v) }
    +    val defaultTopic = 
caseInsensitiveParams.get(TOPIC_OPTION_KEY).map(_.trim.toLowerCase)
    +    val specifiedKafkaParams =
    +      parameters
    +        .keySet
    +        .filter(_.toLowerCase.startsWith("kafka."))
    +        .map { k => k.drop(6).toString -> parameters(k) }
    +        .toMap + ("value.serializer" -> classOf[BytesSerializer].getName,
    +        "key.serializer" -> classOf[BytesSerializer].getName)
    +    new KafkaSink(sqlContext,
    +      new ju.HashMap[String, Object](specifiedKafkaParams.asJava),
    +      defaultTopic)
    +  }
    +
    +  override def createRelation(
    +      outerSQLContext: SQLContext,
    +      mode: SaveMode,
    +      parameters: Map[String, String],
    +      data: DataFrame): BaseRelation = {
    +    mode match {
    +      case SaveMode.Overwrite | SaveMode.Ignore =>
    +        throw new AnalysisException(s"save mode $mode not allowed for 
Kafka. " +
    --- End diff --
    
    *S*ave mode $mode


---
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