You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "jessiedanwang (via GitHub)" <gi...@apache.org> on 2024/02/20 18:54:26 UTC
[I] Issue with 'writeTo' [iceberg]
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: issues-unsubscribe@iceberg.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Issue with 'writeTo' [iceberg]
Posted by "zero1zero (via GitHub)" <gi...@apache.org>.
zero1zero commented on issue #9766:
URL: https://github.com/apache/iceberg/issues/9766#issuecomment-2154025618
What was the bug in your code?
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Issue with 'writeTo' [iceberg]
Posted by "jessiedanwang (via GitHub)" <gi...@apache.org>.
jessiedanwang closed issue #9766: Issue with 'writeTo'
URL: https://github.com/apache/iceberg/issues/9766
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Issue with 'writeTo' [iceberg]
Posted by "jessiedanwang (via GitHub)" <gi...@apache.org>.
jessiedanwang commented on issue #9766:
URL: https://github.com/apache/iceberg/issues/9766#issuecomment-1954917660
Also got the following except when using MERGE INTO logic,
Exception in thread "stream execution thread for iceberg/cdc/xxx [id = b9e11736-cc3c-4260-aa2b-17dd6735f8bf, runId = 671cdfb4-a831-4a61-90be-13eebd401304]" java.lang.NoClassDefFoundError: Could not initialize class org.apache.spark.SparkThrowableHelper$
at org.apache.spark.sql.streaming.StreamingQueryException.<init>(StreamingQueryException.scala:54)
at org.apache.spark.sql.execution.streaming.StreamExecution.org$apache$spark$sql$execution$streaming$StreamExecution$$runStream(StreamExecution.scala:333)
at org.apache.spark.sql.execution.streaming.StreamExecution$$anon$1.run(StreamExecution.scala:207)
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Issue with 'writeTo' [iceberg]
Posted by "jessiedanwang (via GitHub)" <gi...@apache.org>.
jessiedanwang commented on issue #9766:
URL: https://github.com/apache/iceberg/issues/9766#issuecomment-1960025819
It turns out that there is a bug in our code, after that's fixed, we have no problem with 'writeTo' or 'merge into'. Thanks
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Issue with 'writeTo' [iceberg]
Posted by "jessiedanwang (via GitHub)" <gi...@apache.org>.
jessiedanwang commented on issue #9766:
URL: https://github.com/apache/iceberg/issues/9766#issuecomment-1954881197
forgot to mention that if we switch from_protobuf to from_arvro to deserialized avro instead of protobuf messages, then we have no problem with 'writeTo'
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org