zsxwing commented on a change in pull request #22282: [SPARK-23539][SS] Add
support for Kafka headers in Structured Streaming
URL: https://github.com/apache/spark/pull/22282#discussion_r266615206
##########
File path:
external/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/KafkaWriter.scala
##########
@@ -75,6 +77,14 @@ private[kafka010] object KafkaWriter extends Logging {
throw new AnalysisException(s"$VALUE_ATTRIBUTE_NAME attribute type " +
s"must be a ${StringType.catalogString} or
${BinaryType.catalogString}")
}
+ schema.find(_.name == HEADERS_ATTRIBUTE_NAME).getOrElse(
+ Literal(CatalystTypeConverters.convertToCatalyst(null),
MapType(StringType, BinaryType))
+ ).dataType match {
+ case MapType(StringType, BinaryType, true) => // good
+ case _ =>
+ throw new AnalysisException(s"$HEADERS_ATTRIBUTE_NAME attribute type "
+
Review comment:
If I have a query that outputs a `headers` column with a different type, it
will run in the current Spark version but will fail after this gets merged.
Right? Could we add a new option to let the user decide whether to output
headers?
----------------------------------------------------------------
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]