JasonWayne edited a comment on issue #23309: [SPARK-26360]remove redundant 
validateQuery call
URL: https://github.com/apache/spark/pull/23309#issuecomment-446995614
 
 
   @srowen
   There is already a validQuery check in the construction process of class
   `KafkaStreamingWriteSupport` as shown in the following code.
   
   ```scala
   // KafkaStreamingWriteSupport.scala
   class KafkaStreamingWriteSupport(
       topic: Option[String],
       producerParams: ju.Map[String, Object],
       schema: StructType)
     extends StreamingWriteSupport {
   
     validateQuery(schema.toAttributes, producerParams, topic)
     ....
   }
   ```
   
   however, there is another function call before creating the 
KafkaStreamingWriteSupport object.
   ```scala
   // KafkaSourceProvider.scala
     override def createStreamingWriteSupport(
         queryId: String,
         schema: StructType,
         mode: OutputMode,
         options: DataSourceOptions): StreamingWriteSupport = {
      .....
       // validate once here
       KafkaWriter.validateQuery(schema.toAttributes, producerParams, topic)
   
       // validate twice here in the construction process
       new KafkaStreamingWriteSupport(topic, producerParams, schema)
     }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to