Skip to content

Commit aa7ae62

Browse files
committed
update streaming load docs and tests
1 parent bc5d8e2 commit aa7ae62

21 files changed

+31
-26
lines changed

docs/doc/12-load-data/02-local.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ CREATE TABLE books
4343
Create and send the API request with the following scripts:
4444

4545
```bash
46-
curl -XPUT 'http://root:@127.0.0.1:8000/v1/streaming_load' -H 'insert_sql: insert into book_db.books format CSV' -H 'format_skip_header: 0' -H 'format_field_delimiter: ,' -H 'format_record_delimiter: \n' -F 'upload=@"./books.csv"'
46+
curl -XPUT 'http://root:@127.0.0.1:8000/v1/streaming_load' -H 'insert_sql: insert into book_db.books file_format = (type = "CSV" skip_header = 0 field_delimiter = "," record_delimiter = "\n")' -F 'upload=@"./books.csv"'
4747
```
4848

4949
Response Example:
@@ -101,7 +101,7 @@ CREATE TABLE bookcomments
101101
Create and send the API request with the following scripts:
102102

103103
```bash
104-
curl -XPUT 'http://root:@127.0.0.1:8000/v1/streaming_load' -H 'insert_sql: insert into book_db.bookcomments(title,author,date)format CSV' -H 'format_skip_header: 0' -H 'format_field_delimiter: ,' -H 'format_record_delimiter: \n' -F 'upload=@"./books.csv"'
104+
curl -XPUT 'http://root:@127.0.0.1:8000/v1/streaming_load' -H 'insert_sql: insert into book_db.bookcomments(title,author,date) file_format = (type = "CSV" skip_header = 0 field_delimiter = "," record_delimiter = "\n")' -F 'upload=@"./books.csv"'
105105
```
106106

107107
Notice that the `insert_sql` part above specifies the columns (title, author, and date) to match the loaded data.

docs/doc/21-use-cases/01-analyze-ontime-with-databend-on-ec2-and-s3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ unzip t_ontime.csv.zip
4848
```
4949

5050
```shell title='Load TSV files into Databend'
51-
curl -H "insert_sql:insert into ontime format TSV" -H "format_skip_header:0" -F "upload=@t_ontime.csv" -XPUT http://root:@127.0.0.1:8000/v1/streaming_load
51+
curl -H "insert_sql:insert into ontime file_format = (type = 'TSV' skip_header = 0)" -F "upload=@t_ontime.csv" -XPUT http://root:@127.0.0.1:8000/v1/streaming_load
5252
```
5353

5454
:::tip

docs/doc/21-use-cases/05-analyze-hits-dataset-with-databend.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ gzip -d hits_1m.csv.gz
4747
```
4848

4949
```shell title='Load CSV files into Databend'
50-
curl -H "insert_sql:insert into hits format TSV" -F "upload=@./hits_1m.tsv" -XPUT http://user1:abc123@127.0.0.1:8000/v1/streaming_load
50+
curl -H "insert_sql:insert into hits file_format = (type = 'TSV')" -F "upload=@./hits_1m.tsv" -XPUT http://user1:abc123@127.0.0.1:8000/v1/streaming_load
5151
```
5252

5353
## Step 3. Queries

tests/suites/0_stateless/13_tpch/13_0000_prepare.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,6 @@ tar -zxf ${CURDIR}/data/tpch.tar.gz -C ${CURDIR}/data
111111
for t in customer lineitem nation orders partsupp part region supplier
112112
do
113113
echo "$t"
114-
curl -s -u root: -XPUT "http://localhost:${QUERY_HTTP_HANDLER_PORT}/v1/streaming_load" -H 'insert_sql: insert into '$t' format CSV' -H 'format_skip_header: 0' -H 'format_field_delimiter:|' -H 'format_record_delimiter: \n' -F 'upload=@"'${CURDIR}'/data/tests/suites/0_stateless/13_tpch/data/'$t'.tbl"' > /dev/null 2>&1
114+
insert_sql="insert into $t file_format = (type = 'CSV' skip_header = 0 field_delimiter = '|' record_delimiter = '\n')"
115+
curl -s -u root: -XPUT "http://localhost:${QUERY_HTTP_HANDLER_PORT}/v1/streaming_load" -H "insert_sql: ${insert_sql}" -F 'upload=@"'${CURDIR}'/data/tests/suites/0_stateless/13_tpch/data/'$t'.tbl"' > /dev/null 2>&1
115116
done

tests/suites/1_stateful/01_load_v2/01_0000_streaming_load_books.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ echo "CREATE TABLE books
1414
);" | $MYSQL_CLIENT_CONNECT
1515

1616
# load csv
17-
curl -H "insert_sql:insert into books format CSV" -F "upload=@${CURDIR}/books.csv" -u root: -XPUT "http://localhost:${QUERY_HTTP_HANDLER_PORT}/v1/streaming_load" > /dev/null 2>&1
17+
curl -H "insert_sql:insert into books file_format = (type = 'CSV')" -F "upload=@${CURDIR}/books.csv" -u root: -XPUT "http://localhost:${QUERY_HTTP_HANDLER_PORT}/v1/streaming_load" > /dev/null 2>&1
1818
echo "select count(), count_if(title is null), count_if(author is null), count_if(date is null), count_if(publish_time is null) from books " | $MYSQL_CLIENT_CONNECT
1919

