gaborgsomogyi commented on a change in pull request #26158: 
[SPARK-29509][SQL][SS] Deduplicate codes from Kafka data source
URL: https://github.com/apache/spark/pull/26158#discussion_r337490704
 
 

 ##########
 File path: 
external/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/KafkaWriter.scala
 ##########
 @@ -101,4 +86,16 @@ private[kafka010] object KafkaWriter extends Logging {
         finallyBlock = writeTask.close())
     }
   }
+
+  private def validateAttribute(
+      schema: Seq[Attribute],
+      attrName: String,
+      desired: Seq[DataType])(
+      defaultFn: () => Expression): Unit = {
+    val attr = schema.find(_.name == attrName).getOrElse(defaultFn())
+    if (!desired.exists(_.sameType(attr.dataType))) {
+      throw new AnalysisException(s"$attrName attribute type must be a " +
 
 Review comment:
   I think it would be helpful to print the actual type and the expected types, 
just like in the previous case.

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


With regards,
Apache Git Services

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

Reply via email to