ClickHouse/tests/queries/0_stateless/02931_file_cluster.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
777 B
Bash
Raw Normal View History

2023-11-28 14:56:04 +00:00
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
USER_FILES_PATH=$($CLICKHOUSE_CLIENT_BINARY --query "select _path,_file from file('nonexist.txt', 'CSV', 'val1 char')" 2>&1 | grep Exception | awk '{gsub("/nonexist.txt","",$9); print $9}')
2023-11-28 14:56:04 +00:00
2023-11-29 14:55:24 +00:00
mkdir -p "${USER_FILES_PATH}"/"${CLICKHOUSE_TEST_UNIQUE_NAME}"/
2023-11-28 14:56:04 +00:00
for i in {1..10}
do
2023-11-29 14:55:24 +00:00
echo \"file"$i"\","$i" > "${USER_FILES_PATH}"/"${CLICKHOUSE_TEST_UNIQUE_NAME}"/file"$i".csv
2023-11-28 14:56:04 +00:00
done
2023-11-29 14:55:24 +00:00
$CLICKHOUSE_CLIENT --query "SELECT * FROM fileCluster('test_cluster_two_shards_localhost', '${CLICKHOUSE_TEST_UNIQUE_NAME}/file{1..10}.csv', 'CSV', 's String, i UInt32') ORDER BY (i, s)"
2023-11-28 14:56:04 +00:00
2023-11-29 14:55:24 +00:00
rm "${USER_FILES_PATH}"/"${CLICKHOUSE_TEST_UNIQUE_NAME}"/file*.csv