Compare commits

...

69 Commits

Author SHA1 Message Date
Dmitry Novik
6f3d6a5f61
Merge 50bc28faf8 into c27fe21339 2024-11-27 16:04:06 +01:00
Nikolay Degterinsky
c27fe21339
Merge pull request #71286 from arthurpassos/demand_changes_on_alter_user
Demand changes on alter user
2024-11-27 14:01:56 +00:00
Max Kainov
0eeb6c38dc
Merge pull request #72531 from ClickHouse/ci_remove_hdfs_tests
CI: Remove functional tests with hdfs
2024-11-27 13:57:03 +00:00
alesapin
6cc7746970
Merge pull request #72497 from ClickHouse/allow_pulling_executor_for_matview
Allow to use pulling executor in materialized views
2024-11-27 12:49:40 +00:00
Vladimir Cherkasov
b4e5178dd0
Merge pull request #72387 from ClickHouse/vdimir/with_fill_dup_sort_bug
Fix WITH FILL: Invalid number of rows in Chunk
2024-11-27 12:30:13 +00:00
Alexey Milovidov
ec914b108e
Merge pull request #71919 from ClickHouse/chesema-fix-test-03006
fix index_granularity_bytes to make test stable
2024-11-27 13:10:27 +01:00
Max Kainov
b61921f237 remove test cases 2024-11-27 12:04:06 +01:00
Alexey Milovidov
4a3ceac1c5
Merge pull request #72518 from vitlibar/fix-data-race-in-counters-set-parent
Fix data race in ProfileEvents::Counters::setParent().
2024-11-27 10:47:00 +00:00
alesapin
045baa3c39 Add to settings changes 2024-11-27 11:10:46 +01:00
Nikita Fomichev
682eb4c92f
Merge pull request #72519 from ClickHouse/24.10_disable_shared_set_join
SettingsChangesHistory: disable allow_experimental_shared_set_join
2024-11-27 10:01:09 +00:00
Max Kainov
bae2c068e9 fix sed in test 2024-11-27 10:23:28 +01:00
Max Kainov
09aa96370e CI: Remove functional tests with hdfs 2024-11-27 10:16:45 +01:00
Robert Schulze
9c893d4712
Merge pull request #72520 from ClickHouse/docs-cloud-atomic-default-engine
[Docs] Specify that Replicated is default engine for cloud
2024-11-27 08:53:36 +00:00
Justin de Guzman
b6725d33d1
[Docs] Specify that Replicated is default engine for cloud 2024-11-26 16:57:49 -08:00
Vitaly Baranov
ac6c28b15f Fix compilation. 2024-11-27 01:46:06 +01:00
Nikita Fomichev
1166e93447 SettingsChangesHistory: disable allow_experimental_shared_set_join 2024-11-27 00:56:03 +01:00
Vitaly Baranov
d78c3d4cba Fix data race in ProfileEvents::Counters::setParent(). 2024-11-27 00:39:15 +01:00
alesapin
6e9e0c82be Allow to use pulling executor in materialized views 2024-11-26 19:39:34 +01:00
Arthur Passos
1429266f65 Merge branch 'master' into demand_changes_on_alter_user 2024-11-26 15:33:33 -03:00
Vladimir Cherkasov
fea9e2ede8
Merge branch 'master' into vdimir/with_fill_dup_sort_bug 2024-11-26 14:14:48 +01:00
Dmitry Novik
50bc28faf8 Update 02174_cte_scalar_cache_mv reference file
Analyzer previously didn't need to use scalar query cache,
but now each expression resolved from aliases is unique.
This commit updates the number of cache hits in the test.
2024-11-25 15:22:56 +01:00
Dmitry Novik
fdc6b9a0a4 Update test 2024-11-25 14:29:47 +01:00
Dmitry Novik
cae94c922f Clean up code 2024-11-25 14:07:04 +01:00
vdimir
37a534325f
Fix WITH FILL: Invalid number of rows in Chunk 2024-11-25 13:00:55 +00:00
Dmitry Novik
ac1791a6ab Fix resolve to CTE in parent scope 2024-11-22 17:02:48 +01:00
Dmitry Novik
9350f5e5bf Fix hits for compound identifiers 2024-11-22 16:54:20 +01:00
Dmitry Novik
670d0bd2ba Update 02374_analyzer_array_join reference file
Change output for the ARRAY JOIN edge case.
2024-11-21 18:37:30 +01:00
Dmitry Novik
9664dc36b6 Fix enable_global_with_statement setting support 2024-11-20 21:05:08 +01:00
Dmitry Novik
aa1c181731 Fix checking for correlated columns
ARRAY JOINs and JOINs don't have AnalysisTableExpressionData,
so they were not registered in IdentifierResolveScope.
2024-11-20 17:27:58 +01:00
Dmitry Novik
397359166d Fix resolve table expression aliases in parent scopes 2024-11-20 14:24:43 +01:00
Dmitry Novik
44bcea0dd4 Fix lambda body resolve in parent scopes.
Allow identifiers inside of lambda body to reference table expressions
from join tree of the nearest query scope.
2024-11-19 18:48:55 +01:00
Dmitry Novik
4882600e15 Forbid to resolve in parent scopes to table expressions aliases.
It is allowed to resolve only to CTEs in parent scopes.
Improve IdentifierResolveScope::dump().
2024-11-19 17:13:01 +01:00
Dmitry Novik
fdabd96648 Update test for invalid WHERE 2024-11-18 13:36:49 +01:00
Dmitry Novik
9d7b5dee82 Fix a typo 2024-11-18 13:29:34 +01:00
Dmitry Novik
66e366f925 Update error code in test 2024-11-14 18:53:40 +01:00
Dmitry Novik
8f0caede41 Return the error code in the reference file back 2024-11-14 18:31:58 +01:00
Dmitry Novik
df23b9c9d7 Fix error in case of recursive lambdas 2024-11-14 18:29:10 +01:00
Dmitry Novik
f5a4e4d07e Improvements: tryResolveFromAliases should not throw exceptions 2024-11-14 18:14:21 +01:00
Dmitry Novik
e51bad5bc6 Add transitive aliases to IdentifierResolveScope::dump() 2024-11-14 17:18:18 +01:00
Dmitry Novik
4bd5aea8ca Fix a typo 2024-11-14 17:17:23 +01:00
Dmitry Novik
35e999137a Merge remote-tracking branch 'origin/master' into fix-analyzer-resolve-in-parent-scope 2024-11-14 16:39:04 +01:00
Dmitry Novik
4343db4dc3 Improve dump() methods output readability 2024-11-14 15:22:17 +01:00
Dmitry Novik
815a9dcb87 Small fix 2024-11-14 13:45:03 +01:00
Sema Checherinda
79ecd1c262 fix index_granularity_bytes to make test stable 2024-11-14 13:37:42 +01:00
Dmitry Novik
5bc7dea53c Simplify isDependentColumn predicate 2024-11-11 16:00:17 +01:00
Arthur Passos
4765fcac38 Merge branch 'master' into demand_changes_on_alter_user 2024-11-11 09:33:33 -03:00
Dmitry Novik
e5fce46532 Update reference files 2024-11-06 17:44:03 +01:00
Dmitry Novik
85d5d07a12 Do not copy table expression nodes 2024-10-31 19:04:42 +01:00
Dmitry Novik
ba3721bb10 Remove identifier resolve caching 2024-10-31 18:07:05 +01:00
Arthur Passos
ffc88fd8a3 comments 2024-10-30 21:53:53 -03:00
Arthur Passos
c7318b60da demand changes on alter user 2024-10-30 19:43:38 -03:00
Dmitry Novik
afd8fb237b Merge remote-tracking branch 'origin/master' into fix-analyzer-resolve-in-parent-scope 2024-10-29 18:47:55 +01:00
Dmitry Novik
7ef96b0086 Another WIP version 2024-10-02 17:01:24 +02:00
Dmitry Novik
caad5369d4 Fix MULTIPLE_EXPRESSIONS_FOR_ALIAS 2024-09-30 16:43:48 +02:00
Dmitry Novik
cea3eb93d7 Merge remote-tracking branch 'origin/master' into fix-analyzer-resolve-in-parent-scope 2024-09-30 16:07:42 +02:00
Dmitry Novik
02fd176c0a Remove unnecessary clone() 2024-08-23 16:07:19 +02:00
Dmitry Novik
9a5552b5e6 Fix crash in IdentifierResolveScope::dump() 2024-08-23 14:56:03 +02:00
Dmitry Novik
046f348fe7 Return required code and add a comment 2024-08-22 18:02:10 +02:00
Dmitry Novik
e503b57bfc Fix style check 2024-08-22 17:57:11 +02:00
Dmitry Novik
e23c9816a3 Some intermediate progress 2024-08-22 17:45:39 +02:00
Dmitry Novik
2a5687b4fd Remove query 2024-08-22 17:15:15 +02:00
Dmitry Novik
2cd16fe963 Add some tests 2024-08-22 17:15:15 +02:00
Dmitry Novik
f68c74a683 Another attempt + refactoring 2024-08-22 17:15:15 +02:00
Dmitry Novik
5533cc5c4f Fix error codes 2024-08-22 17:15:15 +02:00
Dmitry Novik
63611faffc Fix crash 2024-08-22 17:15:15 +02:00
Dmitry Novik
2962ad10da Resolve expressions CTE references to 2024-08-22 17:15:15 +02:00
Dmitry Novik
85e57700aa WIP on resolve from parent scopes 2024-08-22 17:15:15 +02:00
Dmitry Novik
5cfbefb95b Fix a typo 2024-08-22 17:15:15 +02:00
Dmitry Novik
ce87ae57b3 WIP on identifier resolution in parent scopes 2024-08-22 17:15:15 +02:00
92 changed files with 2134 additions and 2241 deletions

