mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 00:52:02 +00:00
Fixing incompatibilities [#METR-2944].
This commit is contained in:
parent
130ec8b58b
commit
dc665c67c5
@ -494,8 +494,6 @@ NamesAndTypesList::iterator ExpressionAnalyzer::findColumn(const String & name,
|
||||
/// Например, при ignore_levels=1 ast не может быть занесен в словарь, но его дети могут.
|
||||
void ExpressionAnalyzer::addASTAliases(ASTPtr & ast, int ignore_levels)
|
||||
{
|
||||
ASTSelectQuery * select = typeid_cast<ASTSelectQuery *>(ast.get());
|
||||
|
||||
/// Обход снизу-вверх. Не опускаемся в подзапросы.
|
||||
for (auto & child : ast->children)
|
||||
{
|
||||
@ -503,10 +501,12 @@ void ExpressionAnalyzer::addASTAliases(ASTPtr & ast, int ignore_levels)
|
||||
|
||||
/// Алиасы верхнего уровня в секции ARRAY JOIN имеют особый смысл, их добавлять не будем
|
||||
/// (пропустим сам expression list и его детей).
|
||||
if (select && child == select->array_join_expression_list())
|
||||
new_ignore_levels = 2;
|
||||
if (typeid_cast<ASTArrayJoin *>(ast.get()))
|
||||
new_ignore_levels = 3;
|
||||
|
||||
if (!typeid_cast<ASTSelectQuery *>(child.get()))
|
||||
/// Don't descent into UNION ALL, table functions and subqueries.
|
||||
if (!typeid_cast<ASTTableExpression *>(child.get())
|
||||
&& !typeid_cast<ASTSelectQuery *>(child.get()))
|
||||
addASTAliases(child, new_ignore_levels);
|
||||
}
|
||||
|
||||
@ -531,7 +531,9 @@ StoragePtr ExpressionAnalyzer::getTable()
|
||||
auto select_database = select->database();
|
||||
auto select_table = select->table();
|
||||
|
||||
if (select_table && !typeid_cast<const ASTSelectQuery *>(select_table.get()) && !typeid_cast<const ASTFunction *>(select_table.get()))
|
||||
if (select_table
|
||||
&& !typeid_cast<const ASTSelectQuery *>(select_table.get())
|
||||
&& !typeid_cast<const ASTFunction *>(select_table.get()))
|
||||
{
|
||||
String database = select_database
|
||||
? typeid_cast<const ASTIdentifier &>(*select_database).name
|
||||
@ -661,10 +663,13 @@ void ExpressionAnalyzer::normalizeTreeImpl(
|
||||
{
|
||||
if (node->table_expression)
|
||||
{
|
||||
if (ASTIdentifier * right = typeid_cast<ASTIdentifier *>(
|
||||
static_cast<ASTTableExpression &>(*node->table_expression).database_and_table_name.get()))
|
||||
auto & database_and_table_name = static_cast<ASTTableExpression &>(*node->table_expression).database_and_table_name;
|
||||
if (database_and_table_name)
|
||||
{
|
||||
right->kind = ASTIdentifier::Table;
|
||||
if (ASTIdentifier * right = typeid_cast<ASTIdentifier *>(database_and_table_name.get()))
|
||||
{
|
||||
right->kind = ASTIdentifier::Table;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -774,7 +779,7 @@ void ExpressionAnalyzer::executeScalarSubqueries()
|
||||
for (auto & child : ast->children)
|
||||
{
|
||||
/// Не опускаемся в FROM, JOIN, UNION.
|
||||
if (typeid_cast<const ASTTablesInSelectQuery *>(child.get())
|
||||
if (!typeid_cast<const ASTTablesInSelectQuery *>(child.get())
|
||||
&& child.get() != select_query->next_union_all.get())
|
||||
{
|
||||
executeScalarSubqueriesImpl(child);
|
||||
@ -879,27 +884,34 @@ void ExpressionAnalyzer::executeScalarSubqueriesImpl(ASTPtr & ast)
|
||||
}
|
||||
else
|
||||
{
|
||||
/** Не опускаемся в подзапросы в аргументах IN.
|
||||
* Но если аргумент - не подзапрос, то глубже внутри него могут быть подзапросы, и в них надо опускаться.
|
||||
/** Don't descend into subqueries in FROM section.
|
||||
*/
|
||||
ASTFunction * func = typeid_cast<ASTFunction *>(ast.get());
|
||||
ASTTablesInSelectQuery * tables = typeid_cast<ASTTablesInSelectQuery *>(ast.get());
|
||||
|
||||
if (func && func->kind == ASTFunction::FUNCTION
|
||||
&& functionIsInOrGlobalInOperator(func->name))
|
||||
if (!tables)
|
||||
{
|
||||
for (auto & child : ast->children)
|
||||
/** Don't descend into subqueries in arguments of IN operator.
|
||||
* But if an argument is not subquery, than deeper may be scalar subqueries and we need to descend in them.
|
||||
*/
|
||||
ASTFunction * func = typeid_cast<ASTFunction *>(ast.get());
|
||||
|
||||
if (func && func->kind == ASTFunction::FUNCTION
|
||||
&& functionIsInOrGlobalInOperator(func->name))
|
||||
{
|
||||
if (child != func->arguments)
|
||||
executeScalarSubqueriesImpl(child);
|
||||
else
|
||||
for (size_t i = 0, size = func->arguments->children.size(); i < size; ++i)
|
||||
if (i != 1 || !typeid_cast<ASTSubquery *>(func->arguments->children[i].get()))
|
||||
executeScalarSubqueriesImpl(func->arguments->children[i]);
|
||||
for (auto & child : ast->children)
|
||||
{
|
||||
if (child != func->arguments)
|
||||
executeScalarSubqueriesImpl(child);
|
||||
else
|
||||
for (size_t i = 0, size = func->arguments->children.size(); i < size; ++i)
|
||||
if (i != 1 || !typeid_cast<ASTSubquery *>(func->arguments->children[i].get()))
|
||||
executeScalarSubqueriesImpl(func->arguments->children[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
for (auto & child : ast->children)
|
||||
executeScalarSubqueriesImpl(child);
|
||||
}
|
||||
else
|
||||
for (auto & child : ast->children)
|
||||
executeScalarSubqueriesImpl(child);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1507,22 +1519,13 @@ void ExpressionAnalyzer::getArrayJoinedColumns()
|
||||
throw Exception("No alias for non-trivial value in ARRAY JOIN: " + nested_table_name, ErrorCodes::ALIAS_REQUIRED);
|
||||
|
||||
if (array_join_alias_to_name.count(nested_table_alias) || aliases.count(nested_table_alias))
|
||||
throw Exception("Duplicate alias " + nested_table_alias, ErrorCodes::MULTIPLE_EXPRESSIONS_FOR_ALIAS);
|
||||
throw Exception("Duplicate alias in ARRAY JOIN: " + nested_table_alias, ErrorCodes::MULTIPLE_EXPRESSIONS_FOR_ALIAS);
|
||||
|
||||
array_join_alias_to_name[nested_table_alias] = nested_table_name;
|
||||
array_join_name_to_alias[nested_table_name] = nested_table_alias;
|
||||
}
|
||||
|
||||
ASTs & query_asts = select_query->children;
|
||||
for (const auto & ast : query_asts)
|
||||
{
|
||||
/// Не опускаемся в подзапросы и UNION.
|
||||
if (typeid_cast<const ASTSelectQuery *>(ast.get()))
|
||||
continue;
|
||||
|
||||
if (ast != select_query->array_join_expression_list())
|
||||
getArrayJoinedColumnsImpl(ast);
|
||||
}
|
||||
getArrayJoinedColumnsImpl(ast);
|
||||
|
||||
/// Если результат ARRAY JOIN не используется, придется все равно по-ARRAY-JOIN-ить какой-нибудь столбец,
|
||||
/// чтобы получить правильное количество строк.
|
||||
@ -1562,6 +1565,9 @@ void ExpressionAnalyzer::getArrayJoinedColumns()
|
||||
/// Заполняет array_join_result_to_source: по каким столбцам-массивам размножить, и как их после этого назвать.
|
||||
void ExpressionAnalyzer::getArrayJoinedColumnsImpl(ASTPtr ast)
|
||||
{
|
||||
if (typeid_cast<ASTTablesInSelectQuery *>(ast.get()))
|
||||
return;
|
||||
|
||||
if (ASTIdentifier * node = typeid_cast<ASTIdentifier *>(ast.get()))
|
||||
{
|
||||
if (node->kind == ASTIdentifier::Column)
|
||||
@ -1595,7 +1601,7 @@ void ExpressionAnalyzer::getArrayJoinedColumnsImpl(ASTPtr ast)
|
||||
else
|
||||
{
|
||||
for (auto & child : ast->children)
|
||||
if (!typeid_cast<const ASTSelectQuery *>(child.get()))
|
||||
if (!typeid_cast<const ASTSubquery *>(child.get()))
|
||||
getArrayJoinedColumnsImpl(child);
|
||||
}
|
||||
}
|
||||
@ -1930,7 +1936,7 @@ void ExpressionAnalyzer::getAggregates(const ASTPtr & ast, ExpressionActionsPtr
|
||||
else
|
||||
{
|
||||
for (const auto & child : ast->children)
|
||||
if (!typeid_cast<const ASTSubquery *>(child.get()) && !typeid_cast<const ASTSelectQuery *>(child.get()))
|
||||
if (!typeid_cast<const ASTSubquery *>(child.get()))
|
||||
getAggregates(child, actions);
|
||||
}
|
||||
}
|
||||
@ -1945,7 +1951,7 @@ void ExpressionAnalyzer::assertNoAggregates(const ASTPtr & ast, const char * des
|
||||
+ " is found " + String(description) + " in query", ErrorCodes::ILLEGAL_AGGREGATION);
|
||||
|
||||
for (const auto & child : ast->children)
|
||||
if (!typeid_cast<const ASTSubquery *>(child.get()) && !typeid_cast<const ASTSelectQuery *>(child.get()))
|
||||
if (!typeid_cast<const ASTSubquery *>(child.get()))
|
||||
assertNoAggregates(child, description);
|
||||
}
|
||||
|
||||
@ -1971,13 +1977,13 @@ void ExpressionAnalyzer::initChain(ExpressionActionsChain & chain, const NamesAn
|
||||
}
|
||||
}
|
||||
|
||||
/// "Большой" ARRAY JOIN.
|
||||
/// "Big" ARRAY JOIN.
|
||||
void ExpressionAnalyzer::addMultipleArrayJoinAction(ExpressionActionsPtr & actions) const
|
||||
{
|
||||
NameSet result_columns;
|
||||
for (const auto & result_source : array_join_result_to_source)
|
||||
{
|
||||
/// Дать столбцам новые имена, если надо.
|
||||
/// Assign new names to columns, if needed.
|
||||
if (result_source.first != result_source.second)
|
||||
actions->add(ExpressionAction::copyColumn(result_source.second, result_source.first));
|
||||
|
||||
@ -2033,7 +2039,7 @@ bool ExpressionAnalyzer::appendJoin(ExpressionActionsChain & chain, bool only_ty
|
||||
getRootActions(join_params.using_expression_list, only_types, false, step.actions);
|
||||
|
||||
/// Не поддерживается два JOIN-а с одинаковым подзапросом, но разными USING-ами.
|
||||
String join_id = join_element.getColumnName();
|
||||
String join_id = join_element.getTreeID();
|
||||
|
||||
SubqueryForSet & subquery_for_set = subqueries_for_sets[join_id];
|
||||
|
||||
@ -2487,6 +2493,7 @@ void ExpressionAnalyzer::collectJoinedColumns(NameSet & joined_columns, NamesAnd
|
||||
std::cerr << std::endl;*/
|
||||
}
|
||||
|
||||
|
||||
Names ExpressionAnalyzer::getRequiredColumns()
|
||||
{
|
||||
if (!unknown_required_columns.empty())
|
||||
@ -2499,6 +2506,7 @@ Names ExpressionAnalyzer::getRequiredColumns()
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
void ExpressionAnalyzer::getRequiredColumnsImpl(ASTPtr ast,
|
||||
NameSet & required_columns, NameSet & ignored_names,
|
||||
const NameSet & available_joined_columns, NameSet & required_joined_columns)
|
||||
@ -2571,16 +2579,14 @@ void ExpressionAnalyzer::getRequiredColumnsImpl(ASTPtr ast,
|
||||
return;
|
||||
}
|
||||
|
||||
ASTSelectQuery * select = typeid_cast<ASTSelectQuery *>(ast.get());
|
||||
|
||||
/// Рекурсивный обход выражения.
|
||||
for (auto & child : ast->children)
|
||||
{
|
||||
/** Не пойдем в секцию ARRAY JOIN, потому что там нужно смотреть на имена не-ARRAY-JOIN-енных столбцов.
|
||||
* Туда collectUsedColumns отправит нас отдельно.
|
||||
*/
|
||||
if (!typeid_cast<ASTSubquery *>(child.get()) && !typeid_cast<ASTSelectQuery *>(child.get()) &&
|
||||
!(select && child == select->array_join_expression_list()))
|
||||
if (!typeid_cast<ASTSelectQuery *>(child.get())
|
||||
&& !typeid_cast<ASTArrayJoin *>(child.get()))
|
||||
getRequiredColumnsImpl(child, required_columns, ignored_names, available_joined_columns, required_joined_columns);
|
||||
}
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ static const ASTTablesInSelectQueryElement * getFirstTableJoin(const ASTSelectQu
|
||||
ASTPtr ASTSelectQuery::database() const
|
||||
{
|
||||
const ASTTableExpression * table_expression = getFirstTableExpression(*this);
|
||||
if (!table_expression || !table_expression->database_and_table_name)
|
||||
if (!table_expression || !table_expression->database_and_table_name || table_expression->database_and_table_name->children.empty())
|
||||
return {};
|
||||
|
||||
if (table_expression->database_and_table_name->children.size() != 2)
|
||||
@ -532,26 +532,41 @@ void ASTSelectQuery::setDatabaseIfNeeded(const String & database_name)
|
||||
{
|
||||
throw Exception("Logical error: more than two components in table expression", ErrorCodes::LOGICAL_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
table_expression->database_and_table_name->children[0] = std::make_shared<ASTIdentifier>(
|
||||
StringRange(), database_name, ASTIdentifier::Database);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ASTSelectQuery::replaceDatabaseAndTable(const String & database_name, const String & table_name)
|
||||
{
|
||||
ASTTableExpression * table_expression = getFirstTableExpression(*this);
|
||||
if (!table_expression)
|
||||
return;
|
||||
|
||||
ASTPtr database = std::make_shared<ASTIdentifier>(StringRange(), database_name, ASTIdentifier::Database);
|
||||
if (!table_expression)
|
||||
{
|
||||
auto tables_list = std::make_shared<ASTTablesInSelectQuery>();
|
||||
auto element = std::make_shared<ASTTablesInSelectQueryElement>();
|
||||
auto table_expr = std::make_shared<ASTTableExpression>();
|
||||
element->table_expression = table_expr;
|
||||
element->children.emplace_back(table_expr);
|
||||
tables_list->children.emplace_back(element);
|
||||
tables = tables_list;
|
||||
children.emplace_back(tables_list);
|
||||
table_expression = table_expr.get();
|
||||
}
|
||||
|
||||
ASTPtr table = std::make_shared<ASTIdentifier>(StringRange(), table_name, ASTIdentifier::Table);
|
||||
|
||||
table_expression->database_and_table_name = std::make_shared<ASTIdentifier>(
|
||||
StringRange(), database_name + "." + table_name, ASTIdentifier::Table);
|
||||
table_expression->database_and_table_name->children = {database, table};
|
||||
if (!database_name.empty())
|
||||
{
|
||||
ASTPtr database = std::make_shared<ASTIdentifier>(StringRange(), database_name, ASTIdentifier::Database);
|
||||
|
||||
table_expression->database_and_table_name = std::make_shared<ASTIdentifier>(
|
||||
StringRange(), database_name + "." + table_name, ASTIdentifier::Table);
|
||||
table_expression->database_and_table_name->children = {database, table};
|
||||
}
|
||||
else
|
||||
{
|
||||
table_expression->database_and_table_name = std::make_shared<ASTIdentifier>(
|
||||
StringRange(), table_name, ASTIdentifier::Table);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -25,10 +25,12 @@ bool ParserTableExpression::parseImpl(Pos & pos, Pos end, ASTPtr & node, Pos & m
|
||||
|
||||
ws.ignore(pos, end);
|
||||
|
||||
if (ParserSubquery().parse(pos, end, res->subquery, max_parsed_pos, expected))
|
||||
if (ParserWithOptionalAlias(std::make_unique<ParserSubquery>(), true)
|
||||
.parse(pos, end, res->subquery, max_parsed_pos, expected))
|
||||
{
|
||||
}
|
||||
else if (ParserFunction().parse(pos, end, res->table_function, max_parsed_pos, expected))
|
||||
else if (ParserWithOptionalAlias(std::make_unique<ParserFunction>(), true)
|
||||
.parse(pos, end, res->table_function, max_parsed_pos, expected))
|
||||
{
|
||||
static_cast<ASTFunction &>(*res->table_function).kind = ASTFunction::TABLE_FUNCTION;
|
||||
}
|
||||
@ -205,6 +207,15 @@ bool ParserTablesInSelectQueryElement::parseImpl(Pos & pos, Pos end, ASTPtr & no
|
||||
|
||||
ws.ignore(pos, end);
|
||||
|
||||
/// Optional OUTER keyword for outer joins.
|
||||
if (table_join->kind == ASTTableJoin::Kind::Left
|
||||
|| table_join->kind == ASTTableJoin::Kind::Right
|
||||
|| table_join->kind == ASTTableJoin::Kind::Full)
|
||||
{
|
||||
ParserString("OUTER", true, true).ignore(pos, end)
|
||||
&& ws.ignore(pos, end);
|
||||
}
|
||||
|
||||
if (!ParserString("JOIN", true, true).ignore(pos, end, max_parsed_pos, expected))
|
||||
return false;
|
||||
|
||||
|
@ -6,25 +6,25 @@ select abs(1.0) = 1.0;
|
||||
select abs(-1.0) = 1.0;
|
||||
select abs(-128) = 128;
|
||||
select abs(127) = 127;
|
||||
select sum(abs(number - 10 as x) = (x < 0 ? -x : x)) / count() array join range(1000000) as number;
|
||||
select sum(abs(number - 10 as x) = (x < 0 ? -x : x)) / count() from array join range(1000000) as number;
|
||||
|
||||
select sqrt(0) = 0;
|
||||
select sqrt(1) = 1;
|
||||
select sqrt(4) = 2;
|
||||
select sum(sqrt(x * x) = x) / count() array join range(1000000) as x;
|
||||
select sum(sqrt(x * x) = x) / count() from array join range(1000000) as x;
|
||||
|
||||
select cbrt(0) = 0;
|
||||
select cbrt(1) = 1;
|
||||
select cbrt(8) = 2;
|
||||
select sum(abs(cbrt(x * x * x) - x) < 1.0e-9) / count() array join range(1000000) as x;
|
||||
select sum(abs(cbrt(x * x * x) - x) < 1.0e-9) / count() from array join range(1000000) as x;
|
||||
|
||||
select pow(1, 0) = 1;
|
||||
select pow(2, 0) = 1;
|
||||
select sum(pow(x, 0) = 1) / count() array join range(1000000) as x;
|
||||
select sum(pow(x, 0) = 1) / count() from array join range(1000000) as x;
|
||||
select pow(1, 1) = 1;
|
||||
select pow(2, 1) = 2;
|
||||
select sum(abs(pow(x, 1) - x) < 1.0e-9) / count() array join range(1000000) as x;
|
||||
select sum(pow(x, 2) = x * x) / count() array join range(10000) as x;
|
||||
select sum(abs(pow(x, 1) - x) < 1.0e-9) / count() from array join range(1000000) as x;
|
||||
select sum(pow(x, 2) = x * x) / count() from array join range(10000) as x;
|
||||
|
||||
select tgamma(0) = inf;
|
||||
select tgamma(1) = 1;
|
||||
@ -32,7 +32,7 @@ select tgamma(2) = 1;
|
||||
select tgamma(3) = 2;
|
||||
select tgamma(4) = 6;
|
||||
|
||||
select sum(abs(lgamma(x + 1) - log(tgamma(x + 1))) < 1.0e-9) / count() array join range(10) as x;
|
||||
select sum(abs(lgamma(x + 1) - log(tgamma(x + 1))) < 1.0e-9) / count() from array join range(10) as x;
|
||||
|
||||
select abs(e() - arraySum(arrayMap(x -> 1 / tgamma(x + 1), range(13)))) < 1.0e-9;
|
||||
|
||||
@ -41,35 +41,35 @@ select log(1) = 0;
|
||||
select log(e()) = 1;
|
||||
select log(exp(1)) = 1;
|
||||
select log(exp(2)) = 2;
|
||||
select sum(abs(log(exp(x)) - x) < 1.0e-9) / count() array join range(100) as x;
|
||||
select sum(abs(log(exp(x)) - x) < 1.0e-9) / count() from array join range(100) as x;
|
||||
|
||||
select exp2(-1) = 1/2;
|
||||
select exp2(0) = 1;
|
||||
select exp2(1) = 2;
|
||||
select exp2(2) = 4;
|
||||
select exp2(3) = 8;
|
||||
select sum(exp2(x) = pow(2, x)) / count() array join range(1000) as x;
|
||||
select sum(exp2(x) = pow(2, x)) / count() from array join range(1000) as x;
|
||||
|
||||
select log2(0) = -inf;
|
||||
select log2(1) = 0;
|
||||
select log2(2) = 1;
|
||||
select log2(4) = 2;
|
||||
select sum(abs(log2(exp2(x)) - x) < 1.0e-9) / count() array join range(1000) as x;
|
||||
select sum(abs(log2(exp2(x)) - x) < 1.0e-9) / count() from array join range(1000) as x;
|
||||
|
||||
select sin(0) = 0;
|
||||
select sin(pi() / 4) = 1 / sqrt(2);
|
||||
select sin(pi() / 2) = 1;
|
||||
select sin(3 * pi() / 2) = -1;
|
||||
select sum(sin(pi() / 2 + 2 * pi() * x) = 1) / count() array join range(1000000) as x;
|
||||
select sum(sin(pi() / 2 + 2 * pi() * x) = 1) / count() from array join range(1000000) as x;
|
||||
|
||||
select cos(0) = 1;
|
||||
select abs(cos(pi() / 4) - 1 / sqrt(2)) < 1.0e-9;
|
||||
select cos(pi() / 2) < 1.0e-9;
|
||||
select sum(abs(cos(2 * pi() * x)) - 1 < 1.0e-9) / count() array join range(1000000) as x;
|
||||
select sum(abs(cos(2 * pi() * x)) - 1 < 1.0e-9) / count() from array join range(1000000) as x;
|
||||
|
||||
select tan(0) = 0;
|
||||
select abs(tan(pi() / 4) - 1) < 1.0e-9;
|
||||
select sum(abs(tan(pi() / 4 + 2 * pi() * x) - 1) < 1.0e-8) / count() array join range(1000000) as x;
|
||||
select sum(abs(tan(pi() / 4 + 2 * pi() * x) - 1) < 1.0e-8) / count() from array join range(1000000) as x;
|
||||
|
||||
select asin(0) = 0;
|
||||
select asin(1) = pi() / 2;
|
||||
|
@ -1,6 +1,8 @@
|
||||
SELECT
|
||||
1 AS DomainID,
|
||||
Domain ANY LEFT JOIN
|
||||
Domain
|
||||
FROM system.one
|
||||
ANY LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
1 AS DomainID,
|
||||
|
@ -1,4 +1,4 @@
|
||||
select IPv4NumToStringClassC(toUInt32(0)) = '0.0.0.xxx';
|
||||
select IPv4NumToStringClassC(0x7f000001) = '127.0.0.xxx';
|
||||
select sum(IPv4NumToStringClassC(materialize(toUInt32(0))) = '0.0.0.xxx') = count() array join range(1024) as n;
|
||||
select sum(IPv4NumToStringClassC(materialize(0x7f000001)) = '127.0.0.xxx') = count() array join range(1024) as n;
|
||||
select sum(IPv4NumToStringClassC(materialize(toUInt32(0))) = '0.0.0.xxx') = count() from array join range(1024) as n;
|
||||
select sum(IPv4NumToStringClassC(materialize(0x7f000001)) = '127.0.0.xxx') = count() from array join range(1024) as n;
|
||||
|
@ -1,2 +1,2 @@
|
||||
SELECT value ANY LEFT JOIN (SELECT dummy, dummy AS value) USING dummy GROUP BY value;
|
||||
SELECT value FROM system.one ANY LEFT JOIN (SELECT dummy, dummy AS value) USING dummy GROUP BY value;
|
||||
SELECT value1, value2, sum(number) FROM (SELECT number, intHash64(number) AS value1 FROM system.numbers LIMIT 10) ANY LEFT JOIN (SELECT number, intHash32(number) AS value2 FROM system.numbers LIMIT 10) USING number GROUP BY value1, value2;
|
||||
|
@ -1 +1 @@
|
||||
SELECT 1 AS k ANY LEFT JOIN (SELECT k FROM (SELECT 1 AS k, 2 AS x)) USING k;
|
||||
SELECT 1 AS k FROM system.one ANY LEFT JOIN (SELECT k FROM (SELECT 1 AS k, 2 AS x)) USING k;
|
||||
|
@ -10,8 +10,8 @@ select URLHash('' as url, 1000) = URLHash(url);
|
||||
select URLHash('http://ya.ru/a' as url, 0 as level) = URLHash(URLHierarchy(url)[level + 1]);
|
||||
select URLHash('http://ya.ru/a' as url, 1 as level) = URLHash(URLHierarchy(url)[level + 1]);
|
||||
|
||||
select URLHash(url, 0 as level) = URLHash(URLHierarchy(url)[level + 1]) array join ['', 'http://ya.ru', 'http://ya.ru/', 'http://ya.ru/a', 'http://ya.ru/a/', 'http://ya.ru/a/b', 'http://ya.ru/a/b?'] as url;
|
||||
select URLHash(url, 1 as level) = URLHash(URLHierarchy(url)[level + 1]) array join ['', 'http://ya.ru', 'http://ya.ru/', 'http://ya.ru/a', 'http://ya.ru/a/', 'http://ya.ru/a/b', 'http://ya.ru/a/b?'] as url;
|
||||
select URLHash(url, 2 as level) = URLHash(URLHierarchy(url)[level + 1]) array join ['', 'http://ya.ru', 'http://ya.ru/', 'http://ya.ru/a', 'http://ya.ru/a/', 'http://ya.ru/a/b', 'http://ya.ru/a/b?'] as url;
|
||||
select URLHash(url, 3 as level) = URLHash(URLHierarchy(url)[level + 1]) array join ['', 'http://ya.ru', 'http://ya.ru/', 'http://ya.ru/a', 'http://ya.ru/a/', 'http://ya.ru/a/b', 'http://ya.ru/a/b?'] as url;
|
||||
select URLHash(url, 4 as level) = URLHash(URLHierarchy(url)[level + 1]) array join ['', 'http://ya.ru', 'http://ya.ru/', 'http://ya.ru/a', 'http://ya.ru/a/', 'http://ya.ru/a/b', 'http://ya.ru/a/b?'] as url;
|
||||
select URLHash(url, 0 as level) = URLHash(URLHierarchy(url)[level + 1]) from array join ['', 'http://ya.ru', 'http://ya.ru/', 'http://ya.ru/a', 'http://ya.ru/a/', 'http://ya.ru/a/b', 'http://ya.ru/a/b?'] as url;
|
||||
select URLHash(url, 1 as level) = URLHash(URLHierarchy(url)[level + 1]) from array join ['', 'http://ya.ru', 'http://ya.ru/', 'http://ya.ru/a', 'http://ya.ru/a/', 'http://ya.ru/a/b', 'http://ya.ru/a/b?'] as url;
|
||||
select URLHash(url, 2 as level) = URLHash(URLHierarchy(url)[level + 1]) from array join ['', 'http://ya.ru', 'http://ya.ru/', 'http://ya.ru/a', 'http://ya.ru/a/', 'http://ya.ru/a/b', 'http://ya.ru/a/b?'] as url;
|
||||
select URLHash(url, 3 as level) = URLHash(URLHierarchy(url)[level + 1]) from array join ['', 'http://ya.ru', 'http://ya.ru/', 'http://ya.ru/a', 'http://ya.ru/a/', 'http://ya.ru/a/b', 'http://ya.ru/a/b?'] as url;
|
||||
select URLHash(url, 4 as level) = URLHash(URLHierarchy(url)[level + 1]) from array join ['', 'http://ya.ru', 'http://ya.ru/', 'http://ya.ru/a', 'http://ya.ru/a/', 'http://ya.ru/a/b', 'http://ya.ru/a/b?'] as url;
|
||||
|
@ -8,22 +8,22 @@ select upperUTF8('AAAAAAAAAAAAAAA012345789,.!AAAA' as str) = str;
|
||||
select upper('AaAaAaAaAaAaAaA012345789,.!aAaA') = 'AAAAAAAAAAAAAAA012345789,.!AAAA';
|
||||
select upperUTF8('AaAaAaAaAaAaAaA012345789,.!aAaA') = 'AAAAAAAAAAAAAAA012345789,.!AAAA';
|
||||
|
||||
select sum(lower(materialize('aaaaaaaaaaaaaaa012345789,.!aaaa') as str) = str) = count() array join range(16384) as n;
|
||||
select sum(lowerUTF8(materialize('aaaaaaaaaaaaaaa012345789,.!aaaa') as str) = str) = count() array join range(16384) as n;
|
||||
select sum(lower(materialize('AaAaAaAaAaAaAaA012345789,.!aAaA')) = materialize('aaaaaaaaaaaaaaa012345789,.!aaaa')) = count() array join range(16384) as n;
|
||||
select sum(lowerUTF8(materialize('AaAaAaAaAaAaAaA012345789,.!aAaA')) = materialize('aaaaaaaaaaaaaaa012345789,.!aaaa')) = count() array join range(16384) as n;
|
||||
select sum(lower(materialize('aaaaaaaaaaaaaaa012345789,.!aaaa') as str) = str) = count() from array join range(16384) as n;
|
||||
select sum(lowerUTF8(materialize('aaaaaaaaaaaaaaa012345789,.!aaaa') as str) = str) = count() from array join range(16384) as n;
|
||||
select sum(lower(materialize('AaAaAaAaAaAaAaA012345789,.!aAaA')) = materialize('aaaaaaaaaaaaaaa012345789,.!aaaa')) = count() from array join range(16384) as n;
|
||||
select sum(lowerUTF8(materialize('AaAaAaAaAaAaAaA012345789,.!aAaA')) = materialize('aaaaaaaaaaaaaaa012345789,.!aaaa')) = count() from array join range(16384) as n;
|
||||
|
||||
select sum(upper(materialize('AAAAAAAAAAAAAAA012345789,.!AAAA') as str) = str) = count() array join range(16384) as n;
|
||||
select sum(upperUTF8(materialize('AAAAAAAAAAAAAAA012345789,.!AAAA') as str) = str) = count() array join range(16384) as n;
|
||||
select sum(upper(materialize('AaAaAaAaAaAaAaA012345789,.!aAaA')) = materialize('AAAAAAAAAAAAAAA012345789,.!AAAA')) = count() array join range(16384) as n;
|
||||
select sum(upperUTF8(materialize('AaAaAaAaAaAaAaA012345789,.!aAaA')) = materialize('AAAAAAAAAAAAAAA012345789,.!AAAA')) = count() array join range(16384) as n;
|
||||
select sum(upper(materialize('AAAAAAAAAAAAAAA012345789,.!AAAA') as str) = str) = count() from array join range(16384) as n;
|
||||
select sum(upperUTF8(materialize('AAAAAAAAAAAAAAA012345789,.!AAAA') as str) = str) = count() from array join range(16384) as n;
|
||||
select sum(upper(materialize('AaAaAaAaAaAaAaA012345789,.!aAaA')) = materialize('AAAAAAAAAAAAAAA012345789,.!AAAA')) = count() from array join range(16384) as n;
|
||||
select sum(upperUTF8(materialize('AaAaAaAaAaAaAaA012345789,.!aAaA')) = materialize('AAAAAAAAAAAAAAA012345789,.!AAAA')) = count() from array join range(16384) as n;
|
||||
|
||||
select lower('aaaaАБВГAAAAaaAA') = 'aaaaАБВГaaaaaaaa';
|
||||
select upper('aaaaАБВГAAAAaaAA') = 'AAAAАБВГAAAAAAAA';
|
||||
select lowerUTF8('aaaaАБВГAAAAaaAA') = 'aaaaабвгaaaaaaaa';
|
||||
select upperUTF8('aaaaАБВГAAAAaaAA') = 'AAAAАБВГAAAAAAAA';
|
||||
|
||||
select sum(lower(materialize('aaaaАБВГAAAAaaAA')) = materialize('aaaaАБВГaaaaaaaa')) = count() array join range(16384) as n;
|
||||
select sum(upper(materialize('aaaaАБВГAAAAaaAA')) = materialize('AAAAАБВГAAAAAAAA')) = count() array join range(16384) as n;
|
||||
select sum(lowerUTF8(materialize('aaaaАБВГAAAAaaAA')) = materialize('aaaaабвгaaaaaaaa')) = count() array join range(16384) as n;
|
||||
select sum(upperUTF8(materialize('aaaaАБВГAAAAaaAA')) = materialize('AAAAАБВГAAAAAAAA')) = count() array join range(16384) as n;
|
||||
select sum(lower(materialize('aaaaАБВГAAAAaaAA')) = materialize('aaaaАБВГaaaaaaaa')) = count() from array join range(16384) as n;
|
||||
select sum(upper(materialize('aaaaАБВГAAAAaaAA')) = materialize('AAAAАБВГAAAAAAAA')) = count() from array join range(16384) as n;
|
||||
select sum(lowerUTF8(materialize('aaaaАБВГAAAAaaAA')) = materialize('aaaaабвгaaaaaaaa')) = count() from array join range(16384) as n;
|
||||
select sum(upperUTF8(materialize('aaaaАБВГAAAAaaAA')) = materialize('AAAAАБВГAAAAAAAA')) = count() from array join range(16384) as n;
|
||||
|
@ -1,11 +1,11 @@
|
||||
SELECT arrayFilter(x -> notEmpty(concat(x, 'hello')), ['']) ARRAY JOIN [0] AS elem, arrayMap(x -> concat(x, 'hello'), ['']) AS unused WHERE NOT ignore(elem);
|
||||
SELECT arrayFilter(x -> notEmpty(concat(x, 'hello')), ['']) FROM ARRAY JOIN [0] AS elem, arrayMap(x -> concat(x, 'hello'), ['']) AS unused WHERE NOT ignore(elem);
|
||||
SELECT '---';
|
||||
SELECT arrayFilter(x -> x = 'hello', ['']) ARRAY JOIN [0] AS elem WHERE NOT ignore(elem) AND arrayExists(x -> x = 'hello', ['']);
|
||||
SELECT arrayFilter(x -> x = 'hello', ['']) FROM ARRAY JOIN [0] AS elem WHERE NOT ignore(elem) AND arrayExists(x -> x = 'hello', ['']);
|
||||
SELECT '---';
|
||||
SELECT arrayJoin([0]), replicate('hello', [1]) WHERE NOT ignore(replicate('hello', [1]));
|
||||
SELECT '---';
|
||||
SELECT arrayJoin([0]), replicate('hello', emptyArrayString()) ARRAY JOIN emptyArrayString() AS unused WHERE NOT ignore(replicate('hello', emptyArrayString()));
|
||||
SELECT arrayJoin([0]), replicate('hello', emptyArrayString()) FROM ARRAY JOIN emptyArrayString() AS unused WHERE NOT ignore(replicate('hello', emptyArrayString()));
|
||||
SELECT '---';
|
||||
SELECT arrayJoin([0]), replicate('hello', emptyArrayString()) WHERE NOT ignore(replicate('hello', emptyArrayString()));
|
||||
SELECT '---';
|
||||
SELECT replicate('hello', emptyArrayString()) ARRAY JOIN emptyArrayString() AS unused WHERE NOT ignore(replicate('hello', emptyArrayString()));
|
||||
SELECT replicate('hello', emptyArrayString()) FROM ARRAY JOIN emptyArrayString() AS unused WHERE NOT ignore(replicate('hello', emptyArrayString()));
|
||||
|
Loading…
Reference in New Issue
Block a user