From 9b8972b4c8f283264dde3055e1871ba38990642b Mon Sep 17 00:00:00 2001 From: proller Date: Fri, 22 Dec 2017 21:29:03 +0300 Subject: [PATCH] Add bad queries from #1563 (#1653) * cmake fix * load shell_config.sh * env bash * fix * use $CLICKHOUSE_CLIENT * fix * curl 1 * curl2 * curl3 * fix * fix * fix * fix * ExtractFromConfig --try * fix * fix * Add symlinks to package * fix bundle * fix * fix * fix package * clickhouse-test --order option * client --ignore-error option (useful with --multiquery) * add bad queries from @filimonov * More queries * --ignore_error via lexer * fix * rename --- dbms/src/Server/Client.cpp | 34 +- .../00534_client_ignore_error.reference | 6 + .../0_stateless/00534_client_ignore_error.sh | 10 + .../queries/0_stateless/00534_filimonov.data | 429 ++++++++++++++++++ ...ts.reference => 00534_filimonov.reference} | 0 .../queries/0_stateless/00534_filimonov.sh | 10 + .../00534_functions_bad_arguments.reference | 1 + ...ts.sh => 00534_functions_bad_arguments.sh} | 0 8 files changed, 486 insertions(+), 4 deletions(-) create mode 100644 dbms/tests/queries/0_stateless/00534_client_ignore_error.reference create mode 100755 dbms/tests/queries/0_stateless/00534_client_ignore_error.sh create mode 100644 dbms/tests/queries/0_stateless/00534_filimonov.data rename dbms/tests/queries/0_stateless/{00531_functions_bad_arguments.reference => 00534_filimonov.reference} (100%) create mode 100755 dbms/tests/queries/0_stateless/00534_filimonov.sh create mode 100644 dbms/tests/queries/0_stateless/00534_functions_bad_arguments.reference rename dbms/tests/queries/0_stateless/{00531_functions_bad_arguments.sh => 00534_functions_bad_arguments.sh} (100%) diff --git a/dbms/src/Server/Client.cpp b/dbms/src/Server/Client.cpp index 4c541b14a2e..2afceca24f6 100644 --- a/dbms/src/Server/Client.cpp +++ b/dbms/src/Server/Client.cpp @@ -548,6 +548,7 @@ private: bool process(const String & text) { + const auto ignore_error = config().getBool("ignore-error", false); if (config().has("multiquery")) { /// Several queries separated by ';'. @@ -563,7 +564,19 @@ private: const char * pos = begin; ASTPtr ast = parseQuery(pos, end, true); if (!ast) + { + if (ignore_error) + { + Tokens tokens(begin, end); + TokenIterator token_iterator(tokens); + while (token_iterator->type != TokenType::Semicolon && token_iterator.isValid()) + ++token_iterator; + begin = token_iterator->end; + + continue; + } return true; + } ASTInsertQuery * insert = typeid_cast(&*ast); @@ -579,10 +592,18 @@ private: while (isWhitespace(*begin) || *begin == ';') ++begin; - if (!processSingleQuery(query, ast)) - return false; + try + { + if (!processSingleQuery(query, ast) && !ignore_error) + return false; + } + catch (...) + { + std::cerr << "Error on processing query: " << query << std::endl << getCurrentExceptionMessage(true); + got_exception = true; + } - if (got_exception) + if (got_exception && !ignore_error) { if (is_interactive) break; @@ -750,7 +771,9 @@ private: ParserQuery parser(end); ASTPtr res; - if (is_interactive) + const auto ignore_error = config().getBool("ignore-error", false); + + if (is_interactive || ignore_error) { String message; res = tryParseQuery(parser, pos, end, message, true, "", allow_multi_statements); @@ -1269,6 +1292,7 @@ public: ("pager", boost::program_options::value(), "pager") ("multiline,m", "multiline") ("multiquery,n", "multiquery") + ("ignore-error", "Do not stop processing in multiquery mode") ("format,f", boost::program_options::value(), "default output format") ("vertical,E", "vertical output format, same as --format=Vertical or FORMAT Vertical or \\G at end of command") ("time,t", "print query execution time to stderr in non-interactive mode (for benchmarks)") @@ -1374,6 +1398,8 @@ public: config().setBool("multiline", true); if (options.count("multiquery")) config().setBool("multiquery", true); + if (options.count("ignore-error")) + config().setBool("ignore-error", true); if (options.count("format")) config().setString("format", options["format"].as()); if (options.count("vertical")) diff --git a/dbms/tests/queries/0_stateless/00534_client_ignore_error.reference b/dbms/tests/queries/0_stateless/00534_client_ignore_error.reference new file mode 100644 index 00000000000..444cc947087 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00534_client_ignore_error.reference @@ -0,0 +1,6 @@ +1 +2 +; +3 +4 +5 diff --git a/dbms/tests/queries/0_stateless/00534_client_ignore_error.sh b/dbms/tests/queries/0_stateless/00534_client_ignore_error.sh new file mode 100755 index 00000000000..105e4fab72a --- /dev/null +++ b/dbms/tests/queries/0_stateless/00534_client_ignore_error.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +. $CURDIR/../shell_config.sh + +echo "SELECT 1; SELECT 2; SELECT CAST(); SELECT ';'; SELECT 3;SELECT CAST();SELECT 4;" | $CLICKHOUSE_CLIENT -n --ignore-error 2>/dev/null +echo "SELECT CAST();" | $CLICKHOUSE_CLIENT -n --ignore-error 2>/dev/null +echo "SELECT 5;" | $CLICKHOUSE_CLIENT -n --ignore-error + +#$CLICKHOUSE_CLIENT -q "SELECT 'Still alive'" diff --git a/dbms/tests/queries/0_stateless/00534_filimonov.data b/dbms/tests/queries/0_stateless/00534_filimonov.data new file mode 100644 index 00000000000..53c64592d0a --- /dev/null +++ b/dbms/tests/queries/0_stateless/00534_filimonov.data @@ -0,0 +1,429 @@ +SELECT toNullable(CAST('\0' AS Nullable(String))); +SELECT assumeNotNull(CAST('\0' AS Nullable(String))); +SELECT tan(NULL); +SELECT sin(NULL); +SELECT lgamma(NULL); +SELECT erfc(NULL); +SELECT erf(NULL); +SELECT sqrt(NULL); +SELECT log10(NULL); +SELECT tgamma(NULL); +SELECT exp10(NULL); +SELECT exp2(NULL); +SELECT exp(NULL); +SELECT decodeURLComponent(NULL); +SELECT cutFragment(NULL); +SELECT cutQueryString(NULL); +SELECT cutWWW(NULL); +SELECT cutToFirstSignificantSubdomain(NULL); +SELECT queryStringAndFragment(NULL); +SELECT queryString(NULL); +SELECT firstSignificantSubdomain(NULL); +SELECT domainWithoutWWW(NULL); +SELECT domain(NULL); +SELECT cbrt(NULL); +SELECT reverse(NULL); +SELECT lowerUTF8(NULL); +SELECT lower(NULL); +SELECT lengthUTF8(NULL); +SELECT notEmpty(CAST('\0' AS Nullable(FixedString(1)))); +SELECT notEmpty(NULL); +SELECT trunc(NULL); +SELECT floor(NULL); +SELECT round(NULL); +SELECT roundAge(NULL); +SELECT roundDuration(NULL); +SELECT reinterpretAsDateTime(NULL); +SELECT reinterpretAsDate(NULL); +SELECT reinterpretAsFloat64(NULL); +SELECT reinterpretAsFloat32(NULL); +SELECT reinterpretAsInt32(NULL); +SELECT upperUTF8(NULL); +SELECT reinterpretAsInt8(NULL); +SELECT reinterpretAsUInt64(NULL); +SELECT reinterpretAsUInt32(NULL); +SELECT reinterpretAsUInt16(NULL); +SELECT randConstant(CAST( 0 AS Nullable(Int8))); +SELECT randConstant(CAST( 0 AS Nullable(Int16))); +SELECT randConstant(CAST( 0 AS Nullable(Int32))); +SELECT randConstant(CAST( 0 AS Nullable(Int64))); +SELECT randConstant(CAST( 0 AS Nullable(UInt8))); +SELECT randConstant(CAST( 0 AS Nullable(UInt16))); +SELECT randConstant(CAST( 0 AS Nullable(UInt32))); +SELECT randConstant(CAST( 0 AS Nullable(UInt64))); +SELECT randConstant(CAST( 0 AS Nullable(Float32))); +SELECT randConstant(CAST( 0 AS Nullable(Float64))); +SELECT randConstant(CAST( 0 AS Nullable(Date))); +SELECT randConstant(CAST( 0 AS Nullable(DateTime))); +SELECT randConstant(CAST( '0' AS Nullable(Enum8('0' = 0, 'z' = 1)))); +SELECT randConstant(CAST('\0' AS Nullable(String))); +SELECT randConstant(CAST('\0' AS Nullable(FixedString(1)))); +SELECT randConstant(CAST(NULL AS Nullable(Int8))); +SELECT randConstant(CAST(NULL AS Nullable(Int16))); +SELECT randConstant(CAST(NULL AS Nullable(Int32))); +SELECT randConstant(CAST(NULL AS Nullable(Int64))); +SELECT randConstant(CAST(NULL AS Nullable(UInt8))); +SELECT randConstant(CAST(NULL AS Nullable(UInt16))); +SELECT randConstant(CAST(NULL AS Nullable(UInt32))); +SELECT randConstant(CAST(NULL AS Nullable(UInt64))); +SELECT randConstant(CAST(NULL AS Nullable(Float32))); +SELECT randConstant(CAST(NULL AS Nullable(Float64))); +SELECT randConstant(CAST(NULL AS Nullable(Date))); +SELECT randConstant(CAST(NULL AS Nullable(DateTime))); +SELECT randConstant(CAST(NULL AS Nullable(Enum8('0' = 0, 'z' = 1)))); +SELECT randConstant(CAST(NULL AS Nullable(String))); +SELECT isInfinite(NULL); +SELECT isNaN(NULL); +SELECT isFinite(NULL); +SELECT length(CAST('\0' AS Nullable(FixedString(1)))); +SELECT length(NULL); +SELECT identity(CAST( 0 AS Nullable(Int8))); +SELECT identity(CAST( 0 AS Nullable(Int16))); +SELECT identity(CAST( 0 AS Nullable(Int32))); +SELECT identity(CAST( 0 AS Nullable(Int64))); +SELECT identity(CAST( 0 AS Nullable(UInt8))); +SELECT identity(CAST( 0 AS Nullable(UInt16))); +SELECT identity(CAST( 0 AS Nullable(UInt32))); +SELECT identity(CAST( 0 AS Nullable(UInt64))); +SELECT identity(CAST( 0 AS Nullable(Float32))); +SELECT identity(CAST( 0 AS Nullable(Float64))); +SELECT identity(CAST( 0 AS Nullable(Date))); +SELECT identity(CAST( 0 AS Nullable(DateTime))); +SELECT identity(CAST( '0' AS Nullable(Enum8('0' = 0, 'z' = 1)))); +SELECT identity(CAST('\0' AS Nullable(String))); +SELECT identity(CAST('\0' AS Nullable(FixedString(1)))); +SELECT identity(CAST(NULL AS Nullable(Int8))); +SELECT identity(CAST(NULL AS Nullable(Int16))); +SELECT identity(CAST(NULL AS Nullable(Int32))); +SELECT identity(CAST(NULL AS Nullable(Int64))); +SELECT identity(CAST(NULL AS Nullable(UInt8))); +SELECT identity(CAST(NULL AS Nullable(UInt16))); +SELECT identity(CAST(NULL AS Nullable(UInt32))); +SELECT identity(CAST(NULL AS Nullable(UInt64))); +SELECT identity(CAST(NULL AS Nullable(Float32))); +SELECT identity(CAST(NULL AS Nullable(Float64))); +SELECT identity(CAST(NULL AS Nullable(Date))); +SELECT identity(CAST(NULL AS Nullable(DateTime))); +SELECT identity(CAST(NULL AS Nullable(Enum8('0' = 0, 'z' = 1)))); +SELECT identity(CAST(NULL AS Nullable(String))); +SELECT substring(NULL); +SELECT empty(CAST('\0' AS Nullable(FixedString(1)))); +SELECT empty(NULL); +SELECT fragment(NULL); +SELECT ceil(NULL); +SELECT URLHash(NULL); +SELECT not(NULL); +SELECT intHash64(NULL); +SELECT toUInt8OrZero(NULL); +SELECT toRelativeSecondNum(NULL); +SELECT toFloat32(NULL); +SELECT toUInt64(NULL); +SELECT ceiling(NULL); +SELECT toStartOfMinute(NULL); +SELECT toUInt32(NULL); +SELECT cutQueryStringAndFragment(NULL); +SELECT toUInt8(NULL); +SELECT UUIDStringToNum(NULL); +SELECT upper(NULL); +SELECT roundToExp2(NULL); +SELECT cos(NULL); +SELECT UUIDNumToString(NULL); +SELECT log2(NULL); +SELECT toTime(NULL); +SELECT path(NULL); +SELECT toUInt16(NULL); +SELECT IPv4StringToNum(NULL); +SELECT reinterpretAsString(NULL); +SELECT IPv4NumToStringClassC(NULL); +SELECT toHour(NULL); +SELECT MACNumToString(NULL); +SELECT toInt64(NULL); +SELECT log(NULL); +SELECT toStringCutToZero(NULL); +SELECT toYYYYMMDDhhmmss(NULL); +SELECT toSecond(NULL); +SELECT SHA224(NULL); +SELECT MACStringToOUI(NULL); +SELECT toUInt64OrZero(NULL); +SELECT toDayOfMonth(NULL); +SELECT IPv4NumToString(NULL); +SELECT bar(NULL); +SELECT toDayOfWeek(NULL); +SELECT reinterpretAsInt64(NULL); +SELECT bitNot(NULL); +SELECT IPv6NumToString(NULL); +SELECT reinterpretAsUInt8(NULL); +SELECT toStartOfYear(NULL); +SELECT arrayConcat(NULL); +SELECT toDate(NULL); +SELECT reverseUTF8(NULL); +SELECT toStartOfQuarter(NULL); +SELECT toYYYYMMDD(NULL); +SELECT abs(NULL); +SELECT negate(NULL); +SELECT bitmaskToArray(NULL); +SELECT toDateTime(NULL); +SELECT toFloat64(NULL); +SELECT unhex(NULL); +SELECT toInt32(NULL); +SELECT topLevelDomain(NULL); +SELECT truncate(NULL); +SELECT toRelativeMinuteNum(NULL); +SELECT IPv4ToIPv6(NULL); +SELECT sipHash64(NULL); +SELECT protocol(NULL); +SELECT toInt16OrZero(NULL); +SELECT formatReadableSize(NULL); +SELECT concatAssumeInjective(NULL); +SELECT toString(NULL); +SELECT MACStringToNum(NULL); +SELECT toUnixTimestamp(NULL); +SELECT reinterpretAsInt16(NULL); +SELECT toInt16(NULL); +SELECT toUInt32OrZero(NULL); +SELECT toInt8OrZero(NULL); +SELECT toStartOfMonth(NULL); +SELECT toInt32OrZero(NULL); +SELECT pathFull(NULL); +SELECT toInt64OrZero(NULL); +SELECT toFloat32OrZero(NULL); +SELECT toFloat64OrZero(NULL); +SELECT atan(NULL); +SELECT toYear(NULL); +SELECT IPv6StringToNum(NULL); +SELECT toMonth(NULL); +SELECT concat(NULL); +SELECT toMinute(NULL); +SELECT toStartOfDay(NULL); +SELECT toMonday(NULL); +SELECT toUInt16OrZero(NULL); +SELECT toStartOfFiveMinute(NULL); +SELECT halfMD5(NULL); +SELECT toStartOfHour(NULL); +SELECT toRelativeYearNum(NULL); +SELECT toRelativeMonthNum(NULL); +SELECT toRelativeWeekNum(NULL); +SELECT toRelativeDayNum(NULL); +SELECT toRelativeHourNum(NULL); +SELECT farmHash64(CAST( 0 AS Nullable(Int8))); +SELECT farmHash64(CAST( 0 AS Nullable(Int16))); +SELECT farmHash64(CAST( 0 AS Nullable(Int32))); +SELECT farmHash64(CAST( 0 AS Nullable(Int64))); +SELECT farmHash64(CAST( 0 AS Nullable(UInt8))); +SELECT farmHash64(CAST( 0 AS Nullable(UInt16))); +SELECT farmHash64(CAST( 0 AS Nullable(UInt32))); +SELECT farmHash64(CAST( 0 AS Nullable(UInt64))); +SELECT farmHash64(CAST( 0 AS Nullable(Float32))); +SELECT farmHash64(CAST( 0 AS Nullable(Float64))); +SELECT farmHash64(CAST( 0 AS Nullable(Date))); +SELECT farmHash64(CAST( 0 AS Nullable(DateTime))); +SELECT farmHash64(CAST( '0' AS Nullable(Enum8('0' = 0, 'z' = 1)))); +SELECT farmHash64(CAST('\0' AS Nullable(String))); +SELECT farmHash64(CAST('\0' AS Nullable(FixedString(1)))); +SELECT farmHash64(CAST(NULL AS Nullable(Int8))); +SELECT farmHash64(CAST(NULL AS Nullable(Int16))); +SELECT farmHash64(CAST(NULL AS Nullable(Int32))); +SELECT farmHash64(CAST(NULL AS Nullable(Int64))); +SELECT farmHash64(CAST(NULL AS Nullable(UInt8))); +SELECT farmHash64(CAST(NULL AS Nullable(UInt16))); +SELECT farmHash64(CAST(NULL AS Nullable(UInt32))); +SELECT farmHash64(CAST(NULL AS Nullable(UInt64))); +SELECT farmHash64(CAST(NULL AS Nullable(Float32))); +SELECT farmHash64(CAST(NULL AS Nullable(Float64))); +SELECT farmHash64(CAST(NULL AS Nullable(Date))); +SELECT farmHash64(CAST(NULL AS Nullable(DateTime))); +SELECT farmHash64(CAST(NULL AS Nullable(Enum8('0' = 0, 'z' = 1)))); +SELECT farmHash64(CAST(NULL AS Nullable(String))); +SELECT timeSlot(NULL); +SELECT hex(NULL); +SELECT toYYYYMM(NULL); +SELECT toInt8(NULL); +SELECT metroHash64(CAST( 0 AS Nullable(Int8))); +SELECT metroHash64(CAST( 0 AS Nullable(Int16))); +SELECT metroHash64(CAST( 0 AS Nullable(Int32))); +SELECT metroHash64(CAST( 0 AS Nullable(Int64))); +SELECT metroHash64(CAST( 0 AS Nullable(UInt8))); +SELECT metroHash64(CAST( 0 AS Nullable(UInt16))); +SELECT metroHash64(CAST( 0 AS Nullable(UInt32))); +SELECT metroHash64(CAST( 0 AS Nullable(UInt64))); +SELECT metroHash64(CAST( 0 AS Nullable(Float32))); +SELECT metroHash64(CAST( 0 AS Nullable(Float64))); +SELECT metroHash64(CAST( 0 AS Nullable(Date))); +SELECT metroHash64(CAST( 0 AS Nullable(DateTime))); +SELECT metroHash64(CAST( '0' AS Nullable(Enum8('0' = 0, 'z' = 1)))); +SELECT metroHash64(CAST('\0' AS Nullable(String))); +SELECT metroHash64(CAST('\0' AS Nullable(FixedString(1)))); +SELECT metroHash64(CAST(NULL AS Nullable(Int8))); +SELECT metroHash64(CAST(NULL AS Nullable(Int16))); +SELECT metroHash64(CAST(NULL AS Nullable(Int32))); +SELECT metroHash64(CAST(NULL AS Nullable(Int64))); +SELECT metroHash64(CAST(NULL AS Nullable(UInt8))); +SELECT metroHash64(CAST(NULL AS Nullable(UInt16))); +SELECT metroHash64(CAST(NULL AS Nullable(UInt32))); +SELECT metroHash64(CAST(NULL AS Nullable(UInt64))); +SELECT metroHash64(CAST(NULL AS Nullable(Float32))); +SELECT metroHash64(CAST(NULL AS Nullable(Float64))); +SELECT metroHash64(CAST(NULL AS Nullable(Date))); +SELECT metroHash64(CAST(NULL AS Nullable(DateTime))); +SELECT metroHash64(CAST(NULL AS Nullable(Enum8('0' = 0, 'z' = 1)))); +SELECT metroHash64(CAST(NULL AS Nullable(String))); +SELECT acos(NULL); +SELECT toUUID(NULL); +SELECT runningDifference(CAST( 0 AS Nullable(Int8))); +SELECT runningDifference(CAST( 0 AS Nullable(Int16))); +SELECT runningDifference(CAST( 0 AS Nullable(Int32))); +SELECT runningDifference(CAST( 0 AS Nullable(Int64))); +SELECT runningDifference(CAST( 0 AS Nullable(UInt8))); +SELECT runningDifference(CAST( 0 AS Nullable(UInt16))); +SELECT runningDifference(CAST( 0 AS Nullable(UInt32))); +SELECT runningDifference(CAST( 0 AS Nullable(UInt64))); +SELECT runningDifference(CAST( 0 AS Nullable(Float32))); +SELECT runningDifference(CAST( 0 AS Nullable(Float64))); +SELECT runningDifference(CAST( 0 AS Nullable(Date))); +SELECT runningDifference(CAST( 0 AS Nullable(DateTime))); +SELECT runningDifference(CAST(NULL AS Nullable(Int8))); +SELECT runningDifference(CAST(NULL AS Nullable(Int16))); +SELECT runningDifference(CAST(NULL AS Nullable(Int32))); +SELECT runningDifference(CAST(NULL AS Nullable(Int64))); +SELECT runningDifference(CAST(NULL AS Nullable(UInt8))); +SELECT runningDifference(CAST(NULL AS Nullable(UInt16))); +SELECT runningDifference(CAST(NULL AS Nullable(UInt32))); +SELECT runningDifference(CAST(NULL AS Nullable(UInt64))); +SELECT runningDifference(CAST(NULL AS Nullable(Float32))); +SELECT runningDifference(CAST(NULL AS Nullable(Float64))); +SELECT runningDifference(CAST(NULL AS Nullable(Date))); +SELECT runningDifference(CAST(NULL AS Nullable(DateTime))); +SELECT bitmaskToList(NULL); +SELECT MD5(NULL); +SELECT SHA256(NULL); +SELECT asin(NULL); +SELECT SHA1(NULL); +SELECT sipHash128(NULL); +SELECT cityHash64(CAST( 0 AS Nullable(Int8))); +SELECT cityHash64(CAST( 0 AS Nullable(Int16))); +SELECT cityHash64(CAST( 0 AS Nullable(Int32))); +SELECT cityHash64(CAST( 0 AS Nullable(Int64))); +SELECT cityHash64(CAST( 0 AS Nullable(UInt8))); +SELECT cityHash64(CAST( 0 AS Nullable(UInt16))); +SELECT cityHash64(CAST( 0 AS Nullable(UInt32))); +SELECT cityHash64(CAST( 0 AS Nullable(UInt64))); +SELECT cityHash64(CAST( 0 AS Nullable(Float32))); +SELECT cityHash64(CAST( 0 AS Nullable(Float64))); +SELECT cityHash64(CAST( 0 AS Nullable(Date))); +SELECT cityHash64(CAST( 0 AS Nullable(DateTime))); +SELECT cityHash64(CAST( '0' AS Nullable(Enum8('0' = 0, 'z' = 1)))); +SELECT cityHash64(CAST('\0' AS Nullable(String))); +SELECT cityHash64(CAST('\0' AS Nullable(FixedString(1)))); +SELECT cityHash64(CAST(NULL AS Nullable(Int8))); +SELECT cityHash64(CAST(NULL AS Nullable(Int16))); +SELECT cityHash64(CAST(NULL AS Nullable(Int32))); +SELECT cityHash64(CAST(NULL AS Nullable(Int64))); +SELECT cityHash64(CAST(NULL AS Nullable(UInt8))); +SELECT cityHash64(CAST(NULL AS Nullable(UInt16))); +SELECT cityHash64(CAST(NULL AS Nullable(UInt32))); +SELECT cityHash64(CAST(NULL AS Nullable(UInt64))); +SELECT cityHash64(CAST(NULL AS Nullable(Float32))); +SELECT cityHash64(CAST(NULL AS Nullable(Float64))); +SELECT cityHash64(CAST(NULL AS Nullable(Date))); +SELECT cityHash64(CAST(NULL AS Nullable(DateTime))); +SELECT cityHash64(CAST(NULL AS Nullable(Enum8('0' = 0, 'z' = 1)))); +SELECT cityHash64(CAST(NULL AS Nullable(String))); +SELECT intHash32(NULL); +SELECT topK(arrayPopBack([CAST('\0' AS Nullable(FixedString(1)))])); +SELECT topK([ [ [1], [2] ], [ [3], [4]] ]); + +SELECT visitParamExtractFloat('',CAST('\0' AS Nullable(String))); +SELECT visitParamExtractFloat('',CAST(NULL AS Nullable(String))); +SELECT visitParamExtractFloat(CAST('\0' AS Nullable(String)),''); +SELECT visitParamExtractFloat(CAST('\0' AS Nullable(String)),CAST('\0' AS Nullable(String))); +SELECT visitParamExtractFloat(CAST(NULL AS Nullable(String)),''); +SELECT visitParamHas('',CAST('\0' AS Nullable(String))); +SELECT visitParamHas(CAST('\0' AS Nullable(String)),''); +SELECT visitParamHas(CAST('\0' AS Nullable(String)),'\0\0\0\0\0\0\0\0\0\0'); +SELECT visitParamHas(CAST(NULL AS Nullable(String)),''); +SELECT visitParamHas(CAST(NULL AS Nullable(String)),CAST('\0' AS Nullable(String))); +SELECT like('',CAST('\0' AS Nullable(String))); +SELECT like('',CAST(NULL AS Nullable(String))); +SELECT like('\0\0\0\0\0\0\0\0\0\0',CAST('\0' AS Nullable(String))); +SELECT like('\0\0\0\0\0\0\0\0\0\0',CAST(NULL AS Nullable(String))); +SELECT like(CAST('\0' AS Nullable(String)),''); +SELECT like(CAST(NULL AS Nullable(String)),''); +SELECT match('',CAST('\0' AS Nullable(String))); +SELECT match('',CAST(NULL AS Nullable(String))); +SELECT match(CAST('\0' AS Nullable(String)),CAST('\0' AS String)); +SELECT match(CAST(NULL AS Nullable(String)),''); +SELECT match(CAST(NULL AS Nullable(String)),CAST(NULL AS Nullable(String))); +SELECT arrayStringConcat([CAST('\0' AS String)],CAST('\0' AS Nullable(String))); +SELECT arrayStringConcat([CAST('\0' AS String)],CAST(NULL AS Nullable(String))); +SELECT arrayStringConcat(arrayPopBack([CAST('\0' AS String)]),CAST('\0' AS Nullable(String))); +SELECT arrayStringConcat(arrayPopBack([CAST('\0' AS String)]),CAST(NULL AS Nullable(String))); +SELECT tupleElement(CAST(1 AS Int8),sumState(0)); +SELECT notLike('',CAST('\0' AS Nullable(String))); +SELECT notLike('',CAST(NULL AS Nullable(String))); +SELECT notLike(CAST('\0' AS Nullable(String)),''); +SELECT notLike(CAST('\0' AS Nullable(String)),CAST('\0' AS Nullable(String))); +SELECT notLike(CAST('\0' AS Nullable(String)),CAST(NULL AS Nullable(String))); +SELECT or(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT or(CAST(1 AS Int8),CAST( 0 AS Nullable(UInt64))); +SELECT or(CAST(1 AS Int8),CAST( 0 AS Nullable(Date))); +SELECT or(CAST(1 AS Int8),CAST( 0 AS Nullable(DateTime))); +SELECT or(CAST(1 AS Int8),CAST( '0' AS Nullable(Enum8('0' = 0, 'z' = 1)))); +SELECT or(CAST(1 AS Int8),CAST(NULL AS Nullable(Float64))); +SELECT or(CAST(1 AS Int8),CAST(NULL AS Nullable(Date))); +SELECT or(CAST(1 AS Int8),CAST(NULL AS Nullable(DateTime))); +SELECT or(CAST(1 AS Int64),CAST(NULL AS Nullable(DateTime))); + +SELECT positionCaseInsensitiveUTF8('',CAST('\0' AS Nullable(String))); +SELECT coalesce(CAST('\0' AS Nullable(String)),''); +SELECT less(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT and(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT visitParamExtractBool('',CAST('\0' AS Nullable(String))); +SELECT notEquals(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT plus(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT positionUTF8('',CAST('\0' AS Nullable(String))); +SELECT bitRotateRight(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT toFixedString('',CAST(9223372036854775807 as Int64)); +SELECT arrayElement([CAST( 0 AS Int8)],CAST( 0 AS Nullable(Int8))); +SELECT position('',CAST('\0' AS Nullable(String))); +SELECT equals(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT bitTest(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT bitOr(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT least(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT bitRotateLeft(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT bitShiftLeft(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT bitTestAny(CAST(1 AS UInt8),CAST( 0 AS Nullable(UInt8))); +SELECT lessOrEquals(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT multiply(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT positionCaseInsensitive('',CAST('\0' AS Nullable(String))); +SELECT bitAnd(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT bitTestAll(CAST(1 AS UInt8),CAST( 0 AS Nullable(UInt8))); +SELECT divide(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT bitXor(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT modulo(CAST( 0 AS Nullable(Int8)),CAST(1 AS Int8)); +SELECT minus(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT intDiv(CAST( 0 AS Nullable(Int8)),CAST(1 AS Int8)); +SELECT visitParamExtractUInt('',CAST('\0' AS Nullable(String))); +SELECT visitParamExtractInt('',CAST('\0' AS Nullable(String))); +SELECT intDivOrZero(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT greatest(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT greater(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT ifNull(CAST('\0' AS Nullable(String)),''); +SELECT bitShiftRight(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT farmHash64(CAST( 0 AS Nullable(Int8))); +SELECT arrayReduce(sumState(0),CAST(1 AS Int8)); +SELECT xor(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT metroHash64(CAST( 0 AS Nullable(Int8))); +SELECT runningDifference(CAST( 0 AS Nullable(Int8))); +SELECT greaterOrEquals(CAST(1 AS Int8),CAST( 0 AS Nullable(Int8))); +SELECT cityHash64(CAST( 0 AS Nullable(Int8))); +SELECT topK(arrayPopBack([CAST('\0' AS Nullable(FixedString(1)))])); +SELECT topKArray([ [ [1], [2] ], [ [3], [4]] ]); +SELECT uniqUpToArray([CAST( 0 AS Int8)],arrayPopBack([CAST( 0 AS Int8)])); +SELECT uniqCombinedArray([CAST( 0 AS Int8)],arrayPopBack([CAST( 0 AS Int8)])); +SELECT uniqCombinedBiasCorrectedArray([CAST( 0 AS Int8)],arrayPopBack([CAST( 0 AS Int8)])); +SELECT uniqCombinedLinearCountingArray([CAST( 0 AS Int8)],arrayPopBack([CAST( 0 AS Int8)])); +SELECT uniqExactArray([CAST( 0 AS Int8)],arrayPopBack([CAST( 0 AS Int8)])); +SELECT COVAR_POPArray([CAST( 0 AS Int8)],arrayPopBack([CAST( 0 AS Int8)])); +SELECT COVAR_SAMPArray([CAST( 0 AS Int8)],arrayPopBack([CAST( 0 AS Int8)])); +SELECT medianTimingWeightedArray([CAST( 0 AS Int8)],arrayPopBack([CAST( 0 AS Int8)])); +SELECT quantilesDeterministicArray([CAST( 0 AS Int8)],arrayPopBack([CAST( 0 AS Int32)])); diff --git a/dbms/tests/queries/0_stateless/00531_functions_bad_arguments.reference b/dbms/tests/queries/0_stateless/00534_filimonov.reference similarity index 100% rename from dbms/tests/queries/0_stateless/00531_functions_bad_arguments.reference rename to dbms/tests/queries/0_stateless/00534_filimonov.reference diff --git a/dbms/tests/queries/0_stateless/00534_filimonov.sh b/dbms/tests/queries/0_stateless/00534_filimonov.sh new file mode 100755 index 00000000000..df21929d36b --- /dev/null +++ b/dbms/tests/queries/0_stateless/00534_filimonov.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +. $CURDIR/../shell_config.sh + +# Server should not crash on any function trash calls + +cat $CURDIR/00531_filimonov.data | $CLICKHOUSE_CLIENT -n --ignore-error >/dev/null 2>&1 + +$CLICKHOUSE_CLIENT -q "SELECT 'Still alive'" diff --git a/dbms/tests/queries/0_stateless/00534_functions_bad_arguments.reference b/dbms/tests/queries/0_stateless/00534_functions_bad_arguments.reference new file mode 100644 index 00000000000..7193c3d3f3d --- /dev/null +++ b/dbms/tests/queries/0_stateless/00534_functions_bad_arguments.reference @@ -0,0 +1 @@ +Still alive diff --git a/dbms/tests/queries/0_stateless/00531_functions_bad_arguments.sh b/dbms/tests/queries/0_stateless/00534_functions_bad_arguments.sh similarity index 100% rename from dbms/tests/queries/0_stateless/00531_functions_bad_arguments.sh rename to dbms/tests/queries/0_stateless/00534_functions_bad_arguments.sh