Fixed tests

This commit is contained in:
Maksim Kita 2023-02-17 16:50:46 +01:00
parent 11965e59e2
commit 6c1436f78e
5 changed files with 15 additions and 4 deletions

View File

@ -165,7 +165,13 @@ private:
REGISTER_FUNCTION(Nested) REGISTER_FUNCTION(Nested)
{ {
factory.registerFunction<FunctionNested>(); factory.registerFunction<FunctionNested>({
R"(
Returns the array of tuples from multiple arrays.
)",
Documentation::Examples{{"nested", "SELECT nested(['keys', 'values'], ['key_1', 'key_2'], ['value_1','value_2'])"}},
Documentation::Categories{"OtherFunctions"}
});
} }
} }

View File

@ -78,6 +78,7 @@ SelectQueryDescription buildSelectQueryDescription(const ASTPtr & select_query,
{ {
ASTPtr inner_query = select_query; ASTPtr inner_query = select_query;
std::optional<StorageID> dependent_table_storage_id; std::optional<StorageID> dependent_table_storage_id;
bool allow_experimental_analyzer = context->getSettingsRef().allow_experimental_analyzer;
while (true) while (true)
{ {
@ -100,7 +101,7 @@ SelectQueryDescription buildSelectQueryDescription(const ASTPtr & select_query,
if (auto db_and_table = getDatabaseAndTable(*inner_select_query, 0)) if (auto db_and_table = getDatabaseAndTable(*inner_select_query, 0))
{ {
const auto * table_expression = getTableExpression(*inner_select_query, 0); const auto * table_expression = getTableExpression(*inner_select_query, 0);
if (table_expression->database_and_table_name->tryGetAlias().empty()) if (allow_experimental_analyzer && table_expression->database_and_table_name->tryGetAlias().empty())
table_expression->database_and_table_name->setAlias("__dependent_table"); table_expression->database_and_table_name->setAlias("__dependent_table");
String select_database_name = db_and_table->database; String select_database_name = db_and_table->database;

View File

@ -1,3 +1,5 @@
SET allow_experimental_analyzer = 1;
with pow(2,2) as four select pow(four, 2), 2 as two, pow(two, 2); with pow(2,2) as four select pow(four, 2), 2 as two, pow(two, 2);
select `pow(four, 2)`, `pow(two, 2)` from (with pow(2,2) as four select pow(four, 2), 2 as two, pow(two, 2)); select `pow(four, 2)`, `pow(two, 2)` from (with pow(2,2) as four select pow(four, 2), 2 as two, pow(two, 2));
with (select pow(two,2)) as four select pow(four, 2), 2 as two, pow(two, 2); with (select pow(two,2)) as four select pow(four, 2), 2 as two, pow(two, 2);

View File

@ -1,10 +1,12 @@
SET allow_experimental_analyzer = 1;
SELECT groupArray(2 + 3)(number) FROM numbers(10); SELECT groupArray(2 + 3)(number) FROM numbers(10);
SELECT groupArray('5'::UInt8)(number) FROM numbers(10); SELECT groupArray('5'::UInt8)(number) FROM numbers(10);
SELECT groupArray(NULL)(number) FROM numbers(10); -- { serverError 36 } SELECT groupArray(NULL)(number) FROM numbers(10); -- { serverError 36 }
SELECT groupArray(NULL + NULL)(number) FROM numbers(10); -- { serverError 36 } SELECT groupArray(NULL + NULL)(number) FROM numbers(10); -- { serverError 36 }
SELECT groupArray([])(number) FROM numbers(10); -- { serverError 36 } SELECT groupArray([])(number) FROM numbers(10); -- { serverError 36 }
SELECT groupArray(throwIf(1))(number) FROM numbers(10); -- { serverError 134 } SELECT groupArray(throwIf(1))(number) FROM numbers(10); -- { serverError 36 }
-- Not the best error message, can be improved. -- Not the best error message, can be improved.
SELECT groupArray(number)(number) FROM numbers(10); -- { serverError 36 } SELECT groupArray(number)(number) FROM numbers(10); -- { serverError 36 }

View File

@ -17,7 +17,7 @@ EXCEPTION_BEFORE_START_QUERY="WITH
FROM system.numbers FROM system.numbers
WHERE number IN (sub) WHERE number IN (sub)
) )
SETTINGS enable_global_with_statement = 0" SETTINGS enable_global_with_statement = 0, allow_experimental_analyzer = 1"
# For this query the system.query_log needs to show ExceptionBeforeStart and elapsed seconds <= 1.0 # For this query the system.query_log needs to show ExceptionBeforeStart and elapsed seconds <= 1.0