View File

@ -78,10 +78,6 @@ RUN arch=${TARGETARCH:-amd64} \
&& curl -L "https://dl.min.io/client/mc/release/linux-${arch}/archive/mc.RELEASE.${MINIO_CLIENT_VERSION}" -o ./mc \
&& chmod +x ./mc ./minio
RUN curl -L --no-verbose -O 'https://archive.apache.org/dist/hadoop/common/hadoop-3.3.1/hadoop-3.3.1.tar.gz' \
&& tar -xvf hadoop-3.3.1.tar.gz \
&& rm -rf hadoop-3.3.1.tar.gz
ENV MINIO_ROOT_USER="clickhouse"
ENV MINIO_ROOT_PASSWORD="clickhouse"
ENV EXPORT_S3_STORAGE_POLICIES=1

View File

@ -6,7 +6,7 @@ sidebar_position: 10
# Atomic
It supports non-blocking [DROP TABLE](#drop-detach-table) and [RENAME TABLE](#rename-table) queries and atomic [EXCHANGE TABLES](#exchange-tables) queries. `Atomic` database engine is used by default.
It supports non-blocking [DROP TABLE](#drop-detach-table) and [RENAME TABLE](#rename-table) queries and atomic [EXCHANGE TABLES](#exchange-tables) queries. `Atomic` database engine is used by default. Note that on ClickHouse Cloud, the `Replicated` database engine is used by default.
## Creating a Database {#creating-a-database}

View File

@ -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
{

View File

@ -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();

View File

@ -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;
}
};
}

View File

@ -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';
}

View File

@ -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

View File

@ -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);

View File

