Allow run test without package install and on custom ports. (#1643)

* ExtractFromConfig --try

* Add symlinks to package

* clickhouse-test --order option
This commit is contained in:
proller 2017-12-15 22:34:19 +03:00 committed by GitHub
parent 254cced2cd
commit e7f82b6a8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
69 changed files with 592 additions and 379 deletions

View File

@ -67,7 +67,7 @@ if (CLICKHOUSE_SPLIT_BINARY)
add_executable (clickhouse-format clickhouse-format.cpp) add_executable (clickhouse-format clickhouse-format.cpp)
target_link_libraries (clickhouse-format clickhouse-format-lib dbms) target_link_libraries (clickhouse-format clickhouse-format-lib dbms)
set (CLICKHOUSE_ALL_TARGETS clickhouse-server clickhouse-client clickhouse-local clickhouse-benchmark clickhouse-performance-test clickhouse-format) set (CLICKHOUSE_ALL_TARGETS clickhouse-server clickhouse-client clickhouse-local clickhouse-benchmark clickhouse-performance-test clickhouse-extract-from-config clickhouse-format)
if (USE_EMBEDDED_COMPILER) if (USE_EMBEDDED_COMPILER)
add_executable (clickhouse-clang clickhouse-clang.cpp) add_executable (clickhouse-clang clickhouse-clang.cpp)
@ -79,7 +79,9 @@ if (CLICKHOUSE_SPLIT_BINARY)
endif () endif ()
install (TARGETS clickhouse-server ${CLICKHOUSE_ALL_TARGETS} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse) install (TARGETS clickhouse-server ${CLICKHOUSE_ALL_TARGETS} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
add_custom_target (clickhouse-bundle ALL DEPENDS ${CLICKHOUSE_ALL_TARGETS}) add_custom_target (clickhouse-bundle ALL DEPENDS ${CLICKHOUSE_ALL_TARGETS})
add_custom_target (clickhouse ALL DEPENDS clickhouse-bundle)
else () else ()
add_executable (clickhouse main.cpp) add_executable (clickhouse main.cpp)
target_include_directories (clickhouse BEFORE PRIVATE ${COMMON_INCLUDE_DIR}) target_include_directories (clickhouse BEFORE PRIVATE ${COMMON_INCLUDE_DIR})
@ -104,6 +106,7 @@ else ()
add_custom_target (clickhouse-local ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-local DEPENDS clickhouse) add_custom_target (clickhouse-local ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-local DEPENDS clickhouse)
add_custom_target (clickhouse-benchmark ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-benchmark DEPENDS clickhouse) add_custom_target (clickhouse-benchmark ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-benchmark DEPENDS clickhouse)
add_custom_target (clickhouse-performance-test ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-performance-test DEPENDS clickhouse) add_custom_target (clickhouse-performance-test ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-performance-test DEPENDS clickhouse)
add_custom_target (clickhouse-extract-from-config ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-extract-from-config DEPENDS clickhouse)
add_custom_target (clickhouse-format ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-format DEPENDS clickhouse) add_custom_target (clickhouse-format ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-format DEPENDS clickhouse)
# install always because depian package want this files: # install always because depian package want this files:
add_custom_target (clickhouse-clang ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-clang DEPENDS clickhouse) add_custom_target (clickhouse-clang ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-clang DEPENDS clickhouse)
@ -116,12 +119,13 @@ else ()
${CMAKE_CURRENT_BINARY_DIR}/clickhouse-local ${CMAKE_CURRENT_BINARY_DIR}/clickhouse-local
${CMAKE_CURRENT_BINARY_DIR}/clickhouse-benchmark ${CMAKE_CURRENT_BINARY_DIR}/clickhouse-benchmark
${CMAKE_CURRENT_BINARY_DIR}/clickhouse-performance-test ${CMAKE_CURRENT_BINARY_DIR}/clickhouse-performance-test
${CMAKE_CURRENT_BINARY_DIR}/clickhouse-extract-from-config
${CMAKE_CURRENT_BINARY_DIR}/clickhouse-format ${CMAKE_CURRENT_BINARY_DIR}/clickhouse-format
${CMAKE_CURRENT_BINARY_DIR}/clickhouse-clang ${CMAKE_CURRENT_BINARY_DIR}/clickhouse-clang
${CMAKE_CURRENT_BINARY_DIR}/clickhouse-lld ${CMAKE_CURRENT_BINARY_DIR}/clickhouse-lld
DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse) DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
add_custom_target (clickhouse-bundle ALL DEPENDS clickhouse) add_custom_target (clickhouse-bundle ALL DEPENDS clickhouse-server clickhouse-client clickhouse-local clickhouse-benchmark clickhouse-performance-test clickhouse-extract-from-config clickhouse-format clickhouse-clang clickhouse-lld)
endif () endif ()
install ( install (

View File

@ -24,7 +24,7 @@ static void setupLogging(const std::string & log_level)
} }
static std::string extractFromConfig( static std::string extractFromConfig(
const std::string & config_path, const std::string & key, bool process_zk_includes) const std::string & config_path, const std::string & key, bool process_zk_includes, bool try_get = false)
{ {
ConfigProcessor processor(config_path, /* throw_on_bad_incl = */ false, /* log_to_console = */ false); ConfigProcessor processor(config_path, /* throw_on_bad_incl = */ false, /* log_to_console = */ false);
bool has_zk_includes; bool has_zk_includes;
@ -38,6 +38,9 @@ static std::string extractFromConfig(
config_xml = processor.processConfig(&has_zk_includes, &zk_node_cache); config_xml = processor.processConfig(&has_zk_includes, &zk_node_cache);
} }
ConfigurationPtr configuration(new Poco::Util::XMLConfiguration(config_xml)); ConfigurationPtr configuration(new Poco::Util::XMLConfiguration(config_xml));
// do not throw exception if not found
if (try_get)
return configuration->getString(key, "");
return configuration->getString(key); return configuration->getString(key);
} }
@ -45,6 +48,7 @@ int mainEntryClickHouseExtractFromConfig(int argc, char ** argv)
{ {
bool print_stacktrace = false; bool print_stacktrace = false;
bool process_zk_includes = false; bool process_zk_includes = false;
bool try_get = false;
std::string log_level; std::string log_level;
std::string config_path; std::string config_path;
std::string key; std::string key;
@ -57,6 +61,7 @@ int mainEntryClickHouseExtractFromConfig(int argc, char ** argv)
("stacktrace", po::bool_switch(&print_stacktrace), "print stack traces of exceptions") ("stacktrace", po::bool_switch(&print_stacktrace), "print stack traces of exceptions")
("process-zk-includes", po::bool_switch(&process_zk_includes), ("process-zk-includes", po::bool_switch(&process_zk_includes),
"if there are from_zk elements in config, connect to ZooKeeper and process them") "if there are from_zk elements in config, connect to ZooKeeper and process them")
("try", po::bool_switch(&try_get), "Do not warn about missing keys")
("log-level", po::value<std::string>(&log_level)->default_value("error"), "log level") ("log-level", po::value<std::string>(&log_level)->default_value("error"), "log level")
("config-file,c", po::value<std::string>(&config_path)->required(), "path to config file") ("config-file,c", po::value<std::string>(&config_path)->required(), "path to config file")
("key,k", po::value<std::string>(&key)->required(), "key to get value for"); ("key,k", po::value<std::string>(&key)->required(), "key to get value for");
@ -83,7 +88,7 @@ int mainEntryClickHouseExtractFromConfig(int argc, char ** argv)
po::notify(options); po::notify(options);
setupLogging(log_level); setupLogging(log_level);
std::cout << extractFromConfig(config_path, key, process_zk_includes) << std::endl; std::cout << extractFromConfig(config_path, key, process_zk_includes, try_get) << std::endl;
} }
catch (...) catch (...)
{ {

View File

@ -114,10 +114,21 @@ def main(args):
# Reverse sort order: we want run newest test first. # Reverse sort order: we want run newest test first.
# And not reverse subtests # And not reverse subtests
def key_func(item): def key_func(item):
if args.random: if args.order == 'random':
return random() return random()
reverse = 1 if args.order == 'asc' else -1
if -1 == item.find('_'):
return 99998
prefix, suffix = item.split('_', 1) prefix, suffix = item.split('_', 1)
return -int(prefix), suffix
try:
return reverse * int(prefix), suffix
except ValueError:
return 99997
for case in sorted(filter(lambda case: re.search(args.test, case) if args.test else True, os.listdir(suite_dir)), key=key_func): for case in sorted(filter(lambda case: re.search(args.test, case) if args.test else True, os.listdir(suite_dir)), key=key_func):
if SERVER_DIED: if SERVER_DIED:
break break
@ -271,11 +282,12 @@ if __name__ == '__main__':
parser.add_argument('-q', '--queries', default = 'queries', help = 'Path to queries dir') parser.add_argument('-q', '--queries', default = 'queries', help = 'Path to queries dir')
parser.add_argument('-b', '--binary', default = 'clickhouse', help = 'Main clickhouse binary') parser.add_argument('-b', '--binary', default = 'clickhouse', help = 'Main clickhouse binary')
parser.add_argument('-c', '--client', help = 'Client program') parser.add_argument('-c', '--client', help = 'Client program')
parser.add_argument('--client_config', help = 'Client config (if you use not default ports)')
parser.add_argument('-o', '--output', help = 'Output xUnit compliant test report directory') parser.add_argument('-o', '--output', help = 'Output xUnit compliant test report directory')
parser.add_argument('-t', '--timeout', type = int, default = 600, help = 'Timeout for each test case in seconds') parser.add_argument('-t', '--timeout', type = int, default = 600, help = 'Timeout for each test case in seconds')
parser.add_argument('test', nargs = '?', help = 'Optional test case name regex') parser.add_argument('test', nargs = '?', help = 'Optional test case name regex')
parser.add_argument('--stop', action = 'store_true', default = None, dest = 'stop', help = 'Stop on network errors') parser.add_argument('--stop', action = 'store_true', default = None, dest = 'stop', help = 'Stop on network errors')
parser.add_argument('--random', action = 'store_true', default = None, dest = 'random', help = 'Randomize tests order') parser.add_argument('--order', default = 'desc', help = 'Run order (asc, desc, random)')
parser.add_argument('--testname', action = 'store_true', default = None, dest = 'testname', help = 'Make query with test name before test run') parser.add_argument('--testname', action = 'store_true', default = None, dest = 'testname', help = 'Make query with test name before test run')
group = parser.add_mutually_exclusive_group(required = False) group = parser.add_mutually_exclusive_group(required = False)
@ -288,4 +300,6 @@ if __name__ == '__main__':
args = parser.parse_args() args = parser.parse_args()
if args.client is None: if args.client is None:
args.client = args.binary + '-client' args.client = args.binary + '-client'
if args.client_config:
args.client += ' -c' + args.client_config
main(args) main(args)

View File

@ -1,9 +1,12 @@
#!/bin/sh #!/usr/bin/env bash
echo 'DROP TABLE IF EXISTS test.long_insert' | curl -sSg 'http://localhost:8123' -d @- CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
echo 'CREATE TABLE test.long_insert (a String) ENGINE = Memory' | curl -sSg 'http://localhost:8123' -d @- . $CURDIR/../shell_config.sh
echo 'DROP TABLE IF EXISTS test.long_insert' | ${CLICKHOUSE_CURL} -sSg ${CLICKHOUSE_URL} -d @-
echo 'CREATE TABLE test.long_insert (a String) ENGINE = Memory' | ${CLICKHOUSE_CURL} -sSg ${CLICKHOUSE_URL} -d @-
for string_size in 1 10 100 1000 10000 100000 1000000; do for string_size in 1 10 100 1000 10000 100000 1000000; do
# Если не указать LC_ALL=C, то Perl будет ругаться на некоторых плохо настроенных системах. # Если не указать LC_ALL=C, то Perl будет ругаться на некоторых плохо настроенных системах.
LC_ALL=C perl -we 'for my $letter ("a" .. "z") { print(($letter x '$string_size') . "\n") }' | curl -sSg 'http://localhost:8123/?query=INSERT+INTO+test.long_insert+FORMAT+TabSeparated' --data-binary @- LC_ALL=C perl -we 'for my $letter ("a" .. "z") { print(($letter x '$string_size') . "\n") }' | ${CLICKHOUSE_CURL} -sSg "${CLICKHOUSE_URL}?query=INSERT+INTO+test.long_insert+FORMAT+TabSeparated" --data-binary @-
echo 'SELECT substring(a, 1, 1) AS c, length(a) AS l FROM test.long_insert ORDER BY c, l' | curl -sSg 'http://localhost:8123' -d @- echo 'SELECT substring(a, 1, 1) AS c, length(a) AS l FROM test.long_insert ORDER BY c, l' | ${CLICKHOUSE_CURL} -sSg ${CLICKHOUSE_URL} -d @-
done done

View File

@ -1,6 +1,10 @@
#!/bin/sh -e #!/usr/bin/env bash
set -e
echo 'DROP TABLE IF EXISTS test.insert_fewer_columns' | curl -sSg 'http://localhost:8123' -d @- CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
echo 'CREATE TABLE test.insert_fewer_columns (a UInt8, b UInt8) ENGINE = Memory' | curl -sSg 'http://localhost:8123' -d @- . $CURDIR/../shell_config.sh
echo 'INSERT INTO test.insert_fewer_columns (a) VALUES (1), (2)' | curl -sSg 'http://localhost:8123' -d @-
echo 'SELECT * FROM test.insert_fewer_columns' | curl -sSg 'http://localhost:8123' -d @- echo 'DROP TABLE IF EXISTS test.insert_fewer_columns' | ${CLICKHOUSE_CURL} -sSg ${CLICKHOUSE_URL} -d @-
echo 'CREATE TABLE test.insert_fewer_columns (a UInt8, b UInt8) ENGINE = Memory' | ${CLICKHOUSE_CURL} -sSg ${CLICKHOUSE_URL} -d @-
echo 'INSERT INTO test.insert_fewer_columns (a) VALUES (1), (2)' | ${CLICKHOUSE_CURL} -sSg ${CLICKHOUSE_URL} -d @-
echo 'SELECT * FROM test.insert_fewer_columns' | ${CLICKHOUSE_CURL} -sSg ${CLICKHOUSE_URL} -d @-

View File

@ -1,5 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
set -o errexit set -o errexit
set -o pipefail set -o pipefail
@ -8,8 +11,8 @@ echo "
CREATE TABLE test.two_blocks (d Date) ENGINE = MergeTree(d, d, 1); CREATE TABLE test.two_blocks (d Date) ENGINE = MergeTree(d, d, 1);
INSERT INTO test.two_blocks VALUES ('2000-01-01'); INSERT INTO test.two_blocks VALUES ('2000-01-01');
INSERT INTO test.two_blocks VALUES ('2000-01-02'); INSERT INTO test.two_blocks VALUES ('2000-01-02');
" | clickhouse-client -n " | $CLICKHOUSE_CLIENT -n
for i in {1..10}; do seq 1 100 | sed 's/.*/SELECT count() FROM (SELECT * FROM test.two_blocks);/' | clickhouse-client -n --receive_timeout=1 | grep -vE '^2$' && echo 'Fail!' && break; echo -n '.'; done; echo for i in {1..10}; do seq 1 100 | sed 's/.*/SELECT count() FROM (SELECT * FROM test.two_blocks);/' | $CLICKHOUSE_CLIENT -n --receive_timeout=1 | grep -vE '^2$' && echo 'Fail!' && break; echo -n '.'; done; echo
echo "DROP TABLE test.two_blocks;" | clickhouse-client -n echo "DROP TABLE test.two_blocks;" | $CLICKHOUSE_CLIENT -n

View File

@ -1,6 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
set -o errexit set -o errexit
set -o pipefail set -o pipefail
for i in {1..10}; do seq 1 100 | sed 's/.*/SELECT count() FROM (SELECT * FROM (SELECT * FROM system.numbers_mt LIMIT 111) LIMIT 55);/' | clickhouse-client -n --receive_timeout=1 --max_block_size=1 | grep -vE '^55$' && echo 'Fail!' && break; echo -n '.'; done; echo for i in {1..10}; do seq 1 100 | sed 's/.*/SELECT count() FROM (SELECT * FROM (SELECT * FROM system.numbers_mt LIMIT 111) LIMIT 55);/' | $CLICKHOUSE_CLIENT -n --receive_timeout=1 --max_block_size=1 | grep -vE '^55$' && echo 'Fail!' && break; echo -n '.'; done; echo

View File

@ -1,6 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
set -o errexit set -o errexit
set -o pipefail set -o pipefail
for i in {1..10}; do seq 1 100 | sed 's/.*/SELECT * FROM (SELECT * FROM system.numbers_mt LIMIT 111) LIMIT 55;/' | clickhouse-client -n --receive_timeout=1 --max_block_size=1 | wc -l | grep -vE '^5500$' && echo 'Fail!' && break; echo -n '.'; done; echo for i in {1..10}; do seq 1 100 | sed 's/.*/SELECT * FROM (SELECT * FROM system.numbers_mt LIMIT 111) LIMIT 55;/' | $CLICKHOUSE_CLIENT -n --receive_timeout=1 --max_block_size=1 | wc -l | grep -vE '^5500$' && echo 'Fail!' && break; echo -n '.'; done; echo

View File

@ -1,6 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
set -o errexit set -o errexit
set -o pipefail set -o pipefail
for i in {1..10}; do seq 1 10 | sed 's/.*/SELECT 1 % ((number + 500) % 1000) FROM system.numbers_mt LIMIT 1000;/' | clickhouse-client -n --receive_timeout=1 --max_block_size=1 >/dev/null 2>&1 && echo 'Fail!' && break; echo -n '.'; done; echo for i in {1..10}; do seq 1 10 | sed 's/.*/SELECT 1 % ((number + 500) % 1000) FROM system.numbers_mt LIMIT 1000;/' | $CLICKHOUSE_CLIENT -n --receive_timeout=1 --max_block_size=1 >/dev/null 2>&1 && echo 'Fail!' && break; echo -n '.'; done; echo

View File

@ -1,6 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
set -o errexit set -o errexit
set -o pipefail set -o pipefail
for i in {1..10}; do seq 1 100 | sed 's/.*/SELECT * FROM system.numbers_mt LIMIT 111;/' | clickhouse-client -n --receive_timeout=1 --max_block_size=$(($RANDOM % 123 + 1)) | wc -l | grep -vE '^11100$' && echo 'Fail!' && break; echo -n '.'; done; echo for i in {1..10}; do seq 1 100 | sed 's/.*/SELECT * FROM system.numbers_mt LIMIT 111;/' | $CLICKHOUSE_CLIENT -n --receive_timeout=1 --max_block_size=$(($RANDOM % 123 + 1)) | wc -l | grep -vE '^11100$' && echo 'Fail!' && break; echo -n '.'; done; echo

View File

@ -1,2 +1,6 @@
#!/bin/sh #!/usr/bin/env bash
seq 1 1000 | sed -r 's/.+/CREATE TABLE IF NOT EXISTS test.buf (a UInt8) ENGINE = Buffer(test, b, 1, 1, 1, 1, 1, 1, 1); DROP TABLE test.buf;/' | clickhouse-client -n
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
seq 1 1000 | sed -r 's/.+/CREATE TABLE IF NOT EXISTS test.buf (a UInt8) ENGINE = Buffer(test, b, 1, 1, 1, 1, 1, 1, 1); DROP TABLE test.buf;/' | $CLICKHOUSE_CLIENT -n

View File

@ -1,7 +1,10 @@
#!/bin/sh #!/usr/bin/env bash
clickhouse-client --query="SELECT sum(dummy) FROM remote('localhost', system, one) WHERE 1 GLOBAL IN (SELECT 1)" CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
echo '1' | clickhouse-client --external --file=- --types=UInt8 --query="SELECT 1 IN _data" . $CURDIR/../shell_config.sh
echo '1' | clickhouse-client --external --file=- --types=UInt8 --query="SELECT 1 IN (SELECT * FROM _data)"
echo '1' | clickhouse-client --external --file=- --types=UInt8 --query="SELECT dummy FROM remote('localhost', system, one) WHERE 1 GLOBAL IN _data" $CLICKHOUSE_CLIENT --query="SELECT sum(dummy) FROM remote('localhost', system, one) WHERE 1 GLOBAL IN (SELECT 1)"
echo '1' | clickhouse-client --external --file=- --types=UInt8 --query="SELECT dummy FROM remote('localhost', system, one) WHERE 1 IN _data" echo '1' | $CLICKHOUSE_CLIENT --external --file=- --types=UInt8 --query="SELECT 1 IN _data"
echo '1' | $CLICKHOUSE_CLIENT --external --file=- --types=UInt8 --query="SELECT 1 IN (SELECT * FROM _data)"
echo '1' | $CLICKHOUSE_CLIENT --external --file=- --types=UInt8 --query="SELECT dummy FROM remote('localhost', system, one) WHERE 1 GLOBAL IN _data"
echo '1' | $CLICKHOUSE_CLIENT --external --file=- --types=UInt8 --query="SELECT dummy FROM remote('localhost', system, one) WHERE 1 IN _data"

View File

@ -1,15 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
set -o errexit set -o errexit
set -o pipefail set -o pipefail
clickhouse-client -n --query=" $CLICKHOUSE_CLIENT -n --query="
DROP TABLE IF EXISTS test.users; DROP TABLE IF EXISTS test.users;
CREATE TABLE test.users (UserID UInt64) ENGINE = Log; CREATE TABLE test.users (UserID UInt64) ENGINE = Log;
INSERT INTO test.users VALUES (1468013291393583084); INSERT INTO test.users VALUES (1468013291393583084);
INSERT INTO test.users VALUES (1321770221388956068); INSERT INTO test.users VALUES (1321770221388956068);
"; ";
for i in {1..10}; do seq 1 10 | sed "s/.*/SELECT count() FROM (SELECT * FROM remote('127.0.0.{1,2}', test, users) WHERE UserID IN (SELECT arrayJoin([1468013291393583084, 1321770221388956068])));/" | clickhouse-client -n | grep -vE '^4$' && echo 'Fail!' && break; echo -n '.'; done; echo for i in {1..10}; do seq 1 10 | sed "s/.*/SELECT count() FROM (SELECT * FROM remote('127.0.0.{1,2}', test, users) WHERE UserID IN (SELECT arrayJoin([1468013291393583084, 1321770221388956068])));/" | $CLICKHOUSE_CLIENT -n | grep -vE '^4$' && echo 'Fail!' && break; echo -n '.'; done; echo
clickhouse-client --query="DROP TABLE test.users;"; $CLICKHOUSE_CLIENT --query="DROP TABLE test.users;";

View File

@ -1,6 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
clickhouse-client -n --query=" CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
$CLICKHOUSE_CLIENT -n --query="
DROP TABLE IF EXISTS test.numbers_100k; DROP TABLE IF EXISTS test.numbers_100k;
CREATE VIEW test.numbers_100k AS SELECT * FROM system.numbers LIMIT 100000; CREATE VIEW test.numbers_100k AS SELECT * FROM system.numbers LIMIT 100000;
"; ";
@ -11,11 +14,11 @@ if [ -n "$DBMS_TESTS_UNDER_VALGRIND" ]; then
fi fi
for i in $(seq 1000000 $((20000 * $STEP_MULTIPLIER)) 10000000 && seq 10100000 $((100000 * $STEP_MULTIPLIER)) 20000000); do for i in $(seq 1000000 $((20000 * $STEP_MULTIPLIER)) 10000000 && seq 10100000 $((100000 * $STEP_MULTIPLIER)) 20000000); do
clickhouse-client --max_memory_usage=$i --query=" $CLICKHOUSE_CLIENT --max_memory_usage=$i --query="
SELECT intDiv(number, 5) AS k, max(toString(number)) FROM remote('127.0.0.{1,2}', test.numbers_100k) GROUP BY k ORDER BY k LIMIT 1; SELECT intDiv(number, 5) AS k, max(toString(number)) FROM remote('127.0.0.{1,2}', test.numbers_100k) GROUP BY k ORDER BY k LIMIT 1;
" 2> /dev/null; " 2> /dev/null;
CODE=$?; CODE=$?;
[ "$CODE" -ne "241" ] && [ "$CODE" -ne "0" ] && echo "Fail" && break; [ "$CODE" -ne "241" ] && [ "$CODE" -ne "0" ] && echo "Fail" && break;
done | uniq done | uniq
clickhouse-client --query="DROP TABLE test.numbers_100k;"; $CLICKHOUSE_CLIENT --query="DROP TABLE test.numbers_100k;";

View File

@ -1,23 +1,26 @@
#!/usr/bin/env bash #!/usr/bin/env bash
function create { CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
clickhouse-client --query="DROP TABLE IF EXISTS test.summing" . $CURDIR/../shell_config.sh
clickhouse-client --query="DROP TABLE IF EXISTS test.collapsing"
clickhouse-client --query="DROP TABLE IF EXISTS test.aggregating"
clickhouse-client --query="DROP TABLE IF EXISTS test.replacing"
clickhouse-client --query="CREATE TABLE test.summing (d Date DEFAULT today(), x UInt64, s UInt64 DEFAULT 1) ENGINE = SummingMergeTree(d, x, 8192)" function create {
clickhouse-client --query="CREATE TABLE test.collapsing (d Date DEFAULT today(), x UInt64, s Int8 DEFAULT 1) ENGINE = CollapsingMergeTree(d, x, 8192, s)" $CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS test.summing"
clickhouse-client --query="CREATE TABLE test.aggregating (d Date DEFAULT today(), x UInt64, s AggregateFunction(sum, UInt64)) ENGINE = AggregatingMergeTree(d, x, 8192)" $CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS test.collapsing"
clickhouse-client --query="CREATE TABLE test.replacing (d Date DEFAULT today(), x UInt64, s Int8 DEFAULT 1, v UInt64) ENGINE = ReplacingMergeTree(d, (x), 8192, v)" $CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS test.aggregating"
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS test.replacing"
$CLICKHOUSE_CLIENT --query="CREATE TABLE test.summing (d Date DEFAULT today(), x UInt64, s UInt64 DEFAULT 1) ENGINE = SummingMergeTree(d, x, 8192)"
$CLICKHOUSE_CLIENT --query="CREATE TABLE test.collapsing (d Date DEFAULT today(), x UInt64, s Int8 DEFAULT 1) ENGINE = CollapsingMergeTree(d, x, 8192, s)"
$CLICKHOUSE_CLIENT --query="CREATE TABLE test.aggregating (d Date DEFAULT today(), x UInt64, s AggregateFunction(sum, UInt64)) ENGINE = AggregatingMergeTree(d, x, 8192)"
$CLICKHOUSE_CLIENT --query="CREATE TABLE test.replacing (d Date DEFAULT today(), x UInt64, s Int8 DEFAULT 1, v UInt64) ENGINE = ReplacingMergeTree(d, (x), 8192, v)"
} }
function cleanup { function cleanup {
clickhouse-client --query="DROP TABLE test.summing" $CLICKHOUSE_CLIENT --query="DROP TABLE test.summing"
clickhouse-client --query="DROP TABLE test.collapsing" $CLICKHOUSE_CLIENT --query="DROP TABLE test.collapsing"
clickhouse-client --query="DROP TABLE test.aggregating" $CLICKHOUSE_CLIENT --query="DROP TABLE test.aggregating"
clickhouse-client --query="DROP TABLE test.replacing" $CLICKHOUSE_CLIENT --query="DROP TABLE test.replacing"
} }
@ -29,41 +32,41 @@ function test {
SETTINGS="--min_insert_block_size_rows=0 --min_insert_block_size_bytes=0" SETTINGS="--min_insert_block_size_rows=0 --min_insert_block_size_bytes=0"
clickhouse-client $SETTINGS --query="INSERT INTO test.summing (x) SELECT number AS x FROM system.numbers LIMIT $1" $CLICKHOUSE_CLIENT $SETTINGS --query="INSERT INTO test.summing (x) SELECT number AS x FROM system.numbers LIMIT $1"
clickhouse-client $SETTINGS --query="INSERT INTO test.summing (x) SELECT number AS x FROM system.numbers LIMIT $2" $CLICKHOUSE_CLIENT $SETTINGS --query="INSERT INTO test.summing (x) SELECT number AS x FROM system.numbers LIMIT $2"
clickhouse-client $SETTINGS --query="INSERT INTO test.collapsing (x) SELECT number AS x FROM system.numbers LIMIT $1" $CLICKHOUSE_CLIENT $SETTINGS --query="INSERT INTO test.collapsing (x) SELECT number AS x FROM system.numbers LIMIT $1"
clickhouse-client $SETTINGS --query="INSERT INTO test.collapsing (x) SELECT number AS x FROM system.numbers LIMIT $2" $CLICKHOUSE_CLIENT $SETTINGS --query="INSERT INTO test.collapsing (x) SELECT number AS x FROM system.numbers LIMIT $2"
clickhouse-client $SETTINGS --query="INSERT INTO test.aggregating (d, x, s) SELECT today() AS d, number AS x, sumState(materialize(toUInt64(1))) AS s FROM (SELECT number FROM system.numbers LIMIT $1) GROUP BY number" $CLICKHOUSE_CLIENT $SETTINGS --query="INSERT INTO test.aggregating (d, x, s) SELECT today() AS d, number AS x, sumState(materialize(toUInt64(1))) AS s FROM (SELECT number FROM system.numbers LIMIT $1) GROUP BY number"
clickhouse-client $SETTINGS --query="INSERT INTO test.aggregating (d, x, s) SELECT today() AS d, number AS x, sumState(materialize(toUInt64(1))) AS s FROM (SELECT number FROM system.numbers LIMIT $2) GROUP BY number" $CLICKHOUSE_CLIENT $SETTINGS --query="INSERT INTO test.aggregating (d, x, s) SELECT today() AS d, number AS x, sumState(materialize(toUInt64(1))) AS s FROM (SELECT number FROM system.numbers LIMIT $2) GROUP BY number"
clickhouse-client $SETTINGS --query="INSERT INTO test.replacing (x, v) SELECT number AS x, toUInt64(number % 3 == 0) FROM system.numbers LIMIT $1" $CLICKHOUSE_CLIENT $SETTINGS --query="INSERT INTO test.replacing (x, v) SELECT number AS x, toUInt64(number % 3 == 0) FROM system.numbers LIMIT $1"
clickhouse-client $SETTINGS --query="INSERT INTO test.replacing (x, v) SELECT number AS x, toUInt64(number % 3 == 1) FROM system.numbers LIMIT $2" $CLICKHOUSE_CLIENT $SETTINGS --query="INSERT INTO test.replacing (x, v) SELECT number AS x, toUInt64(number % 3 == 1) FROM system.numbers LIMIT $2"
clickhouse-client --query="SELECT count() = $SUM, sum(s) = $SUM FROM test.summing" $CLICKHOUSE_CLIENT --query="SELECT count() = $SUM, sum(s) = $SUM FROM test.summing"
clickhouse-client --query="OPTIMIZE TABLE test.summing" $CLICKHOUSE_CLIENT --query="OPTIMIZE TABLE test.summing"
clickhouse-client --query="SELECT count() = $MAX, sum(s) = $SUM FROM test.summing" $CLICKHOUSE_CLIENT --query="SELECT count() = $MAX, sum(s) = $SUM FROM test.summing"
echo echo
clickhouse-client --query="SELECT count() = $SUM, sum(s) = $SUM FROM test.collapsing" $CLICKHOUSE_CLIENT --query="SELECT count() = $SUM, sum(s) = $SUM FROM test.collapsing"
clickhouse-client --query="OPTIMIZE TABLE test.collapsing" $CLICKHOUSE_CLIENT --query="OPTIMIZE TABLE test.collapsing"
clickhouse-client --query="SELECT count() = $MAX, sum(s) = $MAX FROM test.collapsing" $CLICKHOUSE_CLIENT --query="SELECT count() = $MAX, sum(s) = $MAX FROM test.collapsing"
echo echo
clickhouse-client --query="SELECT count() = $SUM, sumMerge(s) = $SUM FROM test.aggregating" $CLICKHOUSE_CLIENT --query="SELECT count() = $SUM, sumMerge(s) = $SUM FROM test.aggregating"
clickhouse-client --query="OPTIMIZE TABLE test.aggregating" $CLICKHOUSE_CLIENT --query="OPTIMIZE TABLE test.aggregating"
clickhouse-client --query="SELECT count() = $MAX, sumMerge(s) = $SUM FROM test.aggregating" $CLICKHOUSE_CLIENT --query="SELECT count() = $MAX, sumMerge(s) = $SUM FROM test.aggregating"
echo echo
clickhouse-client --query="SELECT count() = $SUM, sum(s) = $SUM FROM test.replacing" $CLICKHOUSE_CLIENT --query="SELECT count() = $SUM, sum(s) = $SUM FROM test.replacing"
clickhouse-client --query="OPTIMIZE TABLE test.replacing" $CLICKHOUSE_CLIENT --query="OPTIMIZE TABLE test.replacing"
clickhouse-client --query="SELECT count() = $MAX, sum(s) = $MAX FROM test.replacing" $CLICKHOUSE_CLIENT --query="SELECT count() = $MAX, sum(s) = $MAX FROM test.replacing"
clickhouse-client --query="SELECT count() = sum(v) FROM test.replacing where x % 3 == 0 and x < $1" $CLICKHOUSE_CLIENT --query="SELECT count() = sum(v) FROM test.replacing where x % 3 == 0 and x < $1"
clickhouse-client --query="SELECT count() = sum(v) FROM test.replacing where x % 3 == 1 and x < $2" $CLICKHOUSE_CLIENT --query="SELECT count() = sum(v) FROM test.replacing where x % 3 == 1 and x < $2"
clickhouse-client --query="SELECT sum(v) = 0 FROM test.replacing where x % 3 == 2" $CLICKHOUSE_CLIENT --query="SELECT sum(v) = 0 FROM test.replacing where x % 3 == 2"
echo echo
echo echo
} }
merged_rows_0=`clickhouse-client -q "select value from system.events where event = 'MergedRows'"` merged_rows_0=`$CLICKHOUSE_CLIENT -q "select value from system.events where event = 'MergedRows'"`
test 8191 8191 test 8191 8191
test 8191 8192 test 8191 8192
@ -78,7 +81,7 @@ test 8193 8194
test 8194 8193 test 8194 8193
test 8194 8194 test 8194 8194
merged_rows_1=`clickhouse-client -q "select value from system.events where event = 'MergedRows'"` merged_rows_1=`$CLICKHOUSE_CLIENT -q "select value from system.events where event = 'MergedRows'"`
[[ $merged_rows_1 -le $merged_rows_0 ]] [[ $merged_rows_1 -le $merged_rows_0 ]]
cleanup cleanup

View File

@ -1,11 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
curl -sS 'http://localhost:8123/?query=DROP+TABLE' -d 'IF EXISTS test.insert' CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
curl -sS 'http://localhost:8123/?query=CREATE' -d 'TABLE test.insert (x UInt8) ENGINE = Memory' . $CURDIR/../shell_config.sh
curl -sS 'http://localhost:8123/' -d 'INSERT INTO test.insert VALUES (1),(2)'
curl -sS 'http://localhost:8123/?query=INSERT+INTO+test.insert+VALUES' -d '(3),(4)' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=DROP+TABLE" -d 'IF EXISTS test.insert'
curl -sS 'http://localhost:8123/?query=INSERT+INTO+test.insert' -d 'VALUES (5),(6)' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=CREATE" -d 'TABLE test.insert (x UInt8) ENGINE = Memory'
curl -sS 'http://localhost:8123/?query=INSERT+INTO+test.insert+VALUES+(7)' -d ',(8)' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d 'INSERT INTO test.insert VALUES (1),(2)'
curl -sS 'http://localhost:8123/?query=INSERT+INTO+test.insert+VALUES+(9),(10)' -d ' ' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=INSERT+INTO+test.insert+VALUES" -d '(3),(4)'
curl -sS 'http://localhost:8123/' -d 'SELECT x FROM test.insert ORDER BY x' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=INSERT+INTO+test.insert" -d 'VALUES (5),(6)'
curl -sS 'http://localhost:8123/?query=DROP+TABLE' -d 'test.insert' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=INSERT+INTO+test.insert+VALUES+(7)" -d ',(8)'
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=INSERT+INTO+test.insert+VALUES+(9),(10)" -d ' '
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d 'SELECT x FROM test.insert ORDER BY x'
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=DROP+TABLE" -d 'test.insert'

View File

@ -1,3 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
(echo 'SELECT number FROM system.numbers WHERE transform(number, ['; seq 1 100000 | tr '\n' ','; echo '0],['; seq 1 100000 | tr '\n' ','; echo '0]) = 10000000 LIMIT 1';) | clickhouse-client --max_query_size=100000000 CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
(echo 'SELECT number FROM system.numbers WHERE transform(number, ['; seq 1 100000 | tr '\n' ','; echo '0],['; seq 1 100000 | tr '\n' ','; echo '0]) = 10000000 LIMIT 1';) | $CLICKHOUSE_CLIENT --max_query_size=100000000

View File

@ -1,6 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
curl -sS http://localhost:8123/?extremes=1 -d @- <<< "DROP TABLE IF EXISTS test.test" CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
curl -sS http://localhost:8123/?extremes=1 -d @- <<< "CREATE TABLE test.test (x UInt8) ENGINE = Log" . $CURDIR/../shell_config.sh
curl -sS http://localhost:8123/?extremes=1 -d @- <<< "INSERT INTO test.test SELECT 1 AS x"
curl -sS http://localhost:8123/?extremes=1 -d @- <<< "DROP TABLE test.test" ${CLICKHOUSE_CURL} -sS ${CLICKHOUSE_URL}?extremes=1 -d @- <<< "DROP TABLE IF EXISTS test.test"
${CLICKHOUSE_CURL} -sS ${CLICKHOUSE_URL}?extremes=1 -d @- <<< "CREATE TABLE test.test (x UInt8) ENGINE = Log"
${CLICKHOUSE_CURL} -sS ${CLICKHOUSE_URL}?extremes=1 -d @- <<< "INSERT INTO test.test SELECT 1 AS x"
${CLICKHOUSE_CURL} -sS ${CLICKHOUSE_URL}?extremes=1 -d @- <<< "DROP TABLE test.test"

View File

@ -1,9 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
curl -vsS http://localhost:8123/?default_format=JSONCompact --data-binary @- <<< "SELECT 1" 2>&1 | grep '< Content-Type'; CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
curl -vsS http://localhost:8123/ --data-binary @- <<< "SELECT 1 FORMAT JSON" 2>&1 | grep '< Content-Type'; . $CURDIR/../shell_config.sh
curl -vsS http://localhost:8123/ --data-binary @- <<< "SELECT 1" 2>&1 | grep '< Content-Type';
curl -vsS http://localhost:8123/ --data-binary @- <<< "SELECT 1 FORMAT TabSeparated" 2>&1 | grep '< Content-Type'; ${CLICKHOUSE_CURL} -vsS ${CLICKHOUSE_URL}?default_format=JSONCompact --data-binary @- <<< "SELECT 1" 2>&1 | grep '< Content-Type';
curl -vsS http://localhost:8123/ --data-binary @- <<< "SELECT 1 FORMAT Vertical" 2>&1 | grep '< Content-Type'; ${CLICKHOUSE_CURL} -vsS ${CLICKHOUSE_URL} --data-binary @- <<< "SELECT 1 FORMAT JSON" 2>&1 | grep '< Content-Type';
curl -vsS http://localhost:8123/ --data-binary @- <<< "SELECT 1 FORMAT Native" 2>&1 | grep '< Content-Type'; ${CLICKHOUSE_CURL} -vsS ${CLICKHOUSE_URL} --data-binary @- <<< "SELECT 1" 2>&1 | grep '< Content-Type';
curl -vsS http://localhost:8123/ --data-binary @- <<< "SELECT 1 FORMAT RowBinary" 2>&1 | grep '< Content-Type'; ${CLICKHOUSE_CURL} -vsS ${CLICKHOUSE_URL} --data-binary @- <<< "SELECT 1 FORMAT TabSeparated" 2>&1 | grep '< Content-Type';
${CLICKHOUSE_CURL} -vsS ${CLICKHOUSE_URL} --data-binary @- <<< "SELECT 1 FORMAT Vertical" 2>&1 | grep '< Content-Type';
${CLICKHOUSE_CURL} -vsS ${CLICKHOUSE_URL} --data-binary @- <<< "SELECT 1 FORMAT Native" 2>&1 | grep '< Content-Type';
${CLICKHOUSE_CURL} -vsS ${CLICKHOUSE_URL} --data-binary @- <<< "SELECT 1 FORMAT RowBinary" 2>&1 | grep '< Content-Type';

View File

@ -1,23 +1,26 @@
#!/usr/bin/env bash #!/usr/bin/env bash
clickhouse-client --query="DROP TABLE IF EXISTS test.csv"; CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
clickhouse-client --query="CREATE TABLE test.csv (s String, n UInt64, d Date) ENGINE = Memory"; . $CURDIR/../shell_config.sh
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS test.csv";
$CLICKHOUSE_CLIENT --query="CREATE TABLE test.csv (s String, n UInt64, d Date) ENGINE = Memory";
echo '"Hello, world", 123, "2016-01-01" echo '"Hello, world", 123, "2016-01-01"
"Hello, ""world""", "456", 2016-01-02, "Hello, ""world""", "456", 2016-01-02,
Hello "world", 789 ,2016-01-03 Hello "world", 789 ,2016-01-03
"Hello "Hello
world", 100, 2016-01-04,' | clickhouse-client --query="INSERT INTO test.csv FORMAT CSV"; world", 100, 2016-01-04,' | $CLICKHOUSE_CLIENT --query="INSERT INTO test.csv FORMAT CSV";
clickhouse-client --query="SELECT * FROM test.csv ORDER BY d"; $CLICKHOUSE_CLIENT --query="SELECT * FROM test.csv ORDER BY d";
clickhouse-client --query="DROP TABLE test.csv"; $CLICKHOUSE_CLIENT --query="DROP TABLE test.csv";
clickhouse-client --query="CREATE TABLE test.csv (t DateTime, s String) ENGINE = Memory"; $CLICKHOUSE_CLIENT --query="CREATE TABLE test.csv (t DateTime, s String) ENGINE = Memory";
echo '"2016-01-01 01:02:03","1" echo '"2016-01-01 01:02:03","1"
2016-01-02 01:02:03, "2" 2016-01-02 01:02:03, "2"
1502792101,"3" 1502792101,"3"
99999,"4"' | clickhouse-client --query="INSERT INTO test.csv FORMAT CSV"; 99999,"4"' | $CLICKHOUSE_CLIENT --query="INSERT INTO test.csv FORMAT CSV";
clickhouse-client --query="SELECT * FROM test.csv ORDER BY s"; $CLICKHOUSE_CLIENT --query="SELECT * FROM test.csv ORDER BY s";
clickhouse-client --query="DROP TABLE test.csv"; $CLICKHOUSE_CLIENT --query="DROP TABLE test.csv";

View File

@ -3,6 +3,9 @@
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh . $CURDIR/../shell_config.sh
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?enable_http_compression=1" -d 'SELECT number FROM system.numbers LIMIT 10'; ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?enable_http_compression=1" -d 'SELECT number FROM system.numbers LIMIT 10';
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?enable_http_compression=0" -H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 10'; ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?enable_http_compression=0" -H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 10';
@ -14,7 +17,7 @@ ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?enable_http_compression=1"
${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?enable_http_compression=1" -H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding'; ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?enable_http_compression=1" -H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding';
${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?enable_http_compression=1" -H 'Accept-Encoding: deflate' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding'; ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?enable_http_compression=1" -H 'Accept-Encoding: deflate' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding';
${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?enable_http_compression=1" -H 'Accept-Encoding: gzip, deflate' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding'; ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?enable_http_compression=1" -H 'Accept-Encoding: gzip, deflate' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding';
-vsS '${CLICKHOUSE_URL}?enable_http_compression=1' -H 'Accept-Encoding: zip, eflate' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding'; ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?enable_http_compression=1" -H 'Accept-Encoding: zip, eflate' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding';
echo "SELECT 1" | ${CLICKHOUSE_CURL} -sS --data-binary @- ${CLICKHOUSE_URL}; echo "SELECT 1" | ${CLICKHOUSE_CURL} -sS --data-binary @- ${CLICKHOUSE_URL};
echo "SELECT 1" | gzip -c | ${CLICKHOUSE_CURL} -sS --data-binary @- -H 'Content-Encoding: gzip' ${CLICKHOUSE_URL}; echo "SELECT 1" | gzip -c | ${CLICKHOUSE_CURL} -sS --data-binary @- -H 'Content-Encoding: gzip' ${CLICKHOUSE_URL};

View File

@ -1,3 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo -ne '1,Hello\n2,World\n' | curl -sSF 'file=@-' 'http://localhost:8123/?query=SELECT+*+FROM+file&file_format=CSV&file_types=UInt8,String'; CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
echo -ne '1,Hello\n2,World\n' | ${CLICKHOUSE_CURL} -sSF 'file=@-' "${CLICKHOUSE_URL}?query=SELECT+*+FROM+file&file_format=CSV&file_types=UInt8,String";

View File

@ -1,20 +1,23 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
# При POST можно делать что угодно. # При POST можно делать что угодно.
curl -sS "http://localhost:8123/?query=SELECT+name,value,changed+FROM+system.settings+WHERE+name+IN+('readonly','max_rows_to_read')&max_rows_to_read=10000&default_format=PrettySpaceNoEscapes" -d' ' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=SELECT+name,value,changed+FROM+system.settings+WHERE+name+IN+('readonly','max_rows_to_read')&max_rows_to_read=10000&default_format=PrettySpaceNoEscapes" -d' '
# При GET выставляется readonly = 2. # При GET выставляется readonly = 2.
curl -sS "http://localhost:8123/?query=SELECT+name,value,changed+FROM+system.settings+WHERE+name+IN+('readonly','max_rows_to_read')&max_rows_to_read=10000&default_format=PrettySpaceNoEscapes" ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=SELECT+name,value,changed+FROM+system.settings+WHERE+name+IN+('readonly','max_rows_to_read')&max_rows_to_read=10000&default_format=PrettySpaceNoEscapes"
# Можно самому усилить readonly и при этом изменить какие-то ещё настройки. # Можно самому усилить readonly и при этом изменить какие-то ещё настройки.
curl -sS "http://localhost:8123/?query=SELECT+name,value,changed+FROM+system.settings+WHERE+name+IN+('readonly','max_rows_to_read')&readonly=1&max_rows_to_read=10000&default_format=PrettySpaceNoEscapes" -d' ' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=SELECT+name,value,changed+FROM+system.settings+WHERE+name+IN+('readonly','max_rows_to_read')&readonly=1&max_rows_to_read=10000&default_format=PrettySpaceNoEscapes" -d' '
curl -sS "http://localhost:8123/?query=SELECT+name,value,changed+FROM+system.settings+WHERE+name+IN+('readonly','max_rows_to_read')&readonly=2&max_rows_to_read=10000&default_format=PrettySpaceNoEscapes" -d' ' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=SELECT+name,value,changed+FROM+system.settings+WHERE+name+IN+('readonly','max_rows_to_read')&readonly=2&max_rows_to_read=10000&default_format=PrettySpaceNoEscapes" -d' '
curl -vsS "http://localhost:8123/?query=DROP+TABLE+IF+EXISTS+test.nonexistent" 2>&1 | grep -q '500 Internal Server Error' && echo 'Ok' || echo 'Fail' ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?query=DROP+TABLE+IF+EXISTS+test.nonexistent" 2>&1 | grep -q '500 Internal Server Error' && echo 'Ok' || echo 'Fail'
curl -vsS "http://localhost:8123/?readonly=0&query=DROP+TABLE+IF+EXISTS+test.nonexistent" 2>&1 | grep -q '500 Internal Server Error' && echo 'Ok' || echo 'Fail' ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?readonly=0&query=DROP+TABLE+IF+EXISTS+test.nonexistent" 2>&1 | grep -q '500 Internal Server Error' && echo 'Ok' || echo 'Fail'
curl -sS "http://localhost:8123/?query=DROP+TABLE+IF+EXISTS+test.nonexistent" -d ' ' | wc -l ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=DROP+TABLE+IF+EXISTS+test.nonexistent" -d ' ' | wc -l
curl -sS "http://localhost:8123/?readonly=0&query=DROP+TABLE+IF+EXISTS+test.nonexistent" -d ' ' | wc -l ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?readonly=0&query=DROP+TABLE+IF+EXISTS+test.nonexistent" -d ' ' | wc -l
curl -vsS "http://localhost:8123/?readonly=1&query=DROP+TABLE+IF+EXISTS+test.nonexistent" -d ' ' 2>&1 | grep -q '500 Internal Server Error' && echo 'Ok' || echo 'Fail' ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?readonly=1&query=DROP+TABLE+IF+EXISTS+test.nonexistent" -d ' ' 2>&1 | grep -q '500 Internal Server Error' && echo 'Ok' || echo 'Fail'
curl -vsS "http://localhost:8123/?readonly=2&query=DROP+TABLE+IF+EXISTS+test.nonexistent" -d ' ' 2>&1 | grep -q '500 Internal Server Error' && echo 'Ok' || echo 'Fail' ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?readonly=2&query=DROP+TABLE+IF+EXISTS+test.nonexistent" -d ' ' 2>&1 | grep -q '500 Internal Server Error' && echo 'Ok' || echo 'Fail'

View File

@ -1,14 +1,17 @@
#!/usr/bin/env bash #!/usr/bin/env bash
clickhouse-client --query="DROP TABLE IF EXISTS test.tskv"; CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
clickhouse-client --query="CREATE TABLE test.tskv (tskv_format String, timestamp DateTime, timezone String, text String, binary_data String) ENGINE = Memory"; . $CURDIR/../shell_config.sh
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS test.tskv";
$CLICKHOUSE_CLIENT --query="CREATE TABLE test.tskv (tskv_format String, timestamp DateTime, timezone String, text String, binary_data String) ENGINE = Memory";
echo -n 'tskv tskv_format=custom-service-log timestamp=2013-01-01 00:00:00 timezone=+0400 text=multiline\ntext binary_data=can contain \0 symbol echo -n 'tskv tskv_format=custom-service-log timestamp=2013-01-01 00:00:00 timezone=+0400 text=multiline\ntext binary_data=can contain \0 symbol
binary_data=abc text=Hello, world binary_data=abc text=Hello, world
binary_data=def text= binary_data=def text=
tskv tskv
' | clickhouse-client --query="INSERT INTO test.tskv FORMAT TSKV"; ' | $CLICKHOUSE_CLIENT --query="INSERT INTO test.tskv FORMAT TSKV";
clickhouse-client --query="SELECT * FROM test.tskv ORDER BY binary_data"; $CLICKHOUSE_CLIENT --query="SELECT * FROM test.tskv ORDER BY binary_data";
clickhouse-client --query="DROP TABLE test.tskv"; $CLICKHOUSE_CLIENT --query="DROP TABLE test.tskv";

View File

@ -1,9 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
curl -sS 'http://localhost:8123/?extremes=1&output_format_write_statistics=0' -d "SELECT 1 AS k, count() GROUP BY k WITH TOTALS"; CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
curl -sS 'http://localhost:8123/?extremes=1&output_format_write_statistics=0' -d "SELECT 1234567890123 AS k, count() GROUP BY k WITH TOTALS FORMAT JSON"; . $CURDIR/../shell_config.sh
curl -sS 'http://localhost:8123/?extremes=1&output_format_write_statistics=0' -d "SELECT toFloat32(1.23) AS k, count() GROUP BY k WITH TOTALS FORMAT JSONCompact";
curl -sS 'http://localhost:8123/?extremes=1&output_format_write_statistics=0' -d "SELECT toDate('2010-01-01') AS k, count() GROUP BY k WITH TOTALS"; ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?extremes=1&output_format_write_statistics=0" -d "SELECT 1 AS k, count() GROUP BY k WITH TOTALS";
curl -sS 'http://localhost:8123/?extremes=1&output_format_write_statistics=0' -d "SELECT toDateTime('2010-01-01 01:02:03') AS k, count() GROUP BY k WITH TOTALS FORMAT JSON"; ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?extremes=1&output_format_write_statistics=0" -d "SELECT 1234567890123 AS k, count() GROUP BY k WITH TOTALS FORMAT JSON";
curl -sS 'http://localhost:8123/?extremes=1&output_format_write_statistics=0' -d "SELECT 1.1 AS k, count() GROUP BY k WITH TOTALS FORMAT JSONCompact"; ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?extremes=1&output_format_write_statistics=0" -d "SELECT toFloat32(1.23) AS k, count() GROUP BY k WITH TOTALS FORMAT JSONCompact";
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?extremes=1&output_format_write_statistics=0" -d "SELECT toDate('2010-01-01') AS k, count() GROUP BY k WITH TOTALS";
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?extremes=1&output_format_write_statistics=0" -d "SELECT toDateTime('2010-01-01 01:02:03') AS k, count() GROUP BY k WITH TOTALS FORMAT JSON";
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?extremes=1&output_format_write_statistics=0" -d "SELECT 1.1 AS k, count() GROUP BY k WITH TOTALS FORMAT JSONCompact";

View File

@ -1,4 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo -ne '\x50\x74\x32\xf2\x59\xe9\x8a\xdb\x37\xc6\x4a\xa7\xfb\x22\xc4\x39''\x82\x13\x00\x00\x00\x09\x00\x00\x00''\x90SELECT 1\n' | curl -sS 'http://localhost:8123/?decompress=1' --data-binary @- CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
echo -ne 'xxxxxxxxxxxxxxxx''\x82\x13\x00\x00\x00\x09\x00\x00\x00''\x90SELECT 1\n' | curl -sS 'http://localhost:8123/?decompress=1&http_native_compression_disable_checksumming_on_decompress=1' --data-binary @- . $CURDIR/../shell_config.sh
echo -ne '\x50\x74\x32\xf2\x59\xe9\x8a\xdb\x37\xc6\x4a\xa7\xfb\x22\xc4\x39''\x82\x13\x00\x00\x00\x09\x00\x00\x00''\x90SELECT 1\n' | ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?decompress=1" --data-binary @-
echo -ne 'xxxxxxxxxxxxxxxx''\x82\x13\x00\x00\x00\x09\x00\x00\x00''\x90SELECT 1\n' | ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?decompress=1&http_native_compression_disable_checksumming_on_decompress=1" --data-binary @-

View File

@ -1,8 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo 'DROP TABLE IF EXISTS test.bom' | curl -sS 'http://localhost:8123/' --data-binary @- CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
echo 'CREATE TABLE test.bom (a UInt8, b UInt8, c UInt8) ENGINE = Memory' | curl -sS 'http://localhost:8123/' --data-binary @- . $CURDIR/../shell_config.sh
echo -ne '1,2,3\n' | curl -sS 'http://localhost:8123/?query=INSERT+INTO+test.bom+FORMAT+CSV' --data-binary @-
echo -ne '\xEF\xBB\xBF4,5,6\n' | curl -sS 'http://localhost:8123/?query=INSERT+INTO+test.bom+FORMAT+CSV' --data-binary @- echo 'DROP TABLE IF EXISTS test.bom' | ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" --data-binary @-
echo 'SELECT * FROM test.bom ORDER BY a' | curl -sS 'http://localhost:8123/' --data-binary @- echo 'CREATE TABLE test.bom (a UInt8, b UInt8, c UInt8) ENGINE = Memory' | ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" --data-binary @-
echo 'DROP TABLE test.bom' | curl -sS 'http://localhost:8123/' --data-binary @- echo -ne '1,2,3\n' | ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=INSERT+INTO+test.bom+FORMAT+CSV" --data-binary @-
echo -ne '\xEF\xBB\xBF4,5,6\n' | ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=INSERT+INTO+test.bom+FORMAT+CSV" --data-binary @-
echo 'SELECT * FROM test.bom ORDER BY a' | ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" --data-binary @-
echo 'DROP TABLE test.bom' | ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" --data-binary @-

View File

@ -1,10 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
curl -sS 'http://localhost:8123/' -d 'SELECT a' | wc -l CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
curl -sS 'http://localhost:8123/?stacktrace=0' -d 'SELECT a' | wc -l . $CURDIR/../shell_config.sh
[[ $(curl -sS 'http://localhost:8123/?stacktrace=1' -d 'SELECT a' | wc -l) -gt 3 ]] && echo 'Ok' || echo 'Fail'
curl -sS 'http://localhost:8123/' -d "SELECT intDiv(number, 0) FROM remote('127.0.0.{1,2}', system.numbers)" | wc -l
clickhouse-client --query="SELECT a" 2>&1 | wc -l ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d 'SELECT a' | wc -l
[[ $(clickhouse-client --query="SELECT a" --stacktrace 2>&1 | wc -l) -gt 3 ]] && echo 'Ok' || echo 'Fail' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?stacktrace=0" -d 'SELECT a' | wc -l
clickhouse-client --query="SELECT intDiv(number, 0) FROM remote('127.0.0.{1,2}', system.numbers)" 2>&1 | wc -l [[ $(${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?stacktrace=1" -d 'SELECT a' | wc -l) -gt 3 ]] && echo 'Ok' || echo 'Fail'
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d "SELECT intDiv(number, 0) FROM remote('127.0.0.{1,2}', system.numbers)" | wc -l
$CLICKHOUSE_CLIENT --query="SELECT a" 2>&1 | wc -l
[[ $($CLICKHOUSE_CLIENT --query="SELECT a" --stacktrace 2>&1 | wc -l) -gt 3 ]] && echo 'Ok' || echo 'Fail'
$CLICKHOUSE_CLIENT --query="SELECT intDiv(number, 0) FROM remote('127.0.0.{1,2}', system.numbers)" 2>&1 | wc -l

View File

@ -1,8 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
curl -sS 'http://localhost:8123/' -d 'DROP TABLE IF EXISTS test.bad_arrays' CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
curl -sS 'http://localhost:8123/' -d 'CREATE TABLE test.bad_arrays (a Array(String)) ENGINE = Memory' . $CURDIR/../shell_config.sh
curl -sS 'http://localhost:8123/' -d 'INSERT INTO test.bad_arrays VALUES ([123])' 2>&1 | grep -c 'Exception'
curl -sS 'http://localhost:8123/' -d "INSERT INTO test.bad_arrays VALUES (['123', concat('Hello', ' world!'), toString(123)])" ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d 'DROP TABLE IF EXISTS test.bad_arrays'
curl -sS 'http://localhost:8123/' -d 'SELECT * FROM test.bad_arrays' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d 'CREATE TABLE test.bad_arrays (a Array(String)) ENGINE = Memory'
curl -sS 'http://localhost:8123/' -d 'DROP TABLE test.bad_arrays' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d 'INSERT INTO test.bad_arrays VALUES ([123])' 2>&1 | grep -c 'Exception'
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d "INSERT INTO test.bad_arrays VALUES (['123', concat('Hello', ' world!'), toString(123)])"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d 'SELECT * FROM test.bad_arrays'
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d 'DROP TABLE test.bad_arrays'

View File

@ -1,5 +1,8 @@
#!/bin/sh #!/usr/bin/env bash
clickhouse-client --host=localhost --query="SELECT 1"; CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
clickhouse-client --host localhost --query "SELECT 1"; . $CURDIR/../shell_config.sh
clickhouse-client -hlocalhost -q"SELECT 1";
$CLICKHOUSE_CLIENT --host=localhost --query="SELECT 1";
$CLICKHOUSE_CLIENT --host localhost --query "SELECT 1";
$CLICKHOUSE_CLIENT -hlocalhost -q"SELECT 1";

View File

@ -1,9 +1,12 @@
#!/bin/sh #!/usr/bin/env bash
clickhouse-client --query="SELECT number FROM system.numbers LIMIT 10 FORMAT JSON" | grep 'rows_read'; CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
clickhouse-client --query="SELECT number FROM system.numbers LIMIT 10 FORMAT JSONCompact" | grep 'rows_read'; . $CURDIR/../shell_config.sh
clickhouse-client --query="SELECT number FROM system.numbers LIMIT 10 FORMAT XML" | grep 'rows_read';
curl -sS 'http://localhost:8123/' -d "SELECT number FROM system.numbers LIMIT 10 FORMAT JSON" | grep 'rows_read'; $CLICKHOUSE_CLIENT --query="SELECT number FROM system.numbers LIMIT 10 FORMAT JSON" | grep 'rows_read';
curl -sS 'http://localhost:8123/' -d "SELECT number FROM system.numbers LIMIT 10 FORMAT JSONCompact" | grep 'rows_read'; $CLICKHOUSE_CLIENT --query="SELECT number FROM system.numbers LIMIT 10 FORMAT JSONCompact" | grep 'rows_read';
curl -sS 'http://localhost:8123/' -d "SELECT number FROM system.numbers LIMIT 10 FORMAT XML" | grep 'rows_read'; $CLICKHOUSE_CLIENT --query="SELECT number FROM system.numbers LIMIT 10 FORMAT XML" | grep 'rows_read';
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d "SELECT number FROM system.numbers LIMIT 10 FORMAT JSON" | grep 'rows_read';
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d "SELECT number FROM system.numbers LIMIT 10 FORMAT JSONCompact" | grep 'rows_read';
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d "SELECT number FROM system.numbers LIMIT 10 FORMAT XML" | grep 'rows_read';

View File

@ -1,47 +1,50 @@
#!/usr/bin/env bash #!/usr/bin/env bash
clickhouse-client --query="SELECT 1" CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
clickhouse-client --query="SELECT 1;" . $CURDIR/../shell_config.sh
clickhouse-client --query="SELECT 1; "
clickhouse-client --query="SELECT 1 ; "
clickhouse-client --query="SELECT 1; S" 2>&1 | grep -o 'Syntax error' $CLICKHOUSE_CLIENT --query="SELECT 1"
clickhouse-client --query="SELECT 1; SELECT 2" 2>&1 | grep -o 'Syntax error' $CLICKHOUSE_CLIENT --query="SELECT 1;"
clickhouse-client --query="SELECT 1; SELECT 2;" 2>&1 | grep -o 'Syntax error' $CLICKHOUSE_CLIENT --query="SELECT 1; "
clickhouse-client --query="SELECT 1; SELECT 2; SELECT" 2>&1 | grep -o 'Syntax error' $CLICKHOUSE_CLIENT --query="SELECT 1 ; "
clickhouse-client -n --query="SELECT 1; S" 2>&1 | grep -o 'Syntax error' $CLICKHOUSE_CLIENT --query="SELECT 1; S" 2>&1 | grep -o 'Syntax error'
clickhouse-client -n --query="SELECT 1; SELECT 2" $CLICKHOUSE_CLIENT --query="SELECT 1; SELECT 2" 2>&1 | grep -o 'Syntax error'
clickhouse-client -n --query="SELECT 1; SELECT 2;" $CLICKHOUSE_CLIENT --query="SELECT 1; SELECT 2;" 2>&1 | grep -o 'Syntax error'
clickhouse-client -n --query="SELECT 1; SELECT 2; SELECT" 2>&1 | grep -o 'Syntax error' $CLICKHOUSE_CLIENT --query="SELECT 1; SELECT 2; SELECT" 2>&1 | grep -o 'Syntax error'
clickhouse-client -n --query="DROP TABLE IF EXISTS test.t; CREATE TABLE test.t (x UInt64) ENGINE = TinyLog;" $CLICKHOUSE_CLIENT -n --query="SELECT 1; S" 2>&1 | grep -o 'Syntax error'
$CLICKHOUSE_CLIENT -n --query="SELECT 1; SELECT 2"
$CLICKHOUSE_CLIENT -n --query="SELECT 1; SELECT 2;"
$CLICKHOUSE_CLIENT -n --query="SELECT 1; SELECT 2; SELECT" 2>&1 | grep -o 'Syntax error'
clickhouse-client --query="INSERT INTO test.t VALUES (1),(2),(3);" $CLICKHOUSE_CLIENT -n --query="DROP TABLE IF EXISTS test.t; CREATE TABLE test.t (x UInt64) ENGINE = TinyLog;"
clickhouse-client --query="SELECT * FROM test.t"
clickhouse-client --query="INSERT INTO test.t VALUES" <<< "(4),(5),(6)"
clickhouse-client --query="SELECT * FROM test.t"
clickhouse-client -n --query="INSERT INTO test.t VALUES (1),(2),(3);" $CLICKHOUSE_CLIENT --query="INSERT INTO test.t VALUES (1),(2),(3);"
clickhouse-client -n --query="SELECT * FROM test.t" $CLICKHOUSE_CLIENT --query="SELECT * FROM test.t"
clickhouse-client -n --query="INSERT INTO test.t VALUES" <<< "(4),(5),(6)" $CLICKHOUSE_CLIENT --query="INSERT INTO test.t VALUES" <<< "(4),(5),(6)"
clickhouse-client -n --query="SELECT * FROM test.t" $CLICKHOUSE_CLIENT --query="SELECT * FROM test.t"
curl -sS 'http://localhost:8123/' -d "SELECT 1" $CLICKHOUSE_CLIENT -n --query="INSERT INTO test.t VALUES (1),(2),(3);"
curl -sS 'http://localhost:8123/' -d "SELECT 1;" $CLICKHOUSE_CLIENT -n --query="SELECT * FROM test.t"
curl -sS 'http://localhost:8123/' -d "SELECT 1; " $CLICKHOUSE_CLIENT -n --query="INSERT INTO test.t VALUES" <<< "(4),(5),(6)"
curl -sS 'http://localhost:8123/' -d "SELECT 1 ; " $CLICKHOUSE_CLIENT -n --query="SELECT * FROM test.t"
curl -sS 'http://localhost:8123/' -d "SELECT 1; S" 2>&1 | grep -o 'Syntax error' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d "SELECT 1"
curl -sS 'http://localhost:8123/' -d "SELECT 1; SELECT 2" 2>&1 | grep -o 'Syntax error' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d "SELECT 1;"
curl -sS 'http://localhost:8123/' -d "SELECT 1; SELECT 2;" 2>&1 | grep -o 'Syntax error' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d "SELECT 1; "
curl -sS 'http://localhost:8123/' -d "SELECT 1; SELECT 2; SELECT" 2>&1 | grep -o 'Syntax error' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d "SELECT 1 ; "
curl -sS 'http://localhost:8123/' -d "INSERT INTO test.t VALUES (1),(2),(3);" ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d "SELECT 1; S" 2>&1 | grep -o 'Syntax error'
clickhouse-client --query="SELECT * FROM test.t" ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d "SELECT 1; SELECT 2" 2>&1 | grep -o 'Syntax error'
curl -sS 'http://localhost:8123/?query=INSERT' -d "INTO test.t VALUES (4),(5),(6);" ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d "SELECT 1; SELECT 2;" 2>&1 | grep -o 'Syntax error'
clickhouse-client --query="SELECT * FROM test.t" ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d "SELECT 1; SELECT 2; SELECT" 2>&1 | grep -o 'Syntax error'
curl -sS 'http://localhost:8123/?query=INSERT+INTO+test.t+VALUES' -d "(7),(8),(9)"
clickhouse-client --query="SELECT * FROM test.t"
clickhouse-client -n --query="DROP TABLE test.t;" ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" -d "INSERT INTO test.t VALUES (1),(2),(3);"
$CLICKHOUSE_CLIENT --query="SELECT * FROM test.t"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=INSERT" -d "INTO test.t VALUES (4),(5),(6);"
$CLICKHOUSE_CLIENT --query="SELECT * FROM test.t"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=INSERT+INTO+test.t+VALUES" -d "(7),(8),(9)"
$CLICKHOUSE_CLIENT --query="SELECT * FROM test.t"
$CLICKHOUSE_CLIENT -n --query="DROP TABLE test.t;"

View File

@ -1,3 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
clickhouse-client --host=localhost --query="SELECT * FROM ext" --format=Vertical --external --file=- --structure="s String" --name=ext --format=JSONEachRow <<< '{"s":"Hello"}' CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
$CLICKHOUSE_CLIENT --host=localhost --query="SELECT * FROM ext" --format=Vertical --external --file=- --structure="s String" --name=ext --format=JSONEachRow <<< '{"s":"Hello"}'

View File

@ -1,5 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
curl -vsS 'http://localhost:8123/?add_http_cors_header=1' -H "Origin:smi2.ru" --data-binary @- <<< "SELECT 1" 2>&1 | grep -F "< Access-Control-Allow-Origin: *" | wc -l CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
curl -vsS 'http://localhost:8123/?add_http_cors_header=0' -H "Origin:smi2.ru" --data-binary @- <<< "SELECT 1" 2>&1 | grep -F "< Access-Control-Allow-Origin: *" | wc -l . $CURDIR/../shell_config.sh
curl -vsS 'http://localhost:8123/?add_http_cors_header=1' --data-binary @- <<< "SELECT 1" 2>&1 | grep -F "< Access-Control-Allow-Origin: *" | wc -l
${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?add_http_cors_header=1" -H "Origin:smi2.ru" --data-binary @- <<< "SELECT 1" 2>&1 | grep -F "< Access-Control-Allow-Origin: *" | wc -l
${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?add_http_cors_header=0" -H "Origin:smi2.ru" --data-binary @- <<< "SELECT 1" 2>&1 | grep -F "< Access-Control-Allow-Origin: *" | wc -l
${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?add_http_cors_header=1" --data-binary @- <<< "SELECT 1" 2>&1 | grep -F "< Access-Control-Allow-Origin: *" | wc -l

View File

@ -1,8 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
clickhouse-client -q "DROP TABLE IF EXISTS test.json_noisy" CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
clickhouse-client -q "CREATE TABLE test.json_noisy (d1 UInt8, d2 String) ENGINE = Memory" . $CURDIR/../shell_config.sh
$CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test.json_noisy"
$CLICKHOUSE_CLIENT -q "CREATE TABLE test.json_noisy (d1 UInt8, d2 String) ENGINE = Memory"
echo '{"d1" : 1, "d2" : "ok"} echo '{"d1" : 1, "d2" : "ok"}
{ } { }
@ -10,20 +14,20 @@ echo '{"d1" : 1, "d2" : "ok"}
{"d2":"ok","t1":[[[]],true, null, false, "1","2",9.03,101], "t2":[["1","2"]], "d1":"1"} {"d2":"ok","t1":[[[]],true, null, false, "1","2",9.03,101], "t2":[["1","2"]], "d1":"1"}
{"d2":"ok","t1":[[[]],true, null, false, "1","2", 0.03, 1], "d1":"1", "t2":["1","2"]} {"d2":"ok","t1":[[[]],true, null, false, "1","2", 0.03, 1], "d1":"1", "t2":["1","2"]}
{"t0" : -0.1, "t1" : +1, "t2" : 0, "t3" : [0.0, -0.1], "d2" : "ok", "d1" : 1}' \ {"t0" : -0.1, "t1" : +1, "t2" : 0, "t3" : [0.0, -0.1], "d2" : "ok", "d1" : 1}' \
| clickhouse-client --input_format_skip_unknown_fields=1 -q "INSERT INTO test.json_noisy FORMAT JSONEachRow" | $CLICKHOUSE_CLIENT --input_format_skip_unknown_fields=1 -q "INSERT INTO test.json_noisy FORMAT JSONEachRow"
clickhouse-client --max_threads=1 -q "SELECT * FROM test.json_noisy" $CLICKHOUSE_CLIENT --max_threads=1 -q "SELECT * FROM test.json_noisy"
clickhouse-client -q "DROP TABLE IF EXISTS test.json_noisy" $CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test.json_noisy"
# Regular test for DateTime # Regular test for DateTime
echo echo
clickhouse-client -q "DROP TABLE IF EXISTS test.json_each_row" $CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test.json_each_row"
clickhouse-client -q "CREATE TABLE test.json_each_row (d DateTime) ENGINE = Memory" $CLICKHOUSE_CLIENT -q "CREATE TABLE test.json_each_row (d DateTime) ENGINE = Memory"
echo '{"d" : "2017-08-31 18:36:48", "t" : ""} echo '{"d" : "2017-08-31 18:36:48", "t" : ""}
{"d" : "1504193808", "t" : -1} {"d" : "1504193808", "t" : -1}
{"d" : 1504193808, "t" : []} {"d" : 1504193808, "t" : []}
{"d" : 01504193808, "t" : []}' \ {"d" : 01504193808, "t" : []}' \
| clickhouse-client --input_format_skip_unknown_fields=1 -q "INSERT INTO test.json_each_row FORMAT JSONEachRow" | $CLICKHOUSE_CLIENT --input_format_skip_unknown_fields=1 -q "INSERT INTO test.json_each_row FORMAT JSONEachRow"
clickhouse-client -q "SELECT DISTINCT * FROM test.json_each_row" $CLICKHOUSE_CLIENT -q "SELECT DISTINCT * FROM test.json_each_row"
clickhouse-client -q "DROP TABLE test.json_each_row" $CLICKHOUSE_CLIENT -q "DROP TABLE test.json_each_row"

View File

@ -1,4 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
curl -sS --local-port 1390 'http://localhost:8123?query=SELECT%20port%20FROM%20system.processes%20ORDER%20BY%20elapsed%20LIMIT%201' CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
${CLICKHOUSE_CURL} -sS --local-port 1390 "${CLICKHOUSE_URL}?query=SELECT%20port%20FROM%20system.processes%20ORDER%20BY%20elapsed%20LIMIT%201"

View File

@ -1,3 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
clickhouse-client --multiquery --query="SELECT 1; SELECT xyz; SELECT 2;" 2> /dev/null || true; CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
$CLICKHOUSE_CLIENT --multiquery --query="SELECT 1; SELECT xyz; SELECT 2;" 2> /dev/null || true;

View File

@ -1,3 +1,6 @@
#!/bin/sh -e #!/usr/bin/env bash
TZ=UTC clickhouse --client --use_client_time_zone=1 --query="SELECT toDateTime(1000000000)" CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
env TZ=UTC $CLICKHOUSE_CLIENT --use_client_time_zone=1 --query="SELECT toDateTime(1000000000)"

View File

@ -1,8 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
echo -ne "1\n2\n3\n" | clickhouse-client --query="SELECT * FROM _data" --external --file=- --types=Int8; CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
echo -ne "1\n2\n3\n" | clickhouse-client --query="SELECT * FROM _data" --external --file - --types Int8; . $CURDIR/../shell_config.sh
echo -ne "1\n2\n3\n" | clickhouse-client --query="SELECT * FROM _data" --external --file=- --types Int8;
echo -ne "1\n2\n3\n" | clickhouse-client --query="SELECT * FROM _data" --external --file - --types=Int8; echo -ne "1\n2\n3\n" | $CLICKHOUSE_CLIENT --query="SELECT * FROM _data" --external --file=- --types=Int8;
echo -ne "1\n2\n3\n" | clickhouse-client --query "SELECT * FROM _data" --external --file=- --types=Int8; echo -ne "1\n2\n3\n" | $CLICKHOUSE_CLIENT --query="SELECT * FROM _data" --external --file - --types Int8;
echo -ne "1\n2\n3\n" | $CLICKHOUSE_CLIENT --query="SELECT * FROM _data" --external --file=- --types Int8;
echo -ne "1\n2\n3\n" | $CLICKHOUSE_CLIENT --query="SELECT * FROM _data" --external --file - --types=Int8;
echo -ne "1\n2\n3\n" | $CLICKHOUSE_CLIENT --query "SELECT * FROM _data" --external --file=- --types=Int8;

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)

View File

@ -1,8 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
curl -vsS http://localhost:8123/ --data-binary @- <<< "SELECT 1" 2>&1 | perl -lnE 'print if /Keep-Alive/'; CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
curl -vsS http://localhost:8123/ --data-binary @- <<< " error here " 2>&1 | perl -lnE 'print if /Keep-Alive/'; . $CURDIR/../shell_config.sh
curl -vsS http://localhost:8123/ping 2>&1 | perl -lnE 'print if /Keep-Alive/';
${CLICKHOUSE_CURL} -vsS ${CLICKHOUSE_URL} --data-binary @- <<< "SELECT 1" 2>&1 | perl -lnE 'print if /Keep-Alive/';
${CLICKHOUSE_CURL} -vsS ${CLICKHOUSE_URL} --data-binary @- <<< " error here " 2>&1 | perl -lnE 'print if /Keep-Alive/';
${CLICKHOUSE_CURL} -vsS ${CLICKHOUSE_URL}ping 2>&1 | perl -lnE 'print if /Keep-Alive/';
# no keep-alive: # no keep-alive:
curl -vsS http://localhost:8123/404/not/found/ 2>&1 | perl -lnE 'print if /Keep-Alive/'; ${CLICKHOUSE_CURL} -vsS ${CLICKHOUSE_URL}404/not/found/ 2>&1 | perl -lnE 'print if /Keep-Alive/';

View File

@ -3,7 +3,7 @@ from __future__ import print_function
import os, itertools, urllib import os, itertools, urllib
def get_ch_answer(query): def get_ch_answer(query):
return urllib.urlopen('http://localhost:8123', data=query).read() return urllib.urlopen(os.environ.get('CLICKHOUSE_URL', 'http://localhost:' + os.environ.get('CLICKHOUSE_PORT_HTTP', '8123') ), data=query).read()
def check_answers(query, answer): def check_answers(query, answer):
ch_answer = get_ch_answer(query) ch_answer = get_ch_answer(query)

View File

@ -36,4 +36,4 @@ fi
rm -f "./test_into_outfile_clickhouse-local.out" rm -f "./test_into_outfile_clickhouse-local.out"
echo "performing test: http" echo "performing test: http"
echo "SELECT 1, 2 INTO OUTFILE './test_into_outfile_http.out'" | curl -s "${CLICKHOUSE_URL}" -d @- --fail || echo "query failed" echo "SELECT 1, 2 INTO OUTFILE './test_into_outfile_http.out'" | ${CLICKHOUSE_CURL} -s "${CLICKHOUSE_URL}" -d @- --fail || echo "query failed"

View File

@ -1,15 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
# This test will fail with external poco (progress not supported) # This test will fail with external poco (progress not supported)
curl -vsS 'http://localhost:8123/?max_block_size=1&send_progress_in_http_headers=1&http_headers_progress_interval_ms=0' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep -E 'Content-Encoding|X-ClickHouse|^[0-9]' ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?max_block_size=1&send_progress_in_http_headers=1&http_headers_progress_interval_ms=0" -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep -E 'Content-Encoding|X-ClickHouse|^[0-9]'
curl -sS 'http://localhost:8123/?max_block_size=1&send_progress_in_http_headers=1&http_headers_progress_interval_ms=0&enable_http_compression=1' -H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 10' | gzip -d ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?max_block_size=1&send_progress_in_http_headers=1&http_headers_progress_interval_ms=0&enable_http_compression=1" -H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 10' | gzip -d
# 'send_progress_in_http_headers' is false by default # 'send_progress_in_http_headers' is false by default
curl -vsS 'http://localhost:8123/?max_block_size=1&http_headers_progress_interval_ms=0' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep -q 'X-ClickHouse-Progress' && echo 'Fail' || true ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?max_block_size=1&http_headers_progress_interval_ms=0" -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep -q 'X-ClickHouse-Progress' && echo 'Fail' || true
# have header? # have header?
curl -vsS 'http://localhost:8123/?max_block_size=1&send_progress_in_http_headers=1&http_headers_progress_interval_ms=0&enable_http_compression=1' -H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 1' 2>&1 | grep -q "Content-Encoding: gzip" && true || echo 'Fail' ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?max_block_size=1&send_progress_in_http_headers=1&http_headers_progress_interval_ms=0&enable_http_compression=1" -H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 1' 2>&1 | grep -q "Content-Encoding: gzip" && true || echo 'Fail'
# nothing in body = no gzip # nothing in body = no gzip
curl -vsS 'http://localhost:8123/?max_block_size=1&send_progress_in_http_headers=1&http_headers_progress_interval_ms=0&enable_http_compression=1' -H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 0' 2>&1 | grep -q 'Content-Encoding: gzip' && echo 'Fail' || true ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}?max_block_size=1&send_progress_in_http_headers=1&http_headers_progress_interval_ms=0&enable_http_compression=1" -H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 0' 2>&1 | grep -q 'Content-Encoding: gzip' && echo 'Fail' || true

View File

@ -1,17 +1,21 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
QUERY_FIELND_NUM=4 QUERY_FIELND_NUM=4
clickhouse-client --max_block_size=1 -q "SELECT sleep(1) FROM system.numbers LIMIT 4" &>/dev/null & $CLICKHOUSE_CLIENT --max_block_size=1 -q "SELECT sleep(1) FROM system.numbers LIMIT 4" &>/dev/null &
sleep 1 sleep 1
clickhouse-client -q "KILL QUERY WHERE query LIKE 'SELECT sleep(%' AND (elapsed >= 0.) SYNC" | cut -f $QUERY_FIELND_NUM $CLICKHOUSE_CLIENT -q "KILL QUERY WHERE query LIKE 'SELECT sleep(%' AND (elapsed >= 0.) SYNC" | cut -f $QUERY_FIELND_NUM
clickhouse-client --max_block_size=1 -q "SELECT sleep(1) FROM system.numbers LIMIT 5" &>/dev/null & $CLICKHOUSE_CLIENT --max_block_size=1 -q "SELECT sleep(1) FROM system.numbers LIMIT 5" &>/dev/null &
sleep 1 sleep 1
clickhouse-client -q "KILL QUERY WHERE query = 'SELECT sleep(1) FROM system.numbers LIMIT 5' ASYNC" | cut -f $QUERY_FIELND_NUM $CLICKHOUSE_CLIENT -q "KILL QUERY WHERE query = 'SELECT sleep(1) FROM system.numbers LIMIT 5' ASYNC" | cut -f $QUERY_FIELND_NUM
clickhouse-client -q "KILL QUERY WHERE 0 ASYNC" $CLICKHOUSE_CLIENT -q "KILL QUERY WHERE 0 ASYNC"
clickhouse-client -q "KILL QUERY WHERE 0 FORMAT TabSeparated" $CLICKHOUSE_CLIENT -q "KILL QUERY WHERE 0 FORMAT TabSeparated"
clickhouse-client -q "KILL QUERY WHERE 0 SYNC FORMAT TabSeparated" $CLICKHOUSE_CLIENT -q "KILL QUERY WHERE 0 SYNC FORMAT TabSeparated"
clickhouse-client -q "KILL QUERY WHERE 1 TEST" &>/dev/null $CLICKHOUSE_CLIENT -q "KILL QUERY WHERE 1 TEST" &>/dev/null

View File

@ -1,3 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
clickhouse-client --query="SELECT * FROM system.build_options" | perl -lnE 'print $1 if /(BUILD_DATE|BUILD_TYPE|CXX_COMPILER|CXX_FLAGS|LINK_FLAGS)\s+\S+/'; CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
$CLICKHOUSE_CLIENT --query="SELECT * FROM system.build_options" | perl -lnE 'print $1 if /(BUILD_DATE|BUILD_TYPE|CXX_COMPILER|CXX_FLAGS|LINK_FLAGS)\s+\S+/';

View File

@ -1,24 +1,27 @@
#!/usr/bin/env bash #!/usr/bin/env bash
clickhouse-client --query="DROP TABLE IF EXISTS test.formats_test" CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
clickhouse-client --query="CREATE TABLE test.formats_test (x UInt64, s String) ENGINE = Memory" . $CURDIR/../shell_config.sh
echo -ne '1\tHello\n \n3\tGoodbye\n' | clickhouse-client --input_format_allow_errors_num=1 --input_format_allow_errors_ratio=0.1 --query="INSERT INTO test.formats_test FORMAT TSV" $CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS test.formats_test"
$CLICKHOUSE_CLIENT --query="CREATE TABLE test.formats_test (x UInt64, s String) ENGINE = Memory"
clickhouse-client --query="SELECT * FROM test.formats_test ORDER BY x, s" echo -ne '1\tHello\n \n3\tGoodbye\n' | $CLICKHOUSE_CLIENT --input_format_allow_errors_num=1 --input_format_allow_errors_ratio=0.1 --query="INSERT INTO test.formats_test FORMAT TSV"
echo -ne '1\tHello\n2\n3\tGoodbye\n\n' | clickhouse-client --input_format_allow_errors_num=1 --input_format_allow_errors_ratio=0.1 --query="INSERT INTO test.formats_test FORMAT TSV" 2> /dev/null; echo $? $CLICKHOUSE_CLIENT --query="SELECT * FROM test.formats_test ORDER BY x, s"
echo -ne '1\tHello\n2\n3\tGoodbye\n\n' | clickhouse-client --input_format_allow_errors_num=2 --input_format_allow_errors_ratio=0.1 --query="INSERT INTO test.formats_test FORMAT TSV" echo -ne '1\tHello\n2\n3\tGoodbye\n\n' | $CLICKHOUSE_CLIENT --input_format_allow_errors_num=1 --input_format_allow_errors_ratio=0.1 --query="INSERT INTO test.formats_test FORMAT TSV" 2> /dev/null; echo $?
clickhouse-client --query="SELECT * FROM test.formats_test ORDER BY x, s" echo -ne '1\tHello\n2\n3\tGoodbye\n\n' | $CLICKHOUSE_CLIENT --input_format_allow_errors_num=2 --input_format_allow_errors_ratio=0.1 --query="INSERT INTO test.formats_test FORMAT TSV"
echo -ne '1\tHello\n2\n3\tGoodbye\n\n' | clickhouse-client --input_format_allow_errors_num=1 --input_format_allow_errors_ratio=0.4 --query="INSERT INTO test.formats_test FORMAT TSV" 2> /dev/null; echo $? $CLICKHOUSE_CLIENT --query="SELECT * FROM test.formats_test ORDER BY x, s"
echo -ne '1\tHello\n2\n3\tGoodbye\n\n' | clickhouse-client --input_format_allow_errors_num=1 --input_format_allow_errors_ratio=0.6 --query="INSERT INTO test.formats_test FORMAT TSV" echo -ne '1\tHello\n2\n3\tGoodbye\n\n' | $CLICKHOUSE_CLIENT --input_format_allow_errors_num=1 --input_format_allow_errors_ratio=0.4 --query="INSERT INTO test.formats_test FORMAT TSV" 2> /dev/null; echo $?
echo -ne 'x=1\ts=TSKV\nx=minus2\ts=trash1\ns=trash2\tx=-3\ns=TSKV Ok\tx=4\ns=trash3\tx=-5\n' | clickhouse-client --input_format_allow_errors_num=3 -q "INSERT INTO test.formats_test FORMAT TSKV" echo -ne '1\tHello\n2\n3\tGoodbye\n\n' | $CLICKHOUSE_CLIENT --input_format_allow_errors_num=1 --input_format_allow_errors_ratio=0.6 --query="INSERT INTO test.formats_test FORMAT TSV"
clickhouse-client --query="SELECT * FROM test.formats_test ORDER BY x, s" echo -ne 'x=1\ts=TSKV\nx=minus2\ts=trash1\ns=trash2\tx=-3\ns=TSKV Ok\tx=4\ns=trash3\tx=-5\n' | $CLICKHOUSE_CLIENT --input_format_allow_errors_num=3 -q "INSERT INTO test.formats_test FORMAT TSKV"
clickhouse-client --query="DROP TABLE test.formats_test" $CLICKHOUSE_CLIENT --query="SELECT * FROM test.formats_test ORDER BY x, s"
$CLICKHOUSE_CLIENT --query="DROP TABLE test.formats_test"

View File

@ -1,5 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
clickhouse-client -q "SHOW PROCESSLIST" &>/dev/null CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
clickhouse-client -q "SHOW DATABASES" &>/dev/null . $CURDIR/../shell_config.sh
clickhouse-client -q "SHOW TABLES" &>/dev/null
$CLICKHOUSE_CLIENT -q "SHOW PROCESSLIST" &>/dev/null
$CLICKHOUSE_CLIENT -q "SHOW DATABASES" &>/dev/null
$CLICKHOUSE_CLIENT -q "SHOW TABLES" &>/dev/null

View File

@ -1,15 +1,19 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
for i in `seq -w 0 2 20`; do for i in `seq -w 0 2 20`; do
clickhouse-client -q "DROP TABLE IF EXISTS test.merge_item_$i" $CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test.merge_item_$i"
clickhouse-client -q "CREATE TABLE test.merge_item_$i (d Int8) ENGINE = Memory" $CLICKHOUSE_CLIENT -q "CREATE TABLE test.merge_item_$i (d Int8) ENGINE = Memory"
clickhouse-client -q "INSERT INTO test.merge_item_$i VALUES ($i)" $CLICKHOUSE_CLIENT -q "INSERT INTO test.merge_item_$i VALUES ($i)"
done done
clickhouse-client -q "DROP TABLE IF EXISTS test.merge_storage" $CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test.merge_storage"
clickhouse-client -q "CREATE TABLE test.merge_storage (d Int8) ENGINE = Merge('test', '^merge_item_')" $CLICKHOUSE_CLIENT -q "CREATE TABLE test.merge_storage (d Int8) ENGINE = Merge('test', '^merge_item_')"
clickhouse-client --max_threads=1 -q "SELECT _table, d FROM test.merge_storage WHERE _table LIKE 'merge_item_1%' ORDER BY _table" $CLICKHOUSE_CLIENT --max_threads=1 -q "SELECT _table, d FROM test.merge_storage WHERE _table LIKE 'merge_item_1%' ORDER BY _table"
clickhouse-client -q "DROP TABLE IF EXISTS test.merge_storage" $CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test.merge_storage"
for i in `seq -w 0 2 20`; do clickhouse-client -q "DROP TABLE IF EXISTS test.merge_item_$i"; done for i in `seq -w 0 2 20`; do $CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test.merge_item_$i"; done

View File

@ -1,9 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
function perform() function perform()
{ {
local query=$1 local query=$1
TZ=UTC clickhouse-client \ TZ=UTC $CLICKHOUSE_CLIENT \
--use_client_time_zone=1 \ --use_client_time_zone=1 \
--input_format_values_interpret_expressions=0 \ --input_format_values_interpret_expressions=0 \
--query "$query" 2>/dev/null --query "$query" 2>/dev/null

View File

@ -1,11 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
# Not found column date in block. There are only columns: x. # Not found column date in block. There are only columns: x.
# Test 1. Complex test checking columns.txt # Test 1. Complex test checking columns.txt
chl="clickhouse-client -q" chl="$CLICKHOUSE_CLIENT -q"
ch_dir=`clickhouse extract-from-config -c /etc/clickhouse-server/config.xml -k path` ch_dir=`${CLICKHOUSE_EXTRACT_CONFIG} -k path`
$chl "DROP TABLE IF EXISTS test.partition_428" $chl "DROP TABLE IF EXISTS test.partition_428"
$chl "CREATE TABLE test.partition_428 (p Date, k Int8, v1 Int8 MATERIALIZED k + 1) ENGINE = MergeTree(p, k, 1)" $chl "CREATE TABLE test.partition_428 (p Date, k Int8, v1 Int8 MATERIALIZED k + 1) ENGINE = MergeTree(p, k, 1)"

View File

@ -1,8 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
max_block_size=100 max_block_size=100
URL='http://localhost:8123/' URL="${CLICKHOUSE_URL}"
function query { function query {
# bash isn't able to store \0 bytes, so use [1; 255] random range # bash isn't able to store \0 bytes, so use [1; 255] random range
@ -10,7 +14,7 @@ function query {
} }
function ch_url() { function ch_url() {
curl -sS "$URL?max_block_size=$max_block_size&$1" -d "`query $2`" ${CLICKHOUSE_CURL} -sS "$URL?max_block_size=$max_block_size&$1" -d "`query $2`"
} }
@ -59,10 +63,10 @@ max_block_size=500000
corner_sizes="1048576 `seq 500000 1000000 3500000`" corner_sizes="1048576 `seq 500000 1000000 3500000`"
# Check HTTP results with clickhouse-client in normal case # Check HTTP results with $CLICKHOUSE_CLIENT in normal case
function cmp_cli_and_http() { function cmp_cli_and_http() {
clickhouse-client -q "`query $1`" > res1 $CLICKHOUSE_CLIENT -q "`query $1`" > res1
ch_url "buffer_size=$2&wait_end_of_query=0" "$1" > res2 ch_url "buffer_size=$2&wait_end_of_query=0" "$1" > res2
ch_url "buffer_size=$2&wait_end_of_query=1" "$1" > res3 ch_url "buffer_size=$2&wait_end_of_query=1" "$1" > res3
cmp res1 res2 && cmp res1 res3 || echo FAIL cmp res1 res2 && cmp res1 res3 || echo FAIL
@ -84,10 +88,10 @@ check_cli_and_http
# Check HTTP internal compression in normal case # Check HTTP internal compression in normal case
function cmp_http_compression() { function cmp_http_compression() {
clickhouse-client -q "`query $1`" > res0 $CLICKHOUSE_CLIENT -q "`query $1`" > res0
ch_url 'compress=1' $1 | clickhouse compressor --decompress > res1 ch_url 'compress=1' $1 | clickhouse-compressor --decompress > res1
ch_url "compress=1&buffer_size=$2&wait_end_of_query=0" $1 | clickhouse compressor --decompress > res2 ch_url "compress=1&buffer_size=$2&wait_end_of_query=0" $1 | clickhouse-compressor --decompress > res2
ch_url "compress=1&buffer_size=$2&wait_end_of_query=1" $1 | clickhouse compressor --decompress > res3 ch_url "compress=1&buffer_size=$2&wait_end_of_query=1" $1 | clickhouse-compressor --decompress > res3
cmp res0 res1 cmp res0 res1
cmp res1 res2 cmp res1 res2
cmp res1 res3 cmp res1 res3

View File

@ -1,5 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
# TODO: enable this test with self-signed server cert # TODO: enable this test with self-signed server cert
# curl -s --insecure 'https://localhost:8443/' -d 'SELECT number FROM system.numbers LIMIT 1' # ${CLICKHOUSE_CURL} -s --insecure 'https://localhost:8443/' -d 'SELECT number FROM system.numbers LIMIT 1'

View File

@ -1,18 +1,22 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
db="test" db="test"
table="optimize_me_finally" table="optimize_me_finally"
name="$db.$table" name="$db.$table"
res_rows=1500000 # >= vertical_merge_algorithm_min_rows_to_activate res_rows=1500000 # >= vertical_merge_algorithm_min_rows_to_activate
function get_num_parts { function get_num_parts {
clickhouse-client -q "SELECT count() FROM system.parts WHERE active AND database='$db' AND table='$table'" $CLICKHOUSE_CLIENT -q "SELECT count() FROM system.parts WHERE active AND database='$db' AND table='$table'"
} }
clickhouse-client -q "DROP TABLE IF EXISTS $name" $CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS $name"
clickhouse-client -q "CREATE TABLE $name ( $CLICKHOUSE_CLIENT -q "CREATE TABLE $name (
date Date, date Date,
Sign Int8, Sign Int8,
ki UInt64, ki UInt64,
@ -35,19 +39,19 @@ s String
) )
ENGINE = CollapsingMergeTree(date, (date, ki), 8192, Sign)" ENGINE = CollapsingMergeTree(date, (date, ki), 8192, Sign)"
clickhouse-client -q "INSERT INTO $name (date, Sign, ki) SELECT $CLICKHOUSE_CLIENT -q "INSERT INTO $name (date, Sign, ki) SELECT
toDate(0) AS date, toDate(0) AS date,
toInt8(1) AS Sign, toInt8(1) AS Sign,
toUInt64(0) AS ki toUInt64(0) AS ki
FROM system.numbers LIMIT 9000" FROM system.numbers LIMIT 9000"
clickhouse-client -q "INSERT INTO $name (date, Sign, ki) SELECT $CLICKHOUSE_CLIENT -q "INSERT INTO $name (date, Sign, ki) SELECT
toDate(0) AS date, toDate(0) AS date,
toInt8(1) AS Sign, toInt8(1) AS Sign,
number AS ki number AS ki
FROM system.numbers LIMIT 9000, 9000" FROM system.numbers LIMIT 9000, 9000"
clickhouse-client -q "INSERT INTO $name SELECT $CLICKHOUSE_CLIENT -q "INSERT INTO $name SELECT
toDate(0) AS date, toDate(0) AS date,
toInt8(1) AS Sign, toInt8(1) AS Sign,
number AS ki, number AS ki,
@ -66,21 +70,21 @@ number AS di10,
[hex(number), hex(number+1)] AS \`n.s\` [hex(number), hex(number+1)] AS \`n.s\`
FROM system.numbers LIMIT $res_rows" FROM system.numbers LIMIT $res_rows"
while [[ `get_num_parts` -ne 1 ]] ; do clickhouse-client -q "OPTIMIZE TABLE $name PARTITION 197001"; done while [[ `get_num_parts` -ne 1 ]] ; do $CLICKHOUSE_CLIENT -q "OPTIMIZE TABLE $name PARTITION 197001"; done
clickhouse-client -q "ALTER TABLE $name ADD COLUMN n.a Array(String)" $CLICKHOUSE_CLIENT -q "ALTER TABLE $name ADD COLUMN n.a Array(String)"
clickhouse-client -q "ALTER TABLE $name ADD COLUMN da Array(String) DEFAULT ['def']" $CLICKHOUSE_CLIENT -q "ALTER TABLE $name ADD COLUMN da Array(String) DEFAULT ['def']"
clickhouse-client -q "OPTIMIZE TABLE $name PARTITION 197001 FINAL" $CLICKHOUSE_CLIENT -q "OPTIMIZE TABLE $name PARTITION 197001 FINAL"
clickhouse-client -q "ALTER TABLE $name MODIFY COLUMN n.a Array(String) DEFAULT ['zzz']" $CLICKHOUSE_CLIENT -q "ALTER TABLE $name MODIFY COLUMN n.a Array(String) DEFAULT ['zzz']"
clickhouse-client -q "ALTER TABLE $name MODIFY COLUMN da Array(String) DEFAULT ['zzz']" $CLICKHOUSE_CLIENT -q "ALTER TABLE $name MODIFY COLUMN da Array(String) DEFAULT ['zzz']"
clickhouse-client -q "SELECT count(), sum(Sign), sum(ki = di05), sum(hex(ki) = ds), sum(ki = n.i[1]), sum([hex(ki), hex(ki+1)] = n.s) FROM $name" $CLICKHOUSE_CLIENT -q "SELECT count(), sum(Sign), sum(ki = di05), sum(hex(ki) = ds), sum(ki = n.i[1]), sum([hex(ki), hex(ki+1)] = n.s) FROM $name"
clickhouse-client -q "SELECT groupUniqArray(da), groupUniqArray(n.a) FROM $name" $CLICKHOUSE_CLIENT -q "SELECT groupUniqArray(da), groupUniqArray(n.a) FROM $name"
hash_src=`clickhouse-client --max_threads=1 -q "SELECT cityHash64(groupArray(ki)) FROM $name"` hash_src=`$CLICKHOUSE_CLIENT --max_threads=1 -q "SELECT cityHash64(groupArray(ki)) FROM $name"`
hash_ref=`clickhouse-client --max_threads=1 -q "SELECT cityHash64(groupArray(ki)) FROM (SELECT number as ki FROM system.numbers LIMIT $res_rows)"` hash_ref=`$CLICKHOUSE_CLIENT --max_threads=1 -q "SELECT cityHash64(groupArray(ki)) FROM (SELECT number as ki FROM system.numbers LIMIT $res_rows)"`
echo $(( $hash_src - $hash_ref )) echo $(( $hash_src - $hash_ref ))
clickhouse-client -q "DROP TABLE IF EXISTS $name" $CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS $name"

View File

@ -1,33 +1,37 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
clickhouse-client -q "DROP TABLE IF EXISTS test.preferred_block_size_bytes" CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
clickhouse-client -q "CREATE TABLE test.preferred_block_size_bytes (p Date, s String) ENGINE = MergeTree(p, p, 1)" . $CURDIR/../shell_config.sh
clickhouse-client -q "INSERT INTO test.preferred_block_size_bytes (s) SELECT '16_bytes_-_-_-_' AS s FROM system.numbers LIMIT 10, 90"
clickhouse-client -q "OPTIMIZE TABLE test.preferred_block_size_bytes" $CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test.preferred_block_size_bytes"
clickhouse-client --preferred_block_size_bytes=26 -q "SELECT DISTINCT blockSize(), ignore(p, s) FROM test.preferred_block_size_bytes" $CLICKHOUSE_CLIENT -q "CREATE TABLE test.preferred_block_size_bytes (p Date, s String) ENGINE = MergeTree(p, p, 1)"
clickhouse-client --preferred_block_size_bytes=52 -q "SELECT DISTINCT blockSize(), ignore(p, s) FROM test.preferred_block_size_bytes" $CLICKHOUSE_CLIENT -q "INSERT INTO test.preferred_block_size_bytes (s) SELECT '16_bytes_-_-_-_' AS s FROM system.numbers LIMIT 10, 90"
clickhouse-client --preferred_block_size_bytes=90 -q "SELECT DISTINCT blockSize(), ignore(p) FROM test.preferred_block_size_bytes" $CLICKHOUSE_CLIENT -q "OPTIMIZE TABLE test.preferred_block_size_bytes"
clickhouse-client -q "DROP TABLE IF EXISTS test.preferred_block_size_bytes" $CLICKHOUSE_CLIENT --preferred_block_size_bytes=26 -q "SELECT DISTINCT blockSize(), ignore(p, s) FROM test.preferred_block_size_bytes"
$CLICKHOUSE_CLIENT --preferred_block_size_bytes=52 -q "SELECT DISTINCT blockSize(), ignore(p, s) FROM test.preferred_block_size_bytes"
$CLICKHOUSE_CLIENT --preferred_block_size_bytes=90 -q "SELECT DISTINCT blockSize(), ignore(p) FROM test.preferred_block_size_bytes"
$CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test.preferred_block_size_bytes"
# PREWHERE using empty column # PREWHERE using empty column
clickhouse-client -q "DROP TABLE IF EXISTS test.pbs" $CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test.pbs"
clickhouse-client -q "CREATE TABLE test.pbs (p Date, i UInt64, sa Array(String)) ENGINE = MergeTree(p, p, 100)" $CLICKHOUSE_CLIENT -q "CREATE TABLE test.pbs (p Date, i UInt64, sa Array(String)) ENGINE = MergeTree(p, p, 100)"
clickhouse-client -q "INSERT INTO test.pbs (p, i, sa) SELECT toDate(i % 30) AS p, number AS i, ['a'] AS sa FROM system.numbers LIMIT 1000" $CLICKHOUSE_CLIENT -q "INSERT INTO test.pbs (p, i, sa) SELECT toDate(i % 30) AS p, number AS i, ['a'] AS sa FROM system.numbers LIMIT 1000"
clickhouse-client -q "ALTER TABLE test.pbs ADD COLUMN s UInt8 DEFAULT 0" $CLICKHOUSE_CLIENT -q "ALTER TABLE test.pbs ADD COLUMN s UInt8 DEFAULT 0"
clickhouse-client --preferred_block_size_bytes=100000 -q "SELECT count() FROM test.pbs PREWHERE s = 0" $CLICKHOUSE_CLIENT --preferred_block_size_bytes=100000 -q "SELECT count() FROM test.pbs PREWHERE s = 0"
clickhouse-client -q "INSERT INTO test.pbs (p, i, sa) SELECT toDate(i % 30) AS p, number AS i, ['a'] AS sa FROM system.numbers LIMIT 1000" $CLICKHOUSE_CLIENT -q "INSERT INTO test.pbs (p, i, sa) SELECT toDate(i % 30) AS p, number AS i, ['a'] AS sa FROM system.numbers LIMIT 1000"
clickhouse-client --preferred_block_size_bytes=100000 -q "SELECT count() FROM test.pbs PREWHERE s = 0" $CLICKHOUSE_CLIENT --preferred_block_size_bytes=100000 -q "SELECT count() FROM test.pbs PREWHERE s = 0"
clickhouse-client -q "DROP TABLE test.pbs" $CLICKHOUSE_CLIENT -q "DROP TABLE test.pbs"
# Nullable PREWHERE # Nullable PREWHERE
clickhouse-client -q "DROP TABLE IF EXISTS test.nullable_prewhere" $CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test.nullable_prewhere"
clickhouse-client -q "CREATE TABLE test.nullable_prewhere (p Date, f Nullable(UInt64), d UInt64) ENGINE = MergeTree(p, p, 8)" $CLICKHOUSE_CLIENT -q "CREATE TABLE test.nullable_prewhere (p Date, f Nullable(UInt64), d UInt64) ENGINE = MergeTree(p, p, 8)"
clickhouse-client -q "INSERT INTO test.nullable_prewhere SELECT toDate(0) AS p, if(number % 2 = 0, CAST(number AS Nullable(UInt64)), CAST(NULL AS Nullable(UInt64))) AS f, number as d FROM system.numbers LIMIT 1001" $CLICKHOUSE_CLIENT -q "INSERT INTO test.nullable_prewhere SELECT toDate(0) AS p, if(number % 2 = 0, CAST(number AS Nullable(UInt64)), CAST(NULL AS Nullable(UInt64))) AS f, number as d FROM system.numbers LIMIT 1001"
clickhouse-client -q "SELECT sum(d), sum(f), max(d) FROM test.nullable_prewhere PREWHERE NOT isNull(f)" $CLICKHOUSE_CLIENT -q "SELECT sum(d), sum(f), max(d) FROM test.nullable_prewhere PREWHERE NOT isNull(f)"
clickhouse-client -q "DROP TABLE IF EXISTS test.nullable_prewhere" $CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test.nullable_prewhere"
# Depend on 00282_merging test # Depend on 00282_merging test
@ -37,10 +41,10 @@ popd > /dev/null
#SCRIPTDIR=`dirname "$SCRIPTPATH"` #SCRIPTDIR=`dirname "$SCRIPTPATH"`
SCRIPTDIR=$SCRIPTPATH SCRIPTDIR=$SCRIPTPATH
cat "$SCRIPTDIR"/00282_merging.sql | clickhouse-client --preferred_block_size_bytes=10 --merge_tree_uniform_read_distribution=1 -n 2>&1 > preferred_block_size_bytes.stdout cat "$SCRIPTDIR"/00282_merging.sql | $CLICKHOUSE_CLIENT --preferred_block_size_bytes=10 --merge_tree_uniform_read_distribution=1 -n 2>&1 > preferred_block_size_bytes.stdout
cmp "$SCRIPTDIR"/00282_merging.reference preferred_block_size_bytes.stdout && echo PASSED || echo FAILED cmp "$SCRIPTDIR"/00282_merging.reference preferred_block_size_bytes.stdout && echo PASSED || echo FAILED
cat "$SCRIPTDIR"/00282_merging.sql | clickhouse-client --preferred_block_size_bytes=20 --merge_tree_uniform_read_distribution=0 -n 2>&1 > preferred_block_size_bytes.stdout cat "$SCRIPTDIR"/00282_merging.sql | $CLICKHOUSE_CLIENT --preferred_block_size_bytes=20 --merge_tree_uniform_read_distribution=0 -n 2>&1 > preferred_block_size_bytes.stdout
cmp "$SCRIPTDIR"/00282_merging.reference preferred_block_size_bytes.stdout && echo PASSED || echo FAILED cmp "$SCRIPTDIR"/00282_merging.reference preferred_block_size_bytes.stdout && echo PASSED || echo FAILED
rm preferred_block_size_bytes.stdout rm preferred_block_size_bytes.stdout

View File

@ -1,6 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
ch="clickhouse-client --stacktrace -q" CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
ch="$CLICKHOUSE_CLIENT --stacktrace -q"
$ch "DROP TABLE IF EXISTS test.clear_column1" $ch "DROP TABLE IF EXISTS test.clear_column1"
$ch "DROP TABLE IF EXISTS test.clear_column2" $ch "DROP TABLE IF EXISTS test.clear_column2"

View File

@ -1,10 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
request() { request() {
local url="$1" local url="$1"
local select="$2" local select="$2"
curl --silent $url --data "$select" ${CLICKHOUSE_CURL} --silent $url --data "$select"
} }
@ -29,9 +31,9 @@ check() {
} }
address="localhost" address=${CLICKHOUSE_HOST}
port="8123" port=${CLICKHOUSE_PORT_HTTP}
url="http://$address:$port/" url="${CLICKHOUSE_PORT_HTTP_PROTO}://$address:$port/"
session="?session_id=test_$$" session="?session_id=test_$$"
select="SELECT * FROM system.settings WHERE name = 'max_rows_to_read'" select="SELECT * FROM system.settings WHERE name = 'max_rows_to_read'"
select_from_temporary_table="SELECT * FROM temp ORDER BY x" select_from_temporary_table="SELECT * FROM temp ORDER BY x"

View File

@ -1,9 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
clickhouse-client --query="select 1/0, -1/0, sqrt(-1), -sqrt(-1) format JSON" --output_format_json_quote_denormals=0 | grep -o null CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
clickhouse-client --query="select 1/0, -1/0, sqrt(-1), -sqrt(-1) format JSONCompact" --output_format_json_quote_denormals=0 | grep -o null . $CURDIR/../shell_config.sh
clickhouse-client --query="select 1/0, -1/0, sqrt(-1), -sqrt(-1) format JSONEachRow" --output_format_json_quote_denormals=0 | grep -o null
clickhouse-client --query="select 1/0, -1/0, sqrt(-1), -sqrt(-1) format JSON" --output_format_json_quote_denormals=1 | grep -o "inf\|-inf\|nan" $CLICKHOUSE_CLIENT --query="select 1/0, -1/0, sqrt(-1), -sqrt(-1) format JSON" --output_format_json_quote_denormals=0 | grep -o null
clickhouse-client --query="select 1/0, -1/0, sqrt(-1), -sqrt(-1) format JSONCompact" --output_format_json_quote_denormals=1 | grep -o "inf\|-inf\|nan" $CLICKHOUSE_CLIENT --query="select 1/0, -1/0, sqrt(-1), -sqrt(-1) format JSONCompact" --output_format_json_quote_denormals=0 | grep -o null
clickhouse-client --query="select 1/0, -1/0, sqrt(-1), -sqrt(-1) format JSONEachRow" --output_format_json_quote_denormals=1 | grep -o "inf\|-inf\|nan" $CLICKHOUSE_CLIENT --query="select 1/0, -1/0, sqrt(-1), -sqrt(-1) format JSONEachRow" --output_format_json_quote_denormals=0 | grep -o null
$CLICKHOUSE_CLIENT --query="select 1/0, -1/0, sqrt(-1), -sqrt(-1) format JSON" --output_format_json_quote_denormals=1 | grep -o "inf\|-inf\|nan"
$CLICKHOUSE_CLIENT --query="select 1/0, -1/0, sqrt(-1), -sqrt(-1) format JSONCompact" --output_format_json_quote_denormals=1 | grep -o "inf\|-inf\|nan"
$CLICKHOUSE_CLIENT --query="select 1/0, -1/0, sqrt(-1), -sqrt(-1) format JSONEachRow" --output_format_json_quote_denormals=1 | grep -o "inf\|-inf\|nan"

View File

@ -1,15 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
clickhouse-client --query="select toUInt64(pow(2, 62)) as value format JSON" --output_format_json_quote_64bit_integers=0 | grep value CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
clickhouse-client --query="select toUInt64(pow(2, 62)) as value format JSON" --output_format_json_quote_64bit_integers=1 | grep value . $CURDIR/../shell_config.sh
clickhouse-client --readonly=1 --multiquery --query="set output_format_json_quote_64bit_integers=1 ; select toUInt64(pow(2, 63)) as value format JSON" 2>&1 | grep -o 'value\|Cannot execute SET query in readonly mode.' $CLICKHOUSE_CLIENT --query="select toUInt64(pow(2, 62)) as value format JSON" --output_format_json_quote_64bit_integers=0 | grep value
clickhouse-client --readonly=1 --multiquery --query="set output_format_json_quote_64bit_integers=0 ; select toUInt64(pow(2, 63)) as value format JSON" 2>&1 | grep -o 'value\|Cannot execute SET query in readonly mode.' $CLICKHOUSE_CLIENT --query="select toUInt64(pow(2, 62)) as value format JSON" --output_format_json_quote_64bit_integers=1 | grep value
curl -sS 'http://localhost:8123/?query=SELECT+toUInt64(pow(2,+63))+as+value+format+JSON&output_format_json_quote_64bit_integers=1' | grep value $CLICKHOUSE_CLIENT --readonly=1 --multiquery --query="set output_format_json_quote_64bit_integers=1 ; select toUInt64(pow(2, 63)) as value format JSON" 2>&1 | grep -o 'value\|Cannot execute SET query in readonly mode.'
curl -sS 'http://localhost:8123/?query=SELECT+toUInt64(pow(2,+63))+as+value+format+JSON&output_format_json_quote_64bit_integers=0' | grep value $CLICKHOUSE_CLIENT --readonly=1 --multiquery --query="set output_format_json_quote_64bit_integers=0 ; select toUInt64(pow(2, 63)) as value format JSON" 2>&1 | grep -o 'value\|Cannot execute SET query in readonly mode.'
curl -sS 'http://localhost:8123/?session_id=readonly' -d 'SET readonly = 1' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=SELECT+toUInt64(pow(2,+63))+as+value+format+JSON&output_format_json_quote_64bit_integers=1" | grep value
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=SELECT+toUInt64(pow(2,+63))+as+value+format+JSON&output_format_json_quote_64bit_integers=0" | grep value
curl -sS 'http://localhost:8123/?session_id=readonly&query=SELECT+toUInt64(pow(2,+63))+as+value+format+JSON&output_format_json_quote_64bit_integers=1' 2>&1 | grep -o 'value\|Cannot override setting' ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?session_id=readonly" -d 'SET readonly = 1'
curl -sS 'http://localhost:8123/?session_id=readonly&query=SELECT+toUInt64(pow(2,+63))+as+value+format+JSON&output_format_json_quote_64bit_integers=0' 2>&1 | grep -o 'value\|Cannot override setting'
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?session_id=readonly&query=SELECT+toUInt64(pow(2,+63))+as+value+format+JSON&output_format_json_quote_64bit_integers=1" 2>&1 | grep -o 'value\|Cannot override setting'
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?session_id=readonly&query=SELECT+toUInt64(pow(2,+63))+as+value+format+JSON&output_format_json_quote_64bit_integers=0" 2>&1 | grep -o 'value\|Cannot override setting'

View File

@ -1,14 +1,17 @@
#!/usr/bin/env bash #!/usr/bin/env bash
clickhouse-client --query="DROP TABLE IF EXISTS test.format" CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
clickhouse-client --query="CREATE TABLE test.format (s String, x FixedString(3)) ENGINE = Memory" . $CURDIR/../shell_config.sh
echo -ne '\tABC\n' | curl -sS "http://localhost:8123/?query=INSERT+INTO+test.format+FORMAT+TabSeparated" --data-binary @- $CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS test.format"
echo -ne 'INSERT INTO test.format FORMAT TabSeparated\n\tDEF\n' | curl -sS "http://localhost:8123/" --data-binary @- $CLICKHOUSE_CLIENT --query="CREATE TABLE test.format (s String, x FixedString(3)) ENGINE = Memory"
echo -ne 'INSERT INTO test.format FORMAT TabSeparated hello\tGHI\n' | curl -sS "http://localhost:8123/" --data-binary @-
echo -ne 'INSERT INTO test.format FORMAT TabSeparated\r\n\tJKL\n' | curl -sS "http://localhost:8123/" --data-binary @-
echo -ne 'INSERT INTO test.format FORMAT TabSeparated \t\r\n\tMNO\n' | curl -sS "http://localhost:8123/" --data-binary @-
echo -ne 'INSERT INTO test.format FORMAT TabSeparated\t\t\thello\tPQR\n' | curl -sS "http://localhost:8123/" --data-binary @-
clickhouse-client --query="SELECT * FROM test.format ORDER BY s, x FORMAT JSONEachRow" echo -ne '\tABC\n' | ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}?query=INSERT+INTO+test.format+FORMAT+TabSeparated" --data-binary @-
clickhouse-client --query="DROP TABLE test.format" echo -ne 'INSERT INTO test.format FORMAT TabSeparated\n\tDEF\n' | ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" --data-binary @-
echo -ne 'INSERT INTO test.format FORMAT TabSeparated hello\tGHI\n' | ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" --data-binary @-
echo -ne 'INSERT INTO test.format FORMAT TabSeparated\r\n\tJKL\n' | ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" --data-binary @-
echo -ne 'INSERT INTO test.format FORMAT TabSeparated \t\r\n\tMNO\n' | ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" --data-binary @-
echo -ne 'INSERT INTO test.format FORMAT TabSeparated\t\t\thello\tPQR\n' | ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}" --data-binary @-
$CLICKHOUSE_CLIENT --query="SELECT * FROM test.format ORDER BY s, x FORMAT JSONEachRow"
$CLICKHOUSE_CLIENT --query="DROP TABLE test.format"

View File

@ -1,28 +1,31 @@
#!/usr/bin/env bash #!/usr/bin/env bash
clickhouse-client -q "DROP TABLE IF EXISTS test.ws"; CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
clickhouse-client -q "CREATE TABLE test.ws (i UInt8) ENGINE = Memory"; . $CURDIR/../shell_config.sh
clickhouse-client -q "INSERT INTO test.ws FORMAT RowBinary ;"; $CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test.ws";
clickhouse-client -q "INSERT INTO test.ws FORMAT RowBinary ; "; $CLICKHOUSE_CLIENT -q "CREATE TABLE test.ws (i UInt8) ENGINE = Memory";
clickhouse-client -q "INSERT INTO test.ws FORMAT RowBinary
$CLICKHOUSE_CLIENT -q "INSERT INTO test.ws FORMAT RowBinary ;";
$CLICKHOUSE_CLIENT -q "INSERT INTO test.ws FORMAT RowBinary ; ";
$CLICKHOUSE_CLIENT -q "INSERT INTO test.ws FORMAT RowBinary
; "; ; ";
echo -n ";" | clickhouse-client -q "INSERT INTO test.ws FORMAT RowBinary"; echo -n ";" | $CLICKHOUSE_CLIENT -q "INSERT INTO test.ws FORMAT RowBinary";
clickhouse-client --max_threads=1 -q "SELECT * FROM test.ws"; $CLICKHOUSE_CLIENT --max_threads=1 -q "SELECT * FROM test.ws";
clickhouse-client -q "DROP TABLE test.ws"; $CLICKHOUSE_CLIENT -q "DROP TABLE test.ws";
clickhouse-client -q "SELECT ''"; $CLICKHOUSE_CLIENT -q "SELECT ''";
clickhouse-client -q "CREATE TABLE test.ws (s String) ENGINE = Memory"; $CLICKHOUSE_CLIENT -q "CREATE TABLE test.ws (s String) ENGINE = Memory";
clickhouse-client -q "INSERT INTO test.ws FORMAT TSV ; $CLICKHOUSE_CLIENT -q "INSERT INTO test.ws FORMAT TSV ;
"; ";
echo ";" | clickhouse-client -q "INSERT INTO test.ws FORMAT TSV" echo ";" | $CLICKHOUSE_CLIENT -q "INSERT INTO test.ws FORMAT TSV"
if clickhouse-client -q "INSERT INTO test.ws FORMAT TSV;" 1>/dev/null 2>/dev/null; then if $CLICKHOUSE_CLIENT -q "INSERT INTO test.ws FORMAT TSV;" 1>/dev/null 2>/dev/null; then
echo ERROR; echo ERROR;
fi fi
clickhouse-client --max_threads=1 -q "SELECT * FROM test.ws"; $CLICKHOUSE_CLIENT --max_threads=1 -q "SELECT * FROM test.ws";
clickhouse-client -q "DROP TABLE test.ws"; $CLICKHOUSE_CLIENT -q "DROP TABLE test.ws";

View File

@ -3,6 +3,9 @@
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh . $CURDIR/../shell_config.sh
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
( ${CLICKHOUSE_CURL} -s --head "${CLICKHOUSE_URL}?query=SELECT%201"; ( ${CLICKHOUSE_CURL} -s --head "${CLICKHOUSE_URL}?query=SELECT%201";
${CLICKHOUSE_CURL} -s --head "${CLICKHOUSE_URL}?query=select+*+from+system.numbers+limit+1000000" ) | grep -v "Date:" ${CLICKHOUSE_CURL} -s --head "${CLICKHOUSE_URL}?query=select+*+from+system.numbers+limit+1000000" ) | grep -v "Date:"

View File

@ -1,14 +1,17 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
# https://github.com/yandex/ClickHouse/issues/1300 # https://github.com/yandex/ClickHouse/issues/1300
clickhouse-client -q "DROP TABLE IF EXISTS test.advertiser"; $CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test.advertiser";
clickhouse-client -q "DROP TABLE IF EXISTS test.advertiser_test"; $CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test.advertiser_test";
clickhouse-client -q "CREATE TABLE test.advertiser ( action_date Date, adblock UInt8, imps Int64 ) Engine = SummingMergeTree( action_date, ( adblock ), 8192, ( imps ) )"; $CLICKHOUSE_CLIENT -q "CREATE TABLE test.advertiser ( action_date Date, adblock UInt8, imps Int64 ) Engine = SummingMergeTree( action_date, ( adblock ), 8192, ( imps ) )";
clickhouse-client -q "CREATE TABLE test.advertiser_test ( action_date Date, adblock UInt8, imps Int64, Hash UInt64 ) Engine = SummingMergeTree( action_date, ( adblock, Hash ), 8192, ( imps ) )"; $CLICKHOUSE_CLIENT -q "CREATE TABLE test.advertiser_test ( action_date Date, adblock UInt8, imps Int64, Hash UInt64 ) Engine = SummingMergeTree( action_date, ( adblock, Hash ), 8192, ( imps ) )";
# This test will fail. It's ok. # This test will fail. It's ok.
clickhouse-client -q "INSERT INTO test.advertiser_test SELECT *, sipHash64( CAST(adblock AS String) ), CAST(1 AS Int8) FROM test.advertiser;" 2>/dev/null $CLICKHOUSE_CLIENT -q "INSERT INTO test.advertiser_test SELECT *, sipHash64( CAST(adblock AS String) ), CAST(1 AS Int8) FROM test.advertiser;" 2>/dev/null
clickhouse-client -q "DROP TABLE test.advertiser"; $CLICKHOUSE_CLIENT -q "DROP TABLE test.advertiser";
clickhouse-client -q "DROP TABLE test.advertiser_test"; $CLICKHOUSE_CLIENT -q "DROP TABLE test.advertiser_test";
clickhouse-client -q "SELECT 'Still alive'"; $CLICKHOUSE_CLIENT -q "SELECT 'Still alive'";

View File

@ -1,10 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Not default server config needed
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh . $CURDIR/../shell_config.sh
# Not default server config needed
tcp_ssl_port=`${CLICKHOUSE_EXTRACT_CONFIG} -k tcp_ssl_port 2>/dev/null` tcp_ssl_port=`${CLICKHOUSE_EXTRACT_CONFIG} -k tcp_ssl_port 2>/dev/null`
if [ -z ${tcp_ssl_port} ]; then if [ -z ${tcp_ssl_port} ]; then
# Secure port disabled. Fake result # Secure port disabled. Fake result
@ -12,5 +12,5 @@ if [ -z ${tcp_ssl_port} ]; then
else else
# Auto port detect # Auto port detect
${CLICKHOUSE_CLIENT} --ssl -q "SELECT 1"; ${CLICKHOUSE_CLIENT} --ssl -q "SELECT 1";
${CLICKHOUSE_CLIENT} --ssl --port=9440 -q "SELECT 2"; ${CLICKHOUSE_CLIENT} --ssl --port=${CLICKHOUSE_PORT_TCP_SSL} -q "SELECT 2";
fi fi

View File

@ -3,8 +3,8 @@
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh . $CURDIR/../shell_config.sh
curl -sS $CLICKHOUSE_URL -d 'SELECT floor(NULL), 1;'; ${CLICKHOUSE_CURL} -sS $CLICKHOUSE_URL -d 'SELECT floor(NULL), 1;';
curl -sS $CLICKHOUSE_URL -d 'SELECT toInt64(null), 2'; ${CLICKHOUSE_CURL} -sS $CLICKHOUSE_URL -d 'SELECT toInt64(null), 2';
curl -sS $CLICKHOUSE_URL -d 'SELECT floor(NULL) FORMAT JSONEachRow;'; ${CLICKHOUSE_CURL} -sS $CLICKHOUSE_URL -d 'SELECT floor(NULL) FORMAT JSONEachRow;';
curl -sS $CLICKHOUSE_URL -d 'SELECT floor(greatCircleDistance(NULL, 55.3, 38.7, 55.1)) AS distance format JSONEachRow;'; ${CLICKHOUSE_CURL} -sS $CLICKHOUSE_URL -d 'SELECT floor(greatCircleDistance(NULL, 55.3, 38.7, 55.1)) AS distance format JSONEachRow;';
curl -sS $CLICKHOUSE_URL -d 'SELECT NULL + 1;'; ${CLICKHOUSE_CURL} -sS $CLICKHOUSE_URL -d 'SELECT NULL + 1;';

View File

@ -5,7 +5,6 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# Server should not crash on any function trash calls # Server should not crash on any function trash calls
# todo: make --ignore-error function in clickhouse-client and load all queries as one .sql (or pipe)
# todo: maybe add more strange usages # todo: maybe add more strange usages
perl -E "say \$_ for map {chomp; (qq{SELECT \$_;}, qq{SELECT \$_();}, qq{SELECT \$_(NULL);}, qq{SELECT \$_([]);}, qq{SELECT \$_([NULL]);}, qq{SELECT \$_(-1);}, qq{SELECT \$_('');},)} qx{$CLICKHOUSE_CLIENT -q 'SELECT name FROM system.functions ORDER BY name;'}" | $CLICKHOUSE_CLIENT -n --ignore-error >/dev/null 2>&1 perl -E "say \$_ for map {chomp; (qq{SELECT \$_;}, qq{SELECT \$_();}, qq{SELECT \$_(NULL);}, qq{SELECT \$_([]);}, qq{SELECT \$_([NULL]);}, qq{SELECT \$_(-1);}, qq{SELECT \$_('');},)} qx{$CLICKHOUSE_CLIENT -q 'SELECT name FROM system.functions ORDER BY name;'}" | $CLICKHOUSE_CLIENT -n --ignore-error >/dev/null 2>&1

View File

@ -3,12 +3,18 @@ export CLICKHOUSE_BINARY=${CLICKHOUSE_BINARY:="clickhouse"}
export CLICKHOUSE_CLIENT=${CLICKHOUSE_CLIENT:="${CLICKHOUSE_BINARY}-client"} export CLICKHOUSE_CLIENT=${CLICKHOUSE_CLIENT:="${CLICKHOUSE_BINARY}-client"}
export CLICKHOUSE_LOCAL=${CLICKHOUSE_LOCAL:="${CLICKHOUSE_BINARY}-local"} export CLICKHOUSE_LOCAL=${CLICKHOUSE_LOCAL:="${CLICKHOUSE_BINARY}-local"}
export CLICKHOUSE_CONFIG=${CLICKHOUSE_CONFIG:="/etc/clickhouse-server/config.xml"}
export CLICKHOUSE_EXTRACT_CONFIG=${CLICKHOUSE_EXTRACT_CONFIG:="$CLICKHOUSE_BINARY-extract-from-config -c $CLICKHOUSE_CONFIG"}
export CLICKHOUSE_HOST=${CLICKHOUSE_HOST:="localhost"} export CLICKHOUSE_HOST=${CLICKHOUSE_HOST:="localhost"}
export CLICKHOUSE_PORT_TCP=${CLICKHOUSE_PORT_TCP:=`${CLICKHOUSE_EXTRACT_CONFIG} --try --key=tcp_port`} 2>/dev/null
export CLICKHOUSE_PORT_TCP=${CLICKHOUSE_PORT_TCP:="9000"} export CLICKHOUSE_PORT_TCP=${CLICKHOUSE_PORT_TCP:="9000"}
export CLICKHOUSE_PORT_TCP_SSL=${CLICKHOUSE_PORT_TCP_SSL:=`${CLICKHOUSE_EXTRACT_CONFIG} --try --key=tcp_ssl_port`} 2>/dev/null
export CLICKHOUSE_PORT_TCP_SSL=${CLICKHOUSE_PORT_TCP_SSL:="9440"}
export CLICKHOUSE_PORT_HTTP=${CLICKHOUSE_PORT_HTTP:=`${CLICKHOUSE_EXTRACT_CONFIG} --key=http_port`}
export CLICKHOUSE_PORT_HTTP=${CLICKHOUSE_PORT_HTTP:="8123"} export CLICKHOUSE_PORT_HTTP=${CLICKHOUSE_PORT_HTTP:="8123"}
export CLICKHOUSE_PORT_HTTPS=${CLICKHOUSE_PORT_HTTPS:=`${CLICKHOUSE_EXTRACT_CONFIG} --try --key=https_port`} 2>/dev/null
export CLICKHOUSE_PORT_HTTPS=${CLICKHOUSE_PORT_HTTPS:="8443"} export CLICKHOUSE_PORT_HTTPS=${CLICKHOUSE_PORT_HTTPS:="8443"}
export CLICKHOUSE_PORT_HTTP_PROTO=${CLICKHOUSE_PORT_HTTP_PROTO:="http"} export CLICKHOUSE_PORT_HTTP_PROTO=${CLICKHOUSE_PORT_HTTP_PROTO:="http"}
export CLICKHOUSE_URL=${CLICKHOUSE_URL:="${CLICKHOUSE_PORT_HTTP_PROTO}://${CLICKHOUSE_HOST}:${CLICKHOUSE_PORT_HTTP}/"} export CLICKHOUSE_URL=${CLICKHOUSE_URL:="${CLICKHOUSE_PORT_HTTP_PROTO}://${CLICKHOUSE_HOST}:${CLICKHOUSE_PORT_HTTP}/"}
export CLICKHOUSE_CONFIG=${CLICKHOUSE_CONFIG:="/etc/clickhouse-server/config.xml"}
export CLICKHOUSE_EXTRACT_CONFIG=${CLICKHOUSE_EXTRACT_CONFIG:="$CLICKHOUSE_BINARY extract-from-config -c $CLICKHOUSE_CONFIG"}
export CLICKHOUSE_CURL=${CLICKHOUSE_CURL:="curl --max-time 5"} export CLICKHOUSE_CURL=${CLICKHOUSE_CURL:="curl --max-time 5"}

1
debian/.pbuilderrc vendored
View File

@ -145,6 +145,7 @@ export DEB_BUILD_OPTIONS=parallel=`nproc`
# Floating bug with permissions: # Floating bug with permissions:
sudo mkdir -p /var/cache/pbuilder/ccache sudo mkdir -p /var/cache/pbuilder/ccache
sudo chmod -R a+rwx /var/cache/pbuilder/ccache sudo chmod -R a+rwx /var/cache/pbuilder/ccache
# chown -R 1234:1234 /var/cache/pbuilder/ccache
# echo "DEBOOTSTRAPOPTS = ${DEBOOTSTRAPOPTS[@]}" # echo "DEBOOTSTRAPOPTS = ${DEBOOTSTRAPOPTS[@]}"

View File

@ -2,3 +2,5 @@
/usr/bin/clickhouse-benchmark /usr/bin/clickhouse-benchmark
/usr/bin/clickhouse-local /usr/bin/clickhouse-local
/etc/clickhouse-client/config.xml /etc/clickhouse-client/config.xml
/usr/bin/clickhouse-extract-from-config
/usr/bin/clickhouse-performance-test