mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 19:42:00 +00:00
Compare commits
45 Commits
6f3d6a5f61
...
d1b313ef55
Author | SHA1 | Date | |
---|---|---|---|
|
d1b313ef55 | ||
|
50bc28faf8 | ||
|
fdc6b9a0a4 | ||
|
cae94c922f | ||
|
ac1791a6ab | ||
|
9350f5e5bf | ||
|
670d0bd2ba | ||
|
9664dc36b6 | ||
|
aa1c181731 | ||
|
397359166d | ||
|
44bcea0dd4 | ||
|
4882600e15 | ||
|
fdabd96648 | ||
|
9d7b5dee82 | ||
|
66e366f925 | ||
|
8f0caede41 | ||
|
df23b9c9d7 | ||
|
f5a4e4d07e | ||
|
e51bad5bc6 | ||
|
4bd5aea8ca | ||
|
35e999137a | ||
|
4343db4dc3 | ||
|
815a9dcb87 | ||
|
5bc7dea53c | ||
|
e5fce46532 | ||
|
85d5d07a12 | ||
|
ba3721bb10 | ||
|
afd8fb237b | ||
|
7ef96b0086 | ||
|
caad5369d4 | ||
|
cea3eb93d7 | ||
|
02fd176c0a | ||
|
9a5552b5e6 | ||
|
046f348fe7 | ||
|
e503b57bfc | ||
|
e23c9816a3 | ||
|
2a5687b4fd | ||
|
2cd16fe963 | ||
|
f68c74a683 | ||
|
5533cc5c4f | ||
|
63611faffc | ||
|
2962ad10da | ||
|
85e57700aa | ||
|
5cfbefb95b | ||
|
ce87ae57b3 |
@ -16,7 +16,11 @@ namespace ErrorCodes
|
||||
extern const int LOGICAL_ERROR;
|
||||
}
|
||||
|
||||
ColumnNode::ColumnNode(NameAndTypePair column_, QueryTreeNodePtr expression_node_, QueryTreeNodeWeakPtr column_source_)
|
||||
ColumnNode::ColumnNode(
|
||||
NameAndTypePair column_,
|
||||
QueryTreeNodePtr expression_node_,
|
||||
QueryTreeNodeWeakPtr column_source_
|
||||
)
|
||||
: IQueryTreeNode(children_size, weak_pointers_size)
|
||||
, column(std::move(column_))
|
||||
{
|
||||
@ -24,10 +28,12 @@ ColumnNode::ColumnNode(NameAndTypePair column_, QueryTreeNodePtr expression_node
|
||||
getSourceWeakPointer() = std::move(column_source_);
|
||||
}
|
||||
|
||||
ColumnNode::ColumnNode(NameAndTypePair column_, QueryTreeNodeWeakPtr column_source_)
|
||||
ColumnNode::ColumnNode(
|
||||
NameAndTypePair column_,
|
||||
QueryTreeNodeWeakPtr column_source_
|
||||
)
|
||||
: ColumnNode(std::move(column_), nullptr /*expression_node*/, std::move(column_source_))
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
QueryTreeNodePtr ColumnNode::getColumnSource() const
|
||||
{
|
||||
|
@ -92,11 +92,11 @@ public:
|
||||
|
||||
void dump(WriteBuffer & buffer) const
|
||||
{
|
||||
buffer << expressions.size() << '\n';
|
||||
buffer << "Expression resolve process stack size: " << expressions.size() << '\n';
|
||||
|
||||
for (const auto & expression : expressions)
|
||||
{
|
||||
buffer << "Expression ";
|
||||
buffer << " Expression ";
|
||||
buffer << expression->formatASTForErrorMessage();
|
||||
|
||||
const auto & alias = expression->getAlias();
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <IO/WriteHelpers.h>
|
||||
#include <IO/Operators.h>
|
||||
#include <IO/WriteBufferFromString.h>
|
||||
@ -110,24 +111,19 @@ inline const char * toString(IdentifierResolvePlace resolved_identifier_place)
|
||||
}
|
||||
}
|
||||
|
||||
struct IdentifierResolveScope;
|
||||
|
||||
struct IdentifierResolveResult
|
||||
{
|
||||
IdentifierResolveResult() = default;
|
||||
|
||||
QueryTreeNodePtr resolved_identifier;
|
||||
IdentifierResolveScope * scope = nullptr;
|
||||
IdentifierResolvePlace resolve_place = IdentifierResolvePlace::NONE;
|
||||
bool resolved_from_parent_scopes = false;
|
||||
|
||||
[[maybe_unused]] bool isResolved() const
|
||||
{
|
||||
return resolve_place != IdentifierResolvePlace::NONE;
|
||||
}
|
||||
|
||||
[[maybe_unused]] bool isResolvedFromParentScopes() const
|
||||
{
|
||||
return resolved_from_parent_scopes;
|
||||
}
|
||||
|
||||
[[maybe_unused]] bool isResolvedFromExpressionArguments() const
|
||||
{
|
||||
return resolve_place == IdentifierResolvePlace::EXPRESSION_ARGUMENTS;
|
||||
@ -156,7 +152,7 @@ struct IdentifierResolveResult
|
||||
return;
|
||||
}
|
||||
|
||||
buffer << resolved_identifier->formatASTForErrorMessage() << " place " << toString(resolve_place) << " resolved from parent scopes " << resolved_from_parent_scopes;
|
||||
buffer << resolved_identifier->formatASTForErrorMessage() << " place " << toString(resolve_place);
|
||||
}
|
||||
|
||||
[[maybe_unused]] String dump() const
|
||||
@ -170,15 +166,17 @@ struct IdentifierResolveResult
|
||||
|
||||
struct IdentifierResolveState
|
||||
{
|
||||
IdentifierResolveResult resolve_result;
|
||||
bool cyclic_identifier_resolve = false;
|
||||
size_t count = 1;
|
||||
};
|
||||
|
||||
struct IdentifierResolveSettings
|
||||
struct IdentifierResolveContext
|
||||
{
|
||||
/// Allow to check join tree during identifier resolution
|
||||
bool allow_to_check_join_tree = true;
|
||||
|
||||
/// Allow to check aliases during identifier resolution
|
||||
bool allow_to_check_aliases = true;
|
||||
|
||||
/// Allow to check CTEs during table identifier resolution
|
||||
bool allow_to_check_cte = true;
|
||||
|
||||
@ -190,6 +188,16 @@ struct IdentifierResolveSettings
|
||||
|
||||
/// Allow to resolve subquery during identifier resolution
|
||||
bool allow_to_resolve_subquery_during_identifier_resolution = true;
|
||||
|
||||
IdentifierResolveScope * scope_to_resolve_alias_expression = nullptr;
|
||||
|
||||
IdentifierResolveContext resolveAliasesAt(IdentifierResolveScope * scope_to_resolve_alias_expression_) const
|
||||
{
|
||||
IdentifierResolveContext temp = *this;
|
||||
if (!scope_to_resolve_alias_expression)
|
||||
temp.scope_to_resolve_alias_expression = scope_to_resolve_alias_expression_;
|
||||
return temp;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -46,8 +46,6 @@ IdentifierResolveScope::IdentifierResolveScope(QueryTreeNodePtr scope_node_, Ide
|
||||
join_use_nulls = context->getSettingsRef()[Setting::join_use_nulls];
|
||||
else if (parent_scope)
|
||||
join_use_nulls = parent_scope->join_use_nulls;
|
||||
|
||||
aliases.alias_name_to_expression_node = &aliases.alias_name_to_expression_node_before_group_by;
|
||||
}
|
||||
|
||||
[[maybe_unused]] const IdentifierResolveScope * IdentifierResolveScope::getNearestQueryScope() const
|
||||
@ -108,76 +106,98 @@ const AnalysisTableExpressionData & IdentifierResolveScope::getTableExpressionDa
|
||||
|
||||
void IdentifierResolveScope::pushExpressionNode(const QueryTreeNodePtr & node)
|
||||
{
|
||||
bool had_aggregate_function = expressions_in_resolve_process_stack.hasAggregateFunction();
|
||||
expressions_in_resolve_process_stack.push(node);
|
||||
if (group_by_use_nulls && had_aggregate_function != expressions_in_resolve_process_stack.hasAggregateFunction())
|
||||
aliases.alias_name_to_expression_node = &aliases.alias_name_to_expression_node_before_group_by;
|
||||
}
|
||||
|
||||
void IdentifierResolveScope::popExpressionNode()
|
||||
{
|
||||
bool had_aggregate_function = expressions_in_resolve_process_stack.hasAggregateFunction();
|
||||
expressions_in_resolve_process_stack.pop();
|
||||
if (group_by_use_nulls && had_aggregate_function != expressions_in_resolve_process_stack.hasAggregateFunction())
|
||||
aliases.alias_name_to_expression_node = &aliases.alias_name_to_expression_node_after_group_by;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
void dump_mapping(WriteBuffer & buffer, const String & mapping_name, const std::unordered_map<std::string, QueryTreeNodePtr> & mapping)
|
||||
{
|
||||
if (mapping.empty())
|
||||
return;
|
||||
|
||||
buffer << mapping_name << " table size: " << mapping.size() << '\n';
|
||||
for (const auto & [alias_name, node] : mapping)
|
||||
buffer << " { '" << alias_name << "' : " << node->formatASTForErrorMessage() << " }\n";
|
||||
}
|
||||
|
||||
void dump_list(WriteBuffer & buffer, const String & list_name, const std::ranges::viewable_range auto & list)
|
||||
{
|
||||
if (list.empty())
|
||||
return;
|
||||
|
||||
buffer << list_name << " table size: " << list.size() << '\n';
|
||||
for (const auto & node : list)
|
||||
buffer << " { '" << node->getAlias() << "' : " << node->formatASTForErrorMessage() << " }\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// Dump identifier resolve scope
|
||||
[[maybe_unused]] void IdentifierResolveScope::dump(WriteBuffer & buffer) const
|
||||
{
|
||||
buffer << "Scope node " << scope_node->formatASTForErrorMessage() << '\n';
|
||||
buffer << "Identifier lookup to resolve state " << identifier_lookup_to_resolve_state.size() << '\n';
|
||||
for (const auto & [identifier, state] : identifier_lookup_to_resolve_state)
|
||||
buffer << "Scope node " << scope_node->formatConvertedASTForErrorMessage() << '\n';
|
||||
|
||||
buffer << "Identifier lookup to resolve state " << identifier_in_lookup_process.size() << '\n';
|
||||
for (const auto & [identifier, state] : identifier_in_lookup_process)
|
||||
{
|
||||
buffer << "Identifier " << identifier.dump() << " resolve result ";
|
||||
state.resolve_result.dump(buffer);
|
||||
buffer << '\n';
|
||||
buffer << " { '" << identifier.dump() << "' : ";
|
||||
buffer << state.count;
|
||||
buffer << " }\n";
|
||||
}
|
||||
|
||||
buffer << "Expression argument name to node " << expression_argument_name_to_node.size() << '\n';
|
||||
for (const auto & [alias_name, node] : expression_argument_name_to_node)
|
||||
buffer << "Alias name " << alias_name << " node " << node->formatASTForErrorMessage() << '\n';
|
||||
dump_mapping(buffer, "Expression argument name to node", expression_argument_name_to_node);
|
||||
dump_mapping(buffer, "Alias name to expression node", aliases.alias_name_to_expression_node);
|
||||
dump_mapping(buffer, "Alias name to function node", aliases.alias_name_to_lambda_node);
|
||||
dump_mapping(buffer, "Alias name to table expression node", aliases.alias_name_to_table_expression_node);
|
||||
|
||||
buffer << "Alias name to expression node table size " << aliases.alias_name_to_expression_node->size() << '\n';
|
||||
for (const auto & [alias_name, node] : *aliases.alias_name_to_expression_node)
|
||||
buffer << "Alias name " << alias_name << " expression node " << node->dumpTree() << '\n';
|
||||
if (!aliases.transitive_aliases.empty())
|
||||
{
|
||||
buffer << "Transitive aliases number: " << aliases.transitive_aliases.size() << '\n';
|
||||
for (const auto & transitive_alias : aliases.transitive_aliases)
|
||||
buffer << " { " << transitive_alias.first << " -> " << transitive_alias.second.getFullName() << " }\n";
|
||||
}
|
||||
|
||||
buffer << "Alias name to function node table size " << aliases.alias_name_to_lambda_node.size() << '\n';
|
||||
for (const auto & [alias_name, node] : aliases.alias_name_to_lambda_node)
|
||||
buffer << "Alias name " << alias_name << " lambda node " << node->formatASTForErrorMessage() << '\n';
|
||||
dump_mapping(buffer, "CTE name to query node", cte_name_to_query_node);
|
||||
dump_mapping(buffer, "WINDOW name to window node", window_name_to_window_node);
|
||||
|
||||
buffer << "Alias name to table expression node table size " << aliases.alias_name_to_table_expression_node.size() << '\n';
|
||||
for (const auto & [alias_name, node] : aliases.alias_name_to_table_expression_node)
|
||||
buffer << "Alias name " << alias_name << " node " << node->formatASTForErrorMessage() << '\n';
|
||||
if (!aliases.nodes_with_duplicated_aliases.empty())
|
||||
{
|
||||
buffer << "Nodes with duplicated aliases size " << aliases.nodes_with_duplicated_aliases.size() << '\n';
|
||||
for (const auto & node : aliases.nodes_with_duplicated_aliases)
|
||||
buffer << " { " << node->formatASTForErrorMessage() << " }\n";
|
||||
}
|
||||
|
||||
buffer << "CTE name to query node table size " << cte_name_to_query_node.size() << '\n';
|
||||
for (const auto & [cte_name, node] : cte_name_to_query_node)
|
||||
buffer << "CTE name " << cte_name << " node " << node->formatASTForErrorMessage() << '\n';
|
||||
dump_list(buffer, "Nodes to remove aliases ", aliases.node_to_remove_aliases);
|
||||
|
||||
buffer << "WINDOW name to window node table size " << window_name_to_window_node.size() << '\n';
|
||||
for (const auto & [window_name, node] : window_name_to_window_node)
|
||||
buffer << "CTE name " << window_name << " node " << node->formatASTForErrorMessage() << '\n';
|
||||
|
||||
buffer << "Nodes with duplicated aliases size " << aliases.nodes_with_duplicated_aliases.size() << '\n';
|
||||
for (const auto & node : aliases.nodes_with_duplicated_aliases)
|
||||
buffer << "Alias name " << node->getAlias() << " node " << node->formatASTForErrorMessage() << '\n';
|
||||
|
||||
buffer << "Expression resolve process stack " << '\n';
|
||||
expressions_in_resolve_process_stack.dump(buffer);
|
||||
|
||||
buffer << "Table expressions in resolve process size " << table_expressions_in_resolve_process.size() << '\n';
|
||||
for (const auto & node : table_expressions_in_resolve_process)
|
||||
buffer << "Table expression " << node->formatASTForErrorMessage() << '\n';
|
||||
if (!table_expressions_in_resolve_process.empty())
|
||||
{
|
||||
buffer << "Table expressions in resolve process size " << table_expressions_in_resolve_process.size() << '\n';
|
||||
for (const auto & node : table_expressions_in_resolve_process)
|
||||
buffer << " { " << node->formatASTForErrorMessage() << " }\n";
|
||||
}
|
||||
|
||||
buffer << "Non cached identifier lookups during expression resolve " << non_cached_identifier_lookups_during_expression_resolve.size() << '\n';
|
||||
for (const auto & identifier_lookup : non_cached_identifier_lookups_during_expression_resolve)
|
||||
buffer << "Identifier lookup " << identifier_lookup.dump() << '\n';
|
||||
if (!non_cached_identifier_lookups_during_expression_resolve.empty())
|
||||
{
|
||||
buffer << "Non cached identifier lookups during expression resolve " << non_cached_identifier_lookups_during_expression_resolve.size() << '\n';
|
||||
for (const auto & identifier_lookup : non_cached_identifier_lookups_during_expression_resolve)
|
||||
buffer << "Identifier lookup " << identifier_lookup.dump() << " }\n";
|
||||
}
|
||||
|
||||
buffer << "Table expression node to data " << table_expression_node_to_data.size() << '\n';
|
||||
buffer << "Table expression node to data: " << table_expression_node_to_data.size() << '\n';
|
||||
for (const auto & [table_expression_node, table_expression_data] : table_expression_node_to_data)
|
||||
buffer << "Table expression node " << table_expression_node->formatASTForErrorMessage() << " data " << table_expression_data.dump() << '\n';
|
||||
buffer << " { " << table_expression_node->formatASTForErrorMessage() << " data:\n " << table_expression_data.dump() << " }\n";
|
||||
|
||||
dump_list(buffer, "Registered table expression nodes", registered_table_expression_nodes);
|
||||
|
||||
buffer << "Use identifier lookup to result cache " << use_identifier_lookup_to_result_cache << '\n';
|
||||
buffer << "Subquery depth " << subquery_depth << '\n';
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ struct IdentifierResolveScope
|
||||
ContextPtr context;
|
||||
|
||||
/// Identifier lookup to result
|
||||
std::unordered_map<IdentifierLookup, IdentifierResolveState, IdentifierLookupHash> identifier_lookup_to_resolve_state;
|
||||
std::unordered_map<IdentifierLookup, IdentifierResolveState, IdentifierLookupHash> identifier_in_lookup_process;
|
||||
|
||||
/// Argument can be expression like constant, column, function or table expression
|
||||
std::unordered_map<std::string, QueryTreeNodePtr> expression_argument_name_to_node;
|
||||
@ -165,6 +165,9 @@ struct IdentifierResolveScope
|
||||
/// Table expression node to data
|
||||
std::unordered_map<QueryTreeNodePtr, AnalysisTableExpressionData> table_expression_node_to_data;
|
||||
|
||||
/// Table expression nodes that appear in the join tree of the corresponding query
|
||||
std::unordered_set<QueryTreeNodePtr> registered_table_expression_nodes;
|
||||
|
||||
QueryTreeNodePtrWithHashIgnoreTypesSet nullable_group_by_keys;
|
||||
/// Here we count the number of nullable GROUP BY keys we met resolving expression.
|
||||
/// E.g. for a query `SELECT tuple(tuple(number)) FROM numbers(10) GROUP BY (number, tuple(number)) with cube`
|
||||
@ -180,9 +183,6 @@ struct IdentifierResolveScope
|
||||
*/
|
||||
QueryTreeNodePtrWithHashMap<QueryTreeNodePtr> join_columns_with_changed_types;
|
||||
|
||||
/// Use identifier lookup to result cache
|
||||
bool use_identifier_lookup_to_result_cache = true;
|
||||
|
||||
/// Apply nullability to aggregation keys
|
||||
bool group_by_use_nulls = false;
|
||||
/// Join retutns NULLs instead of default values
|
||||
|
@ -228,18 +228,22 @@ void IdentifierResolver::collectScopeValidIdentifiersForTypoCorrection(
|
||||
|
||||
if (allow_expression_identifiers)
|
||||
{
|
||||
for (const auto & [name, expression] : *scope.aliases.alias_name_to_expression_node)
|
||||
for (const auto & [name, expression] : scope.aliases.alias_name_to_expression_node)
|
||||
{
|
||||
assert(expression);
|
||||
auto expression_identifier = Identifier(name);
|
||||
valid_identifiers_result.insert(expression_identifier);
|
||||
}
|
||||
|
||||
auto result_type = getExpressionNodeResultTypeOrNull(expression);
|
||||
|
||||
if (identifier_is_compound && result_type)
|
||||
if (identifier_is_compound)
|
||||
{
|
||||
for (const auto & [name, expression_type] : scope.aliases.alias_name_to_expression_type)
|
||||
{
|
||||
chassert(expression_type);
|
||||
auto expression_identifier = Identifier(name);
|
||||
|
||||
collectCompoundExpressionValidIdentifiersForTypoCorrection(unresolved_identifier,
|
||||
result_type,
|
||||
expression_type,
|
||||
expression_identifier,
|
||||
valid_identifiers_result);
|
||||
}
|
||||
@ -258,7 +262,7 @@ void IdentifierResolver::collectScopeValidIdentifiersForTypoCorrection(
|
||||
{
|
||||
if (allow_function_identifiers)
|
||||
{
|
||||
for (const auto & [name, _] : *scope.aliases.alias_name_to_expression_node)
|
||||
for (const auto & [name, _] : scope.aliases.alias_name_to_expression_node)
|
||||
valid_identifiers_result.insert(Identifier(name));
|
||||
}
|
||||
|
||||
@ -393,7 +397,7 @@ QueryTreeNodePtr IdentifierResolver::wrapExpressionNodeInTupleElement(QueryTreeN
|
||||
/// Resolve identifier functions implementation
|
||||
|
||||
/// Try resolve table identifier from database catalog
|
||||
QueryTreeNodePtr IdentifierResolver::tryResolveTableIdentifierFromDatabaseCatalog(const Identifier & table_identifier, ContextPtr context)
|
||||
IdentifierResolveResult IdentifierResolver::tryResolveTableIdentifierFromDatabaseCatalog(const Identifier & table_identifier, IdentifierResolveScope & scope)
|
||||
{
|
||||
size_t parts_size = table_identifier.getPartsSize();
|
||||
if (parts_size < 1 || parts_size > 2)
|
||||
@ -415,6 +419,7 @@ QueryTreeNodePtr IdentifierResolver::tryResolveTableIdentifierFromDatabaseCatalo
|
||||
}
|
||||
|
||||
StorageID storage_id(database_name, table_name);
|
||||
const auto & context = scope.context;
|
||||
storage_id = context->resolveStorageID(storage_id);
|
||||
bool is_temporary_table = storage_id.getDatabaseName() == DatabaseCatalog::TEMPORARY_DATABASE;
|
||||
|
||||
@ -450,7 +455,7 @@ QueryTreeNodePtr IdentifierResolver::tryResolveTableIdentifierFromDatabaseCatalo
|
||||
if (is_temporary_table)
|
||||
result->setTemporaryTableName(table_name);
|
||||
|
||||
return result;
|
||||
return { .resolved_identifier = result, .scope = &scope, .resolve_place = IdentifierResolvePlace::DATABASE_CATALOG };
|
||||
}
|
||||
|
||||
/// Resolve identifier from compound expression
|
||||
@ -535,7 +540,7 @@ QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromCompoundExpression(
|
||||
*
|
||||
* 3. If identifier is compound and identifier lookup is in expression context use `tryResolveIdentifierFromCompoundExpression`.
|
||||
*/
|
||||
QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromExpressionArguments(const IdentifierLookup & identifier_lookup, IdentifierResolveScope & scope)
|
||||
IdentifierResolveResult IdentifierResolver::tryResolveIdentifierFromExpressionArguments(const IdentifierLookup & identifier_lookup, IdentifierResolveScope & scope)
|
||||
{
|
||||
auto it = scope.expression_argument_name_to_node.find(identifier_lookup.identifier.getFullName());
|
||||
bool resolve_full_identifier = it != scope.expression_argument_name_to_node.end();
|
||||
@ -558,9 +563,13 @@ QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromExpressionArguments
|
||||
return {};
|
||||
|
||||
if (!resolve_full_identifier && identifier_lookup.identifier.isCompound() && identifier_lookup.isExpressionLookup())
|
||||
return tryResolveIdentifierFromCompoundExpression(identifier_lookup.identifier, 1 /*identifier_bind_size*/, it->second, {}, scope);
|
||||
{
|
||||
if (auto resolved_identifier = tryResolveIdentifierFromCompoundExpression(identifier_lookup.identifier, 1 /*identifier_bind_size*/, it->second, {}, scope))
|
||||
return { .resolved_identifier = resolved_identifier, .scope = &scope, .resolve_place = IdentifierResolvePlace::EXPRESSION_ARGUMENTS };
|
||||
return {};
|
||||
}
|
||||
|
||||
return it->second;
|
||||
return { .resolved_identifier = it->second, .scope = &scope, .resolve_place = IdentifierResolvePlace::EXPRESSION_ARGUMENTS };
|
||||
}
|
||||
|
||||
bool IdentifierResolver::tryBindIdentifierToAliases(const IdentifierLookup & identifier_lookup, const IdentifierResolveScope & scope)
|
||||
@ -680,7 +689,7 @@ bool IdentifierResolver::tryBindIdentifierToTableExpressions(const IdentifierLoo
|
||||
return can_bind_identifier_to_table_expression;
|
||||
}
|
||||
|
||||
QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromStorage(
|
||||
IdentifierResolveResult IdentifierResolver::tryResolveIdentifierFromStorage(
|
||||
const Identifier & identifier,
|
||||
const QueryTreeNodePtr & table_expression_node,
|
||||
const AnalysisTableExpressionData & table_expression_data,
|
||||
@ -872,10 +881,10 @@ QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromStorage(
|
||||
auto qualified_identifier_full_name = qualified_identifier.getFullName();
|
||||
node_to_projection_name.emplace(result_expression, std::move(qualified_identifier_full_name));
|
||||
|
||||
return result_expression;
|
||||
return { .resolved_identifier = result_expression, .scope = &scope, .resolve_place = IdentifierResolvePlace::JOIN_TREE };
|
||||
}
|
||||
|
||||
QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromTableExpression(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveResult IdentifierResolver::tryResolveIdentifierFromTableExpression(const IdentifierLookup & identifier_lookup,
|
||||
const QueryTreeNodePtr & table_expression_node,
|
||||
IdentifierResolveScope & scope)
|
||||
{
|
||||
@ -908,10 +917,11 @@ QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromTableExpression(con
|
||||
const auto & database_name = table_expression_data.database_name;
|
||||
|
||||
if (parts_size == 1 && path_start == table_name)
|
||||
return table_expression_node;
|
||||
if (parts_size == 2 && path_start == database_name && identifier[1] == table_name)
|
||||
return table_expression_node;
|
||||
return {};
|
||||
return { .resolved_identifier = table_expression_node, .scope = &scope, .resolve_place = IdentifierResolvePlace::JOIN_TREE };
|
||||
else if (parts_size == 2 && path_start == database_name && identifier[1] == table_name)
|
||||
return { .resolved_identifier = table_expression_node, .scope = &scope, .resolve_place = IdentifierResolvePlace::JOIN_TREE };
|
||||
else
|
||||
return {};
|
||||
}
|
||||
|
||||
/** If identifier first part binds to some column start or table has full identifier name. Then we can try to find whole identifier in table.
|
||||
@ -932,9 +942,9 @@ QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromTableExpression(con
|
||||
* Example: `SELECT t.t from (SELECT 1 as t) AS a FULL JOIN (SELECT 1 as t) as t ON a.t = t.t;`
|
||||
* Initially, we will try to resolve t.t from `a` because `t.` is bound to `1 as t`. However, as it is not a nested column, we will need to resolve it from the second table expression.
|
||||
*/
|
||||
auto resolved_identifier = tryResolveIdentifierFromStorage(identifier, table_expression_node, table_expression_data, scope, 0 /*identifier_column_qualifier_parts*/, true /*can_be_not_found*/);
|
||||
if (resolved_identifier)
|
||||
return resolved_identifier;
|
||||
auto lookup_result = tryResolveIdentifierFromStorage(identifier, table_expression_node, table_expression_data, scope, 0 /*identifier_column_qualifier_parts*/, true /*can_be_not_found*/);
|
||||
if (lookup_result.resolved_identifier)
|
||||
return lookup_result;
|
||||
}
|
||||
|
||||
if (identifier.getPartsSize() == 1)
|
||||
@ -995,13 +1005,13 @@ bool resolvedIdenfiersFromJoinAreEquals(
|
||||
return left_resolved_to_compare->isEqual(*right_resolved_to_compare, IQueryTreeNode::CompareOptions{.compare_aliases = false});
|
||||
}
|
||||
|
||||
QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromJoin(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveResult IdentifierResolver::tryResolveIdentifierFromJoin(const IdentifierLookup & identifier_lookup,
|
||||
const QueryTreeNodePtr & table_expression_node,
|
||||
IdentifierResolveScope & scope)
|
||||
{
|
||||
const auto & from_join_node = table_expression_node->as<const JoinNode &>();
|
||||
auto left_resolved_identifier = tryResolveIdentifierFromJoinTreeNode(identifier_lookup, from_join_node.getLeftTableExpression(), scope);
|
||||
auto right_resolved_identifier = tryResolveIdentifierFromJoinTreeNode(identifier_lookup, from_join_node.getRightTableExpression(), scope);
|
||||
auto left_resolved_identifier = tryResolveIdentifierFromJoinTreeNode(identifier_lookup, from_join_node.getLeftTableExpression(), scope).resolved_identifier;
|
||||
auto right_resolved_identifier = tryResolveIdentifierFromJoinTreeNode(identifier_lookup, from_join_node.getRightTableExpression(), scope).resolved_identifier;
|
||||
|
||||
if (!identifier_lookup.isExpressionLookup())
|
||||
{
|
||||
@ -1012,7 +1022,11 @@ QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromJoin(const Identifi
|
||||
identifier_lookup.dump(),
|
||||
scope.scope_node->formatASTForErrorMessage());
|
||||
|
||||
return left_resolved_identifier ? left_resolved_identifier : right_resolved_identifier;
|
||||
return {
|
||||
.resolved_identifier = left_resolved_identifier ? left_resolved_identifier : right_resolved_identifier,
|
||||
.scope = &scope,
|
||||
.resolve_place = IdentifierResolvePlace::JOIN_TREE
|
||||
};
|
||||
}
|
||||
|
||||
bool join_node_in_resolve_process = scope.table_expressions_in_resolve_process.contains(table_expression_node.get());
|
||||
@ -1095,7 +1109,7 @@ QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromJoin(const Identifi
|
||||
/// If columns from left or right table were missed Object(Nullable('json')) subcolumns, they will be replaced
|
||||
/// to ConstantNode(NULL), which can't be cast to ColumnNode, so we resolve it here.
|
||||
if (auto missed_subcolumn_identifier = checkIsMissedObjectJSONSubcolumn(left_resolved_identifier, right_resolved_identifier))
|
||||
return missed_subcolumn_identifier;
|
||||
return { .resolved_identifier = missed_subcolumn_identifier, .scope = &scope, .resolve_place = IdentifierResolvePlace::JOIN_TREE };
|
||||
|
||||
if (left_resolved_identifier && right_resolved_identifier)
|
||||
{
|
||||
@ -1241,8 +1255,11 @@ QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromJoin(const Identifi
|
||||
}
|
||||
}
|
||||
|
||||
if (join_node_in_resolve_process || !resolved_identifier)
|
||||
return resolved_identifier;
|
||||
if (!resolved_identifier)
|
||||
return {};
|
||||
|
||||
if (join_node_in_resolve_process)
|
||||
return { .resolved_identifier = resolved_identifier, .scope = &scope, .resolve_place = IdentifierResolvePlace::JOIN_TREE };
|
||||
|
||||
if (scope.join_use_nulls)
|
||||
{
|
||||
@ -1259,7 +1276,7 @@ QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromJoin(const Identifi
|
||||
}
|
||||
}
|
||||
|
||||
return resolved_identifier;
|
||||
return { .resolved_identifier = resolved_identifier, .scope = &scope, .resolve_place = IdentifierResolvePlace::JOIN_TREE };
|
||||
}
|
||||
|
||||
QueryTreeNodePtr IdentifierResolver::matchArrayJoinSubcolumns(
|
||||
@ -1391,15 +1408,15 @@ QueryTreeNodePtr IdentifierResolver::tryResolveExpressionFromArrayJoinExpression
|
||||
return array_join_resolved_expression;
|
||||
}
|
||||
|
||||
QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromArrayJoin(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveResult IdentifierResolver::tryResolveIdentifierFromArrayJoin(const IdentifierLookup & identifier_lookup,
|
||||
const QueryTreeNodePtr & table_expression_node,
|
||||
IdentifierResolveScope & scope)
|
||||
{
|
||||
const auto & from_array_join_node = table_expression_node->as<const ArrayJoinNode &>();
|
||||
auto resolved_identifier = tryResolveIdentifierFromJoinTreeNode(identifier_lookup, from_array_join_node.getTableExpression(), scope);
|
||||
auto resolve_result = tryResolveIdentifierFromJoinTreeNode(identifier_lookup, from_array_join_node.getTableExpression(), scope);
|
||||
|
||||
if (scope.table_expressions_in_resolve_process.contains(table_expression_node.get()) || !identifier_lookup.isExpressionLookup())
|
||||
return resolved_identifier;
|
||||
return resolve_result;
|
||||
|
||||
const auto & array_join_column_expressions = from_array_join_node.getJoinExpressions();
|
||||
const auto & array_join_column_expressions_nodes = array_join_column_expressions.getNodes();
|
||||
@ -1433,7 +1450,7 @@ QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromArrayJoin(const Ide
|
||||
{
|
||||
auto array_join_column = std::make_shared<ColumnNode>(array_join_column_expression_typed.getColumn(),
|
||||
array_join_column_expression_typed.getColumnSource());
|
||||
return array_join_column;
|
||||
return { .resolved_identifier = array_join_column, .scope = &scope, .resolve_place = IdentifierResolvePlace::JOIN_TREE };
|
||||
}
|
||||
|
||||
/// Resolve subcolumns. Example : SELECT x.y.z FROM tab ARRAY JOIN arr AS x
|
||||
@ -1446,20 +1463,20 @@ QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromArrayJoin(const Ide
|
||||
true /* can_be_not_found */);
|
||||
|
||||
if (compound_expr)
|
||||
return compound_expr;
|
||||
return { .resolved_identifier = compound_expr, .scope = &scope, .resolve_place = IdentifierResolvePlace::JOIN_TREE };
|
||||
}
|
||||
|
||||
if (!resolved_identifier)
|
||||
return nullptr;
|
||||
if (!resolve_result.resolved_identifier)
|
||||
return {};
|
||||
|
||||
auto array_join_resolved_expression = tryResolveExpressionFromArrayJoinExpressions(resolved_identifier, table_expression_node, scope);
|
||||
auto array_join_resolved_expression = tryResolveExpressionFromArrayJoinExpressions(resolve_result.resolved_identifier, table_expression_node, scope);
|
||||
if (array_join_resolved_expression)
|
||||
resolved_identifier = std::move(array_join_resolved_expression);
|
||||
resolve_result = { .resolved_identifier = std::move(array_join_resolved_expression), .scope = &scope, .resolve_place = IdentifierResolvePlace::JOIN_TREE };
|
||||
|
||||
return resolved_identifier;
|
||||
return resolve_result;
|
||||
}
|
||||
|
||||
QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromJoinTreeNode(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveResult IdentifierResolver::tryResolveIdentifierFromJoinTreeNode(const IdentifierLookup & identifier_lookup,
|
||||
const QueryTreeNodePtr & join_tree_node,
|
||||
IdentifierResolveScope & scope)
|
||||
{
|
||||
@ -1510,7 +1527,7 @@ QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromJoinTreeNode(const
|
||||
* Start with identifier first part, if it match some column name in table try to get column with full identifier name.
|
||||
* TODO: Need to check if it is okay to throw exception if compound identifier first part bind to column but column is not valid.
|
||||
*/
|
||||
QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromJoinTree(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveResult IdentifierResolver::tryResolveIdentifierFromJoinTree(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveScope & scope)
|
||||
{
|
||||
if (identifier_lookup.isFunctionLookup())
|
||||
@ -1518,7 +1535,7 @@ QueryTreeNodePtr IdentifierResolver::tryResolveIdentifierFromJoinTree(const Iden
|
||||
|
||||
/// Try to resolve identifier from table columns
|
||||
if (auto resolved_identifier = tryResolveIdentifierFromTableColumns(identifier_lookup, scope))
|
||||
return resolved_identifier;
|
||||
return { .resolved_identifier = resolved_identifier, .scope = &scope, .resolve_place = IdentifierResolvePlace::JOIN_TREE };
|
||||
|
||||
if (scope.expression_join_tree_node)
|
||||
return tryResolveIdentifierFromJoinTreeNode(identifier_lookup, scope.expression_join_tree_node, scope);
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
|
||||
/// Resolve identifier functions
|
||||
|
||||
static QueryTreeNodePtr tryResolveTableIdentifierFromDatabaseCatalog(const Identifier & table_identifier, ContextPtr context);
|
||||
static IdentifierResolveResult tryResolveTableIdentifierFromDatabaseCatalog(const Identifier & table_identifier, IdentifierResolveScope & scope);
|
||||
|
||||
QueryTreeNodePtr tryResolveIdentifierFromCompoundExpression(const Identifier & expression_identifier,
|
||||
size_t identifier_bind_size,
|
||||
@ -95,7 +95,7 @@ public:
|
||||
IdentifierResolveScope & scope,
|
||||
bool can_be_not_found = false);
|
||||
|
||||
QueryTreeNodePtr tryResolveIdentifierFromExpressionArguments(const IdentifierLookup & identifier_lookup, IdentifierResolveScope & scope);
|
||||
IdentifierResolveResult tryResolveIdentifierFromExpressionArguments(const IdentifierLookup & identifier_lookup, IdentifierResolveScope & scope);
|
||||
|
||||
static bool tryBindIdentifierToAliases(const IdentifierLookup & identifier_lookup, const IdentifierResolveScope & scope);
|
||||
|
||||
@ -109,11 +109,11 @@ public:
|
||||
const QueryTreeNodePtr & table_expression_node,
|
||||
const IdentifierResolveScope & scope);
|
||||
|
||||
QueryTreeNodePtr tryResolveIdentifierFromTableExpression(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveResult tryResolveIdentifierFromTableExpression(const IdentifierLookup & identifier_lookup,
|
||||
const QueryTreeNodePtr & table_expression_node,
|
||||
IdentifierResolveScope & scope);
|
||||
|
||||
QueryTreeNodePtr tryResolveIdentifierFromJoin(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveResult tryResolveIdentifierFromJoin(const IdentifierLookup & identifier_lookup,
|
||||
const QueryTreeNodePtr & table_expression_node,
|
||||
IdentifierResolveScope & scope);
|
||||
|
||||
@ -127,18 +127,18 @@ public:
|
||||
const QueryTreeNodePtr & table_expression_node,
|
||||
IdentifierResolveScope & scope);
|
||||
|
||||
QueryTreeNodePtr tryResolveIdentifierFromArrayJoin(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveResult tryResolveIdentifierFromArrayJoin(const IdentifierLookup & identifier_lookup,
|
||||
const QueryTreeNodePtr & table_expression_node,
|
||||
IdentifierResolveScope & scope);
|
||||
|
||||
QueryTreeNodePtr tryResolveIdentifierFromJoinTreeNode(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveResult tryResolveIdentifierFromJoinTreeNode(const IdentifierLookup & identifier_lookup,
|
||||
const QueryTreeNodePtr & join_tree_node,
|
||||
IdentifierResolveScope & scope);
|
||||
|
||||
QueryTreeNodePtr tryResolveIdentifierFromJoinTree(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveResult tryResolveIdentifierFromJoinTree(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveScope & scope);
|
||||
|
||||
QueryTreeNodePtr tryResolveIdentifierFromStorage(
|
||||
IdentifierResolveResult tryResolveIdentifierFromStorage(
|
||||
const Identifier & identifier,
|
||||
const QueryTreeNodePtr & table_expression_node,
|
||||
const AnalysisTableExpressionData & table_expression_data,
|
||||
|
@ -1159,9 +1159,9 @@ std::string QueryAnalyzer::rewriteAggregateFunctionNameIfNeeded(
|
||||
*
|
||||
* 5. If identifier is compound and identifier lookup is in expression context, use `tryResolveIdentifierFromCompoundExpression`.
|
||||
*/
|
||||
QueryTreeNodePtr QueryAnalyzer::tryResolveIdentifierFromAliases(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveResult QueryAnalyzer::tryResolveIdentifierFromAliases(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveScope & scope,
|
||||
IdentifierResolveSettings identifier_resolve_settings)
|
||||
IdentifierResolveContext identifier_resolve_context)
|
||||
{
|
||||
const auto & identifier_bind_part = identifier_lookup.identifier.front();
|
||||
|
||||
@ -1169,7 +1169,20 @@ QueryTreeNodePtr QueryAnalyzer::tryResolveIdentifierFromAliases(const Identifier
|
||||
if (it == nullptr)
|
||||
return {};
|
||||
|
||||
QueryTreeNodePtr & alias_node = *it;
|
||||
auto * scope_to_resolve_alias_expression = &scope;
|
||||
if (identifier_resolve_context.scope_to_resolve_alias_expression)
|
||||
{
|
||||
scope_to_resolve_alias_expression = identifier_resolve_context.scope_to_resolve_alias_expression;
|
||||
}
|
||||
|
||||
QueryTreeNodePtr alias_node = *it;
|
||||
|
||||
auto node_type = alias_node->getNodeType();
|
||||
if (!IdentifierResolver::isTableExpressionNodeType(node_type))
|
||||
{
|
||||
alias_node = alias_node->clone();
|
||||
scope_to_resolve_alias_expression->aliases.node_to_remove_aliases.push_back(alias_node);
|
||||
}
|
||||
|
||||
if (!alias_node)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR,
|
||||
@ -1177,6 +1190,10 @@ QueryTreeNodePtr QueryAnalyzer::tryResolveIdentifierFromAliases(const Identifier
|
||||
identifier_bind_part,
|
||||
scope.scope_node->formatASTForErrorMessage());
|
||||
|
||||
/* Do not use alias to resolve identifier when it's part of aliased expression. This is required to support queries like:
|
||||
* 1. SELECT dummy + 1 AS dummy
|
||||
* 2. SELECT avg(a) OVER () AS a, id FROM test
|
||||
*/
|
||||
if (auto root_expression_with_alias = scope.expressions_in_resolve_process_stack.getExpressionWithAlias(identifier_bind_part))
|
||||
{
|
||||
const auto top_expression = scope.expressions_in_resolve_process_stack.getTop();
|
||||
@ -1191,58 +1208,65 @@ QueryTreeNodePtr QueryAnalyzer::tryResolveIdentifierFromAliases(const Identifier
|
||||
return {};
|
||||
}
|
||||
|
||||
auto node_type = alias_node->getNodeType();
|
||||
|
||||
/// Resolve expression if necessary
|
||||
if (node_type == QueryTreeNodeType::IDENTIFIER)
|
||||
{
|
||||
scope.pushExpressionNode(alias_node);
|
||||
scope_to_resolve_alias_expression->pushExpressionNode(alias_node);
|
||||
|
||||
auto & alias_identifier_node = alias_node->as<IdentifierNode &>();
|
||||
auto identifier = alias_identifier_node.getIdentifier();
|
||||
auto lookup_result = tryResolveIdentifier(IdentifierLookup{identifier, identifier_lookup.lookup_context}, scope, identifier_resolve_settings);
|
||||
auto lookup_result = tryResolveIdentifier(IdentifierLookup{identifier, identifier_lookup.lookup_context}, *scope_to_resolve_alias_expression, identifier_resolve_context);
|
||||
|
||||
scope_to_resolve_alias_expression->popExpressionNode();
|
||||
|
||||
if (!lookup_result.resolved_identifier)
|
||||
{
|
||||
std::unordered_set<Identifier> valid_identifiers;
|
||||
IdentifierResolver::collectScopeWithParentScopesValidIdentifiersForTypoCorrection(identifier, scope, true, false, false, valid_identifiers);
|
||||
auto hints = IdentifierResolver::collectIdentifierTypoHints(identifier, valid_identifiers);
|
||||
|
||||
throw Exception(ErrorCodes::UNKNOWN_IDENTIFIER, "Unknown {} identifier '{}'. In scope {}{}",
|
||||
toStringLowercase(identifier_lookup.lookup_context),
|
||||
identifier.getFullName(),
|
||||
scope.scope_node->formatASTForErrorMessage(),
|
||||
getHintsErrorMessageSuffix(hints));
|
||||
// Resolve may succeed in another place or scope
|
||||
return {};
|
||||
}
|
||||
|
||||
alias_node = lookup_result.resolved_identifier;
|
||||
scope.popExpressionNode();
|
||||
}
|
||||
else if (node_type == QueryTreeNodeType::FUNCTION)
|
||||
{
|
||||
resolveExpressionNode(alias_node, scope, false /*allow_lambda_expression*/, false /*allow_table_expression*/);
|
||||
resolveExpressionNode(alias_node, *scope_to_resolve_alias_expression, false /*allow_lambda_expression*/, false /*allow_table_expression*/);
|
||||
}
|
||||
else if (node_type == QueryTreeNodeType::QUERY || node_type == QueryTreeNodeType::UNION)
|
||||
{
|
||||
if (identifier_resolve_settings.allow_to_resolve_subquery_during_identifier_resolution)
|
||||
resolveExpressionNode(alias_node, scope, false /*allow_lambda_expression*/, identifier_lookup.isTableExpressionLookup() /*allow_table_expression*/);
|
||||
if (identifier_resolve_context.allow_to_resolve_subquery_during_identifier_resolution)
|
||||
resolveExpressionNode(alias_node, *scope_to_resolve_alias_expression, false /*allow_lambda_expression*/, identifier_lookup.isTableExpressionLookup() /*allow_table_expression*/);
|
||||
}
|
||||
|
||||
if (identifier_lookup.isExpressionLookup() && alias_node)
|
||||
{
|
||||
// Do not collect result rype in case of untuple() expression
|
||||
if (alias_node->getNodeType() != QueryTreeNodeType::LIST)
|
||||
{
|
||||
// Remember resolved type for typo correction
|
||||
scope_to_resolve_alias_expression->aliases.alias_name_to_expression_type[identifier_bind_part] = alias_node->getResultType();
|
||||
}
|
||||
}
|
||||
|
||||
if (identifier_lookup.identifier.isCompound() && alias_node)
|
||||
{
|
||||
if (identifier_lookup.isExpressionLookup())
|
||||
{
|
||||
return identifier_resolver.tryResolveIdentifierFromCompoundExpression(
|
||||
if (auto resolved_identifier = identifier_resolver.tryResolveIdentifierFromCompoundExpression(
|
||||
identifier_lookup.identifier,
|
||||
1 /*identifier_bind_size*/,
|
||||
alias_node,
|
||||
{} /* compound_expression_source */,
|
||||
scope,
|
||||
identifier_resolve_settings.allow_to_check_join_tree /* can_be_not_found */);
|
||||
identifier_resolve_context.allow_to_check_join_tree /* can_be_not_found */))
|
||||
{
|
||||
return { .resolved_identifier = resolved_identifier, .scope = &scope, .resolve_place = IdentifierResolvePlace::ALIASES };
|
||||
}
|
||||
return {};
|
||||
}
|
||||
if (identifier_lookup.isFunctionLookup() || identifier_lookup.isTableExpressionLookup())
|
||||
{
|
||||
throw Exception(
|
||||
ErrorCodes::BAD_ARGUMENTS,
|
||||
ErrorCodes::UNKNOWN_IDENTIFIER,
|
||||
"Compound identifier '{}' cannot be resolved as {}. In scope {}",
|
||||
identifier_lookup.identifier.getFullName(),
|
||||
identifier_lookup.isFunctionLookup() ? "function" : "table expression",
|
||||
@ -1250,7 +1274,7 @@ QueryTreeNodePtr QueryAnalyzer::tryResolveIdentifierFromAliases(const Identifier
|
||||
}
|
||||
}
|
||||
|
||||
return alias_node;
|
||||
return { .resolved_identifier = alias_node, .scope = &scope, .resolve_place = IdentifierResolvePlace::ALIASES };
|
||||
}
|
||||
|
||||
/** Try resolve identifier in current scope parent scopes.
|
||||
@ -1260,92 +1284,104 @@ QueryTreeNodePtr QueryAnalyzer::tryResolveIdentifierFromAliases(const Identifier
|
||||
* If initial scope is expression. Then try to resolve identifier in parent scopes until query scope is hit.
|
||||
* For query scope resolve strategy is same as if initial scope if query.
|
||||
*/
|
||||
IdentifierResolveResult QueryAnalyzer::tryResolveIdentifierInParentScopes(const IdentifierLookup & identifier_lookup, IdentifierResolveScope & scope)
|
||||
IdentifierResolveResult QueryAnalyzer::tryResolveIdentifierInParentScopes(const IdentifierLookup & identifier_lookup, IdentifierResolveScope & scope, const IdentifierResolveContext identifier_resolve_settings)
|
||||
{
|
||||
bool initial_scope_is_query = scope.scope_node->getNodeType() == QueryTreeNodeType::QUERY;
|
||||
bool initial_scope_is_expression = !initial_scope_is_query;
|
||||
|
||||
IdentifierResolveSettings identifier_resolve_settings;
|
||||
identifier_resolve_settings.allow_to_check_parent_scopes = false;
|
||||
identifier_resolve_settings.allow_to_check_database_catalog = false;
|
||||
|
||||
IdentifierResolveScope * scope_to_check = scope.parent_scope;
|
||||
|
||||
if (initial_scope_is_expression)
|
||||
{
|
||||
while (scope_to_check != nullptr)
|
||||
{
|
||||
auto resolve_result = tryResolveIdentifier(identifier_lookup, *scope_to_check, identifier_resolve_settings);
|
||||
if (resolve_result.resolved_identifier)
|
||||
return resolve_result;
|
||||
|
||||
bool scope_was_query = scope_to_check->scope_node->getNodeType() == QueryTreeNodeType::QUERY;
|
||||
scope_to_check = scope_to_check->parent_scope;
|
||||
|
||||
if (scope_was_query)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!scope.context->getSettingsRef()[Setting::enable_global_with_statement])
|
||||
if (!scope.parent_scope)
|
||||
return {};
|
||||
|
||||
/** Nested subqueries cannot access outer subqueries table expressions from JOIN tree because
|
||||
bool initial_scope_is_query = scope.scope_node->getNodeType() == QueryTreeNodeType::QUERY;
|
||||
|
||||
auto new_resolve_context = identifier_resolve_settings.resolveAliasesAt(&scope);
|
||||
|
||||
/** 1. Nested subqueries cannot access outer subqueries table expressions from JOIN tree because
|
||||
* that can prevent resolution of table expression from CTE.
|
||||
*
|
||||
* Example: WITH a AS (SELECT number FROM numbers(1)), b AS (SELECT number FROM a) SELECT * FROM a as l, b as r;
|
||||
*
|
||||
* 2. Allow to check join tree and aliases when resolving lambda body.
|
||||
*
|
||||
* Example: SELECT arrayMap(x -> test_table.* EXCEPT value, [1,2,3]) FROM test_table;
|
||||
*/
|
||||
if (identifier_lookup.isTableExpressionLookup())
|
||||
identifier_resolve_settings.allow_to_check_join_tree = false;
|
||||
|
||||
while (scope_to_check != nullptr)
|
||||
if (initial_scope_is_query)
|
||||
{
|
||||
auto lookup_result = tryResolveIdentifier(identifier_lookup, *scope_to_check, identifier_resolve_settings);
|
||||
const auto & resolved_identifier = lookup_result.resolved_identifier;
|
||||
|
||||
scope_to_check = scope_to_check->parent_scope;
|
||||
|
||||
if (resolved_identifier)
|
||||
if (identifier_lookup.isTableExpressionLookup())
|
||||
{
|
||||
auto * subquery_node = resolved_identifier->as<QueryNode>();
|
||||
auto * union_node = resolved_identifier->as<UnionNode>();
|
||||
|
||||
bool is_cte = (subquery_node && subquery_node->isCTE()) || (union_node && union_node->isCTE());
|
||||
bool is_table_from_expression_arguments = lookup_result.resolve_place == IdentifierResolvePlace::EXPRESSION_ARGUMENTS &&
|
||||
resolved_identifier->getNodeType() == QueryTreeNodeType::TABLE;
|
||||
bool is_valid_table_expression = is_cte || is_table_from_expression_arguments;
|
||||
new_resolve_context.allow_to_check_join_tree = false;
|
||||
|
||||
/** From parent scopes we can resolve table identifiers only as CTE.
|
||||
* Example: SELECT (SELECT 1 FROM a) FROM test_table AS a;
|
||||
*
|
||||
* During child scope table identifier resolve a, table node test_table with alias a from parent scope
|
||||
* is invalid.
|
||||
*/
|
||||
if (identifier_lookup.isTableExpressionLookup() && !is_valid_table_expression)
|
||||
continue;
|
||||
* Example: SELECT (SELECT 1 FROM a) FROM test_table AS a;
|
||||
*
|
||||
* During child scope table identifier resolve a, table node test_table with alias a from parent scope
|
||||
* is invalid.
|
||||
*/
|
||||
new_resolve_context.allow_to_check_aliases = false;
|
||||
}
|
||||
|
||||
if (is_valid_table_expression || resolved_identifier->as<ConstantNode>())
|
||||
{
|
||||
return lookup_result;
|
||||
}
|
||||
if (auto * resolved_function = resolved_identifier->as<FunctionNode>())
|
||||
{
|
||||
/// Special case: scalar subquery was executed and replaced by __getScalar function.
|
||||
/// Handle it as a constant.
|
||||
if (resolved_function->getFunctionName() == "__getScalar")
|
||||
return lookup_result;
|
||||
}
|
||||
|
||||
throw Exception(ErrorCodes::UNSUPPORTED_METHOD,
|
||||
"Resolve identifier '{}' from parent scope only supported for constants and CTE. Actual {} node type {}. In scope {}",
|
||||
identifier_lookup.identifier.getFullName(),
|
||||
resolved_identifier->formatASTForErrorMessage(),
|
||||
resolved_identifier->getNodeTypeName(),
|
||||
scope.scope_node->formatASTForErrorMessage());
|
||||
if (!scope.context->getSettingsRef()[Setting::enable_global_with_statement])
|
||||
{
|
||||
new_resolve_context.allow_to_check_aliases = false;
|
||||
new_resolve_context.allow_to_check_cte = false;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
new_resolve_context.allow_to_check_database_catalog = false;
|
||||
|
||||
auto resolve_result = tryResolveIdentifier(identifier_lookup, *scope.parent_scope, new_resolve_context);
|
||||
auto & resolved_identifier = resolve_result.resolved_identifier;
|
||||
|
||||
if (!resolved_identifier)
|
||||
return {};
|
||||
|
||||
/** From parent scopes we can resolve table identifiers only as CTE.
|
||||
* Example: SELECT (SELECT 1 FROM a) FROM test_table AS a;
|
||||
*
|
||||
* During child scope table identifier resolve a, table node test_table with alias a from parent scope
|
||||
* is invalid.
|
||||
*/
|
||||
if (identifier_lookup.isTableExpressionLookup())
|
||||
{
|
||||
auto * subquery_node = resolved_identifier->as<QueryNode>();
|
||||
auto * union_node = resolved_identifier->as<UnionNode>();
|
||||
|
||||
bool is_cte = (subquery_node && subquery_node->isCTE()) || (union_node && union_node->isCTE());
|
||||
bool is_table_from_expression_arguments = resolve_result.isResolvedFromExpressionArguments() &&
|
||||
resolved_identifier->getNodeType() == QueryTreeNodeType::TABLE;
|
||||
bool is_from_join_tree_or_aliases = !initial_scope_is_query && (resolve_result.isResolvedFromJoinTree() || resolve_result.isResolvedFromAliases());
|
||||
bool is_valid_table_expression = is_cte || is_table_from_expression_arguments || is_from_join_tree_or_aliases;
|
||||
|
||||
if (!is_valid_table_expression)
|
||||
return {};
|
||||
return resolve_result;
|
||||
}
|
||||
if (identifier_lookup.isFunctionLookup())
|
||||
return resolve_result;
|
||||
|
||||
QueryTreeNodes nodes_to_process = { resolved_identifier };
|
||||
while (!nodes_to_process.empty())
|
||||
{
|
||||
auto current = nodes_to_process.back();
|
||||
nodes_to_process.pop_back();
|
||||
if (auto * current_column = current->as<ColumnNode>())
|
||||
{
|
||||
if (isDependentColumn(&scope, current_column->getColumnSource()))
|
||||
{
|
||||
throw Exception(ErrorCodes::UNSUPPORTED_METHOD,
|
||||
"Resolved identifier '{}' in parent scope to expression '{}' with correlated column '{}'. In scope {}",
|
||||
identifier_lookup.identifier.getFullName(),
|
||||
resolved_identifier->formatASTForErrorMessage(),
|
||||
current_column->getColumnName(),
|
||||
scope.scope_node->formatASTForErrorMessage());
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto & child : current->getChildren())
|
||||
{
|
||||
if (child)
|
||||
nodes_to_process.push_back(child);
|
||||
}
|
||||
}
|
||||
|
||||
return resolve_result;
|
||||
}
|
||||
|
||||
/** Resolve identifier in scope.
|
||||
@ -1384,38 +1420,26 @@ IdentifierResolveResult QueryAnalyzer::tryResolveIdentifierInParentScopes(const
|
||||
*/
|
||||
IdentifierResolveResult QueryAnalyzer::tryResolveIdentifier(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveScope & scope,
|
||||
IdentifierResolveSettings identifier_resolve_settings)
|
||||
IdentifierResolveContext identifier_resolve_settings)
|
||||
{
|
||||
auto it = scope.identifier_lookup_to_resolve_state.find(identifier_lookup);
|
||||
if (it != scope.identifier_lookup_to_resolve_state.end())
|
||||
auto it = scope.identifier_in_lookup_process.find(identifier_lookup);
|
||||
|
||||
bool already_in_resolve_process = false;
|
||||
if (it != scope.identifier_in_lookup_process.end())
|
||||
{
|
||||
if (it->second.cyclic_identifier_resolve)
|
||||
throw Exception(ErrorCodes::CYCLIC_ALIASES,
|
||||
"Cyclic aliases for identifier '{}'. In scope {}",
|
||||
identifier_lookup.identifier.getFullName(),
|
||||
scope.scope_node->formatASTForErrorMessage());
|
||||
|
||||
if (!it->second.resolve_result.isResolved())
|
||||
it->second.cyclic_identifier_resolve = true;
|
||||
|
||||
if (it->second.resolve_result.isResolved() &&
|
||||
scope.use_identifier_lookup_to_result_cache &&
|
||||
!scope.non_cached_identifier_lookups_during_expression_resolve.contains(identifier_lookup) &&
|
||||
(!it->second.resolve_result.isResolvedFromCTEs() || !ctes_in_resolve_process.contains(identifier_lookup.identifier.getFullName())))
|
||||
return it->second.resolve_result;
|
||||
it->second.count++;
|
||||
already_in_resolve_process = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto [insert_it, _] = scope.identifier_lookup_to_resolve_state.insert({identifier_lookup, IdentifierResolveState()});
|
||||
auto [insert_it, _] = scope.identifier_in_lookup_process.insert({identifier_lookup, IdentifierResolveState()});
|
||||
it = insert_it;
|
||||
}
|
||||
|
||||
/// Resolve identifier from current scope
|
||||
|
||||
IdentifierResolveResult resolve_result;
|
||||
resolve_result.resolved_identifier = identifier_resolver.tryResolveIdentifierFromExpressionArguments(identifier_lookup, scope);
|
||||
if (resolve_result.resolved_identifier)
|
||||
resolve_result.resolve_place = IdentifierResolvePlace::EXPRESSION_ARGUMENTS;
|
||||
resolve_result = identifier_resolver.tryResolveIdentifierFromExpressionArguments(identifier_lookup, scope);
|
||||
|
||||
if (!resolve_result.resolved_identifier)
|
||||
{
|
||||
@ -1441,34 +1465,22 @@ IdentifierResolveResult QueryAnalyzer::tryResolveIdentifier(const IdentifierLook
|
||||
{
|
||||
if (identifier_resolve_settings.allow_to_check_join_tree)
|
||||
{
|
||||
resolve_result.resolved_identifier = identifier_resolver.tryResolveIdentifierFromJoinTree(identifier_lookup, scope);
|
||||
|
||||
if (resolve_result.resolved_identifier)
|
||||
resolve_result.resolve_place = IdentifierResolvePlace::JOIN_TREE;
|
||||
resolve_result = identifier_resolver.tryResolveIdentifierFromJoinTree(identifier_lookup, scope);
|
||||
}
|
||||
|
||||
if (!resolve_result.resolved_identifier)
|
||||
if (identifier_resolve_settings.allow_to_check_aliases && !resolve_result.resolved_identifier && !already_in_resolve_process)
|
||||
{
|
||||
resolve_result.resolved_identifier = tryResolveIdentifierFromAliases(identifier_lookup, scope, identifier_resolve_settings);
|
||||
|
||||
if (resolve_result.resolved_identifier)
|
||||
resolve_result.resolve_place = IdentifierResolvePlace::ALIASES;
|
||||
resolve_result = tryResolveIdentifierFromAliases(identifier_lookup, scope, identifier_resolve_settings);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resolve_result.resolved_identifier = tryResolveIdentifierFromAliases(identifier_lookup, scope, identifier_resolve_settings);
|
||||
if (identifier_resolve_settings.allow_to_check_aliases && !already_in_resolve_process)
|
||||
resolve_result = tryResolveIdentifierFromAliases(identifier_lookup, scope, identifier_resolve_settings);
|
||||
|
||||
if (resolve_result.resolved_identifier)
|
||||
if (!resolve_result.resolved_identifier && identifier_resolve_settings.allow_to_check_join_tree)
|
||||
{
|
||||
resolve_result.resolve_place = IdentifierResolvePlace::ALIASES;
|
||||
}
|
||||
else if (identifier_resolve_settings.allow_to_check_join_tree)
|
||||
{
|
||||
resolve_result.resolved_identifier = identifier_resolver.tryResolveIdentifierFromJoinTree(identifier_lookup, scope);
|
||||
|
||||
if (resolve_result.resolved_identifier)
|
||||
resolve_result.resolve_place = IdentifierResolvePlace::JOIN_TREE;
|
||||
resolve_result = identifier_resolver.tryResolveIdentifierFromJoinTree(identifier_lookup, scope);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1488,7 +1500,7 @@ IdentifierResolveResult QueryAnalyzer::tryResolveIdentifier(const IdentifierLook
|
||||
}
|
||||
}
|
||||
|
||||
if (!resolve_result.resolved_identifier && identifier_lookup.isTableExpressionLookup())
|
||||
if (!resolve_result.resolved_identifier && identifier_resolve_settings.allow_to_check_cte && identifier_lookup.isTableExpressionLookup())
|
||||
{
|
||||
auto full_name = identifier_lookup.identifier.getFullName();
|
||||
auto cte_query_node_it = scope.cte_name_to_query_node.find(full_name);
|
||||
@ -1508,43 +1520,31 @@ IdentifierResolveResult QueryAnalyzer::tryResolveIdentifier(const IdentifierLook
|
||||
if (cte_query_node_it != scope.cte_name_to_query_node.end()
|
||||
&& !ctes_in_resolve_process.contains(full_name))
|
||||
{
|
||||
resolve_result.resolved_identifier = cte_query_node_it->second;
|
||||
resolve_result.resolve_place = IdentifierResolvePlace::CTE;
|
||||
resolve_result = { .resolved_identifier = cte_query_node_it->second, .scope = &scope, .resolve_place = IdentifierResolvePlace::CTE };
|
||||
}
|
||||
}
|
||||
|
||||
/// Try to resolve identifier from parent scopes
|
||||
|
||||
if (!resolve_result.resolved_identifier && identifier_resolve_settings.allow_to_check_parent_scopes)
|
||||
if (!resolve_result.resolved_identifier)
|
||||
{
|
||||
resolve_result = tryResolveIdentifierInParentScopes(identifier_lookup, scope);
|
||||
|
||||
if (resolve_result.resolved_identifier)
|
||||
resolve_result.resolved_from_parent_scopes = true;
|
||||
resolve_result = tryResolveIdentifierInParentScopes(identifier_lookup, scope, identifier_resolve_settings);
|
||||
}
|
||||
|
||||
/// Try to resolve table identifier from database catalog
|
||||
|
||||
if (!resolve_result.resolved_identifier && identifier_resolve_settings.allow_to_check_database_catalog && identifier_lookup.isTableExpressionLookup())
|
||||
{
|
||||
resolve_result.resolved_identifier = IdentifierResolver::tryResolveTableIdentifierFromDatabaseCatalog(identifier_lookup.identifier, scope.context);
|
||||
|
||||
if (resolve_result.resolved_identifier)
|
||||
resolve_result.resolve_place = IdentifierResolvePlace::DATABASE_CATALOG;
|
||||
resolve_result = IdentifierResolver::tryResolveTableIdentifierFromDatabaseCatalog(identifier_lookup.identifier, scope);
|
||||
}
|
||||
|
||||
bool was_cyclic_identifier_resolve = it->second.cyclic_identifier_resolve;
|
||||
if (!was_cyclic_identifier_resolve)
|
||||
it->second.resolve_result = resolve_result;
|
||||
it->second.cyclic_identifier_resolve = false;
|
||||
it->second.count--;
|
||||
|
||||
/** If identifier was not resolved, or during expression resolution identifier was explicitly added into non cached set,
|
||||
* or identifier caching was disabled in resolve scope we remove identifier lookup result from identifier lookup to result table.
|
||||
*/
|
||||
if (!was_cyclic_identifier_resolve && (!resolve_result.resolved_identifier ||
|
||||
scope.non_cached_identifier_lookups_during_expression_resolve.contains(identifier_lookup) ||
|
||||
!scope.use_identifier_lookup_to_result_cache))
|
||||
scope.identifier_lookup_to_resolve_state.erase(it);
|
||||
if (it->second.count == 0)
|
||||
{
|
||||
scope.identifier_in_lookup_process.erase(it);
|
||||
}
|
||||
|
||||
return resolve_result;
|
||||
}
|
||||
@ -1643,7 +1643,7 @@ GetColumnsOptions QueryAnalyzer::buildGetColumnsOptions(QueryTreeNodePtr & match
|
||||
QueryAnalyzer::QueryTreeNodesWithNames QueryAnalyzer::getMatchedColumnNodesWithNames(const QueryTreeNodePtr & matcher_node,
|
||||
const QueryTreeNodePtr & table_expression_node,
|
||||
const NamesAndTypes & matched_columns,
|
||||
const IdentifierResolveScope & scope)
|
||||
IdentifierResolveScope & scope)
|
||||
{
|
||||
auto & matcher_node_typed = matcher_node->as<MatcherNode &>();
|
||||
|
||||
@ -1848,7 +1848,7 @@ QueryAnalyzer::QueryTreeNodesWithNames QueryAnalyzer::resolveQualifiedMatcher(Qu
|
||||
|
||||
/// Try to resolve qualified matcher for table expression
|
||||
|
||||
IdentifierResolveSettings identifier_resolve_settings;
|
||||
IdentifierResolveContext identifier_resolve_settings;
|
||||
identifier_resolve_settings.allow_to_check_cte = false;
|
||||
identifier_resolve_settings.allow_to_check_database_catalog = false;
|
||||
|
||||
@ -2565,13 +2565,13 @@ ProjectionNames QueryAnalyzer::resolveLambda(const QueryTreeNodePtr & lambda_nod
|
||||
/** Register lambda as being resolved, to prevent recursive lambdas resolution.
|
||||
* Example: WITH (x -> x + lambda_2(x)) AS lambda_1, (x -> x + lambda_1(x)) AS lambda_2 SELECT 1;
|
||||
*/
|
||||
auto it = lambdas_in_resolve_process.find(lambda_node.get());
|
||||
auto it = lambdas_in_resolve_process.find(lambda_node);
|
||||
if (it != lambdas_in_resolve_process.end())
|
||||
throw Exception(ErrorCodes::UNSUPPORTED_METHOD,
|
||||
"Recursive lambda {}. In scope {}",
|
||||
lambda_node->formatASTForErrorMessage(),
|
||||
scope.scope_node->formatASTForErrorMessage());
|
||||
lambdas_in_resolve_process.emplace(lambda_node.get());
|
||||
lambdas_in_resolve_process.emplace(lambda_node);
|
||||
|
||||
size_t arguments_size = lambda_arguments.size();
|
||||
if (lambda_arguments_nodes_size != arguments_size)
|
||||
@ -2603,7 +2603,7 @@ ProjectionNames QueryAnalyzer::resolveLambda(const QueryTreeNodePtr & lambda_nod
|
||||
const auto & lambda_argument_name = lambda_argument_identifier ? lambda_argument_identifier->getIdentifier().getFullName()
|
||||
: lambda_argument_column->getColumnName();
|
||||
|
||||
bool has_expression_node = scope.aliases.alias_name_to_expression_node->contains(lambda_argument_name);
|
||||
bool has_expression_node = scope.aliases.alias_name_to_expression_node.contains(lambda_argument_name);
|
||||
bool has_alias_node = scope.aliases.alias_name_to_lambda_node.contains(lambda_argument_name);
|
||||
|
||||
if (has_expression_node || has_alias_node)
|
||||
@ -2624,7 +2624,7 @@ ProjectionNames QueryAnalyzer::resolveLambda(const QueryTreeNodePtr & lambda_nod
|
||||
/// Lambda body expression is resolved as standard query expression node.
|
||||
auto result_projection_names = resolveExpressionNode(lambda_to_resolve.getExpression(), scope, false /*allow_lambda_expression*/, false /*allow_table_expression*/);
|
||||
|
||||
lambdas_in_resolve_process.erase(lambda_node.get());
|
||||
lambdas_in_resolve_process.erase(lambda_node);
|
||||
|
||||
return result_projection_names;
|
||||
}
|
||||
@ -2777,7 +2777,7 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
|
||||
}
|
||||
else
|
||||
{
|
||||
auto table_node = IdentifierResolver::tryResolveTableIdentifierFromDatabaseCatalog(identifier, scope.context);
|
||||
auto table_node = IdentifierResolver::tryResolveTableIdentifierFromDatabaseCatalog(identifier, scope).resolved_identifier;
|
||||
if (!table_node)
|
||||
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Function {} first argument expected table identifier '{}'. In scope {}",
|
||||
@ -2901,6 +2901,7 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
|
||||
}
|
||||
|
||||
auto & function_node = *function_node_ptr;
|
||||
// bool rewrite_to_negate_has = false;
|
||||
|
||||
/// Replace right IN function argument if it is table or table function with subquery that read ordinary columns
|
||||
if (is_special_function_in)
|
||||
@ -3378,6 +3379,7 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
|
||||
QueryTreeNodes lambda_arguments;
|
||||
lambda_arguments.reserve(lambda_arguments_size);
|
||||
|
||||
IdentifierResolveScope lambda_scope(lambda_to_resolve, &scope /*parent_scope*/);
|
||||
for (size_t i = 0; i < lambda_arguments_size; ++i)
|
||||
{
|
||||
const auto & argument_type = function_data_type_argument_types[i];
|
||||
@ -3385,7 +3387,6 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
|
||||
lambda_arguments.push_back(std::make_shared<ColumnNode>(std::move(column_name_and_type), lambda_to_resolve));
|
||||
}
|
||||
|
||||
IdentifierResolveScope lambda_scope(lambda_to_resolve, &scope /*parent_scope*/);
|
||||
lambda_projection_names = resolveLambda(lambda_argument, lambda_to_resolve, lambda_arguments, lambda_scope);
|
||||
|
||||
if (auto * lambda_list_node_result = lambda_to_resolve_typed.getExpression()->as<ListNode>())
|
||||
@ -3629,38 +3630,6 @@ ProjectionNames QueryAnalyzer::resolveExpressionNode(
|
||||
if (is_duplicated_alias)
|
||||
scope.non_cached_identifier_lookups_during_expression_resolve.insert({Identifier{node_alias}, IdentifierLookupContext::EXPRESSION});
|
||||
|
||||
/** Do not use alias table if node has alias same as some other node.
|
||||
* Example: WITH x -> x + 1 AS lambda SELECT 1 AS lambda;
|
||||
* During 1 AS lambda resolve if we use alias table we replace node with x -> x + 1 AS lambda.
|
||||
*
|
||||
* Do not use alias table if allow_table_expression = true and we resolve query node directly.
|
||||
* Example: SELECT a FROM test_table WHERE id IN (SELECT 1) AS a;
|
||||
* To support both (SELECT 1) AS expression in projection and (SELECT 1) as subquery in IN, do not use
|
||||
* alias table because in alias table subquery could be evaluated as scalar.
|
||||
*/
|
||||
bool use_alias_table = !ignore_alias;
|
||||
if (is_duplicated_alias || (allow_table_expression && IdentifierResolver::isSubqueryNodeType(node->getNodeType())))
|
||||
use_alias_table = false;
|
||||
|
||||
if (!node_alias.empty() && use_alias_table)
|
||||
{
|
||||
/** Node could be potentially resolved by resolving other nodes.
|
||||
* SELECT b, a as b FROM test_table;
|
||||
*
|
||||
* To resolve b we need to resolve a.
|
||||
*/
|
||||
auto it = scope.aliases.alias_name_to_expression_node->find(node_alias);
|
||||
if (it != scope.aliases.alias_name_to_expression_node->end())
|
||||
node = it->second;
|
||||
|
||||
if (allow_lambda_expression)
|
||||
{
|
||||
it = scope.aliases.alias_name_to_lambda_node.find(node_alias);
|
||||
if (it != scope.aliases.alias_name_to_lambda_node.end())
|
||||
node = it->second;
|
||||
}
|
||||
}
|
||||
|
||||
scope.pushExpressionNode(node);
|
||||
|
||||
auto node_type = node->getNodeType();
|
||||
@ -3923,23 +3892,6 @@ ProjectionNames QueryAnalyzer::resolveExpressionNode(
|
||||
}
|
||||
}
|
||||
|
||||
/** Update aliases after expression node was resolved.
|
||||
* Do not update node in alias table if we resolve it for duplicate alias.
|
||||
*/
|
||||
if (!node_alias.empty() && use_alias_table && !scope.group_by_use_nulls)
|
||||
{
|
||||
auto it = scope.aliases.alias_name_to_expression_node->find(node_alias);
|
||||
if (it != scope.aliases.alias_name_to_expression_node->end())
|
||||
it->second = node;
|
||||
|
||||
if (allow_lambda_expression)
|
||||
{
|
||||
it = scope.aliases.alias_name_to_lambda_node.find(node_alias);
|
||||
if (it != scope.aliases.alias_name_to_lambda_node.end())
|
||||
it->second = node;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_duplicated_alias)
|
||||
scope.non_cached_identifier_lookups_during_expression_resolve.erase({Identifier{node_alias}, IdentifierLookupContext::EXPRESSION});
|
||||
|
||||
@ -4348,7 +4300,7 @@ void QueryAnalyzer::initializeQueryJoinTreeNode(QueryTreeNodePtr & join_tree_nod
|
||||
|
||||
auto from_table_identifier_alias = from_table_identifier.getAlias();
|
||||
|
||||
IdentifierResolveSettings resolve_settings;
|
||||
IdentifierResolveContext resolve_settings;
|
||||
/// In join tree initialization ignore join tree as identifier lookup source
|
||||
resolve_settings.allow_to_check_join_tree = false;
|
||||
/** Disable resolve of subquery during identifier resolution.
|
||||
@ -4713,6 +4665,10 @@ void QueryAnalyzer::resolveTableFunction(QueryTreeNodePtr & table_function_node,
|
||||
|
||||
if (parametrized_view_storage)
|
||||
{
|
||||
/// Remove initial TableFunctionNode from the set. Otherwise it may lead to segfault
|
||||
/// when IdentifierResolveScope::dump() is used.
|
||||
scope.table_expressions_in_resolve_process.erase(table_function_node.get());
|
||||
|
||||
auto fake_table_node = std::make_shared<TableNode>(parametrized_view_storage, scope_context);
|
||||
fake_table_node->setAlias(table_function_node->getAlias());
|
||||
table_function_node = fake_table_node;
|
||||
@ -5181,7 +5137,8 @@ void QueryAnalyzer::resolveJoin(QueryTreeNodePtr & join_node, IdentifierResolveS
|
||||
/// Create ColumnNode with expression from parent projection
|
||||
return std::make_shared<ColumnNode>(
|
||||
NameAndTypePair{identifier_full_name_, resolved_nodes.front()->getResultType()},
|
||||
resolved_nodes.front(), left_table_expression);
|
||||
resolved_nodes.front(),
|
||||
left_table_expression);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5199,7 +5156,7 @@ void QueryAnalyzer::resolveJoin(QueryTreeNodePtr & join_node, IdentifierResolveS
|
||||
|
||||
IdentifierLookup identifier_lookup{identifier_node->getIdentifier(), IdentifierLookupContext::EXPRESSION};
|
||||
if (!result_left_table_expression)
|
||||
result_left_table_expression = identifier_resolver.tryResolveIdentifierFromJoinTreeNode(identifier_lookup, join_node_typed.getLeftTableExpression(), scope);
|
||||
result_left_table_expression = identifier_resolver.tryResolveIdentifierFromJoinTreeNode(identifier_lookup, join_node_typed.getLeftTableExpression(), scope).resolved_identifier;
|
||||
|
||||
/** Here we may try to resolve identifier from projection in case it's not resolved from left table expression
|
||||
* and analyzer_compatibility_join_using_top_level_identifier is disabled.
|
||||
@ -5243,7 +5200,7 @@ void QueryAnalyzer::resolveJoin(QueryTreeNodePtr & join_node, IdentifierResolveS
|
||||
identifier_full_name,
|
||||
scope.scope_node->formatASTForErrorMessage());
|
||||
|
||||
auto result_right_table_expression = identifier_resolver.tryResolveIdentifierFromJoinTreeNode(identifier_lookup, join_node_typed.getRightTableExpression(), scope);
|
||||
auto result_right_table_expression = identifier_resolver.tryResolveIdentifierFromJoinTreeNode(identifier_lookup, join_node_typed.getRightTableExpression(), scope).resolved_identifier;
|
||||
if (!result_right_table_expression)
|
||||
throw Exception(ErrorCodes::UNKNOWN_IDENTIFIER,
|
||||
"JOIN {} using identifier '{}' cannot be resolved from right table expression. In scope {}",
|
||||
@ -5368,6 +5325,7 @@ void QueryAnalyzer::resolveQueryJoinTreeNode(QueryTreeNodePtr & join_tree_node,
|
||||
};
|
||||
|
||||
add_table_expression_alias_into_scope(join_tree_node);
|
||||
scope.registered_table_expression_nodes.insert(join_tree_node);
|
||||
scope.table_expressions_in_resolve_process.erase(join_tree_node.get());
|
||||
}
|
||||
|
||||
@ -5494,7 +5452,6 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
|
||||
bool subquery_is_cte = (subquery_node && subquery_node->isCTE()) || (union_node && union_node->isCTE());
|
||||
if (!subquery_is_cte)
|
||||
continue;
|
||||
|
||||
const auto & cte_name = subquery_node ? subquery_node->getCTEName() : union_node->getCTEName();
|
||||
|
||||
auto [_, inserted] = scope.cte_name_to_query_node.emplace(cte_name, node);
|
||||
@ -5545,7 +5502,6 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
|
||||
* In first join expression ON t1.id = t2.id t1.id is resolved into test_table.id column.
|
||||
* In second join expression ON t1.id = t3.id t1.id must be resolved into test_table.id column after first JOIN.
|
||||
*/
|
||||
scope.use_identifier_lookup_to_result_cache = false;
|
||||
|
||||
TableExpressionsAliasVisitor table_expressions_visitor(scope);
|
||||
table_expressions_visitor.visit(query_node_typed.getJoinTree());
|
||||
@ -5555,9 +5511,6 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
|
||||
|
||||
resolveQueryJoinTreeNode(query_node_typed.getJoinTree(), scope, visitor);
|
||||
|
||||
if (!scope.group_by_use_nulls)
|
||||
scope.use_identifier_lookup_to_result_cache = true;
|
||||
|
||||
/// Resolve query node sections.
|
||||
|
||||
NamesAndTypes projection_columns;
|
||||
@ -5597,13 +5550,6 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
|
||||
if (scope.group_by_use_nulls)
|
||||
{
|
||||
resolved_expressions.clear();
|
||||
/// Clone is needed cause aliases share subtrees.
|
||||
/// If not clone, the same (shared) subtree could be resolved again with different (Nullable) type
|
||||
/// See 03023_group_by_use_nulls_analyzer_crashes
|
||||
for (auto & [key, node] : scope.aliases.alias_name_to_expression_node_before_group_by)
|
||||
scope.aliases.alias_name_to_expression_node_after_group_by[key] = node->clone();
|
||||
|
||||
scope.aliases.alias_name_to_expression_node = &scope.aliases.alias_name_to_expression_node_after_group_by;
|
||||
}
|
||||
|
||||
if (query_node_typed.hasHaving())
|
||||
@ -5686,17 +5632,20 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
|
||||
|
||||
bool has_node_in_alias_table = false;
|
||||
|
||||
auto it = scope.aliases.alias_name_to_expression_node->find(node_alias);
|
||||
if (it != scope.aliases.alias_name_to_expression_node->end())
|
||||
auto it = scope.aliases.alias_name_to_expression_node.find(node_alias);
|
||||
if (it != scope.aliases.alias_name_to_expression_node.end())
|
||||
{
|
||||
has_node_in_alias_table = true;
|
||||
|
||||
bool matched = it->second->isEqual(*node);
|
||||
auto original_node = it->second;
|
||||
resolveExpressionNode(original_node, scope, true /*allow_lambda_expression*/, true /*allow_table_expression*/);
|
||||
|
||||
bool matched = original_node->isEqual(*node);
|
||||
if (!matched)
|
||||
/// Table expression could be resolved as scalar subquery,
|
||||
/// but for duplicating alias we allow table expression to be returned.
|
||||
/// So, check constant node source expression as well.
|
||||
if (const auto * constant_node = it->second->as<ConstantNode>())
|
||||
if (const auto * constant_node = original_node->as<ConstantNode>())
|
||||
if (const auto & source_expression = constant_node->getSourceExpression())
|
||||
matched = source_expression->isEqual(*node);
|
||||
|
||||
@ -5704,7 +5653,7 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
|
||||
throw Exception(ErrorCodes::MULTIPLE_EXPRESSIONS_FOR_ALIAS,
|
||||
"Multiple expressions {} and {} for alias {}. In scope {}",
|
||||
node->formatASTForErrorMessage(),
|
||||
it->second->formatASTForErrorMessage(),
|
||||
original_node->formatASTForErrorMessage(),
|
||||
node_alias,
|
||||
scope.scope_node->formatASTForErrorMessage());
|
||||
}
|
||||
@ -5714,11 +5663,14 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
|
||||
{
|
||||
has_node_in_alias_table = true;
|
||||
|
||||
if (!it->second->isEqual(*node))
|
||||
auto original_node = it->second;
|
||||
resolveExpressionNode(original_node, scope, true /*allow_lambda_expression*/, true /*allow_table_expression*/);
|
||||
|
||||
if (!original_node->isEqual(*node))
|
||||
throw Exception(ErrorCodes::MULTIPLE_EXPRESSIONS_FOR_ALIAS,
|
||||
"Multiple expressions {} and {} for alias {}. In scope {}",
|
||||
node->formatASTForErrorMessage(),
|
||||
it->second->formatASTForErrorMessage(),
|
||||
original_node->formatASTForErrorMessage(),
|
||||
node_alias,
|
||||
scope.scope_node->formatASTForErrorMessage());
|
||||
}
|
||||
@ -5755,7 +5707,10 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
|
||||
|
||||
/// Remove aliases from expression and lambda nodes
|
||||
|
||||
for (auto & [_, node] : *scope.aliases.alias_name_to_expression_node)
|
||||
for (auto & node : scope.aliases.node_to_remove_aliases)
|
||||
node->removeAlias();
|
||||
|
||||
for (auto & [_, node] : scope.aliases.alias_name_to_expression_node)
|
||||
node->removeAlias();
|
||||
|
||||
for (auto & [_, node] : scope.aliases.alias_name_to_lambda_node)
|
||||
|
@ -172,15 +172,15 @@ private:
|
||||
|
||||
/// Resolve identifier functions
|
||||
|
||||
QueryTreeNodePtr tryResolveIdentifierFromAliases(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveResult tryResolveIdentifierFromAliases(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveScope & scope,
|
||||
IdentifierResolveSettings identifier_resolve_settings);
|
||||
IdentifierResolveContext identifier_resolve_context);
|
||||
|
||||
IdentifierResolveResult tryResolveIdentifierInParentScopes(const IdentifierLookup & identifier_lookup, IdentifierResolveScope & scope);
|
||||
IdentifierResolveResult tryResolveIdentifierInParentScopes(const IdentifierLookup & identifier_lookup, IdentifierResolveScope & scope, const IdentifierResolveContext identifier_resolve_settings);
|
||||
|
||||
IdentifierResolveResult tryResolveIdentifier(const IdentifierLookup & identifier_lookup,
|
||||
IdentifierResolveScope & scope,
|
||||
IdentifierResolveSettings identifier_resolve_settings = {});
|
||||
IdentifierResolveContext identifier_resolve_settings = {});
|
||||
|
||||
/// Resolve query tree nodes functions
|
||||
|
||||
@ -195,7 +195,7 @@ private:
|
||||
QueryTreeNodesWithNames getMatchedColumnNodesWithNames(const QueryTreeNodePtr & matcher_node,
|
||||
const QueryTreeNodePtr & table_expression_node,
|
||||
const NamesAndTypes & matched_columns,
|
||||
const IdentifierResolveScope & scope);
|
||||
IdentifierResolveScope & scope);
|
||||
|
||||
void updateMatchedColumnsFromJoinUsing(QueryTreeNodesWithNames & result_matched_column_nodes_with_names, const QueryTreeNodePtr & source_table_expression, IdentifierResolveScope & scope);
|
||||
|
||||
@ -249,7 +249,7 @@ private:
|
||||
void resolveUnion(const QueryTreeNodePtr & union_node, IdentifierResolveScope & scope);
|
||||
|
||||
/// Lambdas that are currently in resolve process
|
||||
std::unordered_set<IQueryTreeNode *> lambdas_in_resolve_process;
|
||||
QueryTreeNodePtrWithHashSet lambdas_in_resolve_process;
|
||||
|
||||
/// CTEs that are currently in resolve process
|
||||
std::unordered_set<std::string_view> ctes_in_resolve_process;
|
||||
|
@ -91,7 +91,7 @@ private:
|
||||
|
||||
if (is_lambda_node)
|
||||
{
|
||||
if (aliases.alias_name_to_expression_node->contains(alias))
|
||||
if (aliases.alias_name_to_expression_node.contains(alias))
|
||||
addDuplicatingAlias(node);
|
||||
|
||||
auto [_, inserted] = aliases.alias_name_to_lambda_node.insert(std::make_pair(alias, node));
|
||||
@ -104,7 +104,7 @@ private:
|
||||
if (aliases.alias_name_to_lambda_node.contains(alias))
|
||||
addDuplicatingAlias(node);
|
||||
|
||||
auto [_, inserted] = aliases.alias_name_to_expression_node->insert(std::make_pair(alias, node));
|
||||
auto [_, inserted] = aliases.alias_name_to_expression_node.insert(std::make_pair(alias, node));
|
||||
if (!inserted)
|
||||
addDuplicatingAlias(node);
|
||||
|
||||
|
@ -9,10 +9,7 @@ namespace DB
|
||||
struct ScopeAliases
|
||||
{
|
||||
/// Alias name to query expression node
|
||||
std::unordered_map<std::string, QueryTreeNodePtr> alias_name_to_expression_node_before_group_by;
|
||||
std::unordered_map<std::string, QueryTreeNodePtr> alias_name_to_expression_node_after_group_by;
|
||||
|
||||
std::unordered_map<std::string, QueryTreeNodePtr> * alias_name_to_expression_node = nullptr;
|
||||
std::unordered_map<std::string, QueryTreeNodePtr> alias_name_to_expression_node;
|
||||
|
||||
/// Alias name to lambda node
|
||||
std::unordered_map<std::string, QueryTreeNodePtr> alias_name_to_lambda_node;
|
||||
@ -27,6 +24,11 @@ struct ScopeAliases
|
||||
std::unordered_set<QueryTreeNodePtr> nodes_with_duplicated_aliases;
|
||||
std::vector<QueryTreeNodePtr> cloned_nodes_with_duplicated_aliases;
|
||||
|
||||
/// Cloned resolved expressions with aliases that must be removed
|
||||
QueryTreeNodes node_to_remove_aliases;
|
||||
|
||||
std::unordered_map<std::string, DataTypePtr> alias_name_to_expression_type;
|
||||
|
||||
/// Names which are aliases from ARRAY JOIN.
|
||||
/// This is needed to properly qualify columns from matchers and avoid name collision.
|
||||
std::unordered_set<std::string> array_join_aliases;
|
||||
@ -35,7 +37,7 @@ struct ScopeAliases
|
||||
{
|
||||
switch (lookup_context)
|
||||
{
|
||||
case IdentifierLookupContext::EXPRESSION: return *alias_name_to_expression_node;
|
||||
case IdentifierLookupContext::EXPRESSION: return alias_name_to_expression_node;
|
||||
case IdentifierLookupContext::FUNCTION: return alias_name_to_lambda_node;
|
||||
case IdentifierLookupContext::TABLE_EXPRESSION: return alias_name_to_table_expression_node;
|
||||
}
|
||||
|
@ -54,22 +54,21 @@ struct AnalysisTableExpressionData
|
||||
|
||||
[[maybe_unused]] void dump(WriteBuffer & buffer) const
|
||||
{
|
||||
buffer << "Table expression name " << table_expression_name;
|
||||
buffer << " Table expression name '" << table_expression_name << "'";
|
||||
|
||||
if (!table_expression_description.empty())
|
||||
buffer << " table expression description " << table_expression_description;
|
||||
buffer << ", description '" << table_expression_description << "'\n";
|
||||
|
||||
if (!database_name.empty())
|
||||
buffer << " database name " << database_name;
|
||||
buffer << " database name '" << database_name << "'\n";
|
||||
|
||||
if (!table_name.empty())
|
||||
buffer << " table name " << table_name;
|
||||
|
||||
buffer << " should qualify columns " << should_qualify_columns;
|
||||
buffer << " columns size " << column_name_to_column_node.size() << '\n';
|
||||
buffer << " table name '" << table_name << "'\n";
|
||||
|
||||
buffer << " Should qualify columns " << should_qualify_columns << "\n";
|
||||
buffer << " Columns size " << column_name_to_column_node.size() << "\n";
|
||||
for (const auto & [column_name, column_node] : column_name_to_column_node)
|
||||
buffer << "Column name " << column_name << " column node " << column_node->dumpTree() << '\n';
|
||||
buffer << " { " << column_name << " : " << column_node->dumpTree() << " }\n";
|
||||
}
|
||||
|
||||
[[maybe_unused]] String dump() const
|
||||
|
@ -22,18 +22,20 @@
|
||||
|
||||
#include <Interpreters/Context.h>
|
||||
|
||||
#include <Analyzer/InDepthQueryTreeVisitor.h>
|
||||
#include <Analyzer/IdentifierNode.h>
|
||||
#include <Analyzer/ConstantNode.h>
|
||||
#include <Analyzer/ColumnNode.h>
|
||||
#include <Analyzer/FunctionNode.h>
|
||||
#include <Analyzer/JoinNode.h>
|
||||
#include <Analyzer/ArrayJoinNode.h>
|
||||
#include <Analyzer/TableNode.h>
|
||||
#include <Analyzer/TableFunctionNode.h>
|
||||
#include <Analyzer/ColumnNode.h>
|
||||
#include <Analyzer/ConstantNode.h>
|
||||
#include <Analyzer/FunctionNode.h>
|
||||
#include <Analyzer/IdentifierNode.h>
|
||||
#include <Analyzer/InDepthQueryTreeVisitor.h>
|
||||
#include <Analyzer/JoinNode.h>
|
||||
#include <Analyzer/QueryNode.h>
|
||||
#include <Analyzer/TableFunctionNode.h>
|
||||
#include <Analyzer/TableNode.h>
|
||||
#include <Analyzer/UnionNode.h>
|
||||
|
||||
#include <Analyzer/Resolve/IdentifierResolveScope.h>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
namespace Setting
|
||||
@ -204,6 +206,27 @@ bool isQueryOrUnionNode(const QueryTreeNodePtr & node)
|
||||
return isQueryOrUnionNode(node.get());
|
||||
}
|
||||
|
||||
bool isDependentColumn(IdentifierResolveScope * scope_to_check, const QueryTreeNodePtr & column_source)
|
||||
{
|
||||
/// The case of lambda argument. Example:
|
||||
/// arrayMap(X -> X + Y, [0])
|
||||
///
|
||||
/// X would have lambda as a source node
|
||||
/// Y comes from outer scope and requires ordinary check.
|
||||
if (column_source->getNodeType() == QueryTreeNodeType::LAMBDA)
|
||||
return false;
|
||||
|
||||
while (scope_to_check != nullptr)
|
||||
{
|
||||
if (scope_to_check->registered_table_expression_nodes.contains(column_source))
|
||||
return false;
|
||||
if (isQueryOrUnionNode(scope_to_check->scope_node))
|
||||
return true;
|
||||
scope_to_check = scope_to_check->parent_scope;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QueryTreeNodePtr buildCastFunction(const QueryTreeNodePtr & expression,
|
||||
const DataTypePtr & type,
|
||||
const ContextPtr & context,
|
||||
|
@ -12,6 +12,7 @@ namespace DB
|
||||
{
|
||||
|
||||
class FunctionNode;
|
||||
struct IdentifierResolveScope;
|
||||
|
||||
/// Returns true if node part of root tree, false otherwise
|
||||
bool isNodePartOfTree(const IQueryTreeNode * node, const IQueryTreeNode * root);
|
||||
@ -40,6 +41,11 @@ bool isQueryOrUnionNode(const IQueryTreeNode * node);
|
||||
/// Returns true, if node has type QUERY or UNION
|
||||
bool isQueryOrUnionNode(const QueryTreeNodePtr & node);
|
||||
|
||||
/* Returns true, if coulmn source is not registered in scopes that appear
|
||||
* before nearest query scope.
|
||||
*/
|
||||
bool isDependentColumn(IdentifierResolveScope * scope_to_check, const QueryTreeNodePtr & column_source);
|
||||
|
||||
/** Build cast function that cast expression into type.
|
||||
* If resolve = true, then result cast function is resolved during build, otherwise
|
||||
* result cast function is not resolved during build.
|
||||
|
@ -40,6 +40,6 @@ QUERY id: 0
|
||||
FUNCTION id: 10, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 11, nodes: 2
|
||||
COLUMN id: 8, column_name: g, result_type: String, source_id: 3
|
||||
CONSTANT id: 12, constant_value: \'6\', constant_value_type: String
|
||||
COLUMN id: 12, column_name: g, result_type: String, source_id: 3
|
||||
CONSTANT id: 13, constant_value: \'6\', constant_value_type: String
|
||||
SETTINGS enable_analyzer=1
|
||||
|
@ -132,24 +132,24 @@ QUERY id: 0
|
||||
FUNCTION id: 4, function_name: in, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 5, nodes: 2
|
||||
COLUMN id: 2, column_name: k, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 6, constant_value: Tuple_(UInt64_1, UInt64_2, UInt64_3), constant_value_type: Tuple(UInt8, UInt8, UInt8)
|
||||
COLUMN id: 7, column_name: s, result_type: UInt64, source_id: 3
|
||||
FUNCTION id: 8, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
COLUMN id: 6, column_name: k, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 7, constant_value: Tuple_(UInt64_1, UInt64_2, UInt64_3), constant_value_type: Tuple(UInt8, UInt8, UInt8)
|
||||
COLUMN id: 8, column_name: s, result_type: UInt64, source_id: 3
|
||||
FUNCTION id: 9, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 9, nodes: 2
|
||||
COLUMN id: 7, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 10, constant_value: UInt64_21, constant_value_type: UInt8
|
||||
FUNCTION id: 11, function_name: in, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 10, nodes: 2
|
||||
COLUMN id: 11, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 12, constant_value: UInt64_21, constant_value_type: UInt8
|
||||
FUNCTION id: 13, function_name: in, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
COLUMN id: 7, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 13, constant_value: Tuple_(UInt64_21, UInt64_22), constant_value_type: Tuple(UInt8, UInt8)
|
||||
FUNCTION id: 14, function_name: in, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 14, nodes: 2
|
||||
COLUMN id: 15, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 16, constant_value: Tuple_(UInt64_21, UInt64_22), constant_value_type: Tuple(UInt8, UInt8)
|
||||
FUNCTION id: 17, function_name: in, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 15, nodes: 2
|
||||
COLUMN id: 7, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 16, constant_value: Tuple_(UInt64_21, UInt64_22, UInt64_23), constant_value_type: Tuple(UInt8, UInt8, UInt8)
|
||||
LIST id: 18, nodes: 2
|
||||
COLUMN id: 19, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 20, constant_value: Tuple_(UInt64_21, UInt64_22, UInt64_23), constant_value_type: Tuple(UInt8, UInt8, UInt8)
|
||||
JOIN TREE
|
||||
TABLE id: 3, alias: __table1, table_name: default.bug
|
||||
SETTINGS enable_analyzer=1
|
||||
@ -181,8 +181,8 @@ QUERY id: 0
|
||||
FUNCTION id: 4, function_name: in, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 5, nodes: 2
|
||||
COLUMN id: 2, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 6, constant_value: Tuple_(UInt64_21, UInt64_22, UInt64_23), constant_value_type: Tuple(UInt8, UInt8, UInt8)
|
||||
COLUMN id: 6, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 7, constant_value: Tuple_(UInt64_21, UInt64_22, UInt64_23), constant_value_type: Tuple(UInt8, UInt8, UInt8)
|
||||
JOIN TREE
|
||||
TABLE id: 3, alias: __table1, table_name: default.bug
|
||||
SETTINGS enable_analyzer=1
|
||||
@ -320,32 +320,32 @@ QUERY id: 0
|
||||
FUNCTION id: 4, function_name: in, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 5, nodes: 2
|
||||
COLUMN id: 2, column_name: k, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 6, constant_value: Tuple_(UInt64_1, UInt64_2, UInt64_3), constant_value_type: Tuple(UInt8, UInt8, UInt8)
|
||||
COLUMN id: 7, column_name: s, result_type: UInt64, source_id: 3
|
||||
FUNCTION id: 8, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
COLUMN id: 6, column_name: k, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 7, constant_value: Tuple_(UInt64_1, UInt64_2, UInt64_3), constant_value_type: Tuple(UInt8, UInt8, UInt8)
|
||||
COLUMN id: 8, column_name: s, result_type: UInt64, source_id: 3
|
||||
FUNCTION id: 9, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 9, nodes: 2
|
||||
COLUMN id: 7, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 10, constant_value: UInt64_21, constant_value_type: UInt8
|
||||
FUNCTION id: 11, function_name: or, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 10, nodes: 2
|
||||
COLUMN id: 11, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 12, constant_value: UInt64_21, constant_value_type: UInt8
|
||||
FUNCTION id: 13, function_name: or, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
FUNCTION id: 13, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 14, nodes: 2
|
||||
FUNCTION id: 15, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 14, nodes: 2
|
||||
COLUMN id: 7, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 15, constant_value: UInt64_21, constant_value_type: UInt8
|
||||
FUNCTION id: 16, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 16, nodes: 2
|
||||
COLUMN id: 17, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 18, constant_value: UInt64_21, constant_value_type: UInt8
|
||||
FUNCTION id: 19, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 17, nodes: 2
|
||||
COLUMN id: 7, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 18, constant_value: UInt64_22, constant_value_type: UInt8
|
||||
FUNCTION id: 19, function_name: in, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 20, nodes: 2
|
||||
COLUMN id: 21, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 22, constant_value: UInt64_22, constant_value_type: UInt8
|
||||
FUNCTION id: 23, function_name: in, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 20, nodes: 2
|
||||
COLUMN id: 7, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 21, constant_value: Tuple_(UInt64_21, UInt64_22, UInt64_23), constant_value_type: Tuple(UInt8, UInt8, UInt8)
|
||||
LIST id: 24, nodes: 2
|
||||
COLUMN id: 25, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 26, constant_value: Tuple_(UInt64_21, UInt64_22, UInt64_23), constant_value_type: Tuple(UInt8, UInt8, UInt8)
|
||||
JOIN TREE
|
||||
TABLE id: 3, alias: __table1, table_name: default.bug
|
||||
SETTINGS enable_analyzer=1
|
||||
@ -377,8 +377,8 @@ QUERY id: 0
|
||||
FUNCTION id: 4, function_name: in, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 5, nodes: 2
|
||||
COLUMN id: 2, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 6, constant_value: Tuple_(UInt64_21, UInt64_22, UInt64_23), constant_value_type: Tuple(UInt8, UInt8, UInt8)
|
||||
COLUMN id: 6, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 7, constant_value: Tuple_(UInt64_21, UInt64_22, UInt64_23), constant_value_type: Tuple(UInt8, UInt8, UInt8)
|
||||
JOIN TREE
|
||||
TABLE id: 3, alias: __table1, table_name: default.bug
|
||||
SETTINGS enable_analyzer=1
|
||||
@ -410,8 +410,8 @@ QUERY id: 0
|
||||
FUNCTION id: 4, function_name: in, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 5, nodes: 2
|
||||
COLUMN id: 2, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 6, constant_value: Tuple_(UInt64_21, UInt64_22, UInt64_23), constant_value_type: Tuple(UInt8, UInt8, UInt8)
|
||||
COLUMN id: 6, column_name: s, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 7, constant_value: Tuple_(UInt64_21, UInt64_22, UInt64_23), constant_value_type: Tuple(UInt8, UInt8, UInt8)
|
||||
JOIN TREE
|
||||
TABLE id: 3, alias: __table1, table_name: default.bug
|
||||
SETTINGS enable_analyzer=1
|
||||
|
@ -63,43 +63,43 @@ QUERY id: 0
|
||||
FUNCTION id: 19, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 20, nodes: 2
|
||||
COLUMN id: 17, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 21, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
COLUMN id: 21, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 22, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
HAVING
|
||||
FUNCTION id: 22, function_name: greater, function_type: ordinary, result_type: UInt8
|
||||
FUNCTION id: 23, function_name: greater, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 23, nodes: 2
|
||||
FUNCTION id: 24, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
LIST id: 24, nodes: 2
|
||||
FUNCTION id: 25, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 25, nodes: 2
|
||||
CONSTANT id: 26, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
LIST id: 26, nodes: 2
|
||||
CONSTANT id: 27, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
EXPRESSION
|
||||
FUNCTION id: 27, function_name: log, function_type: ordinary, result_type: Float64
|
||||
FUNCTION id: 28, function_name: log, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 28, nodes: 1
|
||||
CONSTANT id: 29, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 30, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
LIST id: 29, nodes: 1
|
||||
CONSTANT id: 30, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 31, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 31, nodes: 1
|
||||
COLUMN id: 32, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 33, constant_value: Float64_3465735.3, constant_value_type: Float64
|
||||
LIST id: 32, nodes: 1
|
||||
COLUMN id: 33, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 34, constant_value: Float64_3465735.3, constant_value_type: Float64
|
||||
ORDER BY
|
||||
LIST id: 34, nodes: 1
|
||||
SORT id: 35, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 35, nodes: 1
|
||||
SORT id: 36, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 36, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
FUNCTION id: 37, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 37, nodes: 2
|
||||
CONSTANT id: 38, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
LIST id: 38, nodes: 2
|
||||
CONSTANT id: 39, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
EXPRESSION
|
||||
FUNCTION id: 5, function_name: log, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 6, nodes: 1
|
||||
CONSTANT id: 7, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 39, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
FUNCTION id: 40, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 40, nodes: 1
|
||||
COLUMN id: 41, column_name: number, result_type: UInt64, source_id: 11
|
||||
LIST id: 41, nodes: 1
|
||||
COLUMN id: 42, column_name: number, result_type: UInt64, source_id: 11
|
||||
SELECT avg(log(2) * number) AS k
|
||||
FROM numbers(10000000)
|
||||
WHERE ((number % 5) * (number % 5)) < 5
|
||||
@ -145,31 +145,31 @@ QUERY id: 0
|
||||
FUNCTION id: 23, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 24, nodes: 2
|
||||
COLUMN id: 17, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 25, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
FUNCTION id: 26, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
COLUMN id: 25, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 26, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
FUNCTION id: 27, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 27, nodes: 2
|
||||
COLUMN id: 17, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 28, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
CONSTANT id: 29, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
LIST id: 28, nodes: 2
|
||||
COLUMN id: 29, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 30, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
CONSTANT id: 31, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
ORDER BY
|
||||
LIST id: 30, nodes: 1
|
||||
SORT id: 31, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 32, nodes: 1
|
||||
SORT id: 33, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 32, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
FUNCTION id: 34, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 33, nodes: 2
|
||||
CONSTANT id: 34, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
LIST id: 35, nodes: 2
|
||||
CONSTANT id: 36, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
EXPRESSION
|
||||
FUNCTION id: 5, function_name: log, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 6, nodes: 1
|
||||
CONSTANT id: 7, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 35, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
FUNCTION id: 37, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 36, nodes: 1
|
||||
COLUMN id: 37, column_name: number, result_type: UInt64, source_id: 11
|
||||
LIST id: 38, nodes: 1
|
||||
COLUMN id: 39, column_name: number, result_type: UInt64, source_id: 11
|
||||
SELECT (number % 5) * (number % 5) AS k
|
||||
FROM numbers(10000000)
|
||||
WHERE ((number % 5) * (number % 5)) < 5
|
||||
@ -191,55 +191,55 @@ QUERY id: 0
|
||||
FUNCTION id: 9, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 10, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 11, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
COLUMN id: 11, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 12, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 7, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 1
|
||||
CONSTANT id: 13, constant_value: UInt64_10000000, constant_value_type: UInt32
|
||||
LIST id: 13, nodes: 1
|
||||
CONSTANT id: 14, constant_value: UInt64_10000000, constant_value_type: UInt32
|
||||
GROUP BY
|
||||
LIST id: 14, nodes: 1
|
||||
FUNCTION id: 15, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 15, nodes: 1
|
||||
FUNCTION id: 16, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 16, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 17, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
LIST id: 17, nodes: 2
|
||||
COLUMN id: 18, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 19, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
HAVING
|
||||
FUNCTION id: 18, function_name: less, function_type: ordinary, result_type: UInt8
|
||||
FUNCTION id: 20, function_name: less, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 19, nodes: 2
|
||||
FUNCTION id: 20, function_name: multiply, function_type: ordinary, result_type: UInt16
|
||||
LIST id: 21, nodes: 2
|
||||
FUNCTION id: 22, function_name: multiply, function_type: ordinary, result_type: UInt16
|
||||
ARGUMENTS
|
||||
LIST id: 21, nodes: 2
|
||||
FUNCTION id: 22, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 23, nodes: 2
|
||||
FUNCTION id: 24, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 23, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 24, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
FUNCTION id: 25, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 26, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
LIST id: 25, nodes: 2
|
||||
COLUMN id: 26, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 27, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
CONSTANT id: 28, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
FUNCTION id: 28, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 29, nodes: 2
|
||||
COLUMN id: 30, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 31, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
CONSTANT id: 32, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
ORDER BY
|
||||
LIST id: 29, nodes: 1
|
||||
SORT id: 30, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 33, nodes: 1
|
||||
SORT id: 34, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 2, function_name: multiply, function_type: ordinary, result_type: UInt16
|
||||
FUNCTION id: 35, function_name: multiply, function_type: ordinary, result_type: UInt16
|
||||
ARGUMENTS
|
||||
LIST id: 3, nodes: 2
|
||||
FUNCTION id: 4, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 36, nodes: 2
|
||||
FUNCTION id: 37, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 5, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 8, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
FUNCTION id: 9, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 38, nodes: 2
|
||||
COLUMN id: 39, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 40, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
FUNCTION id: 41, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 10, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 11, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
LIST id: 42, nodes: 2
|
||||
COLUMN id: 43, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 44, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
3465735.9028
|
||||
3465735.9028
|
||||
3465736.595947
|
||||
@ -293,53 +293,53 @@ QUERY id: 0
|
||||
FUNCTION id: 21, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 22, nodes: 2
|
||||
COLUMN id: 19, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 23, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
FUNCTION id: 24, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
COLUMN id: 23, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 24, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
FUNCTION id: 25, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 25, nodes: 2
|
||||
COLUMN id: 19, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 26, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
FUNCTION id: 27, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 26, nodes: 2
|
||||
COLUMN id: 27, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 28, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
FUNCTION id: 29, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 28, nodes: 2
|
||||
COLUMN id: 19, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 29, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
LIST id: 30, nodes: 2
|
||||
COLUMN id: 31, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 32, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
HAVING
|
||||
FUNCTION id: 30, function_name: greater, function_type: ordinary, result_type: UInt8
|
||||
FUNCTION id: 33, function_name: greater, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 31, nodes: 2
|
||||
FUNCTION id: 32, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
LIST id: 34, nodes: 2
|
||||
FUNCTION id: 35, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 33, nodes: 2
|
||||
CONSTANT id: 34, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
LIST id: 36, nodes: 2
|
||||
CONSTANT id: 37, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
EXPRESSION
|
||||
FUNCTION id: 35, function_name: log, function_type: ordinary, result_type: Float64
|
||||
FUNCTION id: 38, function_name: log, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 36, nodes: 1
|
||||
CONSTANT id: 37, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 38, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
LIST id: 39, nodes: 1
|
||||
CONSTANT id: 40, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 41, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 39, nodes: 1
|
||||
COLUMN id: 40, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 41, constant_value: Float64_3465735.3, constant_value_type: Float64
|
||||
LIST id: 42, nodes: 1
|
||||
COLUMN id: 43, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 44, constant_value: Float64_3465735.3, constant_value_type: Float64
|
||||
ORDER BY
|
||||
LIST id: 42, nodes: 1
|
||||
SORT id: 43, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 45, nodes: 1
|
||||
SORT id: 46, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 44, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
FUNCTION id: 47, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 45, nodes: 2
|
||||
CONSTANT id: 46, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
LIST id: 48, nodes: 2
|
||||
CONSTANT id: 49, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
EXPRESSION
|
||||
FUNCTION id: 5, function_name: log, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 6, nodes: 1
|
||||
CONSTANT id: 7, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 47, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
FUNCTION id: 50, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 48, nodes: 1
|
||||
COLUMN id: 49, column_name: number, result_type: UInt64, source_id: 11
|
||||
LIST id: 51, nodes: 1
|
||||
COLUMN id: 52, column_name: number, result_type: UInt64, source_id: 11
|
||||
SELECT avg(log(2) * number) AS k
|
||||
FROM numbers(10000000)
|
||||
WHERE ((number % 5) * (number % 5)) < 5
|
||||
|
@ -64,7 +64,7 @@ QUERY id: 0
|
||||
LIST id: 11, nodes: 1
|
||||
SORT id: 12, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
COLUMN id: 7, column_name: number, result_type: UInt64, source_id: 8
|
||||
COLUMN id: 13, column_name: number, result_type: UInt64, source_id: 8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT groupArray(x)
|
||||
FROM
|
||||
@ -98,7 +98,7 @@ QUERY id: 0
|
||||
LIST id: 11, nodes: 1
|
||||
SORT id: 12, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
COLUMN id: 7, column_name: number, result_type: UInt64, source_id: 8
|
||||
COLUMN id: 13, column_name: number, result_type: UInt64, source_id: 8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT groupArray(x)
|
||||
FROM
|
||||
@ -137,10 +137,10 @@ QUERY id: 0
|
||||
FUNCTION id: 13, function_name: exp, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 14, nodes: 1
|
||||
COLUMN id: 7, column_name: number, result_type: UInt64, source_id: 8
|
||||
SORT id: 15, sort_direction: ASCENDING, with_fill: 0
|
||||
COLUMN id: 15, column_name: number, result_type: UInt64, source_id: 8
|
||||
SORT id: 16, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
COLUMN id: 7, column_name: number, result_type: UInt64, source_id: 8
|
||||
COLUMN id: 17, column_name: number, result_type: UInt64, source_id: 8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT
|
||||
key,
|
||||
@ -225,10 +225,10 @@ QUERY id: 0
|
||||
LIST id: 5, nodes: 2
|
||||
SORT id: 6, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
COLUMN id: 2, column_name: key, result_type: UInt64, source_id: 3
|
||||
SORT id: 7, sort_direction: ASCENDING, with_fill: 0
|
||||
COLUMN id: 7, column_name: key, result_type: UInt64, source_id: 3
|
||||
SORT id: 8, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
COLUMN id: 4, column_name: a, result_type: UInt8, source_id: 3
|
||||
COLUMN id: 9, column_name: a, result_type: UInt8, source_id: 3
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT
|
||||
key,
|
||||
@ -251,17 +251,17 @@ QUERY id: 0
|
||||
LIST id: 5, nodes: 2
|
||||
SORT id: 6, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
COLUMN id: 2, column_name: key, result_type: UInt64, source_id: 3
|
||||
SORT id: 7, sort_direction: ASCENDING, with_fill: 0
|
||||
COLUMN id: 7, column_name: key, result_type: UInt64, source_id: 3
|
||||
SORT id: 8, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 8, function_name: exp, function_type: ordinary, result_type: Float64
|
||||
FUNCTION id: 9, function_name: exp, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 9, nodes: 1
|
||||
FUNCTION id: 10, function_name: plus, function_type: ordinary, result_type: UInt64
|
||||
LIST id: 10, nodes: 1
|
||||
FUNCTION id: 11, function_name: plus, function_type: ordinary, result_type: UInt64
|
||||
ARGUMENTS
|
||||
LIST id: 11, nodes: 2
|
||||
COLUMN id: 2, column_name: key, result_type: UInt64, source_id: 3
|
||||
COLUMN id: 4, column_name: a, result_type: UInt8, source_id: 3
|
||||
LIST id: 12, nodes: 2
|
||||
COLUMN id: 13, column_name: key, result_type: UInt64, source_id: 3
|
||||
COLUMN id: 14, column_name: a, result_type: UInt8, source_id: 3
|
||||
SETTINGS enable_analyzer=1
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
@ -273,18 +273,18 @@ QUERY id: 0
|
||||
TABLE id: 3, alias: __table1, table_name: default.test
|
||||
GROUP BY
|
||||
LIST id: 4, nodes: 1
|
||||
COLUMN id: 2, column_name: key, result_type: UInt64, source_id: 3
|
||||
COLUMN id: 5, column_name: key, result_type: UInt64, source_id: 3
|
||||
ORDER BY
|
||||
LIST id: 5, nodes: 2
|
||||
SORT id: 6, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 6, nodes: 2
|
||||
SORT id: 7, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 7, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
FUNCTION id: 8, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 8, nodes: 1
|
||||
COLUMN id: 9, column_name: a, result_type: UInt8, source_id: 3
|
||||
SORT id: 10, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 9, nodes: 1
|
||||
COLUMN id: 10, column_name: a, result_type: UInt8, source_id: 3
|
||||
SORT id: 11, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
COLUMN id: 2, column_name: key, result_type: UInt64, source_id: 3
|
||||
COLUMN id: 12, column_name: key, result_type: UInt64, source_id: 3
|
||||
SETTINGS enable_analyzer=1
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
|
@ -20,5 +20,5 @@ QUERY id: 0
|
||||
CONSTANT id: 9, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
GROUP BY
|
||||
LIST id: 10, nodes: 1
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
COLUMN id: 11, column_name: number, result_type: UInt64, source_id: 7
|
||||
SETTINGS enable_analyzer=1
|
||||
|
@ -75,6 +75,25 @@ DROP TABLE IF EXISTS trace_log;
|
||||
|
||||
SYSTEM FLUSH LOGS;
|
||||
|
||||
WITH
|
||||
(
|
||||
SELECT query_start_time_microseconds
|
||||
FROM system.query_log
|
||||
WHERE current_database = currentDatabase()
|
||||
ORDER BY query_start_time DESC
|
||||
LIMIT 1
|
||||
) AS time_with_microseconds,
|
||||
(
|
||||
SELECT
|
||||
inf,
|
||||
query_start_time
|
||||
FROM system.query_log
|
||||
WHERE current_database = currentDatabase()
|
||||
ORDER BY query_start_time DESC
|
||||
LIMIT 1
|
||||
) AS t
|
||||
SELECT if(dateDiff('second', toDateTime(time_with_microseconds), toDateTime(t)) = -9223372036854775808, 'ok', ''); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
|
||||
|
||||
WITH (
|
||||
(
|
||||
SELECT query_start_time_microseconds
|
||||
@ -92,7 +111,8 @@ WITH (
|
||||
ORDER BY query_start_time DESC
|
||||
LIMIT 1
|
||||
) AS t)
|
||||
SELECT if(dateDiff('second', toDateTime(time_with_microseconds), toDateTime(t)) = -9223372036854775808, 'ok', ''); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
|
||||
SELECT if(dateDiff('second', toDateTime(time_with_microseconds), toDateTime(t)) = -9223372036854775808, 'ok', '')
|
||||
SETTINGS allow_experimental_analyzer = 1; -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
|
||||
|
||||
WITH (
|
||||
(
|
||||
|
@ -39,7 +39,7 @@
|
||||
89 89 89 89 5
|
||||
94 94 94 94 5
|
||||
99 99 99 99 5
|
||||
02177_MV 0 0 22
|
||||
02177_MV 2 63 22
|
||||
10
|
||||
40
|
||||
70
|
||||
|
@ -19,27 +19,27 @@ QUERY id: 0
|
||||
FUNCTION id: 8, function_name: like, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 9, nodes: 2
|
||||
FUNCTION id: 2, function_name: materialize, function_type: ordinary, result_type: String
|
||||
FUNCTION id: 10, function_name: materialize, function_type: ordinary, result_type: String
|
||||
ARGUMENTS
|
||||
LIST id: 3, nodes: 1
|
||||
CONSTANT id: 4, constant_value: \'Привет, World\', constant_value_type: String
|
||||
CONSTANT id: 10, constant_value: \'hell%\', constant_value_type: String
|
||||
FUNCTION id: 11, function_name: ilike, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
FUNCTION id: 2, function_name: materialize, function_type: ordinary, result_type: String
|
||||
ARGUMENTS
|
||||
LIST id: 3, nodes: 1
|
||||
CONSTANT id: 4, constant_value: \'Привет, World\', constant_value_type: String
|
||||
CONSTANT id: 13, constant_value: \'%привет%\', constant_value_type: String
|
||||
LIST id: 11, nodes: 1
|
||||
CONSTANT id: 12, constant_value: \'Привет, World\', constant_value_type: String
|
||||
CONSTANT id: 13, constant_value: \'hell%\', constant_value_type: String
|
||||
FUNCTION id: 14, function_name: ilike, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 15, nodes: 2
|
||||
FUNCTION id: 2, function_name: materialize, function_type: ordinary, result_type: String
|
||||
FUNCTION id: 16, function_name: materialize, function_type: ordinary, result_type: String
|
||||
ARGUMENTS
|
||||
LIST id: 3, nodes: 1
|
||||
CONSTANT id: 4, constant_value: \'Привет, World\', constant_value_type: String
|
||||
CONSTANT id: 16, constant_value: \'world%\', constant_value_type: String
|
||||
LIST id: 17, nodes: 1
|
||||
CONSTANT id: 18, constant_value: \'Привет, World\', constant_value_type: String
|
||||
CONSTANT id: 19, constant_value: \'%привет%\', constant_value_type: String
|
||||
FUNCTION id: 20, function_name: ilike, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 21, nodes: 2
|
||||
FUNCTION id: 22, function_name: materialize, function_type: ordinary, result_type: String
|
||||
ARGUMENTS
|
||||
LIST id: 23, nodes: 1
|
||||
CONSTANT id: 24, constant_value: \'Привет, World\', constant_value_type: String
|
||||
CONSTANT id: 25, constant_value: \'world%\', constant_value_type: String
|
||||
SETTINGS optimize_or_like_chain=0 enable_analyzer=1
|
||||
SELECT materialize(\'Привет, World\') AS s
|
||||
WHERE multiMatchAny(s, [\'^hell\', \'(?i)привет\', \'(?i)^world\']) OR false
|
||||
@ -62,12 +62,12 @@ QUERY id: 0
|
||||
FUNCTION id: 8, function_name: multiMatchAny, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 9, nodes: 2
|
||||
FUNCTION id: 2, function_name: materialize, function_type: ordinary, result_type: String
|
||||
FUNCTION id: 10, function_name: materialize, function_type: ordinary, result_type: String
|
||||
ARGUMENTS
|
||||
LIST id: 3, nodes: 1
|
||||
CONSTANT id: 4, constant_value: \'Привет, World\', constant_value_type: String
|
||||
CONSTANT id: 10, constant_value: Array_[\'^hell\', \'(?i)привет\', \'(?i)^world\'], constant_value_type: Array(String)
|
||||
CONSTANT id: 11, constant_value: UInt64_0, constant_value_type: UInt8
|
||||
LIST id: 11, nodes: 1
|
||||
CONSTANT id: 12, constant_value: \'Привет, World\', constant_value_type: String
|
||||
CONSTANT id: 13, constant_value: Array_[\'^hell\', \'(?i)привет\', \'(?i)^world\'], constant_value_type: Array(String)
|
||||
CONSTANT id: 14, constant_value: UInt64_0, constant_value_type: UInt8
|
||||
SETTINGS optimize_or_like_chain=1 enable_analyzer=1
|
||||
SELECT
|
||||
materialize(\'Привет, World\') AS s1,
|
||||
|
@ -4,7 +4,7 @@ SELECT c1, c2, c3, c4 FROM format('CSV', '1,2,"[1,2,3]","[[\'abc\'], [], [\'d\',
|
||||
SELECT f.c1, f.c2, f.c3, f.c4 FROM format('CSV', '1,2,"[1,2,3]","[[\'abc\'], [], [\'d\', \'e\']]"') AS f;
|
||||
SELECT f.* FROM format('CSV', '1,2,"[1,2,3]","[[\'abc\'], [], [\'d\', \'e\']]"') AS f;
|
||||
|
||||
WITH 'CSV', '1,2,"[1,2,3]","[[\'abc\'], [], [\'d\', \'e\']]"' AS format_value SELECT c1, c2, c3, c4 FROM format('CSV', format_value);
|
||||
WITH 'CSV' as format_name, '1,2,"[1,2,3]","[[\'abc\'], [], [\'d\', \'e\']]"' AS format_value SELECT c1, c2, c3, c4 FROM format('CSV', format_value);
|
||||
WITH concat('1,2,"[1,2,3]",','"[[\'abc\'], [], [\'d\', \'e\']]"') AS format_value SELECT c1, c2, c3, c4 FROM format('CSV', format_value);
|
||||
|
||||
SELECT format, format_value, c1, c2, c3, c4 FROM format('CSV' AS format, '1,2,"[1,2,3]","[[\'abc\'], [], [\'d\', \'e\']]"' AS format_value);
|
||||
|
@ -82,12 +82,12 @@ SELECT id, value, value_array, value_array_element FROM test_table ARRAY JOIN va
|
||||
SELECT '--';
|
||||
--
|
||||
SELECT id, value, value_array AS value_array_array_alias FROM test_table ARRAY JOIN value_array_array_alias;
|
||||
0 Value [1,2,3]
|
||||
0 Value [1,2,3]
|
||||
0 Value [1,2,3]
|
||||
0 Value [4,5,6]
|
||||
0 Value [4,5,6]
|
||||
0 Value [4,5,6]
|
||||
0 Value 1
|
||||
0 Value 2
|
||||
0 Value 3
|
||||
0 Value 4
|
||||
0 Value 5
|
||||
0 Value 6
|
||||
SELECT '--';
|
||||
--
|
||||
SELECT id AS value FROM test_table ARRAY JOIN value_array AS value;
|
||||
|
@ -186,6 +186,10 @@ DESCRIBE (SELECT arrayMap(x -> test_table.* EXCEPT value, [1,2,3]) FROM test_tab
|
||||
arrayMap(lambda(tuple(x), id), [1, 2, 3]) Array(UInt64)
|
||||
SELECT '--';
|
||||
--
|
||||
DESCRIBE (SELECT arrayMap(x -> tt.* EXCEPT value, [1,2,3]) FROM test_table as tt);
|
||||
arrayMap(lambda(tuple(x), id), [1, 2, 3]) Array(UInt64)
|
||||
SELECT '--';
|
||||
--
|
||||
DESCRIBE (SELECT arrayMap(x -> test_table.* EXCEPT value APPLY x -> x, [1,2,3]) FROM test_table);
|
||||
arrayMap(lambda(tuple(x), id), [1, 2, 3]) Array(UInt64)
|
||||
SELECT '--';
|
||||
|
@ -191,6 +191,10 @@ DESCRIBE (SELECT arrayMap(x -> test_table.* EXCEPT value, [1,2,3]) FROM test_tab
|
||||
|
||||
SELECT '--';
|
||||
|
||||
DESCRIBE (SELECT arrayMap(x -> tt.* EXCEPT value, [1,2,3]) FROM test_table as tt);
|
||||
|
||||
SELECT '--';
|
||||
|
||||
DESCRIBE (SELECT arrayMap(x -> test_table.* EXCEPT value APPLY x -> x, [1,2,3]) FROM test_table);
|
||||
|
||||
SELECT '--';
|
||||
|
@ -6,7 +6,7 @@ SELECT '--';
|
||||
|
||||
WITH (x -> x + 1) AS lambda SELECT lambda(1);
|
||||
|
||||
WITH (x -> x + 1) AS lambda SELECT lambda.nested(1); -- { serverError BAD_ARGUMENTS }
|
||||
WITH (x -> x + 1) AS lambda SELECT lambda.nested(1); -- { serverError UNKNOWN_IDENTIFIER }
|
||||
|
||||
SELECT '--';
|
||||
|
||||
@ -16,6 +16,6 @@ SELECT '--';
|
||||
|
||||
SELECT * FROM t1 AS t2, (SELECT 1) AS t1;
|
||||
|
||||
SELECT * FROM (SELECT 1) AS t1, t1.nested AS t2; -- { serverError BAD_ARGUMENTS }
|
||||
SELECT * FROM (SELECT 1) AS t1, t1.nested AS t2; -- { serverError UNKNOWN_IDENTIFIER }
|
||||
|
||||
SELECT * FROM t1.nested AS t2, (SELECT 1) AS t1; -- { serverError BAD_ARGUMENTS }
|
||||
SELECT * FROM t1.nested AS t2, (SELECT 1) AS t1; -- { serverError UNKNOWN_IDENTIFIER }
|
||||
|
@ -134,7 +134,7 @@ $CLICKHOUSE_CLIENT -q "SELECT cast(tuple(1), 'Tuple(value_1 String)') AS constan
|
||||
| grep "Maybe you meant: \['constant_value.value_1'\]" &>/dev/null;
|
||||
|
||||
$CLICKHOUSE_CLIENT -q "SELECT cast(tuple(1), 'Tuple(value_1 String)') AS constant_value, constant_valu.value_ SETTINGS enable_analyzer = 1;" 2>&1 \
|
||||
| grep "Maybe you meant: \['constant_value.value_1'\]" &>/dev/null;
|
||||
| grep "Maybe you meant: \['constant_value'\]" &>/dev/null;
|
||||
|
||||
$CLICKHOUSE_CLIENT -q "SELECT cast(tuple(1), 'Tuple(value_1 String)') AS constant_value, arrayMap(lambda_argument -> lambda_argument + constant_value.value_, [1, 2, 3]) SETTINGS enable_analyzer = 1;" 2>&1 \
|
||||
| grep "Maybe you meant: \['constant_value.value_1'\]" &>/dev/null;
|
||||
|
@ -19,7 +19,7 @@ QUERY id: 0
|
||||
FUNCTION id: 6, function_name: avg, function_type: aggregate, result_type: Nullable(Float64)
|
||||
ARGUMENTS
|
||||
LIST id: 7, nodes: 1
|
||||
COLUMN id: 4, column_name: a, result_type: Nullable(Int8), source_id: 5
|
||||
COLUMN id: 8, column_name: a, result_type: Nullable(Int8), source_id: 5
|
||||
JOIN TREE
|
||||
TABLE id: 5, alias: __table1, table_name: default.fuse_tbl
|
||||
QUERY id: 0
|
||||
@ -123,20 +123,20 @@ QUERY id: 0
|
||||
FUNCTION id: 30, function_name: plus, function_type: ordinary, result_type: Nullable(Int16)
|
||||
ARGUMENTS
|
||||
LIST id: 31, nodes: 2
|
||||
COLUMN id: 6, column_name: a, result_type: Nullable(Int8), source_id: 7
|
||||
CONSTANT id: 32, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
FUNCTION id: 33, function_name: sum, function_type: aggregate, result_type: Nullable(Int64)
|
||||
COLUMN id: 32, column_name: a, result_type: Nullable(Int8), source_id: 7
|
||||
CONSTANT id: 33, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
FUNCTION id: 34, function_name: sum, function_type: aggregate, result_type: Nullable(Int64)
|
||||
ARGUMENTS
|
||||
LIST id: 34, nodes: 1
|
||||
FUNCTION id: 35, function_name: plus, function_type: ordinary, result_type: Nullable(Int16)
|
||||
LIST id: 35, nodes: 1
|
||||
FUNCTION id: 36, function_name: plus, function_type: ordinary, result_type: Nullable(Int16)
|
||||
ARGUMENTS
|
||||
LIST id: 36, nodes: 2
|
||||
COLUMN id: 6, column_name: a, result_type: Nullable(Int8), source_id: 7
|
||||
CONSTANT id: 37, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 38, function_name: count, function_type: aggregate, result_type: UInt64
|
||||
LIST id: 37, nodes: 2
|
||||
COLUMN id: 38, column_name: a, result_type: Nullable(Int8), source_id: 7
|
||||
CONSTANT id: 39, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 40, function_name: count, function_type: aggregate, result_type: UInt64
|
||||
ARGUMENTS
|
||||
LIST id: 39, nodes: 1
|
||||
COLUMN id: 6, column_name: a, result_type: Nullable(Int8), source_id: 7
|
||||
LIST id: 41, nodes: 1
|
||||
COLUMN id: 42, column_name: a, result_type: Nullable(Int8), source_id: 7
|
||||
JOIN TREE
|
||||
TABLE id: 7, alias: __table1, table_name: default.fuse_tbl
|
||||
QUERY id: 0
|
||||
|
@ -79,4 +79,4 @@ QUERY id: 0
|
||||
TABLE id: 30, alias: __table3, table_name: default.fuse_tbl
|
||||
GROUP BY
|
||||
LIST id: 35, nodes: 1
|
||||
COLUMN id: 18, column_name: x, result_type: Float64, source_id: 19
|
||||
COLUMN id: 36, column_name: x, result_type: Float64, source_id: 19
|
||||
|
@ -16,9 +16,9 @@ QUERY id: 0
|
||||
FUNCTION id: 6, function_name: in, function_type: ordinary, result_type: LowCardinality(UInt8)
|
||||
ARGUMENTS
|
||||
LIST id: 7, nodes: 2
|
||||
COLUMN id: 2, column_name: a, result_type: LowCardinality(String), source_id: 3
|
||||
CONSTANT id: 8, constant_value: Tuple_(\'x\', \'y\'), constant_value_type: Tuple(String, String)
|
||||
CONSTANT id: 9, constant_value: UInt64_0, constant_value_type: UInt8
|
||||
COLUMN id: 8, column_name: a, result_type: LowCardinality(String), source_id: 3
|
||||
CONSTANT id: 9, constant_value: Tuple_(\'x\', \'y\'), constant_value_type: Tuple(String, String)
|
||||
CONSTANT id: 10, constant_value: UInt64_0, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT a
|
||||
FROM t_logical_expressions_optimizer_low_cardinality
|
||||
@ -38,9 +38,9 @@ QUERY id: 0
|
||||
FUNCTION id: 6, function_name: in, function_type: ordinary, result_type: LowCardinality(UInt8)
|
||||
ARGUMENTS
|
||||
LIST id: 7, nodes: 2
|
||||
COLUMN id: 2, column_name: a, result_type: LowCardinality(String), source_id: 3
|
||||
CONSTANT id: 8, constant_value: Tuple_(\'x\', \'y\'), constant_value_type: Tuple(String, String)
|
||||
CONSTANT id: 9, constant_value: UInt64_0, constant_value_type: UInt8
|
||||
COLUMN id: 8, column_name: a, result_type: LowCardinality(String), source_id: 3
|
||||
CONSTANT id: 9, constant_value: Tuple_(\'x\', \'y\'), constant_value_type: Tuple(String, String)
|
||||
CONSTANT id: 10, constant_value: UInt64_0, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT a
|
||||
FROM t_logical_expressions_optimizer_low_cardinality
|
||||
@ -60,9 +60,9 @@ QUERY id: 0
|
||||
FUNCTION id: 6, function_name: notIn, function_type: ordinary, result_type: LowCardinality(UInt8)
|
||||
ARGUMENTS
|
||||
LIST id: 7, nodes: 2
|
||||
COLUMN id: 2, column_name: a, result_type: LowCardinality(String), source_id: 3
|
||||
CONSTANT id: 8, constant_value: Tuple_(\'x\', \'y\'), constant_value_type: Tuple(String, String)
|
||||
CONSTANT id: 9, constant_value: \'UInt8\', constant_value_type: String
|
||||
COLUMN id: 8, column_name: a, result_type: LowCardinality(String), source_id: 3
|
||||
CONSTANT id: 9, constant_value: Tuple_(\'x\', \'y\'), constant_value_type: Tuple(String, String)
|
||||
CONSTANT id: 10, constant_value: \'UInt8\', constant_value_type: String
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT a
|
||||
FROM t_logical_expressions_optimizer_low_cardinality
|
||||
@ -82,9 +82,9 @@ QUERY id: 0
|
||||
FUNCTION id: 6, function_name: notIn, function_type: ordinary, result_type: LowCardinality(UInt8)
|
||||
ARGUMENTS
|
||||
LIST id: 7, nodes: 2
|
||||
COLUMN id: 2, column_name: a, result_type: LowCardinality(String), source_id: 3
|
||||
CONSTANT id: 8, constant_value: Tuple_(\'x\', \'y\'), constant_value_type: Tuple(String, String)
|
||||
CONSTANT id: 9, constant_value: \'UInt8\', constant_value_type: String
|
||||
COLUMN id: 8, column_name: a, result_type: LowCardinality(String), source_id: 3
|
||||
CONSTANT id: 9, constant_value: Tuple_(\'x\', \'y\'), constant_value_type: Tuple(String, String)
|
||||
CONSTANT id: 10, constant_value: \'UInt8\', constant_value_type: String
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT a
|
||||
FROM t_logical_expressions_optimizer_low_cardinality
|
||||
@ -109,8 +109,8 @@ QUERY id: 0
|
||||
FUNCTION id: 10, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 11, nodes: 2
|
||||
COLUMN id: 8, column_name: b, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 12, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
COLUMN id: 12, column_name: b, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 13, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT a
|
||||
FROM t_logical_expressions_optimizer_low_cardinality
|
||||
@ -135,6 +135,6 @@ QUERY id: 0
|
||||
FUNCTION id: 10, function_name: notEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 11, nodes: 2
|
||||
COLUMN id: 8, column_name: b, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 12, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
COLUMN id: 12, column_name: b, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 13, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
|
@ -35,55 +35,55 @@ QUERY id: 0, group_by_type: grouping_sets
|
||||
FUNCTION id: 22, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 23, nodes: 2
|
||||
COLUMN id: 20, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 24, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 25, nodes: 1
|
||||
FUNCTION id: 26, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
COLUMN id: 24, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 25, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 26, nodes: 1
|
||||
FUNCTION id: 27, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 27, nodes: 2
|
||||
COLUMN id: 20, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 28, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 29, nodes: 1
|
||||
FUNCTION id: 30, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 28, nodes: 2
|
||||
COLUMN id: 29, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 30, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 31, nodes: 1
|
||||
FUNCTION id: 32, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 31, nodes: 2
|
||||
COLUMN id: 20, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 32, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
LIST id: 33, nodes: 2
|
||||
COLUMN id: 34, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 35, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
HAVING
|
||||
FUNCTION id: 33, function_name: greater, function_type: ordinary, result_type: UInt8
|
||||
FUNCTION id: 36, function_name: greater, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 34, nodes: 2
|
||||
FUNCTION id: 35, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
LIST id: 37, nodes: 2
|
||||
FUNCTION id: 38, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 36, nodes: 2
|
||||
CONSTANT id: 37, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
LIST id: 39, nodes: 2
|
||||
CONSTANT id: 40, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
EXPRESSION
|
||||
FUNCTION id: 38, function_name: log, function_type: ordinary, result_type: Float64
|
||||
FUNCTION id: 41, function_name: log, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 39, nodes: 1
|
||||
CONSTANT id: 40, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 41, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
LIST id: 42, nodes: 1
|
||||
CONSTANT id: 43, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 44, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 42, nodes: 1
|
||||
COLUMN id: 43, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 44, constant_value: Float64_3465735.3, constant_value_type: Float64
|
||||
LIST id: 45, nodes: 1
|
||||
COLUMN id: 46, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 47, constant_value: Float64_3465735.3, constant_value_type: Float64
|
||||
ORDER BY
|
||||
LIST id: 45, nodes: 1
|
||||
SORT id: 46, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 48, nodes: 1
|
||||
SORT id: 49, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 47, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
FUNCTION id: 50, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 48, nodes: 2
|
||||
CONSTANT id: 49, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
LIST id: 51, nodes: 2
|
||||
CONSTANT id: 52, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
EXPRESSION
|
||||
FUNCTION id: 5, function_name: log, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 6, nodes: 1
|
||||
CONSTANT id: 7, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 50, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
FUNCTION id: 53, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 51, nodes: 1
|
||||
COLUMN id: 52, column_name: number, result_type: UInt64, source_id: 11
|
||||
LIST id: 54, nodes: 1
|
||||
COLUMN id: 55, column_name: number, result_type: UInt64, source_id: 11
|
||||
QUERY id: 0, group_by_type: grouping_sets
|
||||
PROJECTION COLUMNS
|
||||
k Float64
|
||||
@ -118,49 +118,49 @@ QUERY id: 0, group_by_type: grouping_sets
|
||||
FUNCTION id: 20, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 21, nodes: 2
|
||||
COLUMN id: 18, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 22, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
LIST id: 23, nodes: 1
|
||||
FUNCTION id: 24, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
COLUMN id: 22, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 23, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
LIST id: 24, nodes: 1
|
||||
FUNCTION id: 25, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 25, nodes: 2
|
||||
COLUMN id: 18, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 26, constant_value: UInt64_4, constant_value_type: UInt8
|
||||
LIST id: 26, nodes: 2
|
||||
COLUMN id: 27, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 28, constant_value: UInt64_4, constant_value_type: UInt8
|
||||
HAVING
|
||||
FUNCTION id: 27, function_name: greater, function_type: ordinary, result_type: UInt8
|
||||
FUNCTION id: 29, function_name: greater, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 28, nodes: 2
|
||||
FUNCTION id: 29, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
LIST id: 30, nodes: 2
|
||||
FUNCTION id: 31, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 30, nodes: 2
|
||||
CONSTANT id: 31, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
LIST id: 32, nodes: 2
|
||||
CONSTANT id: 33, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
EXPRESSION
|
||||
FUNCTION id: 32, function_name: log, function_type: ordinary, result_type: Float64
|
||||
FUNCTION id: 34, function_name: log, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 33, nodes: 1
|
||||
CONSTANT id: 34, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 35, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
LIST id: 35, nodes: 1
|
||||
CONSTANT id: 36, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 37, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 36, nodes: 1
|
||||
COLUMN id: 37, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 38, constant_value: Float64_3465735.3, constant_value_type: Float64
|
||||
LIST id: 38, nodes: 1
|
||||
COLUMN id: 39, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 40, constant_value: Float64_3465735.3, constant_value_type: Float64
|
||||
ORDER BY
|
||||
LIST id: 39, nodes: 1
|
||||
SORT id: 40, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 41, nodes: 1
|
||||
SORT id: 42, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 41, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
FUNCTION id: 43, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 42, nodes: 2
|
||||
CONSTANT id: 43, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
LIST id: 44, nodes: 2
|
||||
CONSTANT id: 45, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
EXPRESSION
|
||||
FUNCTION id: 5, function_name: log, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 6, nodes: 1
|
||||
CONSTANT id: 7, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 44, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
FUNCTION id: 46, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 45, nodes: 1
|
||||
COLUMN id: 46, column_name: number, result_type: UInt64, source_id: 11
|
||||
LIST id: 47, nodes: 1
|
||||
COLUMN id: 48, column_name: number, result_type: UInt64, source_id: 11
|
||||
QUERY id: 0, group_by_type: grouping_sets
|
||||
PROJECTION COLUMNS
|
||||
k Float64
|
||||
@ -198,54 +198,54 @@ QUERY id: 0, group_by_type: grouping_sets
|
||||
FUNCTION id: 22, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 23, nodes: 2
|
||||
COLUMN id: 20, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 24, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
FUNCTION id: 25, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
COLUMN id: 24, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 25, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
FUNCTION id: 26, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 26, nodes: 2
|
||||
COLUMN id: 20, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 27, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 28, nodes: 1
|
||||
FUNCTION id: 29, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 27, nodes: 2
|
||||
COLUMN id: 28, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 29, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 30, nodes: 1
|
||||
FUNCTION id: 31, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 30, nodes: 2
|
||||
COLUMN id: 20, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 31, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
LIST id: 32, nodes: 2
|
||||
COLUMN id: 33, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 34, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
HAVING
|
||||
FUNCTION id: 32, function_name: greater, function_type: ordinary, result_type: UInt8
|
||||
FUNCTION id: 35, function_name: greater, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 33, nodes: 2
|
||||
FUNCTION id: 34, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
LIST id: 36, nodes: 2
|
||||
FUNCTION id: 37, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 35, nodes: 2
|
||||
CONSTANT id: 36, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
LIST id: 38, nodes: 2
|
||||
CONSTANT id: 39, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
EXPRESSION
|
||||
FUNCTION id: 37, function_name: log, function_type: ordinary, result_type: Float64
|
||||
FUNCTION id: 40, function_name: log, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 38, nodes: 1
|
||||
CONSTANT id: 39, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 40, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
LIST id: 41, nodes: 1
|
||||
CONSTANT id: 42, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 43, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 41, nodes: 1
|
||||
COLUMN id: 42, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 43, constant_value: Float64_3465735.3, constant_value_type: Float64
|
||||
LIST id: 44, nodes: 1
|
||||
COLUMN id: 45, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 46, constant_value: Float64_3465735.3, constant_value_type: Float64
|
||||
ORDER BY
|
||||
LIST id: 44, nodes: 1
|
||||
SORT id: 45, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 47, nodes: 1
|
||||
SORT id: 48, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 46, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
FUNCTION id: 49, function_name: multiply, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 47, nodes: 2
|
||||
CONSTANT id: 48, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
LIST id: 50, nodes: 2
|
||||
CONSTANT id: 51, constant_value: Float64_0.6931471805599453, constant_value_type: Float64
|
||||
EXPRESSION
|
||||
FUNCTION id: 5, function_name: log, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 6, nodes: 1
|
||||
CONSTANT id: 7, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 49, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
FUNCTION id: 52, function_name: avg, function_type: aggregate, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 50, nodes: 1
|
||||
COLUMN id: 51, column_name: number, result_type: UInt64, source_id: 11
|
||||
LIST id: 53, nodes: 1
|
||||
COLUMN id: 54, column_name: number, result_type: UInt64, source_id: 11
|
||||
QUERY id: 0, group_by_type: grouping_sets
|
||||
PROJECTION COLUMNS
|
||||
count() UInt64
|
||||
@ -265,21 +265,21 @@ QUERY id: 0, group_by_type: grouping_sets
|
||||
FUNCTION id: 10, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 11, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 12, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 13, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
COLUMN id: 12, column_name: number, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 13, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 14, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 14, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 15, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 16, nodes: 2
|
||||
FUNCTION id: 17, function_name: divide, function_type: ordinary, result_type: Float64
|
||||
LIST id: 15, nodes: 2
|
||||
COLUMN id: 16, column_name: number, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 17, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 18, nodes: 2
|
||||
FUNCTION id: 19, function_name: divide, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 18, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 19, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 20, function_name: divide, function_type: ordinary, result_type: Float64
|
||||
LIST id: 20, nodes: 2
|
||||
COLUMN id: 21, column_name: number, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 22, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 23, function_name: divide, function_type: ordinary, result_type: Float64
|
||||
ARGUMENTS
|
||||
LIST id: 21, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 22, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 24, nodes: 2
|
||||
COLUMN id: 25, column_name: number, result_type: UInt64, source_id: 3
|
||||
CONSTANT id: 26, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
|
@ -319,31 +319,31 @@ QUERY id: 0
|
||||
LIST id: 16, nodes: 2
|
||||
CONSTANT id: 17, constant_value: \'google\', constant_value_type: String
|
||||
CONSTANT id: 18, constant_value: \'Enum8(\\\'censor.net\\\' = 1, \\\'google\\\' = 2)\', constant_value_type: String
|
||||
FUNCTION id: 2, function_name: toString, function_type: ordinary, result_type: String
|
||||
FUNCTION id: 19, function_name: toString, function_type: ordinary, result_type: String
|
||||
ARGUMENTS
|
||||
LIST id: 3, nodes: 1
|
||||
FUNCTION id: 4, function_name: if, function_type: ordinary, result_type: Enum8(\'censor.net\' = 1, \'google\' = 2)
|
||||
LIST id: 20, nodes: 1
|
||||
FUNCTION id: 21, function_name: if, function_type: ordinary, result_type: Enum8(\'censor.net\' = 1, \'google\' = 2)
|
||||
ARGUMENTS
|
||||
LIST id: 5, nodes: 3
|
||||
FUNCTION id: 6, function_name: greater, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 22, nodes: 3
|
||||
FUNCTION id: 23, function_name: greater, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 7, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 10, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
FUNCTION id: 11, function_name: _CAST, function_type: ordinary, result_type: Enum8(\'censor.net\' = 1, \'google\' = 2)
|
||||
LIST id: 24, nodes: 2
|
||||
COLUMN id: 25, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 26, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
FUNCTION id: 27, function_name: _CAST, function_type: ordinary, result_type: Enum8(\'censor.net\' = 1, \'google\' = 2)
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
CONSTANT id: 13, constant_value: \'censor.net\', constant_value_type: String
|
||||
CONSTANT id: 14, constant_value: \'Enum8(\\\'censor.net\\\' = 1, \\\'google\\\' = 2)\', constant_value_type: String
|
||||
FUNCTION id: 15, function_name: _CAST, function_type: ordinary, result_type: Enum8(\'censor.net\' = 1, \'google\' = 2)
|
||||
LIST id: 28, nodes: 2
|
||||
CONSTANT id: 29, constant_value: \'censor.net\', constant_value_type: String
|
||||
CONSTANT id: 30, constant_value: \'Enum8(\\\'censor.net\\\' = 1, \\\'google\\\' = 2)\', constant_value_type: String
|
||||
FUNCTION id: 31, function_name: _CAST, function_type: ordinary, result_type: Enum8(\'censor.net\' = 1, \'google\' = 2)
|
||||
ARGUMENTS
|
||||
LIST id: 16, nodes: 2
|
||||
CONSTANT id: 17, constant_value: \'google\', constant_value_type: String
|
||||
CONSTANT id: 18, constant_value: \'Enum8(\\\'censor.net\\\' = 1, \\\'google\\\' = 2)\', constant_value_type: String
|
||||
LIST id: 32, nodes: 2
|
||||
CONSTANT id: 33, constant_value: \'google\', constant_value_type: String
|
||||
CONSTANT id: 34, constant_value: \'Enum8(\\\'censor.net\\\' = 1, \\\'google\\\' = 2)\', constant_value_type: String
|
||||
JOIN TREE
|
||||
TABLE id: 9, alias: __table1, table_name: system.numbers
|
||||
LIMIT
|
||||
CONSTANT id: 19, constant_value: UInt64_10, constant_value_type: UInt64
|
||||
CONSTANT id: 35, constant_value: UInt64_10, constant_value_type: UInt64
|
||||
other other
|
||||
other other
|
||||
google google
|
||||
@ -383,28 +383,28 @@ QUERY id: 0
|
||||
LIST id: 14, nodes: 2
|
||||
CONSTANT id: 15, constant_value: \'other\', constant_value_type: String
|
||||
CONSTANT id: 16, constant_value: \'Enum8(\\\'censor.net\\\' = 1, \\\'google\\\' = 2, \\\'other\\\' = 3, \\\'yahoo\\\' = 4)\', constant_value_type: String
|
||||
FUNCTION id: 2, function_name: toString, function_type: ordinary, result_type: String
|
||||
FUNCTION id: 17, function_name: toString, function_type: ordinary, result_type: String
|
||||
ARGUMENTS
|
||||
LIST id: 3, nodes: 1
|
||||
FUNCTION id: 4, function_name: transform, function_type: ordinary, result_type: Enum8(\'censor.net\' = 1, \'google\' = 2, \'other\' = 3, \'yahoo\' = 4)
|
||||
LIST id: 18, nodes: 1
|
||||
FUNCTION id: 19, function_name: transform, function_type: ordinary, result_type: Enum8(\'censor.net\' = 1, \'google\' = 2, \'other\' = 3, \'yahoo\' = 4)
|
||||
ARGUMENTS
|
||||
LIST id: 5, nodes: 4
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 8, constant_value: Array_[UInt64_2, UInt64_4, UInt64_6], constant_value_type: Array(UInt8)
|
||||
FUNCTION id: 9, function_name: _CAST, function_type: ordinary, result_type: Array(Enum8(\'censor.net\' = 1, \'google\' = 2, \'other\' = 3, \'yahoo\' = 4))
|
||||
LIST id: 20, nodes: 4
|
||||
COLUMN id: 21, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 22, constant_value: Array_[UInt64_2, UInt64_4, UInt64_6], constant_value_type: Array(UInt8)
|
||||
FUNCTION id: 23, function_name: _CAST, function_type: ordinary, result_type: Array(Enum8(\'censor.net\' = 1, \'google\' = 2, \'other\' = 3, \'yahoo\' = 4))
|
||||
ARGUMENTS
|
||||
LIST id: 10, nodes: 2
|
||||
CONSTANT id: 11, constant_value: Array_[\'google\', \'censor.net\', \'yahoo\'], constant_value_type: Array(String)
|
||||
CONSTANT id: 12, constant_value: \'Array(Enum8(\\\'censor.net\\\' = 1, \\\'google\\\' = 2, \\\'other\\\' = 3, \\\'yahoo\\\' = 4))\', constant_value_type: String
|
||||
FUNCTION id: 13, function_name: _CAST, function_type: ordinary, result_type: Enum8(\'censor.net\' = 1, \'google\' = 2, \'other\' = 3, \'yahoo\' = 4)
|
||||
LIST id: 24, nodes: 2
|
||||
CONSTANT id: 25, constant_value: Array_[\'google\', \'censor.net\', \'yahoo\'], constant_value_type: Array(String)
|
||||
CONSTANT id: 26, constant_value: \'Array(Enum8(\\\'censor.net\\\' = 1, \\\'google\\\' = 2, \\\'other\\\' = 3, \\\'yahoo\\\' = 4))\', constant_value_type: String
|
||||
FUNCTION id: 27, function_name: _CAST, function_type: ordinary, result_type: Enum8(\'censor.net\' = 1, \'google\' = 2, \'other\' = 3, \'yahoo\' = 4)
|
||||
ARGUMENTS
|
||||
LIST id: 14, nodes: 2
|
||||
CONSTANT id: 15, constant_value: \'other\', constant_value_type: String
|
||||
CONSTANT id: 16, constant_value: \'Enum8(\\\'censor.net\\\' = 1, \\\'google\\\' = 2, \\\'other\\\' = 3, \\\'yahoo\\\' = 4)\', constant_value_type: String
|
||||
LIST id: 28, nodes: 2
|
||||
CONSTANT id: 29, constant_value: \'other\', constant_value_type: String
|
||||
CONSTANT id: 30, constant_value: \'Enum8(\\\'censor.net\\\' = 1, \\\'google\\\' = 2, \\\'other\\\' = 3, \\\'yahoo\\\' = 4)\', constant_value_type: String
|
||||
JOIN TREE
|
||||
TABLE id: 7, alias: __table1, table_name: system.numbers
|
||||
LIMIT
|
||||
CONSTANT id: 17, constant_value: UInt64_10, constant_value_type: UInt64
|
||||
CONSTANT id: 31, constant_value: UInt64_10, constant_value_type: UInt64
|
||||
other
|
||||
other
|
||||
other
|
||||
|
@ -18,13 +18,13 @@ QUERY id: 0
|
||||
LIST id: 7, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 10, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 11, constant_value: UInt64_0, constant_value_type: UInt8
|
||||
COLUMN id: 11, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 12, constant_value: UInt64_0, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 9, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 1
|
||||
CONSTANT id: 13, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 13, nodes: 1
|
||||
CONSTANT id: 14, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
EXPLAIN QUERY TREE run_passes = 1 select sum(if(number % 2, 0, number)) from numbers(100);
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
@ -43,12 +43,12 @@ QUERY id: 0
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 10, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
CONSTANT id: 11, constant_value: UInt64_0, constant_value_type: UInt8
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
COLUMN id: 12, column_name: number, result_type: UInt64, source_id: 9
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 9, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 1
|
||||
CONSTANT id: 13, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 13, nodes: 1
|
||||
CONSTANT id: 14, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
EXPLAIN QUERY TREE run_passes = 1 select sum(if(number % 2, number, null)) from numbers(100);
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
@ -66,13 +66,13 @@ QUERY id: 0
|
||||
LIST id: 7, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 10, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 11, constant_value: NULL, constant_value_type: Nullable(Nothing)
|
||||
COLUMN id: 11, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 12, constant_value: NULL, constant_value_type: Nullable(Nothing)
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 9, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 1
|
||||
CONSTANT id: 13, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 13, nodes: 1
|
||||
CONSTANT id: 14, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
EXPLAIN QUERY TREE run_passes = 1 select sum(if(number % 2, null, number)) from numbers(100);
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
@ -91,12 +91,12 @@ QUERY id: 0
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 10, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
CONSTANT id: 11, constant_value: NULL, constant_value_type: Nullable(Nothing)
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
COLUMN id: 12, column_name: number, result_type: UInt64, source_id: 9
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 9, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 1
|
||||
CONSTANT id: 13, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 13, nodes: 1
|
||||
CONSTANT id: 14, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
EXPLAIN QUERY TREE run_passes = 1 select avg(if(number % 2, number, null)) from numbers(100);
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
@ -114,13 +114,13 @@ QUERY id: 0
|
||||
LIST id: 7, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 10, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 11, constant_value: NULL, constant_value_type: Nullable(Nothing)
|
||||
COLUMN id: 11, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 12, constant_value: NULL, constant_value_type: Nullable(Nothing)
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 9, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 1
|
||||
CONSTANT id: 13, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 13, nodes: 1
|
||||
CONSTANT id: 14, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
EXPLAIN QUERY TREE run_passes = 1 select avg(if(number % 2, null, number)) from numbers(100);
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
@ -139,12 +139,12 @@ QUERY id: 0
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 10, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
CONSTANT id: 11, constant_value: NULL, constant_value_type: Nullable(Nothing)
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
COLUMN id: 12, column_name: number, result_type: UInt64, source_id: 9
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 9, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 1
|
||||
CONSTANT id: 13, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 13, nodes: 1
|
||||
CONSTANT id: 14, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
EXPLAIN QUERY TREE run_passes = 1 select quantiles(0.5, 0.9, 0.99)(if(number % 2, number, null)) from numbers(100);
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
@ -167,13 +167,13 @@ QUERY id: 0
|
||||
LIST id: 11, nodes: 2
|
||||
COLUMN id: 12, column_name: number, result_type: UInt64, source_id: 13
|
||||
CONSTANT id: 14, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
COLUMN id: 12, column_name: number, result_type: UInt64, source_id: 13
|
||||
CONSTANT id: 15, constant_value: NULL, constant_value_type: Nullable(Nothing)
|
||||
COLUMN id: 15, column_name: number, result_type: UInt64, source_id: 13
|
||||
CONSTANT id: 16, constant_value: NULL, constant_value_type: Nullable(Nothing)
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 13, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 16, nodes: 1
|
||||
CONSTANT id: 17, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 17, nodes: 1
|
||||
CONSTANT id: 18, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
EXPLAIN QUERY TREE run_passes = 1 select quantiles(0.5, 0.9, 0.99)(if(number % 2, null, number)) from numbers(100);
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
@ -197,12 +197,12 @@ QUERY id: 0
|
||||
COLUMN id: 12, column_name: number, result_type: UInt64, source_id: 13
|
||||
CONSTANT id: 14, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
CONSTANT id: 15, constant_value: NULL, constant_value_type: Nullable(Nothing)
|
||||
COLUMN id: 12, column_name: number, result_type: UInt64, source_id: 13
|
||||
COLUMN id: 16, column_name: number, result_type: UInt64, source_id: 13
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 13, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 16, nodes: 1
|
||||
CONSTANT id: 17, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 17, nodes: 1
|
||||
CONSTANT id: 18, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
set optimize_rewrite_aggregate_function_with_if = true;
|
||||
EXPLAIN QUERY TREE run_passes = 1 select sum(if(number % 2, number, 0)) from numbers(100);
|
||||
QUERY id: 0
|
||||
@ -217,13 +217,13 @@ QUERY id: 0
|
||||
FUNCTION id: 6, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 7, nodes: 2
|
||||
COLUMN id: 4, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 8, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 9, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 5, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 9, nodes: 1
|
||||
CONSTANT id: 10, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 10, nodes: 1
|
||||
CONSTANT id: 11, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
EXPLAIN QUERY TREE run_passes = 1 select sum(if(number % 2, 0, number)) from numbers(100);
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
@ -240,13 +240,13 @@ QUERY id: 0
|
||||
FUNCTION id: 8, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 9, nodes: 2
|
||||
COLUMN id: 4, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 10, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
COLUMN id: 10, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 11, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 5, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 11, nodes: 1
|
||||
CONSTANT id: 12, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 12, nodes: 1
|
||||
CONSTANT id: 13, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
EXPLAIN QUERY TREE run_passes = 1 select sum(if(number % 2, number, null)) from numbers(100);
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
@ -264,13 +264,13 @@ QUERY id: 0
|
||||
FUNCTION id: 9, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 10, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 11, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
COLUMN id: 11, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 12, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 7, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 1
|
||||
CONSTANT id: 13, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 13, nodes: 1
|
||||
CONSTANT id: 14, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
EXPLAIN QUERY TREE run_passes = 1 select sum(if(number % 2, null, number)) from numbers(100);
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
@ -291,13 +291,13 @@ QUERY id: 0
|
||||
FUNCTION id: 11, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 13, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
COLUMN id: 13, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 14, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 7, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 14, nodes: 1
|
||||
CONSTANT id: 15, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 15, nodes: 1
|
||||
CONSTANT id: 16, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
EXPLAIN QUERY TREE run_passes = 1 select avg(if(number % 2, number, null)) from numbers(100);
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
@ -315,13 +315,13 @@ QUERY id: 0
|
||||
FUNCTION id: 9, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 10, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 11, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
COLUMN id: 11, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 12, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 7, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 1
|
||||
CONSTANT id: 13, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 13, nodes: 1
|
||||
CONSTANT id: 14, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
EXPLAIN QUERY TREE run_passes = 1 select avg(if(number % 2, null, number)) from numbers(100);
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
@ -342,13 +342,13 @@ QUERY id: 0
|
||||
FUNCTION id: 11, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 13, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
COLUMN id: 13, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 14, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 7, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 14, nodes: 1
|
||||
CONSTANT id: 15, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 15, nodes: 1
|
||||
CONSTANT id: 16, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
EXPLAIN QUERY TREE run_passes = 1 select quantiles(0.5, 0.9, 0.99)(if(number % 2, number, null)) from numbers(100);
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
@ -371,13 +371,13 @@ QUERY id: 0
|
||||
FUNCTION id: 13, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 14, nodes: 2
|
||||
COLUMN id: 10, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 15, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
COLUMN id: 15, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 16, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 11, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 16, nodes: 1
|
||||
CONSTANT id: 17, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 17, nodes: 1
|
||||
CONSTANT id: 18, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
EXPLAIN QUERY TREE run_passes = 1 select quantiles(0.5, 0.9, 0.99)(if(number % 2, null, number)) from numbers(100);
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
@ -403,10 +403,10 @@ QUERY id: 0
|
||||
FUNCTION id: 15, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 16, nodes: 2
|
||||
COLUMN id: 10, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 17, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
COLUMN id: 17, column_name: number, result_type: UInt64, source_id: 11
|
||||
CONSTANT id: 18, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 11, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 18, nodes: 1
|
||||
CONSTANT id: 19, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 19, nodes: 1
|
||||
CONSTANT id: 20, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
|
@ -19,8 +19,8 @@ QUERY id: 0
|
||||
TABLE id: 5, alias: __table1, table_name: default.test_table
|
||||
GROUP BY
|
||||
LIST id: 9, nodes: 2
|
||||
COLUMN id: 4, column_name: id, result_type: UInt64, source_id: 5
|
||||
COLUMN id: 8, column_name: value, result_type: String, source_id: 5
|
||||
COLUMN id: 10, column_name: id, result_type: UInt64, source_id: 5
|
||||
COLUMN id: 11, column_name: value, result_type: String, source_id: 5
|
||||
SELECT grouping(id) AS grouping_id, grouping(value) AS grouping_value, id, value FROM test_table
|
||||
GROUP BY id, value ORDER BY grouping_id, grouping_value;
|
||||
0 0 0 Value
|
||||
@ -45,8 +45,8 @@ QUERY id: 0, group_by_type: rollup
|
||||
TABLE id: 6, alias: __table1, table_name: default.test_table
|
||||
GROUP BY
|
||||
LIST id: 11, nodes: 2
|
||||
COLUMN id: 5, column_name: id, result_type: UInt64, source_id: 6
|
||||
COLUMN id: 10, column_name: value, result_type: String, source_id: 6
|
||||
COLUMN id: 12, column_name: id, result_type: UInt64, source_id: 6
|
||||
COLUMN id: 13, column_name: value, result_type: String, source_id: 6
|
||||
SELECT grouping(id) AS grouping_id, grouping(value) AS grouping_value, id, value FROM test_table
|
||||
GROUP BY ROLLUP (id, value) ORDER BY grouping_id, grouping_value;
|
||||
0 0 0 Value
|
||||
@ -73,8 +73,8 @@ QUERY id: 0, group_by_type: cube
|
||||
TABLE id: 6, alias: __table1, table_name: default.test_table
|
||||
GROUP BY
|
||||
LIST id: 11, nodes: 2
|
||||
COLUMN id: 5, column_name: id, result_type: UInt64, source_id: 6
|
||||
COLUMN id: 10, column_name: value, result_type: String, source_id: 6
|
||||
COLUMN id: 12, column_name: id, result_type: UInt64, source_id: 6
|
||||
COLUMN id: 13, column_name: value, result_type: String, source_id: 6
|
||||
SELECT grouping(id) AS grouping_id, grouping(value) AS grouping_value, id, value FROM test_table
|
||||
GROUP BY CUBE (id, value) ORDER BY grouping_id, grouping_value;
|
||||
0 0 0 Value
|
||||
@ -103,9 +103,9 @@ QUERY id: 0, group_by_type: grouping_sets
|
||||
GROUP BY
|
||||
LIST id: 11, nodes: 2
|
||||
LIST id: 12, nodes: 1
|
||||
COLUMN id: 5, column_name: id, result_type: UInt64, source_id: 6
|
||||
LIST id: 13, nodes: 1
|
||||
COLUMN id: 10, column_name: value, result_type: String, source_id: 6
|
||||
COLUMN id: 13, column_name: id, result_type: UInt64, source_id: 6
|
||||
LIST id: 14, nodes: 1
|
||||
COLUMN id: 15, column_name: value, result_type: String, source_id: 6
|
||||
SELECT grouping(id) AS grouping_id, grouping(value) AS grouping_value, id, value FROM test_table
|
||||
GROUP BY GROUPING SETS (id, value) ORDER BY grouping_id, grouping_value;
|
||||
0 1 0
|
||||
@ -132,9 +132,9 @@ QUERY id: 0, group_by_type: grouping_sets
|
||||
GROUP BY
|
||||
LIST id: 11, nodes: 2
|
||||
LIST id: 12, nodes: 1
|
||||
COLUMN id: 5, column_name: id, result_type: UInt64, source_id: 6
|
||||
LIST id: 13, nodes: 1
|
||||
COLUMN id: 10, column_name: value, result_type: String, source_id: 6
|
||||
COLUMN id: 13, column_name: id, result_type: UInt64, source_id: 6
|
||||
LIST id: 14, nodes: 1
|
||||
COLUMN id: 15, column_name: value, result_type: String, source_id: 6
|
||||
SELECT grouping(id) AS grouping_id, grouping(value) AS grouping_value, id, value FROM test_table
|
||||
GROUP BY GROUPING SETS ((id), (value)) ORDER BY grouping_id, grouping_value;
|
||||
0 1 0
|
||||
|
@ -63,17 +63,17 @@ QUERY id: 0
|
||||
FUNCTION id: 28, function_name: plus, function_type: ordinary, result_type: UInt64
|
||||
ARGUMENTS
|
||||
LIST id: 29, nodes: 2
|
||||
COLUMN id: 24, column_name: a, result_type: UInt64, source_id: 25
|
||||
CONSTANT id: 30, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
COLUMN id: 31, column_name: b, result_type: UInt64, source_id: 25
|
||||
COLUMN id: 30, column_name: a, result_type: UInt64, source_id: 25
|
||||
CONSTANT id: 31, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
COLUMN id: 32, column_name: b, result_type: UInt64, source_id: 25
|
||||
JOIN EXPRESSION
|
||||
FUNCTION id: 32, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
FUNCTION id: 33, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 33, nodes: 2
|
||||
COLUMN id: 21, column_name: a, result_type: UInt64, source_id: 6
|
||||
COLUMN id: 34, column_name: x, result_type: UInt64, source_id: 9
|
||||
LIST id: 34, nodes: 2
|
||||
COLUMN id: 35, column_name: a, result_type: UInt64, source_id: 6
|
||||
COLUMN id: 36, column_name: x, result_type: UInt64, source_id: 9
|
||||
WHERE
|
||||
CONSTANT id: 35, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
CONSTANT id: 37, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
EXPLAIN QUERY TREE
|
||||
SELECT * FROM t1, t2, (SELECT a as x from t3 where a + 1 = b ) as t3
|
||||
WHERE t1.a = if(t2.b > 0, t2.a, 0) AND t2.a = t3.x AND 1
|
||||
@ -116,33 +116,33 @@ QUERY id: 0
|
||||
FUNCTION id: 17, function_name: plus, function_type: ordinary, result_type: UInt64
|
||||
ARGUMENTS
|
||||
LIST id: 18, nodes: 2
|
||||
COLUMN id: 13, column_name: a, result_type: UInt64, source_id: 14
|
||||
CONSTANT id: 19, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
COLUMN id: 20, column_name: b, result_type: UInt64, source_id: 14
|
||||
COLUMN id: 19, column_name: a, result_type: UInt64, source_id: 14
|
||||
CONSTANT id: 20, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
COLUMN id: 21, column_name: b, result_type: UInt64, source_id: 14
|
||||
WHERE
|
||||
FUNCTION id: 21, function_name: and, function_type: ordinary, result_type: UInt8
|
||||
FUNCTION id: 22, function_name: and, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 22, nodes: 3
|
||||
FUNCTION id: 23, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 23, nodes: 3
|
||||
FUNCTION id: 24, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 24, nodes: 2
|
||||
COLUMN id: 25, column_name: a, result_type: UInt64, source_id: 3
|
||||
FUNCTION id: 26, function_name: if, function_type: ordinary, result_type: UInt64
|
||||
LIST id: 25, nodes: 2
|
||||
COLUMN id: 26, column_name: a, result_type: UInt64, source_id: 3
|
||||
FUNCTION id: 27, function_name: if, function_type: ordinary, result_type: UInt64
|
||||
ARGUMENTS
|
||||
LIST id: 27, nodes: 3
|
||||
FUNCTION id: 28, function_name: greater, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 28, nodes: 3
|
||||
FUNCTION id: 29, function_name: greater, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 29, nodes: 2
|
||||
COLUMN id: 30, column_name: b, result_type: UInt64, source_id: 6
|
||||
CONSTANT id: 31, constant_value: UInt64_0, constant_value_type: UInt8
|
||||
COLUMN id: 32, column_name: a, result_type: UInt64, source_id: 6
|
||||
CONSTANT id: 33, constant_value: UInt64_0, constant_value_type: UInt8
|
||||
FUNCTION id: 34, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 30, nodes: 2
|
||||
COLUMN id: 31, column_name: b, result_type: UInt64, source_id: 6
|
||||
CONSTANT id: 32, constant_value: UInt64_0, constant_value_type: UInt8
|
||||
COLUMN id: 33, column_name: a, result_type: UInt64, source_id: 6
|
||||
CONSTANT id: 34, constant_value: UInt64_0, constant_value_type: UInt8
|
||||
FUNCTION id: 35, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 35, nodes: 2
|
||||
COLUMN id: 32, column_name: a, result_type: UInt64, source_id: 6
|
||||
COLUMN id: 36, column_name: x, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 37, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
LIST id: 36, nodes: 2
|
||||
COLUMN id: 37, column_name: a, result_type: UInt64, source_id: 6
|
||||
COLUMN id: 38, column_name: x, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 39, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
SETTINGS cross_to_inner_join_rewrite=0
|
||||
EXPLAIN QUERY TREE
|
||||
SELECT * FROM t1, t2, (SELECT a as x from t3 where a + 1 = b ) as t3
|
||||
@ -200,6 +200,6 @@ QUERY id: 0
|
||||
FUNCTION id: 28, function_name: plus, function_type: ordinary, result_type: UInt64
|
||||
ARGUMENTS
|
||||
LIST id: 29, nodes: 2
|
||||
COLUMN id: 24, column_name: a, result_type: UInt64, source_id: 25
|
||||
CONSTANT id: 30, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
COLUMN id: 31, column_name: b, result_type: UInt64, source_id: 25
|
||||
COLUMN id: 30, column_name: a, result_type: UInt64, source_id: 25
|
||||
CONSTANT id: 31, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
COLUMN id: 32, column_name: b, result_type: UInt64, source_id: 25
|
||||
|
@ -23,12 +23,12 @@ QUERY id: 0
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
CONSTANT id: 13, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 9, column_name: a, result_type: Int32, source_id: 3
|
||||
FUNCTION id: 14, function_name: equals, function_type: ordinary, result_type: Nullable(Nothing)
|
||||
COLUMN id: 14, column_name: a, result_type: Int32, source_id: 3
|
||||
FUNCTION id: 15, function_name: equals, function_type: ordinary, result_type: Nullable(Nothing)
|
||||
ARGUMENTS
|
||||
LIST id: 15, nodes: 2
|
||||
CONSTANT id: 16, constant_value: NULL, constant_value_type: Nullable(Nothing)
|
||||
COLUMN id: 9, column_name: a, result_type: Int32, source_id: 3
|
||||
LIST id: 16, nodes: 2
|
||||
CONSTANT id: 17, constant_value: NULL, constant_value_type: Nullable(Nothing)
|
||||
COLUMN id: 18, column_name: a, result_type: Int32, source_id: 3
|
||||
1 test
|
||||
2 test2
|
||||
3 another
|
||||
@ -54,8 +54,8 @@ QUERY id: 0
|
||||
FUNCTION id: 11, function_name: in, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
COLUMN id: 9, column_name: a, result_type: Int32, source_id: 3
|
||||
CONSTANT id: 13, constant_value: Tuple_(UInt64_1, UInt64_3, UInt64_2), constant_value_type: Tuple(UInt8, UInt8, UInt8)
|
||||
COLUMN id: 13, column_name: a, result_type: Int32, source_id: 3
|
||||
CONSTANT id: 14, constant_value: Tuple_(UInt64_1, UInt64_3, UInt64_2), constant_value_type: Tuple(UInt8, UInt8, UInt8)
|
||||
1 test
|
||||
2 test2
|
||||
3 another
|
||||
|
@ -37,8 +37,8 @@ QUERY id: 0
|
||||
FUNCTION id: 21, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 22, nodes: 2
|
||||
COLUMN id: 19, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 23, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 23, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 24, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -79,8 +79,8 @@ QUERY id: 0
|
||||
FUNCTION id: 21, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 22, nodes: 2
|
||||
COLUMN id: 19, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 23, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 23, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 24, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -113,8 +113,8 @@ QUERY id: 0
|
||||
FUNCTION id: 16, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 17, nodes: 2
|
||||
COLUMN id: 14, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 18, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 18, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 19, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -147,8 +147,8 @@ QUERY id: 0
|
||||
FUNCTION id: 16, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 17, nodes: 2
|
||||
COLUMN id: 14, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 18, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 18, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 19, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -181,8 +181,8 @@ QUERY id: 0
|
||||
FUNCTION id: 16, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 17, nodes: 2
|
||||
COLUMN id: 14, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 18, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 18, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 19, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -215,8 +215,8 @@ QUERY id: 0
|
||||
FUNCTION id: 16, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 17, nodes: 2
|
||||
COLUMN id: 14, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 18, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 18, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 19, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -244,21 +244,21 @@ QUERY id: 0
|
||||
FUNCTION id: 12, function_name: less, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 13, nodes: 2
|
||||
COLUMN id: 10, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 14, constant_value: \'1998-01-01\', constant_value_type: String
|
||||
FUNCTION id: 15, function_name: and, function_type: ordinary, result_type: UInt8
|
||||
COLUMN id: 14, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 15, constant_value: \'1998-01-01\', constant_value_type: String
|
||||
FUNCTION id: 16, function_name: and, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 16, nodes: 2
|
||||
FUNCTION id: 17, function_name: greaterOrEquals, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 17, nodes: 2
|
||||
FUNCTION id: 18, function_name: greaterOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 18, nodes: 2
|
||||
COLUMN id: 19, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 20, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
FUNCTION id: 21, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 19, nodes: 2
|
||||
COLUMN id: 20, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 21, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
FUNCTION id: 22, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 22, nodes: 2
|
||||
COLUMN id: 19, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 23, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 23, nodes: 2
|
||||
COLUMN id: 24, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 25, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -297,26 +297,26 @@ QUERY id: 0
|
||||
FUNCTION id: 19, function_name: greaterOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 20, nodes: 2
|
||||
COLUMN id: 12, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 21, constant_value: \'1994-01-01\', constant_value_type: String
|
||||
FUNCTION id: 22, function_name: less, function_type: ordinary, result_type: UInt8
|
||||
COLUMN id: 21, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 22, constant_value: \'1994-01-01\', constant_value_type: String
|
||||
FUNCTION id: 23, function_name: less, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 23, nodes: 2
|
||||
COLUMN id: 12, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 24, constant_value: \'1995-01-01\', constant_value_type: String
|
||||
FUNCTION id: 25, function_name: and, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 24, nodes: 2
|
||||
COLUMN id: 21, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 25, constant_value: \'1995-01-01\', constant_value_type: String
|
||||
FUNCTION id: 26, function_name: and, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 26, nodes: 2
|
||||
FUNCTION id: 27, function_name: greaterOrEquals, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 27, nodes: 2
|
||||
FUNCTION id: 28, function_name: greaterOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 28, nodes: 2
|
||||
COLUMN id: 29, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 30, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
FUNCTION id: 31, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 29, nodes: 2
|
||||
COLUMN id: 30, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 31, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
FUNCTION id: 32, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 32, nodes: 2
|
||||
COLUMN id: 29, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 33, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 33, nodes: 2
|
||||
COLUMN id: 34, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 35, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT
|
||||
value1,
|
||||
@ -346,26 +346,26 @@ QUERY id: 0
|
||||
FUNCTION id: 11, function_name: greaterOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
COLUMN id: 6, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 13, constant_value: \'1993-01-01\', constant_value_type: String
|
||||
FUNCTION id: 14, function_name: less, function_type: ordinary, result_type: UInt8
|
||||
COLUMN id: 13, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 14, constant_value: \'1993-01-01\', constant_value_type: String
|
||||
FUNCTION id: 15, function_name: less, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 15, nodes: 2
|
||||
COLUMN id: 6, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 16, constant_value: \'1994-01-01\', constant_value_type: String
|
||||
FUNCTION id: 17, function_name: and, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 16, nodes: 2
|
||||
COLUMN id: 13, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 17, constant_value: \'1994-01-01\', constant_value_type: String
|
||||
FUNCTION id: 18, function_name: and, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 18, nodes: 2
|
||||
FUNCTION id: 19, function_name: greaterOrEquals, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 19, nodes: 2
|
||||
FUNCTION id: 20, function_name: greaterOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 20, nodes: 2
|
||||
COLUMN id: 21, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 22, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
FUNCTION id: 23, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 21, nodes: 2
|
||||
COLUMN id: 22, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 23, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
FUNCTION id: 24, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 24, nodes: 2
|
||||
COLUMN id: 21, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 25, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 25, nodes: 2
|
||||
COLUMN id: 26, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 27, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -398,8 +398,8 @@ QUERY id: 0
|
||||
FUNCTION id: 16, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 17, nodes: 2
|
||||
COLUMN id: 14, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 18, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 18, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 19, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -439,8 +439,8 @@ QUERY id: 0
|
||||
FUNCTION id: 19, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 20, nodes: 2
|
||||
COLUMN id: 17, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 21, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 21, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 22, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -465,22 +465,22 @@ QUERY id: 0
|
||||
FUNCTION id: 10, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 11, nodes: 2
|
||||
COLUMN id: 8, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 12, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 12, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 13, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
HAVING
|
||||
FUNCTION id: 13, function_name: and, function_type: ordinary, result_type: UInt8
|
||||
FUNCTION id: 14, function_name: and, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 14, nodes: 2
|
||||
FUNCTION id: 15, function_name: greaterOrEquals, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 15, nodes: 2
|
||||
FUNCTION id: 16, function_name: greaterOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 16, nodes: 2
|
||||
COLUMN id: 17, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 18, constant_value: \'1993-01-01\', constant_value_type: String
|
||||
FUNCTION id: 19, function_name: less, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 17, nodes: 2
|
||||
COLUMN id: 18, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 19, constant_value: \'1993-01-01\', constant_value_type: String
|
||||
FUNCTION id: 20, function_name: less, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 20, nodes: 2
|
||||
COLUMN id: 17, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 21, constant_value: \'1994-01-01\', constant_value_type: String
|
||||
LIST id: 21, nodes: 2
|
||||
COLUMN id: 18, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 22, constant_value: \'1994-01-01\', constant_value_type: String
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -516,8 +516,8 @@ QUERY id: 0
|
||||
FUNCTION id: 18, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 19, nodes: 2
|
||||
COLUMN id: 16, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 20, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 20, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 21, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -553,8 +553,8 @@ QUERY id: 0
|
||||
FUNCTION id: 18, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 19, nodes: 2
|
||||
COLUMN id: 16, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 20, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 20, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 21, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -595,8 +595,8 @@ QUERY id: 0
|
||||
FUNCTION id: 21, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 22, nodes: 2
|
||||
COLUMN id: 19, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 23, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 23, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 24, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -637,8 +637,8 @@ QUERY id: 0
|
||||
FUNCTION id: 21, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 22, nodes: 2
|
||||
COLUMN id: 19, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 23, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 23, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 24, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -679,8 +679,8 @@ QUERY id: 0
|
||||
FUNCTION id: 21, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 22, nodes: 2
|
||||
COLUMN id: 19, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 23, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 23, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 24, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -713,8 +713,8 @@ QUERY id: 0
|
||||
FUNCTION id: 16, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 17, nodes: 2
|
||||
COLUMN id: 14, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 18, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 18, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 19, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -747,8 +747,8 @@ QUERY id: 0
|
||||
FUNCTION id: 16, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 17, nodes: 2
|
||||
COLUMN id: 14, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 18, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 18, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 19, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -781,8 +781,8 @@ QUERY id: 0
|
||||
FUNCTION id: 16, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 17, nodes: 2
|
||||
COLUMN id: 14, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 18, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 18, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 19, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -815,8 +815,8 @@ QUERY id: 0
|
||||
FUNCTION id: 16, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 17, nodes: 2
|
||||
COLUMN id: 14, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 18, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 18, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 19, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date_t
|
||||
@ -847,26 +847,26 @@ QUERY id: 0
|
||||
FUNCTION id: 14, function_name: greaterOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 15, nodes: 2
|
||||
COLUMN id: 10, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 16, constant_value: \'1993-01-01\', constant_value_type: String
|
||||
FUNCTION id: 17, function_name: less, function_type: ordinary, result_type: UInt8
|
||||
COLUMN id: 16, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 17, constant_value: \'1993-01-01\', constant_value_type: String
|
||||
FUNCTION id: 18, function_name: less, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 18, nodes: 2
|
||||
COLUMN id: 10, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 19, constant_value: \'1994-01-01\', constant_value_type: String
|
||||
FUNCTION id: 20, function_name: and, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 19, nodes: 2
|
||||
COLUMN id: 16, column_name: date1, result_type: Date, source_id: 3
|
||||
CONSTANT id: 20, constant_value: \'1994-01-01\', constant_value_type: String
|
||||
FUNCTION id: 21, function_name: and, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 21, nodes: 2
|
||||
FUNCTION id: 22, function_name: greaterOrEquals, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 22, nodes: 2
|
||||
FUNCTION id: 23, function_name: greaterOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 23, nodes: 2
|
||||
COLUMN id: 24, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 25, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
FUNCTION id: 26, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 24, nodes: 2
|
||||
COLUMN id: 25, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 26, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
FUNCTION id: 27, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 27, nodes: 2
|
||||
COLUMN id: 24, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 28, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 28, nodes: 2
|
||||
COLUMN id: 29, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 30, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM datetime_t
|
||||
@ -907,8 +907,8 @@ QUERY id: 0
|
||||
FUNCTION id: 21, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 22, nodes: 2
|
||||
COLUMN id: 19, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 23, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 23, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 24, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM datetime_t
|
||||
@ -949,8 +949,8 @@ QUERY id: 0
|
||||
FUNCTION id: 21, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 22, nodes: 2
|
||||
COLUMN id: 19, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 23, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 23, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 24, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date32_t
|
||||
@ -991,8 +991,8 @@ QUERY id: 0
|
||||
FUNCTION id: 21, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 22, nodes: 2
|
||||
COLUMN id: 19, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 23, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 23, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 24, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM date32_t
|
||||
@ -1033,8 +1033,8 @@ QUERY id: 0
|
||||
FUNCTION id: 21, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 22, nodes: 2
|
||||
COLUMN id: 19, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 23, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 23, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 24, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM datetime64_t
|
||||
@ -1075,8 +1075,8 @@ QUERY id: 0
|
||||
FUNCTION id: 21, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 22, nodes: 2
|
||||
COLUMN id: 19, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 23, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 23, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 24, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
SELECT value1
|
||||
FROM datetime64_t
|
||||
@ -1117,6 +1117,6 @@ QUERY id: 0
|
||||
FUNCTION id: 21, function_name: lessOrEquals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 22, nodes: 2
|
||||
COLUMN id: 19, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 23, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 23, column_name: id, result_type: UInt32, source_id: 3
|
||||
CONSTANT id: 24, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
SETTINGS enable_analyzer=1
|
||||
|
@ -62,41 +62,41 @@ QUERY id: 0
|
||||
FUNCTION id: 7, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 8, nodes: 2
|
||||
COLUMN id: 4, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 9, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 9, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 10, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 5, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 10, nodes: 1
|
||||
CONSTANT id: 11, constant_value: UInt64_10000000, constant_value_type: UInt32
|
||||
LIST id: 11, nodes: 1
|
||||
CONSTANT id: 12, constant_value: UInt64_10000000, constant_value_type: UInt32
|
||||
GROUP BY
|
||||
LIST id: 12, nodes: 2
|
||||
FUNCTION id: 13, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 13, nodes: 2
|
||||
FUNCTION id: 14, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 14, nodes: 2
|
||||
COLUMN id: 4, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 15, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 16, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 15, nodes: 2
|
||||
COLUMN id: 16, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 17, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 18, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 17, nodes: 2
|
||||
COLUMN id: 4, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 18, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 19, nodes: 2
|
||||
COLUMN id: 20, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 21, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
ORDER BY
|
||||
LIST id: 19, nodes: 2
|
||||
SORT id: 20, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 22, nodes: 2
|
||||
SORT id: 23, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 2, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
FUNCTION id: 24, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 3, nodes: 2
|
||||
COLUMN id: 4, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 6, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
SORT id: 21, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 25, nodes: 2
|
||||
COLUMN id: 26, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 27, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
SORT id: 28, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 7, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
FUNCTION id: 29, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 8, nodes: 2
|
||||
COLUMN id: 4, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 9, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 30, nodes: 2
|
||||
COLUMN id: 31, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 32, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
a UInt8
|
||||
@ -111,41 +111,41 @@ QUERY id: 0
|
||||
FUNCTION id: 7, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 8, nodes: 2
|
||||
COLUMN id: 4, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 9, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 9, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 10, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 5, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 10, nodes: 1
|
||||
CONSTANT id: 11, constant_value: UInt64_10000000, constant_value_type: UInt32
|
||||
LIST id: 11, nodes: 1
|
||||
CONSTANT id: 12, constant_value: UInt64_10000000, constant_value_type: UInt32
|
||||
GROUP BY
|
||||
LIST id: 12, nodes: 2
|
||||
FUNCTION id: 13, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 13, nodes: 2
|
||||
FUNCTION id: 14, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 14, nodes: 2
|
||||
COLUMN id: 4, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 15, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 16, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 15, nodes: 2
|
||||
COLUMN id: 16, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 17, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 18, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 17, nodes: 2
|
||||
COLUMN id: 4, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 18, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 19, nodes: 2
|
||||
COLUMN id: 20, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 21, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
ORDER BY
|
||||
LIST id: 19, nodes: 2
|
||||
SORT id: 20, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 22, nodes: 2
|
||||
SORT id: 23, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 2, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
FUNCTION id: 24, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 3, nodes: 2
|
||||
COLUMN id: 4, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 6, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
SORT id: 21, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 25, nodes: 2
|
||||
COLUMN id: 26, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 27, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
SORT id: 28, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 7, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
FUNCTION id: 29, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 8, nodes: 2
|
||||
COLUMN id: 4, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 9, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 30, nodes: 2
|
||||
COLUMN id: 31, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 32, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
a UInt16
|
||||
@ -162,42 +162,42 @@ QUERY id: 0
|
||||
FUNCTION id: 9, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 10, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 11, constant_value: UInt64_7, constant_value_type: UInt8
|
||||
COLUMN id: 11, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 12, constant_value: UInt64_7, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 7, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 1
|
||||
CONSTANT id: 13, constant_value: UInt64_10000000, constant_value_type: UInt32
|
||||
LIST id: 13, nodes: 1
|
||||
CONSTANT id: 14, constant_value: UInt64_10000000, constant_value_type: UInt32
|
||||
GROUP BY
|
||||
LIST id: 14, nodes: 2
|
||||
FUNCTION id: 15, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 15, nodes: 2
|
||||
FUNCTION id: 16, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 16, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 17, constant_value: UInt64_7, constant_value_type: UInt8
|
||||
FUNCTION id: 18, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 17, nodes: 2
|
||||
COLUMN id: 18, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 19, constant_value: UInt64_7, constant_value_type: UInt8
|
||||
FUNCTION id: 20, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 19, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 20, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
LIST id: 21, nodes: 2
|
||||
COLUMN id: 22, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 23, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
ORDER BY
|
||||
LIST id: 21, nodes: 1
|
||||
SORT id: 22, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 24, nodes: 1
|
||||
SORT id: 25, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 2, function_name: multiply, function_type: ordinary, result_type: UInt16
|
||||
FUNCTION id: 26, function_name: multiply, function_type: ordinary, result_type: UInt16
|
||||
ARGUMENTS
|
||||
LIST id: 3, nodes: 2
|
||||
FUNCTION id: 4, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 27, nodes: 2
|
||||
FUNCTION id: 28, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 5, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 8, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
FUNCTION id: 9, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 29, nodes: 2
|
||||
COLUMN id: 30, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 31, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
FUNCTION id: 32, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 10, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 11, constant_value: UInt64_7, constant_value_type: UInt8
|
||||
LIST id: 33, nodes: 2
|
||||
COLUMN id: 34, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 35, constant_value: UInt64_7, constant_value_type: UInt8
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
foo UInt64
|
||||
@ -218,7 +218,7 @@ QUERY id: 0
|
||||
CONSTANT id: 8, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
GROUP BY
|
||||
LIST id: 9, nodes: 1
|
||||
COLUMN id: 5, column_name: number, result_type: UInt64, source_id: 6
|
||||
COLUMN id: 10, column_name: number, result_type: UInt64, source_id: 6
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
min(number) OVER (PARTITION BY modulo(number, 2)) UInt64
|
||||
@ -235,16 +235,16 @@ QUERY id: 0
|
||||
FUNCTION id: 8, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 9, nodes: 2
|
||||
COLUMN id: 4, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 10, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
COLUMN id: 10, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 11, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 5, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 11, nodes: 1
|
||||
CONSTANT id: 12, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 12, nodes: 1
|
||||
CONSTANT id: 13, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
GROUP BY
|
||||
LIST id: 13, nodes: 1
|
||||
COLUMN id: 4, column_name: number, result_type: UInt64, source_id: 5
|
||||
LIST id: 14, nodes: 1
|
||||
COLUMN id: 15, column_name: number, result_type: UInt64, source_id: 5
|
||||
set optimize_aggregators_of_group_by_keys = 0
|
||||
0 0
|
||||
0 1
|
||||
@ -314,47 +314,47 @@ QUERY id: 0
|
||||
FUNCTION id: 11, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 13, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 13, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 14, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 7, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 14, nodes: 1
|
||||
CONSTANT id: 15, constant_value: UInt64_10000000, constant_value_type: UInt32
|
||||
LIST id: 15, nodes: 1
|
||||
CONSTANT id: 16, constant_value: UInt64_10000000, constant_value_type: UInt32
|
||||
GROUP BY
|
||||
LIST id: 16, nodes: 2
|
||||
FUNCTION id: 17, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 17, nodes: 2
|
||||
FUNCTION id: 18, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 18, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 19, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 20, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 19, nodes: 2
|
||||
COLUMN id: 20, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 21, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 22, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 21, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 22, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 23, nodes: 2
|
||||
COLUMN id: 24, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 25, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
ORDER BY
|
||||
LIST id: 23, nodes: 2
|
||||
SORT id: 24, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 26, nodes: 2
|
||||
SORT id: 27, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 2, function_name: min, function_type: aggregate, result_type: UInt8
|
||||
FUNCTION id: 28, function_name: min, function_type: aggregate, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 3, nodes: 1
|
||||
FUNCTION id: 4, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 29, nodes: 1
|
||||
FUNCTION id: 30, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 5, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 8, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
SORT id: 25, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 31, nodes: 2
|
||||
COLUMN id: 32, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 33, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
SORT id: 34, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 9, function_name: max, function_type: aggregate, result_type: UInt8
|
||||
FUNCTION id: 35, function_name: max, function_type: aggregate, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 10, nodes: 1
|
||||
FUNCTION id: 11, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 36, nodes: 1
|
||||
FUNCTION id: 37, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 13, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 38, nodes: 2
|
||||
COLUMN id: 39, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 40, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
a UInt8
|
||||
@ -375,47 +375,47 @@ QUERY id: 0
|
||||
FUNCTION id: 11, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 13, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
COLUMN id: 13, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 14, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 7, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 14, nodes: 1
|
||||
CONSTANT id: 15, constant_value: UInt64_10000000, constant_value_type: UInt32
|
||||
LIST id: 15, nodes: 1
|
||||
CONSTANT id: 16, constant_value: UInt64_10000000, constant_value_type: UInt32
|
||||
GROUP BY
|
||||
LIST id: 16, nodes: 2
|
||||
FUNCTION id: 17, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 17, nodes: 2
|
||||
FUNCTION id: 18, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 18, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 19, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 20, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 19, nodes: 2
|
||||
COLUMN id: 20, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 21, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
FUNCTION id: 22, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 21, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 22, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 23, nodes: 2
|
||||
COLUMN id: 24, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 25, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
ORDER BY
|
||||
LIST id: 23, nodes: 2
|
||||
SORT id: 24, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 26, nodes: 2
|
||||
SORT id: 27, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 2, function_name: any, function_type: aggregate, result_type: UInt8
|
||||
FUNCTION id: 28, function_name: any, function_type: aggregate, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 3, nodes: 1
|
||||
FUNCTION id: 4, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 29, nodes: 1
|
||||
FUNCTION id: 30, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 5, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 8, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
SORT id: 25, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 31, nodes: 2
|
||||
COLUMN id: 32, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 33, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
SORT id: 34, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 9, function_name: anyLast, function_type: aggregate, result_type: UInt8
|
||||
FUNCTION id: 35, function_name: anyLast, function_type: aggregate, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 10, nodes: 1
|
||||
FUNCTION id: 11, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 36, nodes: 1
|
||||
FUNCTION id: 37, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 13, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 38, nodes: 2
|
||||
COLUMN id: 39, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 40, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
a UInt16
|
||||
@ -435,45 +435,45 @@ QUERY id: 0
|
||||
FUNCTION id: 11, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 13, constant_value: UInt64_7, constant_value_type: UInt8
|
||||
COLUMN id: 13, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 14, constant_value: UInt64_7, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 9, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 14, nodes: 1
|
||||
CONSTANT id: 15, constant_value: UInt64_10000000, constant_value_type: UInt32
|
||||
LIST id: 15, nodes: 1
|
||||
CONSTANT id: 16, constant_value: UInt64_10000000, constant_value_type: UInt32
|
||||
GROUP BY
|
||||
LIST id: 16, nodes: 2
|
||||
FUNCTION id: 17, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 17, nodes: 2
|
||||
FUNCTION id: 18, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 18, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 19, constant_value: UInt64_7, constant_value_type: UInt8
|
||||
FUNCTION id: 20, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 19, nodes: 2
|
||||
COLUMN id: 20, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 21, constant_value: UInt64_7, constant_value_type: UInt8
|
||||
FUNCTION id: 22, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 21, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 22, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
LIST id: 23, nodes: 2
|
||||
COLUMN id: 24, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 25, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
ORDER BY
|
||||
LIST id: 23, nodes: 1
|
||||
SORT id: 24, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 26, nodes: 1
|
||||
SORT id: 27, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 2, function_name: max, function_type: aggregate, result_type: UInt16
|
||||
FUNCTION id: 28, function_name: max, function_type: aggregate, result_type: UInt16
|
||||
ARGUMENTS
|
||||
LIST id: 3, nodes: 1
|
||||
FUNCTION id: 4, function_name: multiply, function_type: ordinary, result_type: UInt16
|
||||
LIST id: 29, nodes: 1
|
||||
FUNCTION id: 30, function_name: multiply, function_type: ordinary, result_type: UInt16
|
||||
ARGUMENTS
|
||||
LIST id: 5, nodes: 2
|
||||
FUNCTION id: 6, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 31, nodes: 2
|
||||
FUNCTION id: 32, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 7, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 10, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
FUNCTION id: 11, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 33, nodes: 2
|
||||
COLUMN id: 34, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 35, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
FUNCTION id: 36, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 13, constant_value: UInt64_7, constant_value_type: UInt8
|
||||
LIST id: 37, nodes: 2
|
||||
COLUMN id: 38, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 39, constant_value: UInt64_7, constant_value_type: UInt8
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
foo UInt64
|
||||
@ -497,7 +497,7 @@ QUERY id: 0
|
||||
CONSTANT id: 10, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
GROUP BY
|
||||
LIST id: 11, nodes: 1
|
||||
COLUMN id: 7, column_name: number, result_type: UInt64, source_id: 8
|
||||
COLUMN id: 12, column_name: number, result_type: UInt64, source_id: 8
|
||||
QUERY id: 0
|
||||
PROJECTION COLUMNS
|
||||
min(number) OVER (PARTITION BY modulo(number, 2)) UInt64
|
||||
@ -514,13 +514,13 @@ QUERY id: 0
|
||||
FUNCTION id: 8, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 9, nodes: 2
|
||||
COLUMN id: 4, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 10, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
COLUMN id: 10, column_name: number, result_type: UInt64, source_id: 5
|
||||
CONSTANT id: 11, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 5, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 11, nodes: 1
|
||||
CONSTANT id: 12, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
LIST id: 12, nodes: 1
|
||||
CONSTANT id: 13, constant_value: UInt64_3, constant_value_type: UInt8
|
||||
GROUP BY
|
||||
LIST id: 13, nodes: 1
|
||||
COLUMN id: 4, column_name: number, result_type: UInt64, source_id: 5
|
||||
LIST id: 14, nodes: 1
|
||||
COLUMN id: 15, column_name: number, result_type: UInt64, source_id: 5
|
||||
|
@ -132,7 +132,7 @@ QUERY id: 0
|
||||
TABLE id: 6, alias: __table2, table_name: default.test_rewrite_uniq_to_count
|
||||
GROUP BY
|
||||
LIST id: 7, nodes: 1
|
||||
COLUMN id: 5, column_name: a, result_type: UInt8, source_id: 6
|
||||
COLUMN id: 8, column_name: a, result_type: UInt8, source_id: 6
|
||||
SETTINGS enable_analyzer=1
|
||||
6. test group by with subquery alias
|
||||
3
|
||||
@ -164,7 +164,7 @@ QUERY id: 0
|
||||
TABLE id: 6, alias: __table2, table_name: default.test_rewrite_uniq_to_count
|
||||
GROUP BY
|
||||
LIST id: 7, nodes: 1
|
||||
COLUMN id: 5, column_name: a, result_type: UInt8, source_id: 6
|
||||
COLUMN id: 8, column_name: a, result_type: UInt8, source_id: 6
|
||||
SETTINGS enable_analyzer=1
|
||||
7. test group by with compound column name
|
||||
3
|
||||
@ -196,7 +196,7 @@ QUERY id: 0
|
||||
TABLE id: 6, alias: __table2, table_name: default.test_rewrite_uniq_to_count
|
||||
GROUP BY
|
||||
LIST id: 7, nodes: 1
|
||||
COLUMN id: 5, column_name: a, result_type: UInt8, source_id: 6
|
||||
COLUMN id: 8, column_name: a, result_type: UInt8, source_id: 6
|
||||
SETTINGS enable_analyzer=1
|
||||
8. test group by with select expression alias
|
||||
3
|
||||
@ -228,5 +228,5 @@ QUERY id: 0
|
||||
TABLE id: 6, alias: __table2, table_name: default.test_rewrite_uniq_to_count
|
||||
GROUP BY
|
||||
LIST id: 7, nodes: 1
|
||||
COLUMN id: 5, column_name: a, result_type: UInt8, source_id: 6
|
||||
COLUMN id: 8, column_name: a, result_type: UInt8, source_id: 6
|
||||
SETTINGS enable_analyzer=1
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -23,26 +23,26 @@ QUERY id: 0
|
||||
CONSTANT id: 13, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
GROUP BY
|
||||
LIST id: 14, nodes: 1
|
||||
FUNCTION id: 6, function_name: plus, function_type: ordinary, result_type: UInt64
|
||||
FUNCTION id: 15, function_name: plus, function_type: ordinary, result_type: UInt64
|
||||
ARGUMENTS
|
||||
LIST id: 7, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 10, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
LIST id: 16, nodes: 2
|
||||
COLUMN id: 17, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 18, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
ORDER BY
|
||||
LIST id: 15, nodes: 1
|
||||
SORT id: 16, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 19, nodes: 1
|
||||
SORT id: 20, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 2, function_name: toString, function_type: ordinary, result_type: String
|
||||
FUNCTION id: 21, function_name: toString, function_type: ordinary, result_type: String
|
||||
ARGUMENTS
|
||||
LIST id: 3, nodes: 1
|
||||
FUNCTION id: 4, function_name: toString, function_type: ordinary, result_type: String
|
||||
LIST id: 22, nodes: 1
|
||||
FUNCTION id: 23, function_name: toString, function_type: ordinary, result_type: String
|
||||
ARGUMENTS
|
||||
LIST id: 5, nodes: 1
|
||||
FUNCTION id: 6, function_name: plus, function_type: ordinary, result_type: UInt64
|
||||
LIST id: 24, nodes: 1
|
||||
FUNCTION id: 25, function_name: plus, function_type: ordinary, result_type: UInt64
|
||||
ARGUMENTS
|
||||
LIST id: 7, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 10, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
LIST id: 26, nodes: 2
|
||||
COLUMN id: 27, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 28, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
1 1
|
||||
2 1
|
||||
QUERY id: 0
|
||||
@ -79,17 +79,17 @@ QUERY id: 0
|
||||
LIST id: 15, nodes: 1
|
||||
SORT id: 16, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 2, function_name: toString, function_type: ordinary, result_type: String
|
||||
FUNCTION id: 17, function_name: toString, function_type: ordinary, result_type: String
|
||||
ARGUMENTS
|
||||
LIST id: 3, nodes: 1
|
||||
FUNCTION id: 4, function_name: toString, function_type: ordinary, result_type: String
|
||||
LIST id: 18, nodes: 1
|
||||
FUNCTION id: 19, function_name: toString, function_type: ordinary, result_type: String
|
||||
ARGUMENTS
|
||||
LIST id: 5, nodes: 1
|
||||
FUNCTION id: 6, function_name: plus, function_type: ordinary, result_type: UInt64
|
||||
LIST id: 20, nodes: 1
|
||||
FUNCTION id: 21, function_name: plus, function_type: ordinary, result_type: UInt64
|
||||
ARGUMENTS
|
||||
LIST id: 7, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 10, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
LIST id: 22, nodes: 2
|
||||
COLUMN id: 23, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 24, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
CHECK WITH TOTALS
|
||||
QUERY id: 0, is_group_by_with_totals: 1
|
||||
PROJECTION COLUMNS
|
||||
@ -116,26 +116,26 @@ QUERY id: 0, is_group_by_with_totals: 1
|
||||
CONSTANT id: 13, constant_value: UInt64_2, constant_value_type: UInt8
|
||||
GROUP BY
|
||||
LIST id: 14, nodes: 1
|
||||
FUNCTION id: 6, function_name: plus, function_type: ordinary, result_type: UInt64
|
||||
FUNCTION id: 15, function_name: plus, function_type: ordinary, result_type: UInt64
|
||||
ARGUMENTS
|
||||
LIST id: 7, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 10, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
LIST id: 16, nodes: 2
|
||||
COLUMN id: 17, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 18, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
ORDER BY
|
||||
LIST id: 15, nodes: 1
|
||||
SORT id: 16, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 19, nodes: 1
|
||||
SORT id: 20, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
FUNCTION id: 2, function_name: toString, function_type: ordinary, result_type: String
|
||||
FUNCTION id: 21, function_name: toString, function_type: ordinary, result_type: String
|
||||
ARGUMENTS
|
||||
LIST id: 3, nodes: 1
|
||||
FUNCTION id: 4, function_name: toString, function_type: ordinary, result_type: String
|
||||
LIST id: 22, nodes: 1
|
||||
FUNCTION id: 23, function_name: toString, function_type: ordinary, result_type: String
|
||||
ARGUMENTS
|
||||
LIST id: 5, nodes: 1
|
||||
FUNCTION id: 6, function_name: plus, function_type: ordinary, result_type: UInt64
|
||||
LIST id: 24, nodes: 1
|
||||
FUNCTION id: 25, function_name: plus, function_type: ordinary, result_type: UInt64
|
||||
ARGUMENTS
|
||||
LIST id: 7, nodes: 2
|
||||
COLUMN id: 8, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 10, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
LIST id: 26, nodes: 2
|
||||
COLUMN id: 27, column_name: number, result_type: UInt64, source_id: 9
|
||||
CONSTANT id: 28, constant_value: UInt64_1, constant_value_type: UInt8
|
||||
1 1
|
||||
2 1
|
||||
|
||||
|
@ -36,10 +36,10 @@ QUERY id: 0
|
||||
ARGUMENTS
|
||||
LIST id: 18, nodes: 2
|
||||
COLUMN id: 19, column_name: id, result_type: UInt32, source_id: 3
|
||||
FUNCTION id: 10, function_name: toYear, function_type: ordinary, result_type: UInt16
|
||||
FUNCTION id: 20, function_name: toYear, function_type: ordinary, result_type: UInt16
|
||||
ARGUMENTS
|
||||
LIST id: 11, nodes: 1
|
||||
COLUMN id: 12, column_name: date1, result_type: Date, source_id: 3
|
||||
LIST id: 21, nodes: 1
|
||||
COLUMN id: 22, column_name: date1, result_type: Date, source_id: 3
|
||||
EXPLAIN QUERY TREE run_passes = 1
|
||||
SELECT *
|
||||
FROM date_t__fuzz_0
|
||||
@ -72,10 +72,10 @@ QUERY id: 0
|
||||
ARGUMENTS
|
||||
LIST id: 15, nodes: 2
|
||||
COLUMN id: 16, column_name: id, result_type: UInt32, source_id: 3
|
||||
FUNCTION id: 10, function_name: toYear, function_type: ordinary, result_type: UInt16
|
||||
FUNCTION id: 17, function_name: toYear, function_type: ordinary, result_type: UInt16
|
||||
ARGUMENTS
|
||||
LIST id: 11, nodes: 1
|
||||
COLUMN id: 12, column_name: date1, result_type: Date, source_id: 3
|
||||
LIST id: 18, nodes: 1
|
||||
COLUMN id: 19, column_name: date1, result_type: Date, source_id: 3
|
||||
SETTINGS optimize_time_filter_with_preimage=0
|
||||
EXPLAIN QUERY TREE run_passes = 1
|
||||
SELECT *
|
||||
@ -117,5 +117,5 @@ QUERY id: 0
|
||||
FUNCTION id: 20, function_name: toYear, function_type: ordinary, result_type: UInt16
|
||||
ARGUMENTS
|
||||
LIST id: 21, nodes: 1
|
||||
COLUMN id: 12, column_name: date1, result_type: Date, source_id: 3
|
||||
COLUMN id: 22, column_name: date1, result_type: Date, source_id: 3
|
||||
SETTINGS optimize_time_filter_with_preimage=1
|
||||
|
@ -1 +1,11 @@
|
||||
10
|
||||
0 0
|
||||
0 1
|
||||
0 2
|
||||
0 3
|
||||
0 4
|
||||
5 5
|
||||
5 6
|
||||
5 7
|
||||
5 8
|
||||
5 9
|
||||
|
@ -25,3 +25,11 @@ SELECT v FROM (
|
||||
);
|
||||
|
||||
WITH (SELECT v FROM vecs_Float32 limit 1) AS a SELECT count(dp) FROM (SELECT dotProduct(a, v) AS dp FROM vecs_Float32);
|
||||
|
||||
WITH
|
||||
t as (SELECT number + a as x FROM numbers(5))
|
||||
SELECT 0 as a, x FROM t
|
||||
UNION ALL
|
||||
SELECT 5 as a, x FROM t
|
||||
ORDER BY a, x
|
||||
SETTINGS allow_experimental_analyzer = 1;
|
||||
|
@ -24,34 +24,34 @@ QUERY id: 0
|
||||
FUNCTION id: 11, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 13, constant_value: UInt64_10, constant_value_type: UInt8
|
||||
CONSTANT id: 14, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
FUNCTION id: 15, function_name: toTypeName, function_type: ordinary, result_type: String
|
||||
COLUMN id: 13, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 14, constant_value: UInt64_10, constant_value_type: UInt8
|
||||
CONSTANT id: 15, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
FUNCTION id: 16, function_name: toTypeName, function_type: ordinary, result_type: String
|
||||
ARGUMENTS
|
||||
LIST id: 16, nodes: 1
|
||||
FUNCTION id: 17, function_name: anyIf, function_type: aggregate, result_type: Nullable(Int128)
|
||||
LIST id: 17, nodes: 1
|
||||
FUNCTION id: 18, function_name: anyIf, function_type: aggregate, result_type: Nullable(Int128)
|
||||
ARGUMENTS
|
||||
LIST id: 18, nodes: 2
|
||||
FUNCTION id: 19, function_name: _CAST, function_type: ordinary, result_type: Nullable(Int128)
|
||||
LIST id: 19, nodes: 2
|
||||
FUNCTION id: 20, function_name: _CAST, function_type: ordinary, result_type: Nullable(Int128)
|
||||
ARGUMENTS
|
||||
LIST id: 20, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 21, constant_value: \'Nullable(Int128)\', constant_value_type: String
|
||||
FUNCTION id: 9, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 21, nodes: 2
|
||||
COLUMN id: 22, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 23, constant_value: \'Nullable(Int128)\', constant_value_type: String
|
||||
FUNCTION id: 24, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 10, nodes: 2
|
||||
FUNCTION id: 11, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 25, nodes: 2
|
||||
FUNCTION id: 26, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 13, constant_value: UInt64_10, constant_value_type: UInt8
|
||||
CONSTANT id: 14, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
LIST id: 27, nodes: 2
|
||||
COLUMN id: 28, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 29, constant_value: UInt64_10, constant_value_type: UInt8
|
||||
CONSTANT id: 30, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 7, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 22, nodes: 1
|
||||
CONSTANT id: 23, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 31, nodes: 1
|
||||
CONSTANT id: 32, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
SELECT any(if((number % 10) = 5, CAST(NULL, 'Nullable(Int128)'), number)) AS a, toTypeName(a) FROM numbers(100) AS a;
|
||||
0 Nullable(Int128)
|
||||
EXPLAIN QUERY TREE SELECT any(if((number % 10) = 5, CAST(NULL, 'Nullable(Int128)'), number)) AS a, toTypeName(a) FROM numbers(100);
|
||||
@ -78,34 +78,34 @@ QUERY id: 0
|
||||
FUNCTION id: 13, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 14, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 15, constant_value: UInt64_10, constant_value_type: UInt8
|
||||
CONSTANT id: 16, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
FUNCTION id: 17, function_name: toTypeName, function_type: ordinary, result_type: String
|
||||
COLUMN id: 15, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 16, constant_value: UInt64_10, constant_value_type: UInt8
|
||||
CONSTANT id: 17, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
FUNCTION id: 18, function_name: toTypeName, function_type: ordinary, result_type: String
|
||||
ARGUMENTS
|
||||
LIST id: 18, nodes: 1
|
||||
FUNCTION id: 19, function_name: anyIf, function_type: aggregate, result_type: Nullable(Int128)
|
||||
LIST id: 19, nodes: 1
|
||||
FUNCTION id: 20, function_name: anyIf, function_type: aggregate, result_type: Nullable(Int128)
|
||||
ARGUMENTS
|
||||
LIST id: 20, nodes: 2
|
||||
FUNCTION id: 21, function_name: _CAST, function_type: ordinary, result_type: Nullable(Int128)
|
||||
LIST id: 21, nodes: 2
|
||||
FUNCTION id: 22, function_name: _CAST, function_type: ordinary, result_type: Nullable(Int128)
|
||||
ARGUMENTS
|
||||
LIST id: 22, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 23, constant_value: \'Nullable(Int128)\', constant_value_type: String
|
||||
FUNCTION id: 24, function_name: not, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 23, nodes: 2
|
||||
COLUMN id: 24, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 25, constant_value: \'Nullable(Int128)\', constant_value_type: String
|
||||
FUNCTION id: 26, function_name: not, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 25, nodes: 1
|
||||
FUNCTION id: 11, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 27, nodes: 1
|
||||
FUNCTION id: 28, function_name: equals, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 12, nodes: 2
|
||||
FUNCTION id: 13, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
LIST id: 29, nodes: 2
|
||||
FUNCTION id: 30, function_name: modulo, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 14, nodes: 2
|
||||
COLUMN id: 6, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 15, constant_value: UInt64_10, constant_value_type: UInt8
|
||||
CONSTANT id: 16, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
LIST id: 31, nodes: 2
|
||||
COLUMN id: 32, column_name: number, result_type: UInt64, source_id: 7
|
||||
CONSTANT id: 33, constant_value: UInt64_10, constant_value_type: UInt8
|
||||
CONSTANT id: 34, constant_value: UInt64_5, constant_value_type: UInt8
|
||||
JOIN TREE
|
||||
TABLE_FUNCTION id: 7, alias: __table1, table_function_name: numbers
|
||||
ARGUMENTS
|
||||
LIST id: 26, nodes: 1
|
||||
CONSTANT id: 27, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
LIST id: 35, nodes: 1
|
||||
CONSTANT id: 36, constant_value: UInt64_100, constant_value_type: UInt8
|
||||
|
@ -10,30 +10,30 @@ QUERY id: 0
|
||||
FUNCTION id: 4, function_name: in, function_type: ordinary, result_type: UInt8
|
||||
ARGUMENTS
|
||||
LIST id: 5, nodes: 2
|
||||
COLUMN id: 2, column_name: id, result_type: UInt64, source_id: 3
|
||||
QUERY id: 6, is_subquery: 1, is_distinct: 1
|
||||
COLUMN id: 6, column_name: id, result_type: UInt64, source_id: 3
|
||||
QUERY id: 7, is_subquery: 1, is_distinct: 1
|
||||
PROJECTION COLUMNS
|
||||
id UInt64
|
||||
PROJECTION
|
||||
LIST id: 7, nodes: 1
|
||||
COLUMN id: 8, column_name: id, result_type: UInt64, source_id: 9
|
||||
LIST id: 8, nodes: 1
|
||||
COLUMN id: 9, column_name: id, result_type: UInt64, source_id: 10
|
||||
JOIN TREE
|
||||
TABLE id: 9, alias: __table1, table_name: default.test, final: 1
|
||||
TABLE id: 10, alias: __table1, table_name: default.test, final: 1
|
||||
ORDER BY
|
||||
LIST id: 10, nodes: 1
|
||||
SORT id: 11, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 11, nodes: 1
|
||||
SORT id: 12, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
COLUMN id: 8, column_name: id, result_type: UInt64, source_id: 9
|
||||
COLUMN id: 13, column_name: id, result_type: UInt64, source_id: 10
|
||||
LIMIT
|
||||
CONSTANT id: 12, constant_value: UInt64_4, constant_value_type: UInt64
|
||||
CONSTANT id: 14, constant_value: UInt64_4, constant_value_type: UInt64
|
||||
ORDER BY
|
||||
LIST id: 13, nodes: 1
|
||||
SORT id: 14, sort_direction: ASCENDING, with_fill: 0
|
||||
LIST id: 15, nodes: 1
|
||||
SORT id: 16, sort_direction: ASCENDING, with_fill: 0
|
||||
EXPRESSION
|
||||
COLUMN id: 2, column_name: id, result_type: UInt64, source_id: 3
|
||||
COLUMN id: 17, column_name: id, result_type: UInt64, source_id: 3
|
||||
LIMIT BY LIMIT
|
||||
CONSTANT id: 15, constant_value: UInt64_1, constant_value_type: UInt64
|
||||
CONSTANT id: 18, constant_value: UInt64_1, constant_value_type: UInt64
|
||||
LIMIT BY
|
||||
LIST id: 16, nodes: 1
|
||||
COLUMN id: 2, column_name: id, result_type: UInt64, source_id: 3
|
||||
LIST id: 19, nodes: 1
|
||||
COLUMN id: 20, column_name: id, result_type: UInt64, source_id: 3
|
||||
SETTINGS enable_analyzer=1
|
||||
|
@ -0,0 +1,6 @@
|
||||
fake
|
||||
objectValue
|
||||
0abc
|
||||
1
|
||||
0
|
||||
1
|
@ -0,0 +1,87 @@
|
||||
CREATE VIEW fake AS SELECT table, database, name FROM system.tables WHERE database = currentDatabase();
|
||||
|
||||
WITH
|
||||
(`database` NOT LIKE 'system' and `name` = 'fake') AS `$condition`,
|
||||
`$main` AS (SELECT DISTINCT table FROM fake WHERE `$condition`)
|
||||
SELECT * FROM `$main`;
|
||||
|
||||
with properties_value[indexOf(properties_key, 'objectId')] as objectId,
|
||||
data as (
|
||||
select
|
||||
['objectId'] as properties_key,
|
||||
['objectValue'] as properties_value
|
||||
),
|
||||
nested_query as (
|
||||
select
|
||||
objectId
|
||||
from
|
||||
data
|
||||
)
|
||||
select
|
||||
*
|
||||
from
|
||||
nested_query;
|
||||
|
||||
WITH leftPad('abc', 4, '0') as paddedval
|
||||
SELECT * FROM (SELECT paddedval);
|
||||
|
||||
with ('408','420') as some_tuple
|
||||
select '408' in some_tuple as flag;
|
||||
|
||||
CREATE VIEW another_fake AS SELECT bytes, table FROM system.parts;
|
||||
|
||||
WITH
|
||||
sum(bytes) as s,
|
||||
data as (
|
||||
SELECT
|
||||
formatReadableSize(s),
|
||||
table
|
||||
FROM another_fake
|
||||
GROUP BY table
|
||||
ORDER BY s
|
||||
)
|
||||
select * from data
|
||||
FORMAT Null;
|
||||
|
||||
CREATE TABLE test
|
||||
(
|
||||
a UInt64,
|
||||
b UInt64,
|
||||
Block_Height UInt64,
|
||||
Block_Date Date
|
||||
) ENGINE = Log;
|
||||
|
||||
WITH Block_Height BETWEEN 1 AND 2 AS block_filter
|
||||
SELECT *
|
||||
FROM test
|
||||
WHERE block_filter
|
||||
AND (
|
||||
Block_Date IN (
|
||||
SELECT Block_Date FROM test WHERE block_filter
|
||||
)
|
||||
);
|
||||
|
||||
CREATE TABLE test_cte
|
||||
(
|
||||
a UInt64,
|
||||
b UInt64,
|
||||
)
|
||||
ENGINE = MergeTree
|
||||
ORDER BY tuple();
|
||||
|
||||
WITH
|
||||
(a > b) as cte,
|
||||
query AS
|
||||
(
|
||||
SELECT count()
|
||||
FROM test_cte
|
||||
WHERE cte
|
||||
)
|
||||
SELECT *
|
||||
FROM query;
|
||||
|
||||
WITH arrayMap(x -> (x + 1), [0]) AS a
|
||||
SELECT 1
|
||||
WHERE 1 IN (
|
||||
SELECT arrayJoin(a)
|
||||
);
|
@ -1 +1,2 @@
|
||||
WITH x -> toString(x) AS lambda_1 SELECT arrayMap(lambda_1 AS lambda_2, [1, 2, 3]), arrayMap(lambda_2, ['1', '2', '3']) WHERE lambda_2; -- { serverError UNEXPECTED_EXPRESSION }
|
||||
WITH x -> toString(x) AS lambda_1 SELECT arrayMap(lambda_1 AS lambda_2, [1, 2, 3]), arrayMap(lambda_2, ['1', '2', '3']) WHERE lambda_2 SETTINGS enable_analyzer = 0; -- { serverError UNEXPECTED_EXPRESSION }
|
||||
WITH x -> toString(x) AS lambda_1 SELECT arrayMap(lambda_1 AS lambda_2, [1, 2, 3]), arrayMap(lambda_2, ['1', '2', '3']) WHERE lambda_2 SETTINGS enable_analyzer = 1; -- { serverError UNKNOWN_IDENTIFIER }
|
||||
|
Loading…
Reference in New Issue
Block a user