kbendick commented on issue #3585:
URL: https://github.com/apache/iceberg/issues/3585#issuecomment-1021743093


   From Spark 3.2, I also used a partitioned table to test dynamic partition 
overwrite in Spark 3.2
   
   Bash start up script from spark-3.2.0-bin-hadoop3.2:
   ```bash
   mkdir -p /tmp/iceberg/warehouse && ./bin/spark-shell \
   --packages 'org.apache.iceberg:iceberg-spark-runtime-3.2_2.12:0.13.0' \
   --repositories 
https://repository.apache.org/content/repositories/orgapacheiceberg-1079/  \
   --conf 
spark.sql.extensions=org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions
 \
   --conf spark.sql.catalog.local=org.apache.iceberg.spark.SparkCatalog  \
   --conf spark.sql.catalog.local.type=hadoop \
   --conf spark.sql.catalog.local.warehouse=/tmp/iceberg/warehouse \
   --conf spark.sql.sources.partitionOverwriteMode=dynamic
   ```
   
   Spark Shell:
   ```scala
   scala> spark.sql("CREATE TABLE local.db.table_partitioned (id bigint, data 
string) USING iceberg partitioned by (id)")
   res6: org.apache.spark.sql.DataFrame = []
   
   scala> spark.sql("show tables in local.db").show
   +---------+-----------------+-----------+
   |namespace|        tableName|isTemporary|
   +---------+-----------------+-----------+
   |       db|table_partitioned|      false|
   |       db|            table|      false|
   +---------+-----------------+-----------+
   
   scala> spark.sql("INSERT INTO local.db.table_partitioned(id, data) VALUES 
(1, 'Hank'), (2, 'Kyle'), (3, 'Jethro'), (4, 'Russell'), (5, 'Maggie')")
   
   scala> spark.sql("select * from local.db.table_partitioned").show
   +---+-------+
   | id|   data|
   +---+-------+
   |  1|   Hank|
   |  2|   Kyle|
   |  3| Jethro|
   |  4|Russell|
   |  5| Maggie|
   +---+-------+
   
   scala> spark.createDataFrame(Seq((3, "Burt"))).toDF("id", 
"data").write.mode("overwrite").insertInto("local.db.table_partitioned")
   
   scala> spark.sql("select * from local.db.table_partitioned").show
   +---+-------+
   | id|   data|
   +---+-------+
   |  3|   Burt|
   |  1|   Hank|
   |  2|   Kyle|
   |  4|Russell|
   |  5| Maggie|
   +---+-------+
   ```


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

Reply via email to