jessiedanwang opened a new issue, #9766:
URL: https://github.com/apache/iceberg/issues/9766
### Apache Iceberg version
1.4.2
### Query engine
Spark
### Please describe the bug 🐞
We use spark structured streaming to consume avro message from kafka and
write them to iceberg tables, see following,
val query =
df.select(from_protobuf(col("value"),"xxx","desc_file_path").as("events")).select("events.*")
.writeStream
.option("checkpointLocation", ckLocation)
.queryName(queryName)
.outputMode("append")
.foreachBatch((df: DataFrame, batchId: Long) => {
df.show(20,false)
writeToIcebergTable(df, batchId)
})
.trigger(Trigger.ProcessingTime(processingInterval)).start()
def writeToIcebergTable(df: DataFrame, batchId: Long): Unit = {
...
df.writeTo(icebergTableName).append()
...
}
We got the following error when use Iceberg 1.4.2 and Spark 3.4.0 on EMR
6.12.0. The protobuf messages are deserialized correctly as shown in
df.show(20,false).
Caused by: org.apache.spark.sql.AnalysisException: 'writeTo' can not be
called on streaming Dataset/DataFrame.
at
org.apache.spark.sql.catalyst.analysis.package$AnalysisErrorAt.failAnalysis(package.scala:52)
~[spark-catalyst_2.12-3.4.0-amzn-0.jar:3.4.0-amzn-0]
at org.apache.spark.sql.Dataset.writeTo(Dataset.scala:3907)
~[spark-sql_2.12-3.4.0-amzn-0.jar:3.4.0-amzn-0]
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]