Skip to content

Commit 3562fbb

Browse files
authored
Merge pull request #88 from Altinity/document_ice_insert_multiple_files
Documented inserting multiple files(and transaction support)
2 parents 0eaaf7e + 8fce2a2 commit 3562fbb

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

examples/scratch/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,69 @@ select * from ice.`flowers.iris_no_copy` limit 10 FORMAT CSVWithNamesAndTypes;
9999
100100
> To clean up simply terminate processes and `rm -rf data/`.
101101
102+
### Inserting Multiple Files
103+
104+
You can insert multiple parquet files at once by piping a list of files to the insert command:
105+
106+
```shell
107+
# insert multiple files from stdin
108+
cat filelist | ice insert -p flowers.iris -
109+
```
110+
111+
where `filelist` is the list of filenames
112+
```
113+
iris1.parquet
114+
iris3.parquet
115+
iris2.parquet
116+
```
117+
118+
When inserting multiple files to the same table, all files are processed as a **single transaction**. If any file fails (e.g., doesn't exist or has schema issues), **none of the files are committed** to the table:
119+
120+
```
121+
cat filelist| insert flowers.iris -
122+
2026-01-09 11:28:02 [-5-thread-3] INFO c.a.i.c.internal.cmd.Insert > file://iris2.parquet: processing
123+
2026-01-09 11:28:02 [-5-thread-1] INFO c.a.i.c.internal.cmd.Insert > file://iris.parquet: processing
124+
2026-01-09 11:28:02 [-5-thread-2] INFO c.a.i.c.internal.cmd.Insert > file://iris3.parquet: processing
125+
2026-01-09 11:28:03 [-5-thread-1] INFO c.a.i.c.internal.cmd.Insert > file://iris.parquet: copying to s3://bucket1/flowers/iris/data/...parquet
126+
2026-01-09 11:28:03 [-5-thread-3] INFO c.a.i.c.internal.cmd.Insert > file://iris2.parquet: copying to s3://bucket1/flowers/iris/data/...parquet
127+
2026-01-09 11:28:03 [-5-thread-3] INFO c.a.i.c.internal.cmd.Insert > file://iris2.parquet: adding data file (copy took 0s)
128+
2026-01-09 11:28:03 [-5-thread-1] INFO c.a.i.c.internal.cmd.Insert > file://iris.parquet: adding data file (copy took 0s)
129+
2026-01-09 11:28:03 [main] ERROR com.altinity.ice.cli.Main > Fatal
130+
java.io.IOException: Error processing file(s)
131+
...
132+
Caused by: java.io.FileNotFoundException: iris3.parquet (No such file or directory)
133+
...
134+
```
135+
136+
```sql
137+
-- query shows 0 rows because iris3.parquet failed and the entire transaction was rolled back
138+
select count(*) from `flowers.iris`;
139+
┌─count()─┐
140+
1. │ 0
141+
└─────────┘
142+
```
143+
144+
When all files are valid, the transaction commits successfully:
145+
146+
```
147+
cat filelist| insert flowers.iris -
148+
2026-01-09 11:29:03 [-5-thread-2] INFO c.a.i.c.internal.cmd.Insert > file://iris2.parquet: processing
149+
2026-01-09 11:29:03 [-5-thread-1] INFO c.a.i.c.internal.cmd.Insert > file://iris.parquet: processing
150+
2026-01-09 11:29:04 [-5-thread-2] INFO c.a.i.c.internal.cmd.Insert > file://iris2.parquet: copying to s3://bucket1/flowers/iris/data/...parquet
151+
2026-01-09 11:29:04 [-5-thread-1] INFO c.a.i.c.internal.cmd.Insert > file://iris.parquet: copying to s3://bucket1/flowers/iris/data/...parquet
152+
2026-01-09 11:29:04 [-5-thread-2] INFO c.a.i.c.internal.cmd.Insert > file://iris2.parquet: adding data file (copy took 0s)
153+
2026-01-09 11:29:04 [-5-thread-1] INFO c.a.i.c.internal.cmd.Insert > file://iris.parquet: adding data file (copy took 0s)
154+
2026-01-09 11:29:04 [main] INFO o.a.i.SnapshotProducer > Committed snapshot 2260546103981693696 (MergeAppend)
155+
```
156+
157+
```sql
158+
-- query shows 300 rows (150 from each file) after successful commit
159+
select count(*) from `flowers.iris`;
160+
┌─count()─┐
161+
1. │ 300
162+
└─────────┘
163+
```
164+
102165
### Troubleshooting
103166

104167
1. `Code: 336. DB::Exception: Unknown database engine: DataLakeCatalog. (UNKNOWN_DATABASE_ENGINE)`

0 commit comments

Comments
 (0)