2020
# load tsv
21-
curl -H "insert_sql:insert into books format TSV" -F "upload=@${CURDIR}/books.tsv" -u root: -XPUT "http://localhost:${QUERY_HTTP_HANDLER_PORT}/v1/streaming_load" > /dev/null 2>&1
21+
curl -H "insert_sql:insert into books file_format = (type = 'TSV')" -F "upload=@${CURDIR}/books.tsv" -u root: -XPUT "http://localhost:${QUERY_HTTP_HANDLER_PORT}/v1/streaming_load" > /dev/null 2>&1
2222
echo "select count(), count_if(title is null), count_if(author is null), count_if(date is null), count_if(publish_time is null) from books " | $MYSQL_CLIENT_CONNECT
2323

2424

tests/suites/1_stateful/01_load_v2/01_0004_streaming_parquet_int96.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if [ $? -ne 0 ]; then
1919
fi
2020

2121
# load parquet
22-
curl -H "insert_sql:insert into mytime format Parquet" -F "upload=@/tmp/mytime.parquet" -u root: -XPUT "http://localhost:${QUERY_HTTP_HANDLER_PORT}/v1/streaming_load" > /dev/null 2>&1
22+
curl -H "insert_sql:insert into mytime file_format = (type = 'Parquet')" -F "upload=@/tmp/mytime.parquet" -u root: -XPUT "http://localhost:${QUERY_HTTP_HANDLER_PORT}/v1/streaming_load" > /dev/null 2>&1
2323
echo "select * from mytime" | $MYSQL_CLIENT_CONNECT
2424
echo "drop table mytime;" | $MYSQL_CLIENT_CONNECT
2525

tests/suites/1_stateful/01_load_v2/01_0004_streaming_variant_load.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ if [ $? -ne 0 ]; then
3232
fi
3333

3434
# load csv
35+
# todo(ariesdevil): change to new syntax when format_quote landing
3536
curl -H "insert_sql:insert into variant_test format Csv" -H "format_skip_header:0" -H 'format_field_delimiter: ,' -H 'format_record_delimiter: \n' -H "format_quote: \'" -F "upload=@/tmp/json_sample1.csv" -u root: -XPUT "http://localhost:${QUERY_HTTP_HANDLER_PORT}/v1/streaming_load" > /dev/null 2>&1
3637
curl -H "insert_sql:insert into variant_test format Csv" -H "format_skip_header:0" -H 'format_field_delimiter: |' -H 'format_record_delimiter: \n' -H "format_quote: \'" -F "upload=@/tmp/json_sample2.csv" -u root: -XPUT "http://localhost:${QUERY_HTTP_HANDLER_PORT}/v1/streaming_load" > /dev/null 2>&1
3738
echo "select * from variant_test order by Id asc;" | $MYSQL_CLIENT_CONNECT
3839

3940
# load ndjson
40-
curl -H "insert_sql:insert into variant_test2 format NdJson" -H "format_skip_header:0" -F "upload=@/tmp/json_sample.ndjson" -u root: -XPUT "http://localhost:${QUERY_HTTP_HANDLER_PORT}/v1/streaming_load" > /dev/null 2>&1
41+
curl -H "insert_sql:insert into variant_test2 file_format = (type = 'NdJson' skip_header = 0)" -F "upload=@/tmp/json_sample.ndjson" -u root: -XPUT "http://localhost:${QUERY_HTTP_HANDLER_PORT}/v1/streaming_load" > /dev/null 2>&1
4142
echo "select * from variant_test2 order by b asc;" | $MYSQL_CLIENT_CONNECT
4243

4344
echo "drop table variant_test;" | $MYSQL_CLIENT_CONNECT

tests/suites/1_stateful/05_formats/05_00_load_unload_all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ test_format() {
3535

3636
echo "truncate table test_load_unload" | $MYSQL_CLIENT_CONNECT
3737

38-
curl -sH "insert_sql:insert into test_load_unload format ${1}" \
38+
curl -sH "insert_sql:insert into test_load_unload file_format = (type = '${1}')" \
3939
-F "upload=@/tmp/test_load_unload.txt" \
4040
-u root: -XPUT "http://localhost:${QUERY_HTTP_HANDLER_PORT}/v1/streaming_load" | grep -c "SUCCESS"
4141

tests/suites/1_stateful/05_formats/05_01_compact/05_01_01_load_compact_streaming_load.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ echo "CREATE TABLE t1
1717
);" | $MYSQL_CLIENT_CONNECT
1818

1919
echo "---load"
20-
curl -sH "insert_sql:insert into t1 format csv" \
20+
curl -sH "insert_sql:insert into t1 file_format = (type = 'CSV')" \
2121
-F "upload=@${DATA}" \
2222
-H "input_read_buffer_size: 100" \
2323
-u root: -XPUT "http://localhost:${QUERY_HTTP_HANDLER_PORT}/v1/streaming_load" | grep -c "SUCCESS"

tests/suites/1_stateful/05_formats/05_01_load_unload_simple.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ test_format() {
3131

3232
echo "truncate table test_load_unload" | $MYSQL_CLIENT_CONNECT
3333

34-
curl -sH "insert_sql:insert into test_load_unload format ${1}" \
34+
curl -sH "insert_sql:insert into test_load_unload file_format = (type = '${1}')" \
3535
-F "upload=@/tmp/test_load_unload.txt" \
3636
-u root: -XPUT "http://localhost:${QUERY_HTTP_HANDLER_PORT}/v1/streaming_load" | grep -c "SUCCESS"
3737

0 commit comments

Comments
 (0)