mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
subquery_requires_alias setting (disabled by default)
This commit is contained in:
parent
91bc0eca11
commit
d5cfbcf6e1
@ -220,6 +220,7 @@ struct Settings : public SettingsCollection<Settings>
|
|||||||
M(SettingSeconds, http_receive_timeout, DEFAULT_HTTP_READ_BUFFER_TIMEOUT, "HTTP receive timeout") \
|
M(SettingSeconds, http_receive_timeout, DEFAULT_HTTP_READ_BUFFER_TIMEOUT, "HTTP receive timeout") \
|
||||||
M(SettingBool, optimize_throw_if_noop, false, "If setting is enabled and OPTIMIZE query didn't actually assign a merge then an explanatory exception is thrown") \
|
M(SettingBool, optimize_throw_if_noop, false, "If setting is enabled and OPTIMIZE query didn't actually assign a merge then an explanatory exception is thrown") \
|
||||||
M(SettingBool, use_index_for_in_with_subqueries, true, "Try using an index if there is a subquery or a table expression on the right side of the IN operator.") \
|
M(SettingBool, use_index_for_in_with_subqueries, true, "Try using an index if there is a subquery or a table expression on the right side of the IN operator.") \
|
||||||
|
M(SettingBool, subquery_requires_alias, false, "Force subquery in FROM to have an alias for correct name qualification.") \
|
||||||
M(SettingBool, empty_result_for_aggregation_by_empty_set, false, "Return empty result when aggregating without keys on empty set.") \
|
M(SettingBool, empty_result_for_aggregation_by_empty_set, false, "Return empty result when aggregating without keys on empty set.") \
|
||||||
M(SettingBool, allow_distributed_ddl, true, "If it is set to true, then a user is allowed to executed distributed DDL queries.") \
|
M(SettingBool, allow_distributed_ddl, true, "If it is set to true, then a user is allowed to executed distributed DDL queries.") \
|
||||||
M(SettingUInt64, odbc_max_field_size, 1024, "Max size of filed can be read from ODBC dictionary. Long strings are truncated.") \
|
M(SettingUInt64, odbc_max_field_size, 1024, "Max size of filed can be read from ODBC dictionary. Long strings are truncated.") \
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <Interpreters/DatabaseAndTableWithAlias.h>
|
#include <Interpreters/DatabaseAndTableWithAlias.h>
|
||||||
#include <Interpreters/Context.h>
|
#include <Interpreters/Context.h>
|
||||||
#include <Parsers/ASTSelectQuery.h>
|
#include <Parsers/ASTSelectQuery.h>
|
||||||
|
#include <Parsers/ASTSubquery.h>
|
||||||
#include <Parsers/ASTTablesInSelectQuery.h>
|
#include <Parsers/ASTTablesInSelectQuery.h>
|
||||||
#include <Parsers/ASTIdentifier.h>
|
#include <Parsers/ASTIdentifier.h>
|
||||||
#include <Parsers/ASTExpressionList.h>
|
#include <Parsers/ASTExpressionList.h>
|
||||||
@ -295,6 +296,23 @@ struct RewriteTablesVisitorData
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Attach alias to the first visited subquery
|
||||||
|
struct SetSubqueryAliasVisitorData
|
||||||
|
{
|
||||||
|
using TypeToVisit = ASTSubquery;
|
||||||
|
|
||||||
|
const String & alias;
|
||||||
|
bool done = false;
|
||||||
|
|
||||||
|
void visit(ASTSubquery &, ASTPtr & ast)
|
||||||
|
{
|
||||||
|
if (done)
|
||||||
|
return;
|
||||||
|
ast->setAlias(alias);
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
bool needRewrite(ASTSelectQuery & select, std::vector<const ASTTableExpression *> & table_expressions)
|
bool needRewrite(ASTSelectQuery & select, std::vector<const ASTTableExpression *> & table_expressions)
|
||||||
{
|
{
|
||||||
if (!select.tables())
|
if (!select.tables())
|
||||||
@ -354,6 +372,8 @@ bool needRewrite(ASTSelectQuery & select, std::vector<const ASTTableExpression *
|
|||||||
|
|
||||||
using RewriteMatcher = OneTypeMatcher<RewriteTablesVisitorData>;
|
using RewriteMatcher = OneTypeMatcher<RewriteTablesVisitorData>;
|
||||||
using RewriteVisitor = InDepthNodeVisitor<RewriteMatcher, true>;
|
using RewriteVisitor = InDepthNodeVisitor<RewriteMatcher, true>;
|
||||||
|
using SetSubqueryAliasMatcher = OneTypeMatcher<SetSubqueryAliasVisitorData>;
|
||||||
|
using SetSubqueryAliasVisitor = InDepthNodeVisitor<SetSubqueryAliasMatcher, true>;
|
||||||
using ExtractAsterisksVisitor = ExtractAsterisksMatcher::Visitor;
|
using ExtractAsterisksVisitor = ExtractAsterisksMatcher::Visitor;
|
||||||
using ColumnAliasesVisitor = InDepthNodeVisitor<ColumnAliasesMatcher, true>;
|
using ColumnAliasesVisitor = InDepthNodeVisitor<ColumnAliasesMatcher, true>;
|
||||||
using AppendSemanticMatcher = OneTypeMatcher<AppendSemanticVisitorData>;
|
using AppendSemanticMatcher = OneTypeMatcher<AppendSemanticVisitorData>;
|
||||||
@ -419,6 +439,14 @@ void JoinToSubqueryTransformMatcher::visit(ASTSelectQuery & select, ASTPtr & ast
|
|||||||
if (!left_table)
|
if (!left_table)
|
||||||
throw Exception("Cannot replace tables with subselect", ErrorCodes::LOGICAL_ERROR);
|
throw Exception("Cannot replace tables with subselect", ErrorCodes::LOGICAL_ERROR);
|
||||||
|
|
||||||
|
/// attach an alias to subquery.
|
||||||
|
/// TODO: remove setting check after testing period
|
||||||
|
if (data.context.getSettingsRef().subquery_requires_alias)
|
||||||
|
{
|
||||||
|
SetSubqueryAliasVisitor::Data alias_data{String("--.join") + std::to_string(i)};
|
||||||
|
SetSubqueryAliasVisitor(alias_data).visit(left_table);
|
||||||
|
}
|
||||||
|
|
||||||
/// attach data to generated asterisk
|
/// attach data to generated asterisk
|
||||||
AppendSemanticVisitor::Data semantic_data{rev_aliases, false};
|
AppendSemanticVisitor::Data semantic_data{rev_aliases, false};
|
||||||
AppendSemanticVisitor(semantic_data).visit(left_table);
|
AppendSemanticVisitor(semantic_data).visit(left_table);
|
||||||
|
@ -50,6 +50,7 @@ namespace ErrorCodes
|
|||||||
extern const int NOT_IMPLEMENTED;
|
extern const int NOT_IMPLEMENTED;
|
||||||
extern const int UNKNOWN_IDENTIFIER;
|
extern const int UNKNOWN_IDENTIFIER;
|
||||||
extern const int EXPECTED_ALL_OR_ANY;
|
extern const int EXPECTED_ALL_OR_ANY;
|
||||||
|
extern const int ALIAS_REQUIRED;
|
||||||
}
|
}
|
||||||
|
|
||||||
NameSet removeDuplicateColumns(NamesAndTypesList & columns)
|
NameSet removeDuplicateColumns(NamesAndTypesList & columns)
|
||||||
@ -99,14 +100,22 @@ void translateQualifiedNames(ASTPtr & query, const ASTSelectQuery & select_query
|
|||||||
const Names & source_columns_list, const NameSet & source_columns_set,
|
const Names & source_columns_list, const NameSet & source_columns_set,
|
||||||
const NameSet & columns_from_joined_table)
|
const NameSet & columns_from_joined_table)
|
||||||
{
|
{
|
||||||
|
auto & settings = context.getSettingsRef();
|
||||||
|
|
||||||
std::vector<TableWithColumnNames> tables_with_columns = getDatabaseAndTablesWithColumnNames(select_query, context);
|
std::vector<TableWithColumnNames> tables_with_columns = getDatabaseAndTablesWithColumnNames(select_query, context);
|
||||||
|
if (settings.subquery_requires_alias && tables_with_columns.size() > 1)
|
||||||
|
{
|
||||||
|
for (auto & pr : tables_with_columns)
|
||||||
|
if (pr.first.table.empty() && pr.first.alias.empty())
|
||||||
|
throw Exception("Not unique subquery in FROM requires an alias (or subquery_requires_alias=0 to disable restriction).",
|
||||||
|
ErrorCodes::ALIAS_REQUIRED);
|
||||||
|
}
|
||||||
|
|
||||||
if (tables_with_columns.empty())
|
if (tables_with_columns.empty())
|
||||||
{
|
{
|
||||||
Names all_columns_name = source_columns_list;
|
Names all_columns_name = source_columns_list;
|
||||||
|
|
||||||
/// TODO: asterisk_left_columns_only probably does not work in some cases
|
if (!settings.asterisk_left_columns_only)
|
||||||
if (!context.getSettingsRef().asterisk_left_columns_only)
|
|
||||||
{
|
{
|
||||||
for (auto & column : columns_from_joined_table)
|
for (auto & column : columns_from_joined_table)
|
||||||
all_columns_name.emplace_back(column);
|
all_columns_name.emplace_back(column);
|
||||||
|
@ -1 +1 @@
|
|||||||
SELECT number, joined FROM system.numbers ANY LEFT JOIN (SELECT number * 2 AS number, number * 10 + 1 AS joined FROM system.numbers LIMIT 10) USING number LIMIT 10
|
SELECT number, joined FROM system.numbers ANY LEFT JOIN (SELECT number * 2 AS number, number * 10 + 1 AS joined FROM system.numbers LIMIT 10) js2 USING number LIMIT 10
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
SELECT * FROM
|
SELECT * FROM
|
||||||
(
|
(
|
||||||
SELECT number AS k FROM system.numbers LIMIT 10
|
SELECT number AS k FROM system.numbers LIMIT 10
|
||||||
)
|
) js1
|
||||||
ALL LEFT JOIN
|
ALL LEFT JOIN
|
||||||
(
|
(
|
||||||
SELECT intDiv(number, 2) AS k, number AS joined FROM system.numbers LIMIT 10
|
SELECT intDiv(number, 2) AS k, number AS joined FROM system.numbers LIMIT 10
|
||||||
)
|
) js2
|
||||||
USING k;
|
USING k;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
SELECT * FROM
|
SELECT * FROM
|
||||||
(
|
(
|
||||||
SELECT reinterpretAsString(number + reinterpretAsUInt8('A')) AS k FROM system.numbers LIMIT 10
|
SELECT reinterpretAsString(number + reinterpretAsUInt8('A')) AS k FROM system.numbers LIMIT 10
|
||||||
)
|
) js1
|
||||||
ALL LEFT JOIN
|
ALL LEFT JOIN
|
||||||
(
|
(
|
||||||
SELECT reinterpretAsString(intDiv(number, 2) + reinterpretAsUInt8('A')) AS k, number AS joined FROM system.numbers LIMIT 10
|
SELECT reinterpretAsString(intDiv(number, 2) + reinterpretAsUInt8('A')) AS k, number AS joined FROM system.numbers LIMIT 10
|
||||||
)
|
) js2
|
||||||
USING k;
|
USING k;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
SELECT left, right FROM
|
SELECT left, right FROM
|
||||||
(
|
(
|
||||||
SELECT number % 4 AS k1, number % 3 AS k2, number AS left FROM system.numbers LIMIT 10
|
SELECT number % 4 AS k1, number % 3 AS k2, number AS left FROM system.numbers LIMIT 10
|
||||||
)
|
) js1
|
||||||
ALL LEFT JOIN
|
ALL LEFT JOIN
|
||||||
(
|
(
|
||||||
SELECT number % 2 AS k1, number % 6 AS k2, number AS right FROM system.numbers LIMIT 10
|
SELECT number % 2 AS k1, number % 6 AS k2, number AS right FROM system.numbers LIMIT 10
|
||||||
)
|
) js2
|
||||||
USING k1, k2;
|
USING k1, k2;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
SELECT left, right FROM
|
SELECT left, right FROM
|
||||||
(
|
(
|
||||||
SELECT number % 4 AS k1, toString(number % 3) AS k2, number AS left FROM system.numbers LIMIT 10
|
SELECT number % 4 AS k1, toString(number % 3) AS k2, number AS left FROM system.numbers LIMIT 10
|
||||||
)
|
) js1
|
||||||
ALL LEFT JOIN
|
ALL LEFT JOIN
|
||||||
(
|
(
|
||||||
SELECT number % 2 AS k1, toString(number % 6) AS k2, number AS right FROM system.numbers LIMIT 10
|
SELECT number % 2 AS k1, toString(number % 6) AS k2, number AS right FROM system.numbers LIMIT 10
|
||||||
)
|
) js2
|
||||||
USING k1, k2;
|
USING k1, k2;
|
||||||
|
@ -1 +1 @@
|
|||||||
SELECT number, number / 2 AS n, j1, j2 FROM system.numbers ANY LEFT JOIN (SELECT number / 3 AS n, number AS j1, 'Hello' AS j2 FROM system.numbers LIMIT 10) USING n LIMIT 10
|
SELECT number, number / 2 AS n, j1, j2 FROM system.numbers ANY LEFT JOIN (SELECT number / 3 AS n, number AS j1, 'Hello' AS j2 FROM system.numbers LIMIT 10) js2 USING n LIMIT 10
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
SET any_join_distinct_right_table_keys = 1;
|
SET any_join_distinct_right_table_keys = 1;
|
||||||
|
|
||||||
SELECT a,b,c,d FROM (SELECT 1 AS a,2 AS b, 3 AS c UNION ALL SELECT 2,3,4 ) ANY INNER JOIN (SELECT 1 AS a,2 AS b,4 AS d UNION ALL SELECT 2,3,5) USING (a) ORDER BY a,b,c,d ASC;
|
SELECT a,b,c,d FROM (SELECT 1 AS a,2 AS b, 3 AS c UNION ALL SELECT 2,3,4 ) js1 ANY INNER JOIN (SELECT 1 AS a,2 AS b,4 AS d UNION ALL SELECT 2,3,5) js2 USING (a) ORDER BY a,b,c,d ASC;
|
||||||
SELECT a,b,c,d FROM (SELECT 1 AS a,2 AS b, 3 AS c UNION ALL SELECT 2,3,4 ) ALL LEFT JOIN (SELECT 1 AS a,2 AS b,4 AS d UNION ALL SELECT 2,3,5) USING (a) ORDER BY a,b,c,d ASC;
|
SELECT a,b,c,d FROM (SELECT 1 AS a,2 AS b, 3 AS c UNION ALL SELECT 2,3,4 ) js1 ALL LEFT JOIN (SELECT 1 AS a,2 AS b,4 AS d UNION ALL SELECT 2,3,5) js2 USING (a) ORDER BY a,b,c,d ASC;
|
||||||
SELECT a,b,c,d FROM (SELECT 1 AS a,2 AS b, 3 AS c UNION ALL SELECT 2,3,4 ) ALL LEFT JOIN (SELECT 1 AS a,2 AS b,4 AS d UNION ALL SELECT 2,3,5) USING a,b ORDER BY a,b,c,d ASC;
|
SELECT a,b,c,d FROM (SELECT 1 AS a,2 AS b, 3 AS c UNION ALL SELECT 2,3,4 ) js1 ALL LEFT JOIN (SELECT 1 AS a,2 AS b,4 AS d UNION ALL SELECT 2,3,5) js2 USING a,b ORDER BY a,b,c,d ASC;
|
||||||
|
@ -11,4 +11,4 @@ ANY LEFT JOIN
|
|||||||
SELECT
|
SELECT
|
||||||
2 AS DomainID,
|
2 AS DomainID,
|
||||||
'def' AS Domain
|
'def' AS Domain
|
||||||
) USING DomainID;
|
) js2 USING DomainID;
|
||||||
|
@ -3,9 +3,9 @@ DROP TABLE IF EXISTS join;
|
|||||||
CREATE TABLE join (k UInt64, s String) ENGINE = Join(ANY, LEFT, k);
|
CREATE TABLE join (k UInt64, s String) ENGINE = Join(ANY, LEFT, k);
|
||||||
|
|
||||||
INSERT INTO join VALUES (1, 'abc'), (2, 'def');
|
INSERT INTO join VALUES (1, 'abc'), (2, 'def');
|
||||||
SELECT k, s FROM (SELECT number AS k FROM system.numbers LIMIT 10) ANY LEFT JOIN join USING k;
|
SELECT k, s FROM (SELECT number AS k FROM system.numbers LIMIT 10) js1 ANY LEFT JOIN join USING k;
|
||||||
|
|
||||||
INSERT INTO join VALUES (6, 'ghi');
|
INSERT INTO join VALUES (6, 'ghi');
|
||||||
SELECT k, s FROM (SELECT number AS k FROM system.numbers LIMIT 10) ANY LEFT JOIN join USING k;
|
SELECT k, s FROM (SELECT number AS k FROM system.numbers LIMIT 10) js1 ANY LEFT JOIN join USING k;
|
||||||
|
|
||||||
DROP TABLE join;
|
DROP TABLE join;
|
||||||
|
@ -6,9 +6,9 @@ INSERT INTO join VALUES ('abc', [0], 1), ('def', [1, 2], 2);
|
|||||||
INSERT INTO join (k, s) VALUES (3, 'ghi');
|
INSERT INTO join (k, s) VALUES (3, 'ghi');
|
||||||
INSERT INTO join (x, k) VALUES ([3, 4, 5], 4);
|
INSERT INTO join (x, k) VALUES ([3, 4, 5], 4);
|
||||||
|
|
||||||
SELECT k, s FROM (SELECT number AS k FROM system.numbers LIMIT 10) ANY LEFT JOIN join USING k;
|
SELECT k, s FROM (SELECT number AS k FROM system.numbers LIMIT 10) js1 ANY LEFT JOIN join USING k;
|
||||||
SELECT s, x FROM (SELECT number AS k FROM system.numbers LIMIT 10) ANY LEFT JOIN join USING k;
|
SELECT s, x FROM (SELECT number AS k FROM system.numbers LIMIT 10) js1 ANY LEFT JOIN join USING k;
|
||||||
SELECT x, s, k FROM (SELECT number AS k FROM system.numbers LIMIT 10) ANY LEFT JOIN join USING k;
|
SELECT x, s, k FROM (SELECT number AS k FROM system.numbers LIMIT 10) js1 ANY LEFT JOIN join USING k;
|
||||||
SELECT 1, x, 2, s, 3, k, 4 FROM (SELECT number AS k FROM system.numbers LIMIT 10) ANY LEFT JOIN join USING k;
|
SELECT 1, x, 2, s, 3, k, 4 FROM (SELECT number AS k FROM system.numbers LIMIT 10) js1 ANY LEFT JOIN join USING k;
|
||||||
|
|
||||||
DROP TABLE join;
|
DROP TABLE join;
|
||||||
|
@ -1,2 +1,6 @@
|
|||||||
SELECT value FROM system.one ANY LEFT JOIN (SELECT dummy, dummy AS value) USING dummy GROUP BY value;
|
SELECT value FROM system.one ANY LEFT JOIN (SELECT dummy, dummy AS value) js2 USING dummy GROUP BY value;
|
||||||
SELECT value1, value2, sum(number) FROM (SELECT number, intHash64(number) AS value1 FROM system.numbers LIMIT 10) ANY LEFT JOIN (SELECT number, intHash32(number) AS value2 FROM system.numbers LIMIT 10) USING number GROUP BY value1, value2;
|
|
||||||
|
SELECT value1, value2, sum(number)
|
||||||
|
FROM (SELECT number, intHash64(number) AS value1 FROM system.numbers LIMIT 10) js1
|
||||||
|
ANY LEFT JOIN (SELECT number, intHash32(number) AS value2 FROM system.numbers LIMIT 10) js2
|
||||||
|
USING number GROUP BY value1, value2;
|
||||||
|
@ -1 +1 @@
|
|||||||
SELECT 1 AS k FROM system.one ANY LEFT JOIN (SELECT k FROM (SELECT 1 AS k, 2 AS x)) USING k;
|
SELECT 1 AS k FROM system.one ANY LEFT JOIN (SELECT k FROM (SELECT 1 AS k, 2 AS x)) js2 USING k;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
SELECT k, s1, s2 FROM (SELECT intDiv(number, 3) AS k, sum(number) AS s1 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k) ANY LEFT JOIN (SELECT intDiv(number, 4) AS k, sum(number) AS s2 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k) USING k ORDER BY k;
|
SELECT k, s1, s2 FROM (SELECT intDiv(number, 3) AS k, sum(number) AS s1 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k) ANY LEFT JOIN (SELECT intDiv(number, 4) AS k, sum(number) AS s2 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k) USING k ORDER BY k;
|
||||||
SELECT k, s1, s2 FROM (SELECT intDiv(number, 3) AS k, sum(number) AS s1 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k WITH TOTALS) ANY LEFT JOIN (SELECT intDiv(number, 4) AS k, sum(number) AS s2 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k) USING k ORDER BY k;
|
SELECT k, s1, s2 FROM (SELECT intDiv(number, 3) AS k, sum(number) AS s1 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k WITH TOTALS) ANY LEFT JOIN (SELECT intDiv(number, 4) AS k, sum(number) AS s2 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k) USING k ORDER BY k;
|
||||||
SELECT k, s1, s2 FROM (SELECT intDiv(number, 3) AS k, sum(number) AS s1 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k) ANY LEFT JOIN (SELECT intDiv(number, 4) AS k, sum(number) AS s2 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k WITH TOTALS) USING k ORDER BY k;
|
SELECT k, s1, s2 FROM (SELECT intDiv(number, 3) AS k, sum(number) AS s1 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k) ANY LEFT JOIN (SELECT intDiv(number, 4) AS k, sum(number) AS s2 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k WITH TOTALS) USING k ORDER BY k;
|
||||||
|
@ -1 +1 @@
|
|||||||
SELECT toFloat64(dummy + 2) AS n, j1, j2 FROM remote('127.0.0.{2,3}', system.one) GLOBAL ANY LEFT JOIN (SELECT number / 3 AS n, number AS j1, 'Hello' AS j2 FROM system.numbers LIMIT 10) USING n LIMIT 10;
|
SELECT toFloat64(dummy + 2) AS n, j1, j2 FROM remote('127.0.0.{2,3}', system.one) jr1 GLOBAL ANY LEFT JOIN (SELECT number / 3 AS n, number AS j1, 'Hello' AS j2 FROM system.numbers LIMIT 10) jr2 USING n LIMIT 10;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
SET any_join_distinct_right_table_keys = 1;
|
SET any_join_distinct_right_table_keys = 1;
|
||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
SELECT number, number / 2 AS n, j1, j2 FROM remote('127.0.0.{2,3}', system.numbers) ANY LEFT JOIN (SELECT number / 3 AS n, number AS j1, 'Hello' AS j2 FROM system.numbers LIMIT 0) USING n LIMIT 10;
|
SELECT number, number / 2 AS n, j1, j2 FROM remote('127.0.0.{2,3}', system.numbers) ANY LEFT JOIN (SELECT number / 3 AS n, number AS j1, 'Hello' AS j2 FROM system.numbers LIMIT 0) USING n LIMIT 10;
|
||||||
SELECT dummy + 2 AS number, number / 2 AS n, j1, j2 FROM remote('127.0.0.{2,3}', system.one) ANY INNER JOIN (SELECT number / 3 AS n, number AS j1, 'Hello' AS j2 FROM system.numbers LIMIT 0) USING n LIMIT 10;
|
SELECT dummy + 2 AS number, number / 2 AS n, j1, j2 FROM remote('127.0.0.{2,3}', system.one) ANY INNER JOIN (SELECT number / 3 AS n, number AS j1, 'Hello' AS j2 FROM system.numbers LIMIT 0) USING n LIMIT 10;
|
||||||
|
@ -8,10 +8,10 @@ FROM
|
|||||||
arrayJoin([1, 2, 3]) AS key1,
|
arrayJoin([1, 2, 3]) AS key1,
|
||||||
0 AS key2,
|
0 AS key2,
|
||||||
999 AS table_1
|
999 AS table_1
|
||||||
) ALL INNER JOIN
|
) js1 ALL INNER JOIN
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
arrayJoin([1, 3, 2]) AS key1,
|
arrayJoin([1, 3, 2]) AS key1,
|
||||||
0 AS key2,
|
0 AS key2,
|
||||||
999 AS table_1
|
999 AS table_1
|
||||||
) USING key2, key1;
|
) js2 USING key2, key1;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
SET any_join_distinct_right_table_keys = 1;
|
SET any_join_distinct_right_table_keys = 1;
|
||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS series;
|
DROP TABLE IF EXISTS series;
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
SET any_join_distinct_right_table_keys = 1;
|
SET any_join_distinct_right_table_keys = 1;
|
||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS series;
|
DROP TABLE IF EXISTS series;
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
SELECT x, y FROM (SELECT number AS x FROM system.numbers LIMIT 3) CROSS JOIN (SELECT number AS y FROM system.numbers LIMIT 5);
|
SELECT x, y FROM (SELECT number AS x FROM system.numbers LIMIT 3) js1 CROSS JOIN (SELECT number AS y FROM system.numbers LIMIT 5) js2;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
SET any_join_distinct_right_table_keys = 1;
|
SET any_join_distinct_right_table_keys = 1;
|
||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
SELECT k, x, y FROM (SELECT arrayJoin([1, 2, 3]) AS k, 'Hello' AS x) ANY FULL JOIN (SELECT range(k) AS y, arrayJoin([3, 4, 5]) AS k) USING k WHERE k < 10 ORDER BY k;
|
SELECT k, x, y FROM (SELECT arrayJoin([1, 2, 3]) AS k, 'Hello' AS x) ANY FULL JOIN (SELECT range(k) AS y, arrayJoin([3, 4, 5]) AS k) USING k WHERE k < 10 ORDER BY k;
|
||||||
SELECT k, x FROM (SELECT arrayJoin([1, 2, 3]) AS k, 'Hello' AS x) ANY FULL JOIN (SELECT range(k) AS y, arrayJoin([3, 4, 5]) AS k) USING k WHERE k < 10 ORDER BY k;
|
SELECT k, x FROM (SELECT arrayJoin([1, 2, 3]) AS k, 'Hello' AS x) ANY FULL JOIN (SELECT range(k) AS y, arrayJoin([3, 4, 5]) AS k) USING k WHERE k < 10 ORDER BY k;
|
||||||
|
@ -1,2 +1,4 @@
|
|||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
SELECT k, a FROM (SELECT 42 AS k FROM remote('127.0.0.2', system.one)) GLOBAL ALL FULL OUTER JOIN (SELECT 42 AS k, 1 AS a, a) USING k;
|
SELECT k, a FROM (SELECT 42 AS k FROM remote('127.0.0.2', system.one)) GLOBAL ALL FULL OUTER JOIN (SELECT 42 AS k, 1 AS a, a) USING k;
|
||||||
SELECT 1 FROM remote('127.0.0.2', system.one) WHERE (1, 1) GLOBAL IN (SELECT 1 AS a, a);
|
SELECT 1 FROM remote('127.0.0.2', system.one) WHERE (1, 1) GLOBAL IN (SELECT 1 AS a, a);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
SET any_join_distinct_right_table_keys = 1;
|
SET any_join_distinct_right_table_keys = 1;
|
||||||
|
|
||||||
SELECT a, b FROM (SELECT 1 AS a, 2000 AS b) ANY RIGHT JOIN (SELECT 2 AS a, 3000 AS b) USING a, b;
|
SELECT a, b FROM (SELECT 1 AS a, 2000 AS b) js1 ANY RIGHT JOIN (SELECT 2 AS a, 3000 AS b) js2 USING a, b;
|
||||||
SELECT a, b FROM (SELECT 1 AS a, 2000 AS b) ANY RIGHT JOIN (SELECT 2 AS a, 3000 AS b) USING b, a;
|
SELECT a, b FROM (SELECT 1 AS a, 2000 AS b) js1 ANY RIGHT JOIN (SELECT 2 AS a, 3000 AS b) js2 USING b, a;
|
||||||
|
|
||||||
SELECT a, b FROM (SELECT 1 AS a, 2000 AS b) ANY RIGHT JOIN (SELECT 2 AS a, 3000 AS b UNION ALL SELECT 1 AS a, 2000 AS b) USING a, b;
|
SELECT a, b FROM (SELECT 1 AS a, 2000 AS b) js1 ANY RIGHT JOIN (SELECT 2 AS a, 3000 AS b UNION ALL SELECT 1 AS a, 2000 AS b) js2 USING a, b;
|
||||||
SELECT a, b FROM (SELECT 1 AS a, 2000 AS b) ANY RIGHT JOIN (SELECT 2 AS a, 3000 AS b UNION ALL SELECT 1 AS a, 2000 AS b) USING b, a;
|
SELECT a, b FROM (SELECT 1 AS a, 2000 AS b) js1 ANY RIGHT JOIN (SELECT 2 AS a, 3000 AS b UNION ALL SELECT 1 AS a, 2000 AS b) js2 USING b, a;
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
select b from (select 1 as a, 42 as c) any left join (select 2 as b, 2 as b, 41 as c) using c;
|
select b from (select 1 as a, 42 as c) js1 any left join (select 2 as b, 2 as b, 41 as c) js2 using c;
|
||||||
select b from (select 1 as a, 42 as c) any left join (select 2 as b, 2 as b, 42 as c) using c;
|
select b from (select 1 as a, 42 as c) js1 any left join (select 2 as b, 2 as b, 42 as c) js2 using c;
|
||||||
|
|
||||||
select c,a,a,b,b from
|
select c,a,a,b,b from
|
||||||
(select 1 as a, 1 as a, 42 as c group by c order by a,c)
|
(select 1 as a, 1 as a, 42 as c group by c order by a,c) js1
|
||||||
any left join
|
any left join
|
||||||
(select 2 as b, 2 as b, 41 as c group by c order by b,c)
|
(select 2 as b, 2 as b, 41 as c group by c order by b,c) js2
|
||||||
using c
|
using c
|
||||||
order by b;
|
order by b;
|
||||||
|
@ -6,8 +6,8 @@ FROM
|
|||||||
(
|
(
|
||||||
SELECT 6534090703218709881 AS DeviceIDHash, 1458586663 AS InstallTimestamp
|
SELECT 6534090703218709881 AS DeviceIDHash, 1458586663 AS InstallTimestamp
|
||||||
UNION ALL SELECT 2697418689476658272, 1458561552
|
UNION ALL SELECT 2697418689476658272, 1458561552
|
||||||
) ANY INNER JOIN
|
) js1 ANY INNER JOIN
|
||||||
(
|
(
|
||||||
SELECT 1034415739529768519 AS DeviceIDHash, 1458566664 AS ReferrerTimestamp
|
SELECT 1034415739529768519 AS DeviceIDHash, 1458566664 AS ReferrerTimestamp
|
||||||
UNION ALL SELECT 2697418689476658272, 1458561552
|
UNION ALL SELECT 2697418689476658272, 1458561552
|
||||||
) USING DeviceIDHash;
|
) js2 USING DeviceIDHash;
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
set any_join_distinct_right_table_keys = 1;
|
set any_join_distinct_right_table_keys = 1;
|
||||||
select a from (select (1, 2) as a) any inner join (select (1, 2) as a) using a;
|
select a from (select (1, 2) as a) js1 any inner join (select (1, 2) as a) js2 using a;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
SET any_join_distinct_right_table_keys = 1;
|
SET any_join_distinct_right_table_keys = 1;
|
||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
select x, y from (select 1 as x, 2 as y, x, y);
|
select x, y from (select 1 as x, 2 as y, x, y);
|
||||||
select x, y from (select 1 as x, 1 as y, x, y);
|
select x, y from (select 1 as x, 1 as y, x, y);
|
||||||
|
@ -12,7 +12,7 @@ FROM
|
|||||||
UNION ALL SELECT 'aaaaaaaabaaaaaaa'
|
UNION ALL SELECT 'aaaaaaaabaaaaaaa'
|
||||||
UNION ALL SELECT 'aaaaaaabaaaaaaaa'
|
UNION ALL SELECT 'aaaaaaabaaaaaaaa'
|
||||||
UNION ALL SELECT 'aaaaaaacaaaaaaaa'
|
UNION ALL SELECT 'aaaaaaacaaaaaaaa'
|
||||||
)
|
) js1
|
||||||
CROSS JOIN
|
CROSS JOIN
|
||||||
(
|
(
|
||||||
SELECT 'aaaaaaaaaaaaaaaa' AS b
|
SELECT 'aaaaaaaaaaaaaaaa' AS b
|
||||||
@ -24,7 +24,7 @@ CROSS JOIN
|
|||||||
UNION ALL SELECT 'aaaaaaaabaaaaaaa'
|
UNION ALL SELECT 'aaaaaaaabaaaaaaa'
|
||||||
UNION ALL SELECT 'aaaaaaabaaaaaaaa'
|
UNION ALL SELECT 'aaaaaaabaaaaaaaa'
|
||||||
UNION ALL SELECT 'aaaaaaacaaaaaaaa'
|
UNION ALL SELECT 'aaaaaaacaaaaaaaa'
|
||||||
)
|
) js2
|
||||||
ORDER BY a, b;
|
ORDER BY a, b;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
SET join_use_nulls = 0;
|
SET join_use_nulls = 0;
|
||||||
SET any_join_distinct_right_table_keys = 1;
|
SET any_join_distinct_right_table_keys = 1;
|
||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
SELECT k, a, b
|
SELECT k, a, b
|
||||||
FROM
|
FROM
|
||||||
|
@ -5,28 +5,28 @@ SELECT k, a, b
|
|||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT nullIf(number, 7) AS k, toString(number) AS a FROM system.numbers LIMIT 10
|
SELECT nullIf(number, 7) AS k, toString(number) AS a FROM system.numbers LIMIT 10
|
||||||
)
|
) js1
|
||||||
ANY INNER JOIN
|
ANY INNER JOIN
|
||||||
(
|
(
|
||||||
SELECT number AS k, toString(number) AS b FROM system.numbers LIMIT 5, 10
|
SELECT number AS k, toString(number) AS b FROM system.numbers LIMIT 5, 10
|
||||||
) USING (k) ORDER BY k;
|
) js2 USING (k) ORDER BY k;
|
||||||
|
|
||||||
SELECT k, a, b
|
SELECT k, a, b
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT number AS k, toString(number) AS a FROM system.numbers LIMIT 10
|
SELECT number AS k, toString(number) AS a FROM system.numbers LIMIT 10
|
||||||
)
|
) js1
|
||||||
ANY LEFT JOIN
|
ANY LEFT JOIN
|
||||||
(
|
(
|
||||||
SELECT nullIf(number, 8) AS k, toString(number) AS b FROM system.numbers LIMIT 5, 10
|
SELECT nullIf(number, 8) AS k, toString(number) AS b FROM system.numbers LIMIT 5, 10
|
||||||
) USING (k) ORDER BY k;
|
) js2 USING (k) ORDER BY k;
|
||||||
|
|
||||||
SELECT k, a, b
|
SELECT k, a, b
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT nullIf(number, 7) AS k, toString(number) AS a FROM system.numbers LIMIT 10
|
SELECT nullIf(number, 7) AS k, toString(number) AS a FROM system.numbers LIMIT 10
|
||||||
)
|
) js1
|
||||||
ANY RIGHT JOIN
|
ANY RIGHT JOIN
|
||||||
(
|
(
|
||||||
SELECT nullIf(number, 8) AS k, toString(number) AS b FROM system.numbers LIMIT 5, 10
|
SELECT nullIf(number, 8) AS k, toString(number) AS b FROM system.numbers LIMIT 5, 10
|
||||||
) USING (k) ORDER BY k;
|
) js2 USING (k) ORDER BY k;
|
||||||
|
@ -13,11 +13,11 @@ DROP TABLE set;
|
|||||||
DROP TABLE IF EXISTS join;
|
DROP TABLE IF EXISTS join;
|
||||||
CREATE TABLE join (k UInt8, x String) ENGINE = Memory;
|
CREATE TABLE join (k UInt8, x String) ENGINE = Memory;
|
||||||
INSERT INTO join VALUES (1, 'hello');
|
INSERT INTO join VALUES (1, 'hello');
|
||||||
SELECT k, x FROM (SELECT arrayJoin([1, 2]) AS k) ANY LEFT JOIN join USING k;
|
SELECT k, x FROM (SELECT arrayJoin([1, 2]) AS k) js1 ANY LEFT JOIN join USING k;
|
||||||
|
|
||||||
DROP TABLE join;
|
DROP TABLE join;
|
||||||
CREATE TABLE join (k UInt8, x String) ENGINE = Join(ANY, LEFT, k);
|
CREATE TABLE join (k UInt8, x String) ENGINE = Join(ANY, LEFT, k);
|
||||||
INSERT INTO join VALUES (1, 'hello');
|
INSERT INTO join VALUES (1, 'hello');
|
||||||
SELECT k, x FROM (SELECT arrayJoin([1, 2]) AS k) ANY LEFT JOIN join USING k;
|
SELECT k, x FROM (SELECT arrayJoin([1, 2]) AS k) js1 ANY LEFT JOIN join USING k;
|
||||||
|
|
||||||
DROP TABLE join;
|
DROP TABLE join;
|
||||||
|
@ -14,7 +14,7 @@ FROM
|
|||||||
toString(number) AS a
|
toString(number) AS a
|
||||||
FROM system.numbers
|
FROM system.numbers
|
||||||
LIMIT 2
|
LIMIT 2
|
||||||
)
|
) js1
|
||||||
ANY LEFT JOIN
|
ANY LEFT JOIN
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
@ -22,7 +22,7 @@ ANY LEFT JOIN
|
|||||||
toString(number) AS b
|
toString(number) AS b
|
||||||
FROM system.numbers
|
FROM system.numbers
|
||||||
LIMIT 1, 2
|
LIMIT 1, 2
|
||||||
) USING (k)
|
) js2 USING (k)
|
||||||
ORDER BY k ASC;
|
ORDER BY k ASC;
|
||||||
|
|
||||||
SELECT * FROM null_00549 ORDER BY k, a, b;
|
SELECT * FROM null_00549 ORDER BY k, a, b;
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
SET any_join_distinct_right_table_keys = 1;
|
SET any_join_distinct_right_table_keys = 1;
|
||||||
SET max_block_size = 10;
|
SET max_block_size = 10;
|
||||||
SELECT * FROM (select toUInt64(1) s limit 1) any right join (select number s, s as x from numbers(11)) using (s) ORDER BY s;
|
SELECT * FROM (select toUInt64(1) s limit 1) js1 any right join (select number s, s as x from numbers(11)) js2 using (s) ORDER BY s;
|
||||||
|
@ -35,7 +35,7 @@ from joinbug;
|
|||||||
select id, id2, val, val2, created
|
select id, id2, val, val2, created
|
||||||
from (
|
from (
|
||||||
SELECT toUInt64(arrayJoin(range(50))) AS id2
|
SELECT toUInt64(arrayJoin(range(50))) AS id2
|
||||||
)
|
) js1
|
||||||
ANY INNER JOIN joinbug_join using id2;
|
ANY INNER JOIN joinbug_join using id2;
|
||||||
|
|
||||||
DROP TABLE joinbug;
|
DROP TABLE joinbug;
|
||||||
|
@ -20,7 +20,7 @@ ALL INNER JOIN
|
|||||||
data
|
data
|
||||||
FROM join_with_index
|
FROM join_with_index
|
||||||
WHERE toUInt64(data) IN (0, 529335254087962442)
|
WHERE toUInt64(data) IN (0, 529335254087962442)
|
||||||
) USING (key);
|
) js2 USING (key);
|
||||||
|
|
||||||
SELECT _uniq, _uniq IN (0, 99)
|
SELECT _uniq, _uniq IN (0, 99)
|
||||||
FROM join_with_index
|
FROM join_with_index
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
SET any_join_distinct_right_table_keys = 1;
|
SET any_join_distinct_right_table_keys = 1;
|
||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
SELECT k, a1, b1, a2, b2 FROM (SELECT 0 AS k, 'hello' AS a1, 123 AS b1, a1) ANY FULL OUTER JOIN (SELECT 1 AS k, 'hello' AS a2, 456 AS b2, a2) USING (k) ORDER BY k;
|
SELECT k, a1, b1, a2, b2 FROM (SELECT 0 AS k, 'hello' AS a1, 123 AS b1, a1) ANY FULL OUTER JOIN (SELECT 1 AS k, 'hello' AS a2, 456 AS b2, a2) USING (k) ORDER BY k;
|
||||||
SELECT k, a, b FROM (SELECT 0 AS k, 'hello' AS a, 123 AS b, a) ANY FULL OUTER JOIN (SELECT 1 AS k) USING (k) ORDER BY k;
|
SELECT k, a, b FROM (SELECT 0 AS k, 'hello' AS a, 123 AS b, a) ANY FULL OUTER JOIN (SELECT 1 AS k) USING (k) ORDER BY k;
|
||||||
|
@ -189,7 +189,7 @@ FROM
|
|||||||
GROUP BY domain
|
GROUP BY domain
|
||||||
ORDER BY domain
|
ORDER BY domain
|
||||||
LIMIT 10
|
LIMIT 10
|
||||||
)
|
) js1
|
||||||
ALL FULL OUTER JOIN
|
ALL FULL OUTER JOIN
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
@ -214,7 +214,7 @@ UNION ALL
|
|||||||
GROUP BY domain
|
GROUP BY domain
|
||||||
ORDER BY domain
|
ORDER BY domain
|
||||||
LIMIT 10
|
LIMIT 10
|
||||||
)
|
) js2
|
||||||
USING (total, domain)
|
USING (total, domain)
|
||||||
ORDER BY total, domain;
|
ORDER BY total, domain;
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ FROM
|
|||||||
GROUP BY domain
|
GROUP BY domain
|
||||||
ORDER BY domain
|
ORDER BY domain
|
||||||
LIMIT 10
|
LIMIT 10
|
||||||
)
|
) js1
|
||||||
ALL FULL OUTER JOIN
|
ALL FULL OUTER JOIN
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
@ -268,7 +268,7 @@ UNION ALL
|
|||||||
GROUP BY domain
|
GROUP BY domain
|
||||||
ORDER BY domain
|
ORDER BY domain
|
||||||
LIMIT 10
|
LIMIT 10
|
||||||
)
|
) js2
|
||||||
USING (total, domain)
|
USING (total, domain)
|
||||||
ORDER BY total, domain;
|
ORDER BY total, domain;
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ FROM
|
|||||||
GROUP BY domain
|
GROUP BY domain
|
||||||
ORDER BY domain
|
ORDER BY domain
|
||||||
LIMIT 10
|
LIMIT 10
|
||||||
)
|
) js1
|
||||||
ALL FULL OUTER JOIN
|
ALL FULL OUTER JOIN
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
@ -322,7 +322,7 @@ UNION ALL
|
|||||||
GROUP BY domain
|
GROUP BY domain
|
||||||
ORDER BY domain
|
ORDER BY domain
|
||||||
LIMIT 10
|
LIMIT 10
|
||||||
)
|
) js2
|
||||||
USING (total, domain)
|
USING (total, domain)
|
||||||
ORDER BY total, domain;
|
ORDER BY total, domain;
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
SET any_join_distinct_right_table_keys = 1;
|
SET any_join_distinct_right_table_keys = 1;
|
||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS local_statements;
|
DROP TABLE IF EXISTS local_statements;
|
||||||
DROP TABLE IF EXISTS statements;
|
DROP TABLE IF EXISTS statements;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
SET send_logs_level = 'none';
|
SET send_logs_level = 'none';
|
||||||
SET any_join_distinct_right_table_keys = 1;
|
SET any_join_distinct_right_table_keys = 1;
|
||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS test_00597;
|
DROP TABLE IF EXISTS test_00597;
|
||||||
DROP TABLE IF EXISTS test_view_00597;
|
DROP TABLE IF EXISTS test_view_00597;
|
||||||
|
@ -34,9 +34,9 @@ select 'max(key) from tab_00612 where (key, left array join n.x) in ((1, 1), (2,
|
|||||||
select max(key) from tab_00612 left array join `n.x` as val where (key, val) in ((1, 1), (2, 2));
|
select max(key) from tab_00612 left array join `n.x` as val where (key, val) in ((1, 1), (2, 2));
|
||||||
select max(key) from tab_00612 left array join n as val where (key, val.x) in ((1, 1), (2, 2));
|
select max(key) from tab_00612 left array join n as val where (key, val.x) in ((1, 1), (2, 2));
|
||||||
select 'max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) using key where (key, val) in (1, 1)';
|
select 'max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) using key where (key, val) in (1, 1)';
|
||||||
select max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) using key where (key, val) in (1, 1);
|
select max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) js2 using key where (key, val) in (1, 1);
|
||||||
select 'max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) using key where (key, val) in ((1, 1), (2, 2))';
|
select 'max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) using key where (key, val) in ((1, 1), (2, 2))';
|
||||||
select max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) using key where (key, val) in ((1, 1), (2, 2));
|
select max(key) from tab_00612 any left join (select key, arrayJoin(n.x) as val from tab_00612) js2 using key where (key, val) in ((1, 1), (2, 2));
|
||||||
|
|
||||||
drop table if exists tab_00612;
|
drop table if exists tab_00612;
|
||||||
CREATE TABLE tab_00612 (key1 Int32, id1 Int64, c1 Int64) ENGINE = MergeTree PARTITION BY id1 ORDER BY (key1) ;
|
CREATE TABLE tab_00612 (key1 Int32, id1 Int64, c1 Int64) ENGINE = MergeTree PARTITION BY id1 ORDER BY (key1) ;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
-- This test (SELECT) without cache can take tens minutes
|
-- This test (SELECT) without cache can take tens minutes
|
||||||
DROP TABLE IF EXISTS dict_string;
|
DROP TABLE IF EXISTS dict_string;
|
||||||
DROP TABLE IF EXISTS dict_ui64;
|
DROP TABLE IF EXISTS dict_ui64;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
drop table if exists tab1;
|
drop table if exists tab1;
|
||||||
drop table if exists tab2;
|
drop table if exists tab2;
|
||||||
drop table if exists tab3;
|
drop table if exists tab3;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
set any_join_distinct_right_table_keys = 1;
|
set any_join_distinct_right_table_keys = 1;
|
||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
SELECT * FROM (SELECT 1 AS id, 2 AS value);
|
SELECT * FROM (SELECT 1 AS id, 2 AS value);
|
||||||
SELECT * FROM (SELECT 1 AS id, 2 AS value, 3 AS A) ANY INNER JOIN (SELECT 1 AS id, 4 AS values, 5 AS D) USING id;
|
SELECT * FROM (SELECT 1 AS id, 2 AS value, 3 AS A) ANY INNER JOIN (SELECT 1 AS id, 4 AS values, 5 AS D) USING id;
|
||||||
|
@ -13,8 +13,8 @@ INSERT INTO a2 VALUES (1, 2);
|
|||||||
INSERT INTO a2 VALUES (1, 3);
|
INSERT INTO a2 VALUES (1, 3);
|
||||||
INSERT INTO a2 VALUES (1, 4);
|
INSERT INTO a2 VALUES (1, 4);
|
||||||
|
|
||||||
SELECT a, b FROM a1 LEFT JOIN (SELECT a, b FROM a2) USING a ORDER BY b SETTINGS join_default_strictness='ANY';
|
SELECT a, b FROM a1 LEFT JOIN (SELECT a, b FROM a2) js2 USING a ORDER BY b SETTINGS join_default_strictness='ANY';
|
||||||
SELECT a, b FROM a1 LEFT JOIN (SELECT a, b FROM a2) USING a ORDER BY b; -- default SETTINGS join_default_strictness='ALL';
|
SELECT a, b FROM a1 LEFT JOIN (SELECT a, b FROM a2) js2 USING a ORDER BY b; -- default SETTINGS join_default_strictness='ALL';
|
||||||
|
|
||||||
DROP TABLE IF EXISTS a1;
|
DROP TABLE IF EXISTS a1;
|
||||||
DROP TABLE IF EXISTS a2;
|
DROP TABLE IF EXISTS a2;
|
||||||
|
@ -7,7 +7,7 @@ CREATE TABLE using2(a UInt8, b UInt8) ENGINE=Memory;
|
|||||||
INSERT INTO using1 VALUES (1, 1) (2, 2) (3, 3);
|
INSERT INTO using1 VALUES (1, 1) (2, 2) (3, 3);
|
||||||
INSERT INTO using2 VALUES (4, 4) (2, 2) (3, 3);
|
INSERT INTO using2 VALUES (4, 4) (2, 2) (3, 3);
|
||||||
|
|
||||||
SELECT * FROM using1 ALL LEFT JOIN (SELECT * FROM using2) USING (a, a, a, b, b, b, a, a) ORDER BY a;
|
SELECT * FROM using1 ALL LEFT JOIN (SELECT * FROM using2) js2 USING (a, a, a, b, b, b, a, a) ORDER BY a;
|
||||||
|
|
||||||
DROP TABLE using1;
|
DROP TABLE using1;
|
||||||
DROP TABLE using2;
|
DROP TABLE using2;
|
||||||
@ -30,6 +30,7 @@ select * from persons all inner join children using id;
|
|||||||
select * from persons all inner join (select * from children) as j using id;
|
select * from persons all inner join (select * from children) as j using id;
|
||||||
select * from (select * from persons) as s all inner join (select * from children ) as j using id;
|
select * from (select * from persons) as s all inner join (select * from children ) as j using id;
|
||||||
--
|
--
|
||||||
|
set subquery_requires_alias = 0;
|
||||||
select * from persons all inner join (select * from children) using id;
|
select * from persons all inner join (select * from children) using id;
|
||||||
select * from (select * from persons) all inner join (select * from children) using id;
|
select * from (select * from persons) all inner join (select * from children) using id;
|
||||||
select * from (select * from persons) as s all inner join (select * from children) using id;
|
select * from (select * from persons) as s all inner join (select * from children) using id;
|
||||||
|
@ -7,7 +7,7 @@ CREATE TABLE default_join2(a Int64, b Int64) ENGINE=Memory;
|
|||||||
INSERT INTO default_join1 VALUES(1, 1), (2, 2), (3, 3);
|
INSERT INTO default_join1 VALUES(1, 1), (2, 2), (3, 3);
|
||||||
INSERT INTO default_join2 VALUES(3, 3), (4, 4);
|
INSERT INTO default_join2 VALUES(3, 3), (4, 4);
|
||||||
|
|
||||||
SELECT a, b FROM default_join1 JOIN (SELECT a, b FROM default_join2) USING a ORDER BY b SETTINGS join_default_strictness='ANY';
|
SELECT a, b FROM default_join1 JOIN (SELECT a, b FROM default_join2) js2 USING a ORDER BY b SETTINGS join_default_strictness='ANY';
|
||||||
|
|
||||||
DROP TABLE default_join1;
|
DROP TABLE default_join1;
|
||||||
DROP TABLE default_join2;
|
DROP TABLE default_join2;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
set subquery_requires_alias = 0;
|
||||||
|
|
||||||
drop table if exists t_00725_2;
|
drop table if exists t_00725_2;
|
||||||
drop table if exists s_00725_2;
|
drop table if exists s_00725_2;
|
||||||
|
|
||||||
|
@ -12,11 +12,11 @@ SELECT
|
|||||||
SELECT perf_1.site, perf_1.z AS z_1
|
SELECT perf_1.site, perf_1.z AS z_1
|
||||||
FROM perf AS perf_1
|
FROM perf AS perf_1
|
||||||
WHERE user_id = 000
|
WHERE user_id = 000
|
||||||
) ALL INNER JOIN (
|
) jss1 ALL INNER JOIN (
|
||||||
SELECT perf_2.site, perf_2.z AS z_2
|
SELECT perf_2.site, perf_2.z AS z_2
|
||||||
FROM perf AS perf_2
|
FROM perf AS perf_2
|
||||||
WHERE user_id = 999
|
WHERE user_id = 999
|
||||||
) USING site) as avg_values,
|
) jss2 USING site) as avg_values,
|
||||||
z_1 - avg_values.1 AS dif_1,
|
z_1 - avg_values.1 AS dif_1,
|
||||||
z_2 - avg_values.2 AS dif_2,
|
z_2 - avg_values.2 AS dif_2,
|
||||||
dif_1 * dif_2 AS mul,
|
dif_1 * dif_2 AS mul,
|
||||||
@ -26,10 +26,10 @@ FROM (
|
|||||||
SELECT perf_1.site, perf_1.z AS z_1
|
SELECT perf_1.site, perf_1.z AS z_1
|
||||||
FROM perf AS perf_1
|
FROM perf AS perf_1
|
||||||
WHERE user_id = 000
|
WHERE user_id = 000
|
||||||
) ALL INNER JOIN (
|
) js1 ALL INNER JOIN (
|
||||||
SELECT perf_2.site, perf_2.z AS z_2
|
SELECT perf_2.site, perf_2.z AS z_2
|
||||||
FROM perf AS perf_2
|
FROM perf AS perf_2
|
||||||
WHERE user_id = 999
|
WHERE user_id = 999
|
||||||
) USING site);
|
) js2 USING site);
|
||||||
|
|
||||||
DROP TABLE perf;
|
DROP TABLE perf;
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
SET send_logs_level = 'none';
|
SET send_logs_level = 'none';
|
||||||
SET join_default_strictness = '';
|
SET join_default_strictness = '';
|
||||||
SELECT * FROM system.one INNER JOIN (SELECT number AS k FROM system.numbers) ON dummy = k; -- { serverError 417 }
|
SELECT * FROM system.one INNER JOIN (SELECT number AS k FROM system.numbers) js2 ON dummy = k; -- { serverError 417 }
|
||||||
|
@ -19,7 +19,7 @@ FROM
|
|||||||
count(),
|
count(),
|
||||||
1
|
1
|
||||||
FROM test_00744
|
FROM test_00744
|
||||||
) USING (1)
|
) jss2 USING (1)
|
||||||
LIMIT 10
|
LIMIT 10
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -33,5 +33,5 @@ ALL INNER JOIN
|
|||||||
count(),
|
count(),
|
||||||
1
|
1
|
||||||
FROM test_00744
|
FROM test_00744
|
||||||
) USING (1)
|
) js2 USING (1)
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
set subquery_requires_alias = 0;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS left_table;
|
DROP TABLE IF EXISTS left_table;
|
||||||
DROP TABLE IF EXISTS right_table;
|
DROP TABLE IF EXISTS right_table;
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
SET max_block_size = 6;
|
SET max_block_size = 6;
|
||||||
SELECT blockSize() bs FROM (SELECT 1 s) ALL RIGHT JOIN (SELECT arrayJoin([2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3]) s) USING (s) GROUP BY bs ORDER BY bs;
|
SELECT blockSize() bs FROM (SELECT 1 s) js1 ALL RIGHT JOIN (SELECT arrayJoin([2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3]) s) js2 USING (s) GROUP BY bs ORDER BY bs;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
set subquery_requires_alias = 0;
|
||||||
|
|
||||||
select * from (select dummy as val from system.one) any left join (select dummy as val from system.one) using val;
|
select * from (select dummy as val from system.one) any left join (select dummy as val from system.one) using val;
|
||||||
select * from (select toLowCardinality(dummy) as val from system.one) any left join (select dummy as val from system.one) using val;
|
select * from (select toLowCardinality(dummy) as val from system.one) any left join (select dummy as val from system.one) using val;
|
||||||
select * from (select dummy as val from system.one) any left join (select toLowCardinality(dummy) as val from system.one) using val;
|
select * from (select dummy as val from system.one) any left join (select toLowCardinality(dummy) as val from system.one) using val;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
SET send_logs_level = 'none';
|
SET send_logs_level = 'none';
|
||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS delta_codec_synthetic;
|
DROP TABLE IF EXISTS delta_codec_synthetic;
|
||||||
DROP TABLE IF EXISTS default_codec_synthetic;
|
DROP TABLE IF EXISTS default_codec_synthetic;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
SET any_join_distinct_right_table_keys = 1;
|
SET any_join_distinct_right_table_keys = 1;
|
||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
SELECT * FROM (SELECT 1 AS a, 'x' AS b) join (SELECT 1 as a, 'y' as b) using a;
|
SELECT * FROM (SELECT 1 AS a, 'x' AS b) join (SELECT 1 as a, 'y' as b) using a;
|
||||||
SELECT * FROM (SELECT 1 AS a, 'x' AS b) left join (SELECT 1 as a, 'y' as b) using a;
|
SELECT * FROM (SELECT 1 AS a, 'x' AS b) left join (SELECT 1 as a, 'y' as b) using a;
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
0 0 0
|
||||||
|
6 60 600
|
||||||
|
12 120 1200
|
||||||
|
18 180 1800
|
||||||
|
0 0 0
|
||||||
|
10 100 1000
|
||||||
|
20 200 2000
|
||||||
|
┌─t1.a─┬─t2.a─┬─t2.b─┬─t3.b─┬─t3.c─┬─t5.a─┬─t5.b─┬─t5.c─┐
|
||||||
|
│ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │
|
||||||
|
└──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┘
|
||||||
|
0 0 0 0
|
||||||
|
6 6 60 60
|
||||||
|
12 12 120 120
|
||||||
|
18 18 180 180
|
||||||
|
0 0 0 0
|
||||||
|
6 6 60 60
|
||||||
|
12 12 120 120
|
||||||
|
18 18 180 180
|
||||||
|
0 0 0 0
|
||||||
|
6 6 60 60
|
||||||
|
12 12 120 120
|
||||||
|
18 18 180 180
|
||||||
|
0 0 0 0
|
||||||
|
6 6 60 60
|
||||||
|
12 12 120 120
|
||||||
|
18 18 180 180
|
||||||
|
0 0 0 0
|
||||||
|
6 6 60 60
|
||||||
|
12 12 120 120
|
||||||
|
18 18 180 180
|
||||||
|
0 0 0 0
|
||||||
|
6 6 60 60
|
||||||
|
12 12 120 120
|
||||||
|
18 18 180 180
|
||||||
|
┌─t1.a─┬─t2.a─┬─t2.b─┬─t3.b─┬─t3.c─┐
|
||||||
|
│ 0 │ 0 │ 0 │ 0 │ 0 │
|
||||||
|
│ 6 │ 6 │ 60 │ 60 │ 600 │
|
||||||
|
│ 12 │ 12 │ 120 │ 120 │ 1200 │
|
||||||
|
│ 18 │ 18 │ 180 │ 180 │ 1800 │
|
||||||
|
└──────┴──────┴──────┴──────┴──────┘
|
||||||
|
┌─t1.a─┬─t2.a─┬─t2.b─┬─t3.b─┬─t3.c─┐
|
||||||
|
│ 0 │ 0 │ 0 │ 0 │ 0 │
|
||||||
|
│ 6 │ 6 │ 60 │ 60 │ 600 │
|
||||||
|
│ 12 │ 12 │ 120 │ 120 │ 1200 │
|
||||||
|
│ 18 │ 18 │ 180 │ 180 │ 1800 │
|
||||||
|
└──────┴──────┴──────┴──────┴──────┘
|
||||||
|
0 0 0 0 0 0 0
|
||||||
|
6 6 60 60 66 66 120
|
||||||
|
12 12 120 120 132 132 240
|
||||||
|
18 18 180 180 198 198 360
|
@ -0,0 +1,85 @@
|
|||||||
|
DROP TABLE IF EXISTS table1;
|
||||||
|
DROP TABLE IF EXISTS table2;
|
||||||
|
DROP TABLE IF EXISTS table3;
|
||||||
|
DROP TABLE IF EXISTS table5;
|
||||||
|
|
||||||
|
CREATE TABLE table1 (a UInt32) ENGINE = Memory;
|
||||||
|
CREATE TABLE table2 (a UInt32, b UInt32) ENGINE = Memory;
|
||||||
|
CREATE TABLE table3 (b UInt32, c UInt32) ENGINE = Memory;
|
||||||
|
CREATE TABLE table5 (a UInt32, b UInt32, c UInt32) ENGINE = Memory;
|
||||||
|
|
||||||
|
INSERT INTO table1 SELECT number FROM numbers(21);
|
||||||
|
INSERT INTO table2 SELECT number * 2, number * 20 FROM numbers(11);
|
||||||
|
INSERT INTO table3 SELECT number * 30, number * 300 FROM numbers(10);
|
||||||
|
INSERT INTO table5 SELECT number * 5, number * 50, number * 500 FROM numbers(10);
|
||||||
|
|
||||||
|
SET allow_experimental_multiple_joins_emulation = 1;
|
||||||
|
SET subquery_requires_alias = 1;
|
||||||
|
|
||||||
|
select t1.a, t2.b, t3.c from table1 as t1 join table2 as t2 on t1.a = t2.a join table3 as t3 on t2.b = t3.b;
|
||||||
|
select t1.a, t2.b, t5.c from table1 as t1 join table2 as t2 on t1.a = t2.a join table5 as t5 on t1.a = t5.a AND t2.b = t5.b;
|
||||||
|
|
||||||
|
select t1.a, t2.a, t2.b, t3.b, t3.c, t5.a, t5.b, t5.c
|
||||||
|
from table1 as t1
|
||||||
|
join table2 as t2 on t1.a = t2.a
|
||||||
|
join table3 as t3 on t2.b = t3.b
|
||||||
|
join table5 as t5 on t3.c = t5.c
|
||||||
|
FORMAT PrettyCompactNoEscapes;
|
||||||
|
|
||||||
|
select t1.a as t1_a, t2.a as t2_a, t2.b as t2_b, t3.b as t3_b
|
||||||
|
from table1 as t1
|
||||||
|
join table2 as t2 on t1_a = t2_a
|
||||||
|
join table3 as t3 on t2_b = t3_b;
|
||||||
|
|
||||||
|
select t1.a as t1_a, t2.a as t2_a, t2.b as t2_b, t3.b as t3_b
|
||||||
|
from table1 as t1
|
||||||
|
join table2 as t2 on t1.a = t2.a
|
||||||
|
join table3 as t3 on t2.b = t3.b;
|
||||||
|
|
||||||
|
select t1.a as t1_a, t2.a as t2_a, t2.b as t2_b, t3.b as t3_b
|
||||||
|
from table1 as t1
|
||||||
|
join table2 as t2 on table1.a = table2.a
|
||||||
|
join table3 as t3 on table2.b = table3.b;
|
||||||
|
|
||||||
|
select t1.a, t2.a, t2.b, t3.b
|
||||||
|
from table1 as t1
|
||||||
|
join table2 as t2 on table1.a = table2.a
|
||||||
|
join table3 as t3 on table2.b = table3.b;
|
||||||
|
|
||||||
|
select t1.a, t2.a, t2.b, t3.b
|
||||||
|
from table1 as t1
|
||||||
|
join table2 as t2 on t1.a = t2.a
|
||||||
|
join table3 as t3 on t2.b = t3.b;
|
||||||
|
|
||||||
|
select table1.a, table2.a, table2.b, table3.b
|
||||||
|
from table1 as t1
|
||||||
|
join table2 as t2 on table1.a = table2.a
|
||||||
|
join table3 as t3 on table2.b = table3.b;
|
||||||
|
|
||||||
|
select t1.*, t2.*, t3.*
|
||||||
|
from table1 as t1
|
||||||
|
join table2 as t2 on table1.a = table2.a
|
||||||
|
join table3 as t3 on table2.b = table3.b
|
||||||
|
FORMAT PrettyCompactNoEscapes;
|
||||||
|
|
||||||
|
select *
|
||||||
|
from table1 as t1
|
||||||
|
join table2 as t2 on t1.a = t2.a
|
||||||
|
join table3 as t3 on t2.b = t3.b
|
||||||
|
FORMAT PrettyCompactNoEscapes;
|
||||||
|
|
||||||
|
select t1.a as t1_a, t2.a as t2_a, t2.b as t2_b, t3.b as t3_b,
|
||||||
|
(t1.a + table2.b) as t1_t2_x, (table1.a + table3.b) as t1_t3_x, (t2.b + t3.b) as t2_t3_x
|
||||||
|
from table1 as t1
|
||||||
|
join table2 as t2 on t1_a = t2_a
|
||||||
|
join table3 as t3 on t2_b = t3_b;
|
||||||
|
|
||||||
|
--select (t1.a + table2.b) as t1_t2_x, (table1.a + table3.b) as t1_t3_x, (t2.b + t3.b) as t2_t3_x
|
||||||
|
--from table1 as t1
|
||||||
|
--join table2 as t2 on t1_t2_x = t2.a
|
||||||
|
--join table3 as t3 on t1_t3_x = t2_t3_x;
|
||||||
|
|
||||||
|
DROP TABLE table1;
|
||||||
|
DROP TABLE table2;
|
||||||
|
DROP TABLE table3;
|
||||||
|
DROP TABLE table5;
|
@ -31,11 +31,11 @@ SELECT
|
|||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT city_id, groupBitmapState( uid ) AS day_today FROM bitmap_test WHERE pickup_date = '2019-01-02' GROUP BY city_id
|
SELECT city_id, groupBitmapState( uid ) AS day_today FROM bitmap_test WHERE pickup_date = '2019-01-02' GROUP BY city_id
|
||||||
)
|
) js1
|
||||||
ALL LEFT JOIN
|
ALL LEFT JOIN
|
||||||
(
|
(
|
||||||
SELECT city_id, groupBitmapState( uid ) AS day_before FROM bitmap_test WHERE pickup_date = '2019-01-01' GROUP BY city_id
|
SELECT city_id, groupBitmapState( uid ) AS day_before FROM bitmap_test WHERE pickup_date = '2019-01-01' GROUP BY city_id
|
||||||
)
|
) js2
|
||||||
USING city_id;
|
USING city_id;
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
@ -48,11 +48,11 @@ SELECT
|
|||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT city_id, groupBitmapState( uid ) AS day_today FROM bitmap_test WHERE pickup_date = '2019-01-02' GROUP BY city_id
|
SELECT city_id, groupBitmapState( uid ) AS day_today FROM bitmap_test WHERE pickup_date = '2019-01-02' GROUP BY city_id
|
||||||
)
|
) js1
|
||||||
ALL LEFT JOIN
|
ALL LEFT JOIN
|
||||||
(
|
(
|
||||||
SELECT city_id, groupBitmapState( uid ) AS day_before FROM bitmap_test WHERE pickup_date = '2019-01-01' GROUP BY city_id
|
SELECT city_id, groupBitmapState( uid ) AS day_before FROM bitmap_test WHERE pickup_date = '2019-01-01' GROUP BY city_id
|
||||||
)
|
) js2
|
||||||
USING city_id;
|
USING city_id;
|
||||||
|
|
||||||
SELECT count(*) FROM bitmap_test WHERE bitmapHasAny((SELECT groupBitmapState(uid) FROM bitmap_test WHERE pickup_date = '2019-01-01'), bitmapBuild([uid]));
|
SELECT count(*) FROM bitmap_test WHERE bitmapHasAny((SELECT groupBitmapState(uid) FROM bitmap_test WHERE pickup_date = '2019-01-01'), bitmapBuild([uid]));
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
SET any_join_distinct_right_table_keys = 1;
|
SET any_join_distinct_right_table_keys = 1;
|
||||||
|
|
||||||
SELECT * FROM (SELECT dummy as a, (toUInt8(0), toUInt8(0)) AS tup FROM system.one)
|
SELECT * FROM (SELECT dummy as a, (toUInt8(0), toUInt8(0)) AS tup FROM system.one) js1
|
||||||
JOIN (SELECT dummy as a, (toUInt8(0), toUInt8(0)) AS tup FROM system.one)
|
JOIN (SELECT dummy as a, (toUInt8(0), toUInt8(0)) AS tup FROM system.one) js2
|
||||||
USING (a, tup);
|
USING (a, tup);
|
||||||
|
|
||||||
SELECT * FROM (SELECT dummy as a, (toUInt8(0), toUInt8(0)) AS tup FROM system.one)
|
SELECT * FROM (SELECT dummy as a, (toUInt8(0), toUInt8(0)) AS tup FROM system.one) js1
|
||||||
GLOBAL ANY FULL OUTER JOIN (SELECT dummy as a, (toUInt8(0), toUInt8(0)) AS tup FROM system.one)
|
GLOBAL ANY FULL OUTER JOIN (SELECT dummy as a, (toUInt8(0), toUInt8(0)) AS tup FROM system.one) js2
|
||||||
USING (a, tup);
|
USING (a, tup);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
SET enable_debug_queries = 1;
|
SET enable_debug_queries = 1;
|
||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t1_00849;
|
DROP TABLE IF EXISTS t1_00849;
|
||||||
DROP TABLE IF EXISTS t2_00849;
|
DROP TABLE IF EXISTS t2_00849;
|
||||||
|
@ -9,6 +9,7 @@ CREATE TABLE t2_00850 (dummy UInt8) ENGINE = Distributed(test_shard_localhost, c
|
|||||||
INSERT INTO t_local VALUES (1);
|
INSERT INTO t_local VALUES (1);
|
||||||
|
|
||||||
SET asterisk_left_columns_only = 1;
|
SET asterisk_left_columns_only = 1;
|
||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
SELECT * FROM t1_00850
|
SELECT * FROM t1_00850
|
||||||
GLOBAL INNER JOIN
|
GLOBAL INNER JOIN
|
||||||
|
@ -44,6 +44,8 @@ ALL RIGHT JOIN
|
|||||||
USING (something)
|
USING (something)
|
||||||
ORDER BY count_a DESC;
|
ORDER BY count_a DESC;
|
||||||
|
|
||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
SELECT something, count_a, count_b, toTypeName(something) FROM
|
SELECT something, count_a, count_b, toTypeName(something) FROM
|
||||||
( SELECT something, count() AS count_a FROM table_a GROUP BY something )
|
( SELECT something, count() AS count_a FROM table_a GROUP BY something )
|
||||||
ALL FULL JOIN
|
ALL FULL JOIN
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
set allow_experimental_multiple_joins_emulation = 0;
|
set allow_experimental_multiple_joins_emulation = 0;
|
||||||
set allow_experimental_cross_to_join_conversion = 0;
|
set allow_experimental_cross_to_join_conversion = 0;
|
||||||
select ax, c from (select [1,2] ax, 0 c) array join ax join (select 0 c) using(c);
|
select ax, c from (select [1,2] ax, 0 c) array join ax join (select 0 c) using(c);
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
select toTypeName(key), toTypeName(value) from (
|
select toTypeName(key), toTypeName(value) from (
|
||||||
select 1 as key, '' as value
|
select 1 as key, '' as value
|
||||||
union all
|
union all
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
SET any_join_distinct_right_table_keys = 1;
|
SET any_join_distinct_right_table_keys = 1;
|
||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
SELECT * FROM (SELECT 1 AS x) ALL LEFT JOIN (SELECT 1 AS x) USING x;
|
SELECT * FROM (SELECT 1 AS x) ALL LEFT JOIN (SELECT 1 AS x) USING x;
|
||||||
SELECT * FROM (SELECT 1 AS x) ALL LEFT JOIN (SELECT 2 AS x) USING x;
|
SELECT * FROM (SELECT 1 AS x) ALL LEFT JOIN (SELECT 2 AS x) USING x;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS ANIMAL;
|
DROP TABLE IF EXISTS ANIMAL;
|
||||||
|
|
||||||
CREATE TABLE ANIMAL ( ANIMAL Nullable(String) ) engine = TinyLog;
|
CREATE TABLE ANIMAL ( ANIMAL Nullable(String) ) engine = TinyLog;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
SET any_join_distinct_right_table_keys = 1;
|
SET any_join_distinct_right_table_keys = 1;
|
||||||
SET join_use_nulls = 1;
|
SET join_use_nulls = 1;
|
||||||
SELECT number FROM system.numbers ANY INNER JOIN (SELECT number, ['test'] FROM system.numbers LIMIT 1) USING (number) LIMIT 1;
|
SELECT number FROM system.numbers ANY INNER JOIN (SELECT number, ['test'] FROM system.numbers LIMIT 1) js2 USING (number) LIMIT 1;
|
||||||
SELECT number FROM system.numbers ANY LEFT JOIN (SELECT number, ['test'] FROM system.numbers LIMIT 1) USING (number) LIMIT 1;
|
SELECT number FROM system.numbers ANY LEFT JOIN (SELECT number, ['test'] FROM system.numbers LIMIT 1) js2 USING (number) LIMIT 1;
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
1 2 3
|
||||||
|
1 2 3
|
@ -0,0 +1,19 @@
|
|||||||
|
SET subquery_requires_alias = 1;
|
||||||
|
|
||||||
|
SELECT * FROM (SELECT 1 as A, 2 as B) X
|
||||||
|
ALL LEFT JOIN (SELECT 3 as A, 2 as B) Y
|
||||||
|
USING (B);
|
||||||
|
|
||||||
|
SELECT * FROM (SELECT 1 as A, 2 as B) X
|
||||||
|
ALL LEFT JOIN (SELECT 3 as A, 2 as B)
|
||||||
|
USING (B); -- { serverError 206 }
|
||||||
|
|
||||||
|
SELECT * FROM (SELECT 1 as A, 2 as B)
|
||||||
|
ALL LEFT JOIN (SELECT 3 as A, 2 as B) Y
|
||||||
|
USING (B); -- { serverError 206 }
|
||||||
|
|
||||||
|
set subquery_requires_alias=0;
|
||||||
|
|
||||||
|
SELECT * FROM (SELECT 1 as A, 2 as B)
|
||||||
|
ALL LEFT JOIN (SELECT 3 as A, 2 as B) Y
|
||||||
|
USING (B);
|
@ -18,4 +18,5 @@ FROM
|
|||||||
GROUP BY EventDate
|
GROUP BY EventDate
|
||||||
) USING EventDate
|
) USING EventDate
|
||||||
ORDER BY hits DESC
|
ORDER BY hits DESC
|
||||||
LIMIT 10;
|
LIMIT 10
|
||||||
|
SETTINGS subquery_requires_alias = 0;
|
||||||
|
@ -12,4 +12,5 @@ FROM test.hits ANY LEFT JOIN
|
|||||||
) USING EventDate
|
) USING EventDate
|
||||||
GROUP BY EventDate
|
GROUP BY EventDate
|
||||||
ORDER BY hits DESC
|
ORDER BY hits DESC
|
||||||
LIMIT 10;
|
LIMIT 10
|
||||||
|
SETTINGS subquery_requires_alias = 0;
|
||||||
|
@ -19,3 +19,4 @@ FROM
|
|||||||
) USING domain
|
) USING domain
|
||||||
ORDER BY hits DESC
|
ORDER BY hits DESC
|
||||||
LIMIT 10
|
LIMIT 10
|
||||||
|
SETTINGS subquery_requires_alias = 0;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
SET any_join_distinct_right_table_keys = 1;
|
SET any_join_distinct_right_table_keys = 1;
|
||||||
|
SET subquery_requires_alias = 0;
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
loyalty,
|
loyalty,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
set any_join_distinct_right_table_keys = 1;
|
set any_join_distinct_right_table_keys = 1;
|
||||||
|
set subquery_requires_alias = 0;
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
CounterID,
|
CounterID,
|
||||||
|
Loading…
Reference in New Issue
Block a user