rdblue commented on a change in pull request #1261: URL: https://github.com/apache/iceberg/pull/1261#discussion_r463336929
########## File path: site/docs/spark-structured-streaming.md ########## @@ -0,0 +1,184 @@ +<!-- + - Licensed to the Apache Software Foundation (ASF) under one or more + - contributor license agreements. See the NOTICE file distributed with + - this work for additional information regarding copyright ownership. + - The ASF licenses this file to You under the Apache License, Version 2.0 + - (the "License"); you may not use this file except in compliance with + - the License. You may obtain a copy of the License at + - + - http://www.apache.org/licenses/LICENSE-2.0 + - + - Unless required by applicable law or agreed to in writing, software + - distributed under the License is distributed on an "AS IS" BASIS, + - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + - See the License for the specific language governing permissions and + - limitations under the License. + --> + +# Spark Structured Streaming + +Iceberg uses Apache Spark's DataSourceV2 API for data source and catalog implementations. Spark DSv2 is an evolving API +with different levels of support in Spark versions. + +As of Spark 3.0, the new API on reading/writing table on table identifier is not yet added on streaming query. + +| Feature support | Spark 3.0| Spark 2.4 | Notes | +|--------------------------------------------------|----------|------------|------------------------------------------------| +| [DataFrame write](#writing-with-streaming-query) | ✔ | ✔ | | + +## Writing with streaming query + +To write values from streaming query to Iceberg table, use `DataStreamWriter`: + +```scala +data.writeStream + .format("iceberg") + .outputMode("append") + .trigger(Trigger.ProcessingTime(1, TimeUnit.MINUTES)) + .option("path", pathToTable) + .option("checkpointLocation", checkpointPath) + .start() +``` + +Iceberg supports below output modes: + +* append +* complete Review comment: It would be great to document what these do: * `append` - appends the output of every micro-batch to the table * `complete` - replaces the table contents every micro-batch ---------------------------------------------------------------- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
