2021-09-01 23:18:09 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
# shellcheck source=../shell_config.sh
|
|
|
|
. "$CURDIR"/../shell_config.sh
|
|
|
|
|
2021-09-16 17:18:34 +00:00
|
|
|
url="${CLICKHOUSE_URL}&async_insert=1&wait_for_async_insert=1"
|
2021-09-01 23:18:09 +00:00
|
|
|
|
|
|
|
${CLICKHOUSE_CLIENT} -q "DROP TABLE IF EXISTS async_inserts"
|
|
|
|
${CLICKHOUSE_CLIENT} -q "CREATE TABLE async_inserts (id UInt32, s String) ENGINE = Memory"
|
|
|
|
|
|
|
|
${CLICKHOUSE_CURL} -sS "$url" -d 'INSERT INTO async_inserts FORMAT CSV
|
|
|
|
1,"a"
|
|
|
|
2,"b"' &
|
|
|
|
|
|
|
|
${CLICKHOUSE_CURL} -sS "$url" -d 'INSERT INTO async_inserts FORMAT CSV
|
|
|
|
3,"c"
|
|
|
|
4,"d"
|
|
|
|
' &
|
|
|
|
|
|
|
|
${CLICKHOUSE_CURL} -sS "$url" -d 'INSERT INTO async_inserts FORMAT JSONEachRow {"id": 5, "s": "e"} {"id": 6, "s": "f"}' &
|
|
|
|
${CLICKHOUSE_CURL} -sS "$url" -d 'INSERT INTO async_inserts FORMAT JSONEachRow {"id": 7, "s": "g"} {"id": 8, "s": "h"}' &
|
|
|
|
|
|
|
|
${CLICKHOUSE_CURL} -sS "$url" -d 'INSERT INTO async_inserts FORMAT CSVWithNames
|
|
|
|
"id","s"
|
|
|
|
9,"i"
|
|
|
|
10,"j"' &
|
|
|
|
|
|
|
|
${CLICKHOUSE_CURL} -sS "$url" -d 'INSERT INTO async_inserts FORMAT CSVWithNames
|
|
|
|
"id","s"
|
|
|
|
11,"k"
|
|
|
|
12,"l"
|
|
|
|
' &
|
|
|
|
|
|
|
|
wait
|
|
|
|
|
|
|
|
${CLICKHOUSE_CLIENT} -q "SELECT * FROM async_inserts ORDER BY id"
|
|
|
|
|
|
|
|
${CLICKHOUSE_CLIENT} -q "DROP TABLE async_inserts"
|