Skip to content

Commit 40c89b5

Browse files
authored
[doc] Add spark dataframe read and write (#5363)
1 parent a3f4ab3 commit 40c89b5

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

docs/content/spark/quick-start.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,32 @@ tblproperties (
177177

178178
## Insert Table
179179

180+
{{< tabs "Insert Paimon Table" >}}
181+
182+
{{< tab "SQL" >}}
183+
180184
```sql
181185
INSERT INTO my_table VALUES (1, 'Hi'), (2, 'Hello');
182186
```
183187

188+
{{< /tab >}}
189+
190+
{{< tab "DataFrame" >}}
191+
192+
```scala
193+
-- you can use
194+
Seq((1, "Hi"), (2, "Hello")).toDF("k", "v")
195+
.write.format("paimon").mode("append").saveAsTable("my_table")
196+
197+
-- or
198+
Seq((1, "Hi"), (2, "Hello")).toDF("k", "v")
199+
.write.format("paimon").mode("append").save("file:/tmp/paimon/default.db/my_table")
200+
```
201+
202+
{{< /tab >}}
203+
204+
{{< /tabs >}}
205+
184206
## Query Table
185207

186208
{{< tabs "Query Paimon Table" >}}
@@ -201,8 +223,11 @@ SELECT * FROM my_table;
201223
{{< tab "DataFrame" >}}
202224

203225
```scala
204-
val dataset = spark.read.format("paimon").load("file:/tmp/paimon/default.db/my_table")
205-
dataset.show()
226+
-- you can use
227+
spark.read.format("paimon").table("my_table").show()
228+
229+
-- or
230+
spark.read.format("paimon").load("file:/tmp/paimon/default.db/my_table").show()
206231

207232
/*
208233
+---+------+

0 commit comments

Comments
 (0)