@ -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,

View File

@ -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)

View File

@ -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;

View File

@ -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);

View File

@ -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;
}

View File

@ -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

View File

@ -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,

View File

@ -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.

View File

@ -962,6 +962,15 @@ Counters::Counters(VariableContext level_, Counters * parent_)
counters = counters_holder.get();
}
Counters::Counters(Counters && src) noexcept
: counters(std::exchange(src.counters, nullptr))
, counters_holder(std::move(src.counters_holder))
, parent(src.parent.exchange(nullptr))
, trace_profile_events(src.trace_profile_events)
, level(src.level)
{
}
void Counters::resetCounters()
{
if (counters)
@ -973,7 +982,7 @@ void Counters::resetCounters()
void Counters::reset()
{
parent = nullptr;
setParent(nullptr);
resetCounters();
}

View File

@ -60,7 +60,7 @@ namespace ProfileEvents
Counter * counters = nullptr;
std::unique_ptr<Counter[]> counters_holder;
/// Used to propagate increments
Counters * parent = nullptr;
std::atomic<Counters *> parent = {};
bool trace_profile_events = false;
public:
@ -74,6 +74,8 @@ namespace ProfileEvents
explicit Counters(Counter * allocated_counters) noexcept
: counters(allocated_counters), parent(nullptr), level(VariableContext::Global) {}
Counters(Counters && src) noexcept;
Counter & operator[] (Event event)
{
return counters[event];
@ -114,13 +116,13 @@ namespace ProfileEvents
/// Get parent (thread unsafe)
Counters * getParent()
{
return parent;
return parent.load(std::memory_order_relaxed);
}
/// Set parent (thread unsafe)
void setParent(Counters * parent_)
{
parent = parent_;
parent.store(parent_, std::memory_order_relaxed);
}
void setTraceProfileEvents(bool value)

View File

@ -5521,6 +5521,8 @@ The default value is `CURRENT_USER`.
DECLARE(UInt64, cache_warmer_threads, 4, R"(
Only available in ClickHouse Cloud. Number of background threads for speculatively downloading new data parts into file cache, when cache_populated_by_fetch is enabled. Zero to disable.
)", 0) \
DECLARE(Bool, use_async_executor_for_materialized_views, false, R"(
Use async and potentially multithreaded execution of materialized view query, can speedup views processing during INSERT, but also consume more memory.)", 0) \
DECLARE(Int64, ignore_cold_parts_seconds, 0, R"(
Only available in ClickHouse Cloud. Exclude new data parts from SELECT queries until they're either pre-warmed (see cache_populated_by_fetch) or this many seconds old. Only for Replicated-/SharedMergeTree.
)", 0) \

View File

@ -60,6 +60,7 @@ static std::initializer_list<std::pair<ClickHouseVersion, SettingsChangesHistory
{
{"24.12",
{
{"use_async_executor_for_materialized_views", false, false, "New setting."},
}
},
{"24.11",
@ -117,7 +118,7 @@ static std::initializer_list<std::pair<ClickHouseVersion, SettingsChangesHistory
{"min_free_disk_ratio_to_perform_insert", 0.0, 0.0, "New setting."},
{"enable_named_columns_in_function_tuple", false, false, "Disabled pending usability improvements"},
{"cloud_mode_database_engine", 1, 1, "A setting for ClickHouse Cloud"},
{"allow_experimental_shared_set_join", 1, 1, "A setting for ClickHouse Cloud"},
{"allow_experimental_shared_set_join", 0, 0, "A setting for ClickHouse Cloud"},
{"read_through_distributed_cache", 0, 0, "A setting for ClickHouse Cloud"},
{"write_through_distributed_cache", 0, 0, "A setting for ClickHouse Cloud"},
{"distributed_cache_throw_on_error", 0, 0, "A setting for ClickHouse Cloud"},

View File

@ -549,6 +549,8 @@ bool ParserCreateUserQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
auto names = typeid_cast<std::shared_ptr<ASTUserNamesWithHost>>(names_ast);
auto names_ref = names->names;
auto pos_after_parsing_names = pos;
std::optional<String> new_name;
std::optional<AllowedClientHosts> hosts;
std::optional<AllowedClientHosts> add_hosts;
@ -674,6 +676,13 @@ bool ParserCreateUserQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
else if (alter)
names->concatParts();
bool alter_query_with_no_changes = alter && pos_after_parsing_names == pos;
if (alter_query_with_no_changes)
{
return false;
}
auto query = std::make_shared<ASTCreateUserQuery>();
node = query;

View File

@ -62,8 +62,8 @@ void Chunk::checkNumRowsIsConsistent()
{
auto & column = columns[i];
if (column->size() != num_rows)
throw Exception(ErrorCodes::LOGICAL_ERROR, "Invalid number of rows in Chunk column {}: expected {}, got {}",
column->getName() + " position " + toString(i), toString(num_rows), toString(column->size()));
throw Exception(ErrorCodes::LOGICAL_ERROR, "Invalid number of rows in Chunk {} column {} at position {}: expected {}, got {}",
dumpStructure(), column->getName(), i, num_rows, column->size());
}
}
@ -100,8 +100,8 @@ void Chunk::addColumn(ColumnPtr column)
if (empty())
num_rows = column->size();
else if (column->size() != num_rows)
throw Exception(ErrorCodes::LOGICAL_ERROR, "Invalid number of rows in Chunk column {}, got {}",
column->getName()+ ": expected " + toString(num_rows), toString(column->size()));
throw Exception(ErrorCodes::LOGICAL_ERROR, "Invalid number of rows in Chunk {} column {}: expected {}, got {}",
dumpStructure(), column->getName(), num_rows, column->size());
columns.emplace_back(std::move(column));
}

View File

@ -205,6 +205,20 @@ static bool tryConvertFields(FillColumnDescription & descr, const DataTypePtr &
return true;
}
SortDescription duduplicateSortDescription(const SortDescription & sort_description)
{
SortDescription result;
std::unordered_set<std::string> unique_columns;
for (const auto & desc : sort_description)
{
const auto & [_, inserted] = unique_columns.insert(desc.column_name);
if (!inserted)
continue;
result.push_back(desc);
}
return result;
}
FillingTransform::FillingTransform(
const Block & header_,
const SortDescription & sort_description_,
@ -212,7 +226,7 @@ FillingTransform::FillingTransform(
InterpolateDescriptionPtr interpolate_description_,
const bool use_with_fill_by_sorting_prefix_)
: ISimpleTransform(header_, transformHeader(header_, fill_description_), true)
, sort_description(sort_description_)
, sort_description(duduplicateSortDescription(sort_description_))
, fill_description(fill_description_)
, interpolate_description(interpolate_description_)
, filling_row(fill_description_)

View File

@ -11,6 +11,7 @@
#include <Processors/Transforms/PlanSquashingTransform.h>
#include <Processors/Transforms/SquashingTransform.h>
#include <Processors/Transforms/ExpressionTransform.h>
#include <Processors/Executors/PullingAsyncPipelineExecutor.h>
#include <Processors/Executors/PullingPipelineExecutor.h>
#include <Storages/LiveView/StorageLiveView.h>
#include <Storages/WindowView/StorageWindowView.h>
@ -63,6 +64,7 @@ namespace Setting
extern const SettingsUInt64 min_insert_block_size_rows_for_materialized_views;
extern const SettingsBool parallel_view_processing;
extern const SettingsBool use_concurrency_control;
extern const SettingsBool use_async_executor_for_materialized_views;
}
namespace ErrorCodes
@ -129,6 +131,7 @@ private:
};
/// For source chunk, execute view query over it.
template <typename Executor>
class ExecutingInnerQueryFromViewTransform final : public ExceptionKeepingTransform
{
public:
@ -148,7 +151,7 @@ private:
struct State
{
QueryPipeline pipeline;
PullingPipelineExecutor executor;
Executor executor;
explicit State(QueryPipeline pipeline_)
: pipeline(std::move(pipeline_))
@ -428,17 +431,31 @@ std::optional<Chain> generateViewChain(
out.addSource(std::make_shared<DeduplicationToken::CheckTokenTransform>("Right after Inner query", out.getInputHeader()));
#endif
auto executing_inner_query = std::make_shared<ExecutingInnerQueryFromViewTransform>(
storage_header, views_data->views.back(), views_data, disable_deduplication_for_children);
executing_inner_query->setRuntimeData(view_thread_status, view_counter_ms);
if (context->getSettingsRef()[Setting::use_async_executor_for_materialized_views])
{
auto executing_inner_query = std::make_shared<ExecutingInnerQueryFromViewTransform<PullingAsyncPipelineExecutor>>(
storage_header, views_data->views.back(), views_data, disable_deduplication_for_children);
executing_inner_query->setRuntimeData(view_thread_status, view_counter_ms);
out.addSource(std::move(executing_inner_query));
out.addSource(std::move(executing_inner_query));
}
else
{
auto executing_inner_query = std::make_shared<ExecutingInnerQueryFromViewTransform<PullingPipelineExecutor>>(
storage_header, views_data->views.back(), views_data, disable_deduplication_for_children);
executing_inner_query->setRuntimeData(view_thread_status, view_counter_ms);
out.addSource(std::move(executing_inner_query));
}
#ifdef ABORT_ON_LOGICAL_ERROR
out.addSource(std::make_shared<DeduplicationToken::CheckTokenTransform>("Right before Inner query", out.getInputHeader()));
#endif
}
return out;
}
@ -766,7 +783,8 @@ IProcessor::Status CopyingDataToViewsTransform::prepare()
}
ExecutingInnerQueryFromViewTransform::ExecutingInnerQueryFromViewTransform(
template <typename Executor>
ExecutingInnerQueryFromViewTransform<Executor>::ExecutingInnerQueryFromViewTransform(
const Block & header,
ViewRuntimeData & view_,
std::shared_ptr<ViewsData> views_data_,
@ -778,14 +796,16 @@ ExecutingInnerQueryFromViewTransform::ExecutingInnerQueryFromViewTransform(
{
}
void ExecutingInnerQueryFromViewTransform::onConsume(Chunk chunk)
template <typename Executor>
void ExecutingInnerQueryFromViewTransform<Executor>::onConsume(Chunk chunk)
{
auto block = getInputPort().getHeader().cloneWithColumns(chunk.detachColumns());
state.emplace(process(std::move(block), view, *views_data, std::move(chunk.getChunkInfos()), disable_deduplication_for_children));
}
ExecutingInnerQueryFromViewTransform::GenerateResult ExecutingInnerQueryFromViewTransform::onGenerate()
template <typename Executor>
ExecutingInnerQueryFromViewTransform<Executor>::GenerateResult ExecutingInnerQueryFromViewTransform<Executor>::onGenerate()
{
GenerateResult res;
if (!state.has_value())

View File

@ -1,21 +0,0 @@
#!/bin/bash
# shellcheck disable=SC2024
set -e -x -a -u
ls -lha
cd /hadoop-3.3.1
export JAVA_HOME=/usr
mkdir -p target/test/data
chown clickhouse ./target/test/data
sudo -E -u clickhouse bin/mapred minicluster -format -nomr -nnport 12222 >> /test_output/hdfs_minicluster.log 2>&1 &
while ! nc -z localhost 12222; do
sleep 1
done
lsof -i :12222
sleep 5

View File

@ -57,8 +57,6 @@ source /repo/tests/docker_scripts/utils.lib
/repo/tests/docker_scripts/setup_minio.sh stateless
/repo/tests/docker_scripts/setup_hdfs_minicluster.sh
config_logs_export_cluster /etc/clickhouse-server/config.d/system_logs_export.yaml
if [[ -n "$BUGFIX_VALIDATE_CHECK" ]] && [[ "$BUGFIX_VALIDATE_CHECK" -eq 1 ]]; then

View File

@ -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

View File

@ -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

View File

@ -1,10 +0,0 @@
-- Tags: no-fasttest, use-hdfs
drop table if exists test_table_hdfs_syntax
;
create table test_table_hdfs_syntax (id UInt32) ENGINE = HDFS('')
; -- { serverError BAD_ARGUMENTS }
create table test_table_hdfs_syntax (id UInt32) ENGINE = HDFS('','','', '')
; -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
drop table if exists test_table_hdfs_syntax
;

View File

@ -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

View File

@ -16,5 +16,5 @@ for _ in {1..1000}; do
if [[ $elapsed -gt 30 ]]; then
break
fi
done 2>&1 | grep -o -P 'Query memory limit exceeded' | sed -r -e 's/(.*):([a-Z ]*)([mM]emory limit exceeded)(.*)/\2\3/' | uniq
done 2>&1 | grep -o 'Query memory limit exceeded' | head -n1
echo 'Ok'

View File

@ -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

View File

@ -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

View File

@ -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 (
(

View File

@ -1,10 +0,0 @@
#!/usr/bin/env bash
# Tags: no-fasttest, use-hdfs
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
TCP_PORT=$($CLICKHOUSE_CLIENT -q "SELECT tcpPort()")
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('hdfs://localhost:$TCP_PORT/data.csv', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "HDFS_ERROR" && echo 'OK' || echo 'FAIL';

View File

@ -1,17 +0,0 @@
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK

View File

@ -1,25 +0,0 @@
#!/usr/bin/env bash
# Tags: no-fasttest, use-hdfs
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('abcd', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "BAD_ARGUMENTS" && echo 'OK' || echo 'FAIL';
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('abcd/', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "BAD_ARGUMENTS" && echo 'OK' || echo 'FAIL';
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('//abcd', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "BAD_ARGUMENTS" && echo 'OK' || echo 'FAIL';
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('//abcd/', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "BAD_ARGUMENTS" && echo 'OK' || echo 'FAIL';
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('//abcd/data', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "BAD_ARGUMENTS" && echo 'OK' || echo 'FAIL';
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('://abcd', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "BAD_ARGUMENTS" && echo 'OK' || echo 'FAIL';
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('://abcd/data', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "BAD_ARGUMENTS" && echo 'OK' || echo 'FAIL';
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('abcd:9000', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "BAD_ARGUMENTS" && echo 'OK' || echo 'FAIL';
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('abcd:9000/data', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "BAD_ARGUMENTS" && echo 'OK' || echo 'FAIL';
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('//abcd:9000/data', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "BAD_ARGUMENTS" && echo 'OK' || echo 'FAIL';
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('://abcd:9000/data', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "BAD_ARGUMENTS" && echo 'OK' || echo 'FAIL';
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('abcd/', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "BAD_ARGUMENTS" && echo 'OK' || echo 'FAIL';
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('hdfs://abcd', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "BAD_ARGUMENTS" && echo 'OK' || echo 'FAIL';
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('hdfs1:9000/data', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "BAD_ARGUMENTS" && echo 'OK' || echo 'FAIL';
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('hdfs://hdfs1/data', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "HDFS_ERROR" && echo 'OK' || echo 'FAIL';
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('http://hdfs1:9000/data', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "BAD_ARGUMENTS" && echo 'OK' || echo 'FAIL';
$CLICKHOUSE_CLIENT -q "SELECT * FROM hdfs('hdfs://hdfs1@nameservice/abcd/data', 'CSV', 'x UInt32')" 2>&1 | grep -F -q "HDFS_ERROR" && echo 'OK' || echo 'FAIL';

View File

@ -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

View File

@ -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,

View File

@ -1,48 +0,0 @@
1 2 3
4 5 6
7 8 9
1 2 3
4 5 6
7 8 9
1 2 3
4 5 6
7 8 9
1 2 3
4 5 6
7 8 9
1 2 3
4 5 6
7 8 9
1 2 3
4 5 6
7 8 9
1 2 3
4 5 6
7 8 9
1 2 3
4 5 6
7 8 9
c1 Nullable(Int64)
c2 Nullable(Int64)
c3 Nullable(Int64)
c1 Nullable(Int64)
c2 Nullable(Int64)
c3 Nullable(Int64)
c1 UInt32
c2 UInt32
c3 UInt32
c1 UInt32
c2 UInt32
c3 UInt32
c1 Nullable(Int64)
c2 Nullable(Int64)
c3 Nullable(Int64)
c1 Nullable(Int64)
c2 Nullable(Int64)
c3 Nullable(Int64)
c1 UInt32
c2 UInt32
c3 UInt32
c1 UInt32
c2 UInt32
c3 UInt32

View File

@ -1,26 +0,0 @@
-- Tags: no-fasttest, no-parallel
-- Tag no-fasttest: Depends on Java
insert into table function hdfs('hdfs://localhost:12222/test_1.tsv', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') select 1, 2, 3 settings hdfs_truncate_on_insert=1;
insert into table function hdfs('hdfs://localhost:12222/test_2.tsv', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') select 4, 5, 6 settings hdfs_truncate_on_insert=1;
insert into table function hdfs('hdfs://localhost:12222/test_3.tsv', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') select 7, 8, 9 settings hdfs_truncate_on_insert=1;
select * from hdfs('hdfs://localhost:12222/test_{1,2,3}.tsv') order by c1, c2, c3;
select * from hdfs('hdfs://localhost:12222/test_{1,2,3}.tsv', 'TSV') order by c1, c2, c3;
select * from hdfs('hdfs://localhost:12222/test_{1,2,3}.tsv', 'TSV', 'c1 UInt32, c2 UInt32, c3 UInt32') order by c1, c2, c3;
select * from hdfs('hdfs://localhost:12222/test_{1,2,3}.tsv', 'TSV', 'c1 UInt32, c2 UInt32, c3 UInt32', 'auto') order by c1, c2, c3;
select * from hdfsCluster('test_cluster_two_shards_localhost', 'hdfs://localhost:12222/test_{1,2,3}.tsv') order by c1, c2, c3;
select * from hdfsCluster('test_cluster_two_shards_localhost', 'hdfs://localhost:12222/test_{1,2,3}.tsv', 'TSV') order by c1, c2, c3;
select * from hdfsCluster('test_cluster_two_shards_localhost', 'hdfs://localhost:12222/test_{1,2,3}.tsv', 'TSV', 'c1 UInt32, c2 UInt32, c3 UInt32') order by c1, c2, c3;
select * from hdfsCluster('test_cluster_two_shards_localhost', 'hdfs://localhost:12222/test_{1,2,3}.tsv', 'TSV', 'c1 UInt32, c2 UInt32, c3 UInt32', 'auto') order by c1, c2, c3;
desc hdfs('hdfs://localhost:12222/test_{1,2,3}.tsv');
desc hdfs('hdfs://localhost:12222/test_{1,2,3}.tsv', 'TSV');
desc hdfs('hdfs://localhost:12222/test_{1,2,3}.tsv', 'TSV', 'c1 UInt32, c2 UInt32, c3 UInt32');
desc hdfs('hdfs://localhost:12222/test_{1,2,3}.tsv', 'TSV', 'c1 UInt32, c2 UInt32, c3 UInt32', 'auto');
desc hdfsCluster('test_cluster_two_shards_localhost', 'hdfs://localhost:12222/test_{1,2,3}.tsv');
desc hdfsCluster('test_cluster_two_shards_localhost', 'hdfs://localhost:12222/test_{1,2,3}.tsv', 'TSV');
desc hdfsCluster('test_cluster_two_shards_localhost', 'hdfs://localhost:12222/test_{1,2,3}.tsv', 'TSV', 'c1 UInt32, c2 UInt32, c3 UInt32');
desc hdfsCluster('test_cluster_two_shards_localhost', 'hdfs://localhost:12222/test_{1,2,3}.tsv', 'TSV', 'c1 UInt32, c2 UInt32, c3 UInt32', 'auto');

View File

@ -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);

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Tags: no-fasttest, no-asan, no-tsan, no-msan, no-ubsan, no-debug
# FIXME https://github.com/ClickHouse/ClickHouse/issues/47207
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
for i in $(seq 1 10);
do
$CLICKHOUSE_CLIENT --query_id="02368_$i" -q "insert into function hdfs('hdfs://localhost:12222/02368_data_$i.jsonl') select range(number % 1000) from numbers(100000) settings hdfs_truncate_on_insert=1, output_format_parallel_formatting=1" 2> /dev/null &
done
sleep 2
$CLICKHOUSE_CLIENT -q "kill query where startsWith(query_id, '02368_') sync" > /dev/null 2>&1
for i in $(seq 1 10);
do
$CLICKHOUSE_CLIENT --query_id="02368_$i" -q "insert into function hdfs('hdfs://localhost:12222/02368_data_$i.jsonl') select range(number % 1000) from numbers(100000) settings hdfs_truncate_on_insert=1, output_format_parallel_formatting=0" 2> /dev/null &
done
sleep 2
$CLICKHOUSE_CLIENT -q "kill query where startsWith(query_id, '02368_') sync" > /dev/null 2>&1

View File

@ -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;

View File

@ -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 '--';

View File

@ -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 '--';

View File

@ -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 }

View File

@ -1,5 +0,0 @@
-- Tags: no-fasttest
SELECT * FROM hdfsCluster('test_shard_localhost', '', 'TSV'); -- { serverError BAD_ARGUMENTS }
SELECT * FROM hdfsCluster('test_shard_localhost', ' ', 'TSV'); -- { serverError BAD_ARGUMENTS }
SELECT * FROM hdfsCluster('test_shard_localhost', '/', 'TSV'); -- { serverError BAD_ARGUMENTS }
SELECT * FROM hdfsCluster('test_shard_localhost', 'http/', 'TSV'); -- { serverError BAD_ARGUMENTS }

View File

@ -1,10 +0,0 @@
c1 Nullable(Int64)
c2 Nullable(Int64)
c3 Nullable(Int64)
c1 Nullable(Int64)
c2 Nullable(Int64)
c3 Nullable(Int64)
1 2 3
4 5 6
1 2 3
4 5 6

View File

@ -1,11 +0,0 @@
-- Tags: no-fasttest, no-parallel
-- Tag no-fasttest: Depends on Java
insert into table function hdfs('hdfs://localhost:12222/test_02458_1.tsv', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') select 1, 2, 3 settings hdfs_truncate_on_insert=1;
insert into table function hdfs('hdfs://localhost:12222/test_02458_2.tsv', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') select 4, 5, 6 settings hdfs_truncate_on_insert=1;
desc hdfsCluster('test_cluster_one_shard_three_replicas_localhost', 'hdfs://localhost:12222/test_02458_{1,2}.tsv');
desc hdfsCluster('test_cluster_one_shard_three_replicas_localhost', 'hdfs://localhost:12222/test_02458_{1,2}.tsv', 'TSV');
select * from hdfsCluster('test_cluster_one_shard_three_replicas_localhost', 'hdfs://localhost:12222/test_02458_{1,2}.tsv') order by c1, c2, c3;
select * from hdfsCluster('test_cluster_one_shard_three_replicas_localhost', 'hdfs://localhost:12222/test_02458_{1,2}.tsv', 'TSV') order by c1, c2, c3;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,11 +0,0 @@
-- Tags: no-fasttest, no-parallel
-- Tag no-fasttest: Depends on Java
insert into table function hdfs('hdfs://localhost:12222/test_02536.jsonl', 'TSV') select '{"x" : {"a" : 1, "b" : 2}}' settings hdfs_truncate_on_insert=1;
set input_format_json_try_infer_named_tuples_from_objects=0;
drop table if exists test;
create table test (x Tuple(a UInt32, b UInt32)) engine=Memory();
insert into test select * from hdfsCluster('test_cluster_two_shards_localhost', 'hdfs://localhost:12222/test_02536.jsonl') settings use_structure_from_insertion_table_in_table_functions=0; -- {serverError ILLEGAL_COLUMN}
insert into test select * from hdfsCluster('test_cluster_two_shards_localhost', 'hdfs://localhost:12222/test_02536.jsonl') settings use_structure_from_insertion_table_in_table_functions=1;
select * from test;
drop table test;

View File

@ -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

View File

@ -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

View File

@ -1,11 +0,0 @@
Test 1: select from hdfs database
1 2 3
test_hdfs_1
1 2 3
test_hdfs_2
Test 2: check exceptions
BAD_ARGUMENTS
OK
OK
OK
OK

View File

@ -1,72 +0,0 @@
#!/usr/bin/env bash
# Tags: no-fasttest, use-hdfs, no-parallel
CLICKHOUSE_CLIENT_SERVER_LOGS_LEVEL=none
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
# Prepare data
${CLICKHOUSE_CLIENT} -q "insert into table function hdfs('hdfs://localhost:12222/test_02725_1.tsv', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') select 1, 2, 3 settings hdfs_truncate_on_insert=1;"
ret=$?
if [ $ret -ne 0 ]; then
echo "Insert failed!"
exit 1
fi
${CLICKHOUSE_CLIENT} -q "insert into table function hdfs('hdfs://localhost:12222/test_02725_2.tsv', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32') select 4, 5, 6 settings hdfs_truncate_on_insert=1;"
ret=$?
if [ $ret -ne 0 ]; then
echo "Insert failed!"
exit 1
fi
#################
echo "Test 1: select from hdfs database"
# Database without specific host
${CLICKHOUSE_CLIENT} --multiline -q """
DROP DATABASE IF EXISTS test_hdfs_1;
CREATE DATABASE test_hdfs_1 ENGINE = HDFS;
USE test_hdfs_1;
SELECT * FROM \"hdfs://localhost:12222/test_02725_1.tsv\"
"""
${CLICKHOUSE_CLIENT} -q "SHOW DATABASES;" | grep test_hdfs_1
# Database with host
${CLICKHOUSE_CLIENT} --multiline -q """
DROP DATABASE IF EXISTS test_hdfs_2;
CREATE DATABASE test_hdfs_2 ENGINE = HDFS('hdfs://localhost:12222');
USE test_hdfs_2;
SELECT * FROM \"test_02725_1.tsv\"
"""
${CLICKHOUSE_CLIENT} -q "SHOW DATABASES;" | grep test_hdfs_2
#################
echo "Test 2: check exceptions"
${CLICKHOUSE_CLIENT} --multiline -q """
DROP DATABASE IF EXISTS test_hdfs_3;
CREATE DATABASE test_hdfs_3 ENGINE = HDFS('abacaba');
""" 2>&1 | tr '\n' ' ' | grep -oF "BAD_ARGUMENTS"
${CLICKHOUSE_CLIENT} --multiline -q """
DROP DATABASE IF EXISTS test_hdfs_4;
CREATE DATABASE test_hdfs_4 ENGINE = HDFS;
USE test_hdfs_4;
SELECT * FROM \"abacaba/file.tsv\"
""" 2>&1 | tr '\n' ' ' | grep -oF "CANNOT_EXTRACT_TABLE_STRUCTURE"
${CLICKHOUSE_CLIENT} -q "SELECT * FROM test_hdfs_4.\`http://localhost:11111/test/a.tsv\`" 2>&1 | tr '\n' ' ' | grep -oF -e "UNKNOWN_TABLE" -e "BAD_ARGUMENTS" > /dev/null && echo "OK" || echo 'FAIL' ||:
${CLICKHOUSE_CLIENT} --query "SELECT * FROM test_hdfs_4.\`hdfs://localhost:12222/file.myext\`" 2>&1 | tr '\n' ' ' | grep -oF -e "UNKNOWN_TABLE" -e "The data format cannot be detected" > /dev/null && echo "OK" || echo 'FAIL' ||:
${CLICKHOUSE_CLIENT} --query "SELECT * FROM test_hdfs_4.\`hdfs://localhost:12222/test_02725_3.tsv\`" 2>&1 | tr '\n' ' ' | grep -oF -e "UNKNOWN_TABLE" -e "The table structure cannot be extracted" > /dev/null && echo "OK" || echo 'FAIL' ||:
${CLICKHOUSE_CLIENT} --query "SELECT * FROM test_hdfs_4.\`hdfs://localhost:12222\`" 2>&1 | tr '\n' ' ' | grep -oF -e "UNKNOWN_TABLE" -e "BAD_ARGUMENTS" > /dev/null && echo "OK" || echo 'FAIL' ||:
# Cleanup
${CLICKHOUSE_CLIENT} --multiline -q """
DROP DATABASE IF EXISTS test_hdfs_1;
DROP DATABASE IF EXISTS test_hdfs_2;
DROP DATABASE IF EXISTS test_hdfs_3;
DROP DATABASE IF EXISTS test_hdfs_4;
"""

View File

@ -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

View File

@ -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

View File

@ -1,15 +0,0 @@
#!/usr/bin/env bash
# Tags: no-fasttest, use-hdfs
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
$CLICKHOUSE_CLIENT -q "insert into table function hdfs('hdfs://localhost:12222/$CLICKHOUSE_TEST_UNIQUE_NAME.data1.tsv') select 1 settings hdfs_truncate_on_insert=1;"
$CLICKHOUSE_CLIENT -q "insert into table function hdfs('hdfs://localhost:12222/$CLICKHOUSE_TEST_UNIQUE_NAME.data2.tsv') select 2 settings hdfs_truncate_on_insert=1;"
$CLICKHOUSE_CLIENT -q "insert into table function hdfs('hdfs://localhost:12222/$CLICKHOUSE_TEST_UNIQUE_NAME.data3.tsv') select 3 settings hdfs_truncate_on_insert=1;"
$CLICKHOUSE_CLIENT --print-profile-events -q "select * from hdfs('hdfs://localhost:12222/$CLICKHOUSE_TEST_UNIQUE_NAME.data*.tsv', auto, 'x UInt64') where _file like '%data1%' format Null" 2>&1 | grep -F -c "EngineFileLikeReadFiles: 1"
$CLICKHOUSE_CLIENT --print-profile-events -q "select * from hdfs('hdfs://localhost:12222/$CLICKHOUSE_TEST_UNIQUE_NAME.data*.tsv', auto, 'x UInt64') where _path like '%data1%' format Null" 2>&1 | grep -F -c "EngineFileLikeReadFiles: 1"

View File

@ -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

View File

@ -1,15 +0,0 @@
#!/usr/bin/env bash
# Tags: no-fasttest, use-hdfs
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
$CLICKHOUSE_CLIENT -q "insert into table function hdfs('hdfs://localhost:12222/$CLICKHOUSE_TEST_UNIQUE_NAME.data1.tsv') select 1 settings hdfs_truncate_on_insert=1;"
$CLICKHOUSE_CLIENT -q "insert into table function hdfs('hdfs://localhost:12222/$CLICKHOUSE_TEST_UNIQUE_NAME.data2.tsv') select 11 settings hdfs_truncate_on_insert=1;"
$CLICKHOUSE_CLIENT -q "insert into table function hdfs('hdfs://localhost:12222/$CLICKHOUSE_TEST_UNIQUE_NAME.data3.tsv') select 111 settings hdfs_truncate_on_insert=1;"
$CLICKHOUSE_CLIENT -q "select _size from hdfs('hdfs://localhost:12222/$CLICKHOUSE_TEST_UNIQUE_NAME.data*.tsv', auto, 'x UInt64') order by _size"
$CLICKHOUSE_CLIENT -q "select _size from hdfs('hdfs://localhost:12222/$CLICKHOUSE_TEST_UNIQUE_NAME.data*.tsv', auto, 'x UInt64') order by _size"

View File

@ -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

View File

@ -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

View File

@ -9,7 +9,7 @@ CREATE TABLE url_na_log
ENGINE = MergeTree
PRIMARY KEY SiteId
ORDER BY (SiteId, DateVisit)
SETTINGS index_granularity = 1000, min_bytes_for_wide_part = 0;
SETTINGS index_granularity_bytes = 1000000, index_granularity = 1000, min_bytes_for_wide_part = 0;
CREATE ROW POLICY url_na_log_policy0 ON url_na_log FOR SELECT USING (DateVisit < '2022-08-11') OR (DateVisit > '2022-08-19') TO default;

View File

@ -1 +1,11 @@
10
0 0
0 1
0 2
0 3
0 4
5 5
5 6
5 7
5 8
5 9

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,6 @@
fake
objectValue
0abc
1
0
1

View File

@ -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)
);

View File

@ -1,2 +0,0 @@
99999
99999

View File

@ -1,11 +0,0 @@
#!/usr/bin/env bash
# Tags: no-fasttest, no-parallel, use-hdfs
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
$CLICKHOUSE_CLIENT -q "insert into table function file('test_03243.parquet', 'Parquet') select number as i from numbers(100000) settings output_format_parquet_row_group_size=10000,engine_file_truncate_on_insert=1"
$CLICKHOUSE_CLIENT -q "select max(i) from file('test_03243.parquet', 'Parquet') settings max_threads = 1;"
$CLICKHOUSE_CLIENT -q "insert into table function hdfs('hdfs://localhost:12222/test_03243.parquet', 'Parquet') select number as i from numbers(100000) settings output_format_parquet_row_group_size=10000,hdfs_truncate_on_insert=1;"
$CLICKHOUSE_CLIENT -q "select max(i) from hdfs('hdfs://localhost:12222/test_03243.parquet', 'Parquet') settings max_threads = 1;"

View File

@ -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 }

View File

@ -0,0 +1,5 @@
-- Tags: no-parallel
create user u_03254_alter_user;
alter user u_03254_alter_user; -- { clientError SYNTAX_ERROR }
drop user u_03254_alter_user;

View File

@ -0,0 +1,8 @@
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9

View File

@ -0,0 +1,7 @@
SELECT
1 AS a,
2 AS b
ORDER BY
a ASC,
1 ASC,
b ASC WITH FILL TO 10;

View File

@ -2,6 +2,8 @@ DROP TABLE IF EXISTS src;
DROP TABLE IF EXISTS dst;
DROP TABLE IF EXISTS matview;
SET use_async_executor_for_materialized_views=1;
CREATE TABLE src (
event_time DateTime,
key UInt64,