mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 17:44:23 +00:00
23 lines
821 B
Bash
Executable File
23 lines
821 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
QUERIES_FILE="queries.sql"
|
|
TABLE=$1
|
|
TRIES=3
|
|
|
|
cat "$QUERIES_FILE" | sed "s|{table}|\"${TABLE}\"|g" | while read query; do
|
|
|
|
echo -n "["
|
|
for i in $(seq 1 $TRIES); do
|
|
while true; do
|
|
RES=$(command time -f %e -o /dev/stdout curl -sS --location-trusted -H "Authorization: OAuth $YT_TOKEN" "$YT_PROXY.yt.yandex.net/query?default_format=Null&max_memory_usage=100000000000&max_memory_usage_for_all_queries=100000000000&max_concurrent_queries_for_user=100&database=*$YT_CLIQUE_ID" --data-binary @- <<< "$query" 2>/dev/null);
|
|
if [[ $? == 0 ]]; then
|
|
[[ $RES =~ 'fail|exception' ]] || break;
|
|
fi
|
|
done
|
|
|
|
[[ "$?" == "0" ]] && echo -n "${RES}" || echo -n "null"
|
|
[[ "$i" != $TRIES ]] && echo -n ", "
|
|
done
|
|
echo "],"
|
|
done
|