Merge pull request #53295 from ClickHouse/less_no_parallel

Remove no-parallel tag from some tests
This commit is contained in:
Alexander Tokmakov 2023-08-17 14:08:35 +03:00 committed by GitHub
commit f83d0dabea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 993 additions and 1034 deletions

View File

@ -847,7 +847,9 @@ void ClientBase::processOrdinaryQuery(const String & query_to_execute, ASTPtr pa
visitor.visit(parsed_query);
/// Get new query after substitutions.
query = serializeAST(*parsed_query);
if (visitor.getNumberOfReplacedParameters())
query = serializeAST(*parsed_query);
chassert(!query.empty());
}
if (allow_merge_tree_settings && parsed_query->as<ASTCreateQuery>())
@ -1332,7 +1334,9 @@ void ClientBase::processInsertQuery(const String & query_to_execute, ASTPtr pars
visitor.visit(parsed_query);
/// Get new query after substitutions.
query = serializeAST(*parsed_query);
if (visitor.getNumberOfReplacedParameters())
query = serializeAST(*parsed_query);
chassert(!query.empty());
}
/// Process the query that requires transferring data blocks to the server.
@ -1811,7 +1815,7 @@ void ClientBase::processParsedSingleQuery(const String & full_query, const Strin
}
if (const auto * use_query = parsed_query->as<ASTUseQuery>())
{
const String & new_database = use_query->database;
const String & new_database = use_query->getDatabase();
/// If the client initiates the reconnection, it takes the settings from the config.
config().setString("database", new_database);
/// If the connection initiates the reconnection, it uses its variable.

View File

@ -116,10 +116,10 @@ String InterpreterShowTablesQuery::getRewrittenQuery()
return rewritten_query.str();
}
if (query.temporary && !query.from.empty())
if (query.temporary && !query.getFrom().empty())
throw Exception(ErrorCodes::SYNTAX_ERROR, "The `FROM` and `TEMPORARY` cannot be used together in `SHOW TABLES`");
String database = getContext()->resolveDatabase(query.from);
String database = getContext()->resolveDatabase(query.getFrom());
DatabaseCatalog::instance().assertDatabaseExists(database);
WriteBufferFromOwnString rewritten_query;

View File

@ -10,7 +10,7 @@ namespace DB
BlockIO InterpreterUseQuery::execute()
{
const String & new_database = query_ptr->as<ASTUseQuery &>().database;
const String & new_database = query_ptr->as<ASTUseQuery &>().getDatabase();
getContext()->checkAccess(AccessType::SHOW_DATABASES, new_database);
getContext()->getSessionContext()->setCurrentDatabase(new_database);
return {};

View File

@ -66,10 +66,11 @@ void ReplaceQueryParameterVisitor::visitChildren(ASTPtr & ast)
const String & ReplaceQueryParameterVisitor::getParamValue(const String & name)
{
auto search = query_parameters.find(name);
if (search != query_parameters.end())
return search->second;
else
if (search == query_parameters.end())
throw Exception(ErrorCodes::UNKNOWN_QUERY_PARAMETER, "Substitution {} is not set", backQuote(name));
++num_replaced_parameters;
return search->second;
}
void ReplaceQueryParameterVisitor::visitQueryParameter(ASTPtr & ast)
@ -131,6 +132,7 @@ void ReplaceQueryParameterVisitor::visitIdentifier(ASTPtr & ast)
if (ast_identifier->children.empty())
return;
bool replaced_parameter = false;
auto & name_parts = ast_identifier->name_parts;
for (size_t i = 0, j = 0, size = name_parts.size(); i < size; ++i)
{
@ -138,9 +140,14 @@ void ReplaceQueryParameterVisitor::visitIdentifier(ASTPtr & ast)
{
const auto & ast_param = ast_identifier->children[j++]->as<ASTQueryParameter &>();
name_parts[i] = getParamValue(ast_param.name);
replaced_parameter = true;
}
}
/// Do not touch AST if there are no parameters
if (!replaced_parameter)
return;
/// FIXME: what should this mean?
if (!ast_identifier->semantic->special && name_parts.size() >= 2)
ast_identifier->semantic->table = ast_identifier->name_parts.end()[-2];

View File

@ -20,8 +20,12 @@ public:
void visit(ASTPtr & ast);
size_t getNumberOfReplacedParameters() const { return num_replaced_parameters; }
private:
const NameToNameMap & query_parameters;
size_t num_replaced_parameters = 0;
const String & getParamValue(const String & name);
void visitIdentifier(ASTPtr & ast);
void visitQueryParameter(ASTPtr & ast);

View File

@ -729,11 +729,16 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
is_create_parameterized_view = create_query->isParameterizedView();
/// Replace ASTQueryParameter with ASTLiteral for prepared statements.
if (!is_create_parameterized_view && context->hasQueryParameters())
/// Even if we don't have parameters in query_context, check that AST doesn't have unknown parameters
bool probably_has_params = find_first_symbols<'{'>(begin, end) != end;
if (!is_create_parameterized_view && probably_has_params)
{
ReplaceQueryParameterVisitor visitor(context->getQueryParameters());
visitor.visit(ast);
query = serializeAST(*ast);
if (visitor.getNumberOfReplacedParameters())
query = serializeAST(*ast);
else
query.assign(begin, query_end);
}
else
{

View File

@ -1,4 +1,5 @@
#include <iomanip>
#include <Parsers/ASTIdentifier_fwd.h>
#include <Parsers/ASTShowTablesQuery.h>
#include <Common/quoteString.h>
#include <IO/Operators.h>
@ -10,10 +11,20 @@ ASTPtr ASTShowTablesQuery::clone() const
{
auto res = std::make_shared<ASTShowTablesQuery>(*this);
res->children.clear();
if (from)
res->set(res->from, from->clone());
cloneOutputOptions(*res);
return res;
}
String ASTShowTablesQuery::getFrom() const
{
String name;
tryGetIdentifierNameInto(from, name);
return name;
}
void ASTShowTablesQuery::formatLike(const FormatSettings & settings) const
{
if (!like.empty())
@ -72,9 +83,11 @@ void ASTShowTablesQuery::formatQueryImpl(const FormatSettings & settings, Format
settings.ostr << (settings.hilite ? hilite_keyword : "") << "SHOW " << (temporary ? "TEMPORARY " : "") <<
(dictionaries ? "DICTIONARIES" : "TABLES") << (settings.hilite ? hilite_none : "");
if (!from.empty())
settings.ostr << (settings.hilite ? hilite_keyword : "") << " FROM " << (settings.hilite ? hilite_none : "")
<< backQuoteIfNeed(from);
if (from)
{
settings.ostr << (settings.hilite ? hilite_keyword : "") << " FROM " << (settings.hilite ? hilite_none : "");
from->formatImpl(settings, state, frame);
}
formatLike(settings);

View File

@ -24,8 +24,9 @@ public:
bool caches = false;
bool full = false;
IAST * from;
String cluster_str;
String from;
String like;
bool not_like = false;
@ -38,6 +39,8 @@ public:
ASTPtr clone() const override;
QueryKind getQueryKind() const override { return QueryKind::Show; }
String getFrom() const;
protected:
void formatLike(const FormatSettings & settings) const;
void formatLimit(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const;

View File

@ -1,6 +1,7 @@
#pragma once
#include <Parsers/IAST.h>
#include <Parsers/ASTIdentifier_fwd.h>
#include <Common/quoteString.h>
#include <IO/Operators.h>
@ -14,19 +15,34 @@ namespace DB
class ASTUseQuery : public IAST
{
public:
String database;
IAST * database;
String getDatabase() const
{
String name;
tryGetIdentifierNameInto(database, name);
return name;
}
/** Get the text that identifies this element. */
String getID(char delim) const override { return "UseQuery" + (delim + database); }
String getID(char delim) const override { return "UseQuery" + (delim + getDatabase()); }
ASTPtr clone() const override { return std::make_shared<ASTUseQuery>(*this); }
ASTPtr clone() const override
{
auto res = std::make_shared<ASTUseQuery>(*this);
res->children.clear();
if (database)
res->set(res->database, database->clone());
return res;
}
QueryKind getQueryKind() const override { return QueryKind::Use; }
protected:
void formatImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override
void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override
{
settings.ostr << (settings.hilite ? hilite_keyword : "") << "USE " << (settings.hilite ? hilite_none : "") << backQuoteIfNeed(database);
settings.ostr << (settings.hilite ? hilite_keyword : "") << "USE " << (settings.hilite ? hilite_none : "");
database->formatImpl(settings, state, frame);
}
};

View File

@ -502,7 +502,7 @@ bool ParserCreateTableQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expe
ParserKeyword s_temporary("TEMPORARY");
ParserKeyword s_table("TABLE");
ParserKeyword s_if_not_exists("IF NOT EXISTS");
ParserCompoundIdentifier table_name_p(true, true);
ParserCompoundIdentifier table_name_p(/*table_name_with_optional_uuid*/ true, /*allow_query_parameter*/ true);
ParserKeyword s_from("FROM");
ParserKeyword s_on("ON");
ParserToken s_dot(TokenType::Dot);
@ -740,7 +740,7 @@ bool ParserCreateLiveViewQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & e
ParserKeyword s_create("CREATE");
ParserKeyword s_attach("ATTACH");
ParserKeyword s_if_not_exists("IF NOT EXISTS");
ParserCompoundIdentifier table_name_p(true, true);
ParserCompoundIdentifier table_name_p(/*table_name_with_optional_uuid*/ true, /*allow_query_parameter*/ true);
ParserKeyword s_as("AS");
ParserKeyword s_view("VIEW");
ParserKeyword s_live("LIVE");
@ -878,7 +878,7 @@ bool ParserCreateWindowViewQuery::parseImpl(Pos & pos, ASTPtr & node, Expected &
ParserKeyword s_temporary("TEMPORARY");
ParserKeyword s_attach("ATTACH");
ParserKeyword s_if_not_exists("IF NOT EXISTS");
ParserCompoundIdentifier table_name_p(true);
ParserCompoundIdentifier table_name_p(/*table_name_with_optional_uuid*/ true, /*allow_query_parameter*/ true);
ParserKeyword s_as("AS");
ParserKeyword s_view("VIEW");
ParserKeyword s_window("WINDOW");
@ -1015,12 +1015,17 @@ bool ParserCreateWindowViewQuery::parseImpl(Pos & pos, ASTPtr & node, Expected &
query->if_not_exists = if_not_exists;
query->is_window_view = true;
StorageID table_id = table->as<ASTTableIdentifier>()->getTableId();
query->setDatabase(table_id.database_name);
query->setTable(table_id.table_name);
query->uuid = table_id.uuid;
auto * table_id = table->as<ASTTableIdentifier>();
query->database = table_id->getDatabase();
query->table = table_id->getTable();
query->uuid = table_id->uuid;
query->cluster = cluster_str;
if (query->database)
query->children.push_back(query->database);
if (query->table)
query->children.push_back(query->table);
if (to_table)
query->to_table_id = to_table->as<ASTTableIdentifier>()->getTableId();
@ -1265,7 +1270,8 @@ bool ParserCreateViewQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
ParserKeyword s_create("CREATE");
ParserKeyword s_attach("ATTACH");
ParserKeyword s_if_not_exists("IF NOT EXISTS");
ParserCompoundIdentifier table_name_p(true, true);
ParserCompoundIdentifier table_name_p(/*table_name_with_optional_uuid*/ true, /*allow_query_parameter*/ true);
ParserCompoundIdentifier to_table_name_p(/*table_name_with_optional_uuid*/ true, /*allow_query_parameter*/ false);
ParserKeyword s_as("AS");
ParserKeyword s_view("VIEW");
ParserKeyword s_materialized("MATERIALIZED");
@ -1487,7 +1493,7 @@ bool ParserCreateDictionaryQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, E
ParserKeyword s_dictionary("DICTIONARY");
ParserKeyword s_if_not_exists("IF NOT EXISTS");
ParserKeyword s_on("ON");
ParserCompoundIdentifier dict_name_p(true, true);
ParserCompoundIdentifier dict_name_p(/*table_name_with_optional_uuid*/ true, /*allow_query_parameter*/ true);
ParserToken s_left_paren(TokenType::OpeningRoundBracket);
ParserToken s_right_paren(TokenType::ClosingRoundBracket);
ParserToken s_dot(TokenType::Dot);

View File

@ -36,7 +36,7 @@ bool ParserShowTablesQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
ParserKeyword s_where("WHERE");
ParserKeyword s_limit("LIMIT");
ParserStringLiteral like_p;
ParserIdentifier name_p;
ParserIdentifier name_p(true);
ParserExpressionWithOptionalAlias exp_elem(false);
ASTPtr like;
@ -174,7 +174,7 @@ bool ParserShowTablesQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
return false;
}
tryGetIdentifierNameInto(database, query->from);
query->set(query->from, database);
if (like)
query->like = like->as<ASTLiteral &>().value.safeGet<const String &>();

View File

@ -11,7 +11,7 @@ namespace DB
bool ParserUseQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
{
ParserKeyword s_use("USE");
ParserIdentifier name_p;
ParserIdentifier name_p{/*allow_query_parameter*/ true};
if (!s_use.ignore(pos, expected))
return false;
@ -21,7 +21,7 @@ bool ParserUseQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
return false;
auto query = std::make_shared<ASTUseQuery>();
tryGetIdentifierNameInto(database, query->database);
query->set(query->database, database);
node = query;
return true;

View File

@ -31,7 +31,7 @@ private:
void visitQueryParameter(const ASTQueryParameter & query_parameter)
{
query_parameters[query_parameter.name]= query_parameter.type;
query_parameters[query_parameter.name] = query_parameter.type;
}
};

View File

@ -1196,8 +1196,18 @@ class TestCase:
# This is for .sh tests
os.environ["CLICKHOUSE_LOG_COMMENT"] = args.testcase_basename
query_params = ""
if "need-query-parameters" in self.tags:
query_params = (
" --param_CLICKHOUSE_DATABASE="
+ database
+ " --param_CLICKHOUSE_DATABASE_1="
+ database
+ "_1"
)
params = {
"client": client + " --database=" + database,
"client": client + " --database=" + database + query_params,
"logs_level": server_logs_level,
"options": client_options,
"test": self.case_file,
@ -1457,13 +1467,13 @@ class TestSuite:
else:
raise Exception(f"Unknown file_extension: {filename}")
def parse_tags_from_line(line, comment_sign):
def parse_tags_from_line(line, comment_sign) -> set[str]:
if not line.startswith(comment_sign):
return None
return set()
tags_str = line[len(comment_sign) :].lstrip() # noqa: ignore E203
tags_prefix = "Tags:"
if not tags_str.startswith(tags_prefix):
return None
return set()
tags_str = tags_str[len(tags_prefix) :] # noqa: ignore E203
tags = tags_str.split(",")
tags = {tag.strip() for tag in tags}
@ -1481,12 +1491,23 @@ class TestSuite:
def load_tags_from_file(filepath):
comment_sign = get_comment_sign(filepath)
need_query_params = False
with open(filepath, "r", encoding="utf-8") as file:
try:
line = find_tag_line(file)
tag_line = find_tag_line(file)
except UnicodeDecodeError:
return []
return parse_tags_from_line(line, comment_sign)
try:
if filepath.endswith(".sql"):
for line in file:
if "{CLICKHOUSE_DATABASE" in line:
need_query_params = True
except UnicodeDecodeError:
pass
parsed_tags = parse_tags_from_line(tag_line, comment_sign)
if need_query_params:
parsed_tags.add("need-query-parameters")
return parsed_tags
all_tags = {}
start_time = datetime.now()

View File

@ -2,8 +2,8 @@ A
B
numbers
one
A 1 TinyLog CREATE TABLE test_show_tables.A (`A` UInt8) ENGINE = TinyLog
B 1 TinyLog CREATE TABLE test_show_tables.B (`A` UInt8) ENGINE = TinyLog
A 1 TinyLog CREATE TABLE default.A (`A` UInt8) ENGINE = TinyLog
B 1 TinyLog CREATE TABLE default.B (`A` UInt8) ENGINE = TinyLog
test_temporary_table
['test_show_tables'] ['test_materialized']
['default'] ['test_materialized']
0

View File

@ -1,32 +1,27 @@
-- Tags: no-parallel
DROP DATABASE IF EXISTS test_show_tables;
DROP DATABASE IF EXISTS {CLICKHOUSE_DATABASE:Identifier};
CREATE DATABASE test_show_tables;
CREATE DATABASE {CLICKHOUSE_DATABASE:Identifier};
CREATE TABLE test_show_tables.A (A UInt8) ENGINE = TinyLog;
CREATE TABLE test_show_tables.B (A UInt8) ENGINE = TinyLog;
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.A (A UInt8) ENGINE = TinyLog;
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.B (A UInt8) ENGINE = TinyLog;
SHOW TABLES from test_show_tables;
SHOW TABLES from {CLICKHOUSE_DATABASE:Identifier};
SHOW TABLES in system where engine like '%System%' and name in ('numbers', 'one');
SELECT name, toUInt32(metadata_modification_time) > 0, engine_full, create_table_query FROM system.tables WHERE database = 'test_show_tables' ORDER BY name FORMAT TSVRaw;
SELECT name, toUInt32(metadata_modification_time) > 0, engine_full, create_table_query FROM system.tables WHERE database = currentDatabase() ORDER BY name FORMAT TSVRaw;
CREATE TEMPORARY TABLE test_temporary_table (id UInt64);
SELECT name FROM system.tables WHERE is_temporary = 1 AND name = 'test_temporary_table';
CREATE TABLE test_show_tables.test_log(id UInt64) ENGINE = Log;
CREATE MATERIALIZED VIEW test_show_tables.test_materialized ENGINE = Log AS SELECT * FROM test_show_tables.test_log;
SELECT dependencies_database, dependencies_table FROM system.tables WHERE name = 'test_log';
DROP DATABASE test_show_tables;
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.test_log(id UInt64) ENGINE = Log;
CREATE MATERIALIZED VIEW {CLICKHOUSE_DATABASE:Identifier}.test_materialized ENGINE = Log AS SELECT * FROM {CLICKHOUSE_DATABASE:Identifier}.test_log;
SELECT dependencies_database, dependencies_table FROM system.tables WHERE name = 'test_log' and database=currentDatabase();
DROP DATABASE {CLICKHOUSE_DATABASE:Identifier};
-- Check that create_table_query works for system tables and unusual Databases
DROP DATABASE IF EXISTS test_DatabaseMemory;
CREATE DATABASE test_DatabaseMemory ENGINE = Memory;
CREATE TABLE test_DatabaseMemory.A (A UInt8) ENGINE = Null;
CREATE DATABASE {CLICKHOUSE_DATABASE:Identifier} ENGINE = Memory;
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.A (A UInt8) ENGINE = Null;
SELECT sum(ignore(*, metadata_modification_time, engine_full, create_table_query)) FROM system.tables WHERE database = 'test_DatabaseMemory';
DROP DATABASE test_DatabaseMemory;
SELECT sum(ignore(*, metadata_modification_time, engine_full, create_table_query)) FROM system.tables WHERE database = '{CLICKHOUSE_DATABASE:String}';

View File

@ -1,8 +1,3 @@
-- Tags: no-parallel
CREATE DATABASE IF NOT EXISTS test_00101_0;
USE test_00101_0;
DROP TABLE IF EXISTS test_table;
DROP TABLE IF EXISTS test_view;
@ -25,9 +20,9 @@ DROP TABLE test_view_filtered;
-- Check only sophisticated constructors and desctructors:
CREATE DATABASE IF NOT EXISTS test_00101_1;
CREATE DATABASE IF NOT EXISTS {CLICKHOUSE_DATABASE_1:Identifier};
USE test_00101_1;
USE {CLICKHOUSE_DATABASE_1:Identifier};
DROP TABLE IF EXISTS tmp;
DROP TABLE IF EXISTS tmp_mv;
@ -57,5 +52,5 @@ EXISTS TABLE `.inner.tmp_mv4`;
DROP TABLE tmp;
DROP DATABASE test_00101_0;
DROP DATABASE test_00101_1;
DROP DATABASE {CLICKHOUSE_DATABASE:Identifier};
DROP DATABASE {CLICKHOUSE_DATABASE_1:Identifier};

View File

@ -1,11 +1,10 @@
-- Tags: no-parallel
CREATE DATABASE IF NOT EXISTS test2_00158;
DROP TABLE IF EXISTS test2_00158.mt_buffer_00158;
DROP TABLE IF EXISTS test2_00158.mt_00158;
CREATE TABLE test2_00158.mt_buffer_00158 (d Date DEFAULT today(), x UInt64) ENGINE = Buffer(test2_00158, mt_00158, 16, 100, 100, 1000000, 1000000, 1000000000, 1000000000);
CREATE DATABASE IF NOT EXISTS {CLICKHOUSE_DATABASE:Identifier};
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.mt_buffer_00158;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.mt_00158;
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.mt_buffer_00158 (d Date DEFAULT today(), x UInt64) ENGINE = Buffer({CLICKHOUSE_DATABASE:Identifier}, mt_00158, 16, 100, 100, 1000000, 1000000, 1000000000, 1000000000);
SET send_logs_level = 'fatal'; -- Supress "Destination table test2.mt doesn't exist. Block of data is discarded."
INSERT INTO test2_00158.mt_buffer_00158 (x) SELECT number AS x FROM system.numbers LIMIT 100000;
INSERT INTO test2_00158.mt_buffer_00158 (x) SELECT number AS x FROM system.numbers LIMIT 1000000;
DROP TABLE IF EXISTS test2_00158.mt_buffer_00158;
DROP DATABASE test2_00158;
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.mt_buffer_00158 (x) SELECT number AS x FROM system.numbers LIMIT 100000;
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.mt_buffer_00158 (x) SELECT number AS x FROM system.numbers LIMIT 1000000;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.mt_buffer_00158;
DROP DATABASE {CLICKHOUSE_DATABASE:Identifier};

View File

@ -1,9 +1,3 @@
-- Tags: no-parallel
DROP DATABASE IF EXISTS test_00508;
CREATE DATABASE test_00508;
USE test_00508;
CREATE TABLE src (x UInt8) ENGINE = Null;
CREATE TABLE dst (x UInt8) ENGINE = Memory;
@ -20,17 +14,17 @@ SELECT * FROM dst ORDER BY x;
USE default;
-- Reattach MV (shortcut)
ATTACH TABLE test_00508.mv_00508;
ATTACH TABLE {CLICKHOUSE_DATABASE:Identifier}.mv_00508;
INSERT INTO test_00508.src VALUES (3);
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.src VALUES (3);
SELECT * FROM test_00508.mv_00508 ORDER BY x;
SELECT * FROM {CLICKHOUSE_DATABASE:Identifier}.mv_00508 ORDER BY x;
-- Drop the MV and see if the data is still readable
DROP TABLE test_00508.mv_00508;
SELECT * FROM test_00508.dst ORDER BY x;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.mv_00508;
SELECT * FROM {CLICKHOUSE_DATABASE:Identifier}.dst ORDER BY x;
DROP TABLE test_00508.src;
DROP TABLE test_00508.dst;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.src;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.dst;
DROP DATABASE test_00508;
DROP DATABASE {CLICKHOUSE_DATABASE:Identifier};

View File

@ -1,32 +1,25 @@
-- Tags: no-parallel
CREATE DATABASE test_00571;
USE test_00571;
DROP DATABASE IF EXISTS none;
DROP TABLE IF EXISTS test_00571;
DROP DATABASE IF EXISTS {CLICKHOUSE_DATABASE_1:Identifier};
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier};
DROP TABLE IF EXISTS test_materialized_00571;
set allow_deprecated_syntax_for_merge_tree=1;
CREATE DATABASE none;
CREATE DATABASE {CLICKHOUSE_DATABASE_1:Identifier};
CREATE TABLE test_00571 ( date Date, platform Enum8('a' = 0, 'b' = 1, 'c' = 2), app Enum8('a' = 0, 'b' = 1) ) ENGINE = MergeTree(date, (platform, app), 8192);
CREATE MATERIALIZED VIEW test_materialized_00571 ENGINE = MergeTree(date, (platform, app), 8192) POPULATE AS SELECT date, platform, app FROM (SELECT * FROM test_00571);
USE none;
USE {CLICKHOUSE_DATABASE_1:Identifier};
INSERT INTO test_00571.test_00571 VALUES('2018-02-16', 'a', 'a');
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.test_00571 VALUES('2018-02-16', 'a', 'a');
SELECT * FROM test_00571.test_00571;
SELECT * FROM test_00571.test_materialized_00571;
SELECT * FROM {CLICKHOUSE_DATABASE:Identifier}.test_00571;
SELECT * FROM {CLICKHOUSE_DATABASE:Identifier}.test_materialized_00571;
DETACH TABLE test_00571.test_materialized_00571;
ATTACH TABLE test_00571.test_materialized_00571;
DETACH TABLE {CLICKHOUSE_DATABASE:Identifier}.test_materialized_00571;
ATTACH TABLE {CLICKHOUSE_DATABASE:Identifier}.test_materialized_00571;
SELECT * FROM test_00571.test_materialized_00571;
SELECT * FROM {CLICKHOUSE_DATABASE:Identifier}.test_materialized_00571;
DROP DATABASE IF EXISTS none;
DROP TABLE IF EXISTS test_00571.test_00571;
DROP TABLE IF EXISTS test_00571.test_materialized_00571;
DROP DATABASE test_00571;
DROP DATABASE IF EXISTS {CLICKHOUSE_DATABASE_1:Identifier};
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.test_00571;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.test_materialized_00571;

View File

@ -1 +1 @@
CREATE DATABASE test_00604\nENGINE = Atomic
CREATE DATABASE default\nENGINE = Atomic

View File

@ -1,5 +1,3 @@
-- Tags: no-ordinary-database, no-parallel
-- Tags: no-ordinary-database, no-replicated-database
create database if not exists test_00604;
show create database test_00604;
drop database test_00604;
show create database {CLICKHOUSE_DATABASE:Identifier};

View File

@ -1,5 +1,3 @@
-- Tags: no-parallel
DROP TABLE IF EXISTS data_00612;
DROP TABLE IF EXISTS dist_00612;

View File

@ -1,10 +1,5 @@
-- Tags: no-parallel
DROP DATABASE IF EXISTS test_00740;
CREATE DATABASE test_00740;
USE test_00740;
DROP TABLE IF EXISTS test_00740;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier};
DROP TABLE IF EXISTS test_view_00740;
DROP TABLE IF EXISTS test_nested_view_00740;
DROP TABLE IF EXISTS test_joined_view_00740;
@ -19,12 +14,10 @@ SELECT * FROM test_nested_view_00740;
SELECT * FROM test_joined_view_00740;
USE default;
SELECT * FROM test_00740.test_view_00740;
SELECT * FROM test_00740.test_nested_view_00740;
SELECT * FROM test_00740.test_joined_view_00740;
SELECT * FROM {CLICKHOUSE_DATABASE:Identifier}.test_view_00740;
SELECT * FROM {CLICKHOUSE_DATABASE:Identifier}.test_nested_view_00740;
SELECT * FROM {CLICKHOUSE_DATABASE:Identifier}.test_joined_view_00740;
DROP TABLE IF EXISTS test_00740.test_00740;
DROP TABLE IF EXISTS test_00740.test_view_00740;
DROP TABLE IF EXISTS test_00740.test_nested_view_00740;
DROP DATABASE test_00740;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.test_00740;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.test_view_00740;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.test_nested_view_00740;

View File

@ -1,4 +1,4 @@
CREATE MATERIALIZED VIEW test_00751.t_mv_00751
CREATE MATERIALIZED VIEW default.t_mv_00751
(
`date` Date,
`platform` Enum8('a' = 0, 'b' = 1),
@ -11,14 +11,14 @@ SELECT
date,
platform,
app
FROM test_00751.t_00751
FROM default.t_00751
WHERE (app = (
SELECT min(app)
FROM test_00751.u_00751
FROM default.u_00751
)) AND (platform = (
SELECT (
SELECT min(platform)
FROM test_00751.v_00751
FROM default.v_00751
)
))
2000-01-01 a a

View File

@ -1,7 +1,3 @@
-- Tags: no-parallel
CREATE DATABASE IF NOT EXISTS test_00751;
USE test_00751;
DROP TABLE IF EXISTS t_00751;
DROP TABLE IF EXISTS t_mv_00751;
@ -25,25 +21,24 @@ CREATE MATERIALIZED VIEW t_mv_00751 ENGINE = MergeTree ORDER BY date
AS SELECT date, platform, app FROM t_00751
WHERE app = (SELECT min(app) from u_00751) AND platform = (SELECT (SELECT min(platform) from v_00751));
SHOW CREATE TABLE test_00751.t_mv_00751 FORMAT TabSeparatedRaw;
SHOW CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.t_mv_00751 FORMAT TabSeparatedRaw;
USE default;
DETACH TABLE test_00751.t_mv_00751;
ATTACH TABLE test_00751.t_mv_00751;
DETACH TABLE {CLICKHOUSE_DATABASE:Identifier}.t_mv_00751;
ATTACH TABLE {CLICKHOUSE_DATABASE:Identifier}.t_mv_00751;
INSERT INTO test_00751.t_00751 VALUES ('2000-01-01', 'a', 'a') ('2000-01-02', 'b', 'b');
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.t_00751 VALUES ('2000-01-01', 'a', 'a') ('2000-01-02', 'b', 'b');
INSERT INTO test_00751.u_00751 VALUES ('a');
INSERT INTO test_00751.v_00751 VALUES ('a');
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.u_00751 VALUES ('a');
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.v_00751 VALUES ('a');
INSERT INTO test_00751.t_00751 VALUES ('2000-01-03', 'a', 'a') ('2000-01-04', 'b', 'b');
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.t_00751 VALUES ('2000-01-03', 'a', 'a') ('2000-01-04', 'b', 'b');
SELECT * FROM test_00751.t_00751 ORDER BY date;
SELECT * FROM test_00751.t_mv_00751 ORDER BY date;
SELECT * FROM {CLICKHOUSE_DATABASE:Identifier}.t_00751 ORDER BY date;
SELECT * FROM {CLICKHOUSE_DATABASE:Identifier}.t_mv_00751 ORDER BY date;
DROP TABLE test_00751.t_00751;
DROP TABLE test_00751.t_mv_00751;
DROP TABLE test_00751.u_00751;
DROP TABLE test_00751.v_00751;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.t_00751;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.t_mv_00751;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.u_00751;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.v_00751;
DROP DATABASE test_00751;

View File

@ -1,8 +1,3 @@
-- Tags: no-parallel
CREATE DATABASE IF NOT EXISTS test_00800;
USE test_00800;
DROP TABLE IF EXISTS join_any_inner;
DROP TABLE IF EXISTS join_any_left;
@ -54,24 +49,22 @@ SELECT joinGet('join_string_key', 'x', 'abc'), joinGet('join_string_key', 'k', '
USE default;
DROP TABLE test_00800.join_any_inner;
DROP TABLE test_00800.join_any_left;
DROP TABLE test_00800.join_any_left_null;
DROP TABLE test_00800.join_all_inner;
DROP TABLE test_00800.join_all_left;
DROP TABLE test_00800.join_string_key;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.join_any_inner;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.join_any_left;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.join_any_left_null;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.join_all_inner;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.join_all_left;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.join_string_key;
-- test provided by Alexander Zaitsev
DROP TABLE IF EXISTS test_00800.join_test;
CREATE TABLE test_00800.join_test (a UInt8, b UInt8) Engine = Join(ANY, LEFT, a);
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.join_test;
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.join_test (a UInt8, b UInt8) Engine = Join(ANY, LEFT, a);
USE test_00800;
USE {CLICKHOUSE_DATABASE:Identifier};
select joinGet('join_test', 'b', 1);
USE system;
SELECT joinGet('test_00800.join_test', 'b', 1);
SELECT joinGet({CLICKHOUSE_DATABASE:String} || '.join_test', 'b', 1);
USE default;
DROP TABLE test_00800.join_test;
DROP DATABASE test_00800;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.join_test;

View File

@ -1,7 +1,3 @@
-- Tags: no-parallel
CREATE DATABASE IF NOT EXISTS test_00815;
USE test_00815;
DROP TABLE IF EXISTS fact_cpc_clicks;
DROP TABLE IF EXISTS dim_model;
@ -16,6 +12,6 @@ select f.model_id from fact_cpc_clicks as f left join dim_model as d on f.model_
USE default;
select f.model_id from test_00815.fact_cpc_clicks as f left join test_00815.dim_model as d on f.model_id=d.model_id limit 10;
select f.model_id from {CLICKHOUSE_DATABASE:Identifier}.fact_cpc_clicks as f left join {CLICKHOUSE_DATABASE:Identifier}.dim_model as d on f.model_id=d.model_id limit 10;
DROP DATABASE test_00815;
DROP DATABASE {CLICKHOUSE_DATABASE:Identifier};

View File

@ -1,7 +1,4 @@
-- Tags: global, no-parallel
CREATE DATABASE IF NOT EXISTS test_00857;
USE test_00857;
DROP TABLE IF EXISTS local_table;
DROP TABLE IF EXISTS other_table;
@ -27,7 +24,7 @@ INSERT INTO other_table VALUES(100, 'One Hundred', now(), 1000);
INSERT INTO other_table VALUES(200, 'Two Hundred', now(), 2000);
select t2.name from remote('127.0.0.2', currentDatabase(), 'local_table') as t1
left join test_00857.other_table as t2 -- FIXME: doesn't work properly on remote without explicit database prefix
left join {CLICKHOUSE_DATABASE:Identifier}.other_table as t2 -- FIXME: doesn't work properly on remote without explicit database prefix
on t1.oth_id = t2.id
order by t2.name;
@ -58,4 +55,3 @@ order by other_table.name;
DROP TABLE local_table;
DROP TABLE other_table;
DROP DATABASE test_00857;

View File

@ -1,22 +1,15 @@
-- Tags: no-parallel
DROP DATABASE IF EXISTS test_show_limit;
CREATE DATABASE test_show_limit;
CREATE TABLE test_show_limit.test1 (test UInt8) ENGINE = TinyLog;
CREATE TABLE test_show_limit.test2 (test UInt8) ENGINE = TinyLog;
CREATE TABLE test_show_limit.test3 (test UInt8) ENGINE = TinyLog;
CREATE TABLE test_show_limit.test4 (test UInt8) ENGINE = TinyLog;
CREATE TABLE test_show_limit.test5 (test UInt8) ENGINE = TinyLog;
CREATE TABLE test_show_limit.test6 (test UInt8) ENGINE = TinyLog;
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.test1 (test UInt8) ENGINE = TinyLog;
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.test2 (test UInt8) ENGINE = TinyLog;
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.test3 (test UInt8) ENGINE = TinyLog;
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.test4 (test UInt8) ENGINE = TinyLog;
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.test5 (test UInt8) ENGINE = TinyLog;
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.test6 (test UInt8) ENGINE = TinyLog;
SELECT '*** Should show 6: ***';
SHOW TABLES FROM test_show_limit;
SHOW TABLES FROM {CLICKHOUSE_DATABASE:Identifier};
SELECT '*** Should show 2: ***';
SHOW TABLES FROM test_show_limit LIMIT 2;
SHOW TABLES FROM {CLICKHOUSE_DATABASE:Identifier} LIMIT 2;
SELECT '*** Should show 4: ***';
SHOW TABLES FROM test_show_limit LIMIT 2 * 2;
DROP DATABASE test_show_limit;
SHOW TABLES FROM {CLICKHOUSE_DATABASE:Identifier} LIMIT 2 * 2;

View File

@ -1,4 +1,3 @@
-- Tags: no-parallel
DROP TABLE IF EXISTS table_01;

View File

@ -15,12 +15,12 @@
dict1 Dictionary
dict2 Dictionary
table_for_dict MergeTree
database_for_dict dict1 ComplexKeyCache
database_for_dict dict2 Hashed
default dict1 ComplexKeyCache
default dict2 Hashed
6
6
6
6
6
database_for_dict.dict3 6
default.dict3 6
6

View File

@ -1,13 +1,9 @@
-- Tags: no-parallel, no-fasttest
-- Tags: no-fasttest
SET send_logs_level = 'fatal';
SET check_table_dependencies=0;
DROP DATABASE IF EXISTS database_for_dict;
CREATE DATABASE database_for_dict;
CREATE TABLE database_for_dict.table_for_dict
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.table_for_dict
(
key_column UInt64,
second_column UInt8,
@ -17,9 +13,9 @@ CREATE TABLE database_for_dict.table_for_dict
ENGINE = MergeTree()
ORDER BY key_column;
INSERT INTO database_for_dict.table_for_dict SELECT number, number % 17, toString(number * number), number / 2.0 from numbers(100);
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.table_for_dict SELECT number, number % 17, toString(number * number), number / 2.0 from numbers(100);
CREATE DICTIONARY database_for_dict.dict1
CREATE DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.dict1
(
key_column UInt64 DEFAULT 0,
second_column UInt8 DEFAULT 1,
@ -27,35 +23,35 @@ CREATE DICTIONARY database_for_dict.dict1
fourth_column Float64 DEFAULT 42.0
)
PRIMARY KEY key_column
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict'))
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB currentDatabase()))
LIFETIME(MIN 1 MAX 10)
LAYOUT(FLAT());
SELECT dictGetUInt8('database_for_dict.dict1', 'second_column', toUInt64(11));
SELECT second_column FROM database_for_dict.dict1 WHERE key_column = 11;
SELECT dictGetString('database_for_dict.dict1', 'third_column', toUInt64(12));
SELECT third_column FROM database_for_dict.dict1 WHERE key_column = 12;
SELECT dictGetFloat64('database_for_dict.dict1', 'fourth_column', toUInt64(14));
SELECT fourth_column FROM database_for_dict.dict1 WHERE key_column = 14;
SELECT dictGetUInt8({CLICKHOUSE_DATABASE:String} || '.dict1', 'second_column', toUInt64(11));
SELECT second_column FROM {CLICKHOUSE_DATABASE:Identifier}.dict1 WHERE key_column = 11;
SELECT dictGetString({CLICKHOUSE_DATABASE:String} || '.dict1', 'third_column', toUInt64(12));
SELECT third_column FROM {CLICKHOUSE_DATABASE:Identifier}.dict1 WHERE key_column = 12;
SELECT dictGetFloat64({CLICKHOUSE_DATABASE:String} || '.dict1', 'fourth_column', toUInt64(14));
SELECT fourth_column FROM {CLICKHOUSE_DATABASE:Identifier}.dict1 WHERE key_column = 14;
SELECT count(distinct(dictGetUInt8('database_for_dict.dict1', 'second_column', toUInt64(number)))) from numbers(100);
SELECT count(distinct(dictGetUInt8({CLICKHOUSE_DATABASE:String} || '.dict1', 'second_column', toUInt64(number)))) from numbers(100);
DETACH DICTIONARY database_for_dict.dict1;
DETACH DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.dict1;
SELECT dictGetUInt8('database_for_dict.dict1', 'second_column', toUInt64(11)); -- {serverError 36}
SELECT dictGetUInt8({CLICKHOUSE_DATABASE:String} || '.dict1', 'second_column', toUInt64(11)); -- {serverError 36}
ATTACH DICTIONARY database_for_dict.dict1;
ATTACH DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.dict1;
SELECT dictGetUInt8('database_for_dict.dict1', 'second_column', toUInt64(11));
SELECT dictGetUInt8({CLICKHOUSE_DATABASE:String} || '.dict1', 'second_column', toUInt64(11));
DROP DICTIONARY database_for_dict.dict1;
DROP DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.dict1;
SELECT dictGetUInt8('database_for_dict.dict1', 'second_column', toUInt64(11)); -- {serverError 36}
SELECT dictGetUInt8({CLICKHOUSE_DATABASE:String} || '.dict1', 'second_column', toUInt64(11)); -- {serverError 36}
-- SOURCE(CLICKHOUSE(...)) uses default params if not specified
DROP DICTIONARY IF EXISTS database_for_dict.dict1;
DROP DICTIONARY IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.dict1;
CREATE DICTIONARY database_for_dict.dict1
CREATE DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.dict1
(
key_column UInt64 DEFAULT 0,
second_column UInt8 DEFAULT 1,
@ -63,17 +59,17 @@ CREATE DICTIONARY database_for_dict.dict1
fourth_column Float64 DEFAULT 42.0
)
PRIMARY KEY key_column
SOURCE(CLICKHOUSE(TABLE 'table_for_dict' DB 'database_for_dict'))
SOURCE(CLICKHOUSE(TABLE 'table_for_dict' DB currentDatabase()))
LIFETIME(MIN 1 MAX 10)
LAYOUT(FLAT());
SELECT dictGetUInt8('database_for_dict.dict1', 'second_column', toUInt64(11));
SELECT dictGetUInt8({CLICKHOUSE_DATABASE:String} || '.dict1', 'second_column', toUInt64(11));
SELECT count(distinct(dictGetUInt8('database_for_dict.dict1', 'second_column', toUInt64(number)))) from numbers(100);
SELECT count(distinct(dictGetUInt8({CLICKHOUSE_DATABASE:String} || '.dict1', 'second_column', toUInt64(number)))) from numbers(100);
DROP DICTIONARY database_for_dict.dict1;
DROP DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.dict1;
CREATE DICTIONARY database_for_dict.dict1
CREATE DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.dict1
(
key_column UInt64 DEFAULT 0,
second_column UInt8 DEFAULT 1,
@ -81,69 +77,68 @@ CREATE DICTIONARY database_for_dict.dict1
fourth_column Float64 DEFAULT 42.0
)
PRIMARY KEY key_column, third_column
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB 'database_for_dict'))
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB currentDatabase()))
LIFETIME(MIN 1 MAX 10)
LAYOUT(COMPLEX_KEY_CACHE(SIZE_IN_CELLS 1));
SELECT dictGetUInt8('database_for_dict.dict1', 'second_column', tuple(toUInt64(11), '121'));
SELECT dictGetFloat64('database_for_dict.dict1', 'fourth_column', tuple(toUInt64(14), '196'));
SELECT dictGetUInt8({CLICKHOUSE_DATABASE:String} || '.dict1', 'second_column', tuple(toUInt64(11), '121'));
SELECT dictGetFloat64({CLICKHOUSE_DATABASE:String} || '.dict1', 'fourth_column', tuple(toUInt64(14), '196'));
DETACH DICTIONARY database_for_dict.dict1;
DETACH DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.dict1;
SELECT dictGetUInt8('database_for_dict.dict1', 'second_column', tuple(toUInt64(11), '121')); -- {serverError 36}
SELECT dictGetUInt8({CLICKHOUSE_DATABASE:String} || '.dict1', 'second_column', tuple(toUInt64(11), '121')); -- {serverError 36}
ATTACH DICTIONARY database_for_dict.dict1;
ATTACH DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.dict1;
SELECT dictGetUInt8('database_for_dict.dict1', 'second_column', tuple(toUInt64(11), '121'));
SELECT dictGetUInt8({CLICKHOUSE_DATABASE:String} || '.dict1', 'second_column', tuple(toUInt64(11), '121'));
CREATE DICTIONARY database_for_dict.dict2
CREATE DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.dict2
(
key_column UInt64 DEFAULT 0,
some_column String EXPRESSION toString(fourth_column),
fourth_column Float64 DEFAULT 42.0
)
PRIMARY KEY key_column
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB 'database_for_dict'))
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB currentDatabase()))
LIFETIME(MIN 1 MAX 10)
LAYOUT(HASHED());
SELECT dictGetString('database_for_dict.dict2', 'some_column', toUInt64(12));
SELECT dictGetString({CLICKHOUSE_DATABASE:String} || '.dict2', 'some_column', toUInt64(12));
SELECT name, engine FROM system.tables WHERE database = 'database_for_dict' ORDER BY name;
-- NOTE: database = currentDatabase() is not mandatory
SELECT name, engine FROM system.tables WHERE database = {CLICKHOUSE_DATABASE:String} ORDER BY name;
SELECT database, name, type FROM system.dictionaries WHERE database = 'database_for_dict' ORDER BY name;
SELECT database, name, type FROM system.dictionaries WHERE database = {CLICKHOUSE_DATABASE:String} ORDER BY name;
-- check dictionary will not update
CREATE DICTIONARY database_for_dict.dict3
CREATE DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.dict3
(
key_column UInt64 DEFAULT 0,
some_column String EXPRESSION toString(fourth_column),
fourth_column Float64 DEFAULT 42.0
)
PRIMARY KEY key_column
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB 'database_for_dict'))
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB currentDatabase()))
LIFETIME(0)
LAYOUT(HASHED());
SELECT dictGetString('database_for_dict.dict3', 'some_column', toUInt64(12));
SELECT dictGetString({CLICKHOUSE_DATABASE:String} || '.dict3', 'some_column', toUInt64(12));
-- dictGet with table name
USE database_for_dict;
USE {CLICKHOUSE_DATABASE:Identifier};
SELECT dictGetString(dict3, 'some_column', toUInt64(12));
SELECT dictGetString(database_for_dict.dict3, 'some_column', toUInt64(12));
SELECT dictGetString({CLICKHOUSE_DATABASE:Identifier}.dict3, 'some_column', toUInt64(12));
SELECT dictGetString(default.dict3, 'some_column', toUInt64(12)); -- {serverError 36}
SELECT dictGet(dict3, 'some_column', toUInt64(12));
SELECT dictGet(database_for_dict.dict3, 'some_column', toUInt64(12));
SELECT dictGet({CLICKHOUSE_DATABASE:Identifier}.dict3, 'some_column', toUInt64(12));
SELECT dictGet(default.dict3, 'some_column', toUInt64(12)); -- {serverError 36}
USE default;
-- alias should be handled correctly
SELECT 'database_for_dict.dict3' as n, dictGet(n, 'some_column', toUInt64(12));
SELECT {CLICKHOUSE_DATABASE:String} || '.dict3' as n, dictGet(n, 'some_column', toUInt64(12));
DROP TABLE database_for_dict.table_for_dict;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.table_for_dict;
SYSTEM RELOAD DICTIONARIES; -- {serverError 60}
SELECT dictGetString('database_for_dict.dict3', 'some_column', toUInt64(12));
DROP DATABASE IF EXISTS database_for_dict;
SELECT dictGetString({CLICKHOUSE_DATABASE:String} || '.dict3', 'some_column', toUInt64(12));

View File

@ -1,14 +1,10 @@
-- Tags: no-parallel, no-fasttest
-- Tags: no-fasttest
SET send_logs_level = 'fatal';
DROP DATABASE IF EXISTS database_for_dict;
CREATE DATABASE database_for_dict;
SELECT '***date dict***';
CREATE TABLE database_for_dict.date_table
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.date_table
(
CountryID UInt64,
StartDate Date,
@ -18,11 +14,11 @@ CREATE TABLE database_for_dict.date_table
ENGINE = MergeTree()
ORDER BY CountryID;
INSERT INTO database_for_dict.date_table VALUES(1, toDate('2019-05-05'), toDate('2019-05-20'), 0.33);
INSERT INTO database_for_dict.date_table VALUES(1, toDate('2019-05-21'), toDate('2019-05-30'), 0.42);
INSERT INTO database_for_dict.date_table VALUES(2, toDate('2019-05-21'), toDate('2019-05-30'), 0.46);
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.date_table VALUES(1, toDate('2019-05-05'), toDate('2019-05-20'), 0.33);
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.date_table VALUES(1, toDate('2019-05-21'), toDate('2019-05-30'), 0.42);
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.date_table VALUES(2, toDate('2019-05-21'), toDate('2019-05-30'), 0.46);
CREATE DICTIONARY database_for_dict.dict1
CREATE DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.dict1
(
CountryID UInt64,
StartDate Date,
@ -30,19 +26,19 @@ CREATE DICTIONARY database_for_dict.dict1
Tax Float64
)
PRIMARY KEY CountryID
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'date_table' DB 'database_for_dict'))
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'date_table' DB currentDatabase()))
LIFETIME(MIN 1 MAX 1000)
LAYOUT(RANGE_HASHED())
RANGE(MIN StartDate MAX EndDate);
SELECT dictGetFloat64('database_for_dict.dict1', 'Tax', toUInt64(1), toDate('2019-05-15'));
SELECT dictGetFloat64('database_for_dict.dict1', 'Tax', toUInt64(1), toDate('2019-05-29'));
SELECT dictGetFloat64('database_for_dict.dict1', 'Tax', toUInt64(2), toDate('2019-05-29'));
SELECT dictGetFloat64('database_for_dict.dict1', 'Tax', toUInt64(2), toDate('2019-05-31'));
SELECT dictGetFloat64({CLICKHOUSE_DATABASE:String} || '.dict1', 'Tax', toUInt64(1), toDate('2019-05-15'));
SELECT dictGetFloat64({CLICKHOUSE_DATABASE:String} || '.dict1', 'Tax', toUInt64(1), toDate('2019-05-29'));
SELECT dictGetFloat64({CLICKHOUSE_DATABASE:String} || '.dict1', 'Tax', toUInt64(2), toDate('2019-05-29'));
SELECT dictGetFloat64({CLICKHOUSE_DATABASE:String} || '.dict1', 'Tax', toUInt64(2), toDate('2019-05-31'));
SELECT '***datetime dict***';
CREATE TABLE database_for_dict.datetime_table
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.datetime_table
(
CountryID UInt64,
StartDate DateTime,
@ -52,11 +48,11 @@ CREATE TABLE database_for_dict.datetime_table
ENGINE = MergeTree()
ORDER BY CountryID;
INSERT INTO database_for_dict.datetime_table VALUES(1, toDateTime('2019-05-05 00:00:00'), toDateTime('2019-05-20 00:00:00'), 0.33);
INSERT INTO database_for_dict.datetime_table VALUES(1, toDateTime('2019-05-21 00:00:00'), toDateTime('2019-05-30 00:00:00'), 0.42);
INSERT INTO database_for_dict.datetime_table VALUES(2, toDateTime('2019-05-21 00:00:00'), toDateTime('2019-05-30 00:00:00'), 0.46);
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.datetime_table VALUES(1, toDateTime('2019-05-05 00:00:00'), toDateTime('2019-05-20 00:00:00'), 0.33);
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.datetime_table VALUES(1, toDateTime('2019-05-21 00:00:00'), toDateTime('2019-05-30 00:00:00'), 0.42);
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.datetime_table VALUES(2, toDateTime('2019-05-21 00:00:00'), toDateTime('2019-05-30 00:00:00'), 0.46);
CREATE DICTIONARY database_for_dict.dict2
CREATE DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.dict2
(
CountryID UInt64,
StartDate DateTime,
@ -64,19 +60,19 @@ CREATE DICTIONARY database_for_dict.dict2
Tax Float64
)
PRIMARY KEY CountryID
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'datetime_table' DB 'database_for_dict'))
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'datetime_table' DB currentDatabase()))
LIFETIME(MIN 1 MAX 1000)
LAYOUT(RANGE_HASHED())
RANGE(MIN StartDate MAX EndDate);
SELECT dictGetFloat64('database_for_dict.dict2', 'Tax', toUInt64(1), toDateTime('2019-05-15 00:00:00'));
SELECT dictGetFloat64('database_for_dict.dict2', 'Tax', toUInt64(1), toDateTime('2019-05-29 00:00:00'));
SELECT dictGetFloat64('database_for_dict.dict2', 'Tax', toUInt64(2), toDateTime('2019-05-29 00:00:00'));
SELECT dictGetFloat64('database_for_dict.dict2', 'Tax', toUInt64(2), toDateTime('2019-05-31 00:00:00'));
SELECT dictGetFloat64({CLICKHOUSE_DATABASE:String} || '.dict2', 'Tax', toUInt64(1), toDateTime('2019-05-15 00:00:00'));
SELECT dictGetFloat64({CLICKHOUSE_DATABASE:String} || '.dict2', 'Tax', toUInt64(1), toDateTime('2019-05-29 00:00:00'));
SELECT dictGetFloat64({CLICKHOUSE_DATABASE:String} || '.dict2', 'Tax', toUInt64(2), toDateTime('2019-05-29 00:00:00'));
SELECT dictGetFloat64({CLICKHOUSE_DATABASE:String} || '.dict2', 'Tax', toUInt64(2), toDateTime('2019-05-31 00:00:00'));
SELECT '***hierarchy dict***';
CREATE TABLE database_for_dict.table_with_hierarchy
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.table_with_hierarchy
(
RegionID UInt64,
ParentRegionID UInt64,
@ -85,24 +81,24 @@ CREATE TABLE database_for_dict.table_with_hierarchy
ENGINE = MergeTree()
ORDER BY RegionID;
INSERT INTO database_for_dict.table_with_hierarchy VALUES (3, 2, 'Hamovniki'), (2, 1, 'Moscow'), (1, 10000, 'Russia') (7, 10000, 'Ulan-Ude');
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.table_with_hierarchy VALUES (3, 2, 'Hamovniki'), (2, 1, 'Moscow'), (1, 10000, 'Russia') (7, 10000, 'Ulan-Ude');
CREATE DICTIONARY database_for_dict.dictionary_with_hierarchy
CREATE DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.dictionary_with_hierarchy
(
RegionID UInt64,
ParentRegionID UInt64 HIERARCHICAL,
RegionName String
)
PRIMARY KEY RegionID
SOURCE(CLICKHOUSE(host 'localhost' port tcpPort() user 'default' db 'database_for_dict' table 'table_with_hierarchy'))
SOURCE(CLICKHOUSE(host 'localhost' port tcpPort() user 'default' db currentDatabase() table 'table_with_hierarchy'))
LAYOUT(HASHED())
LIFETIME(MIN 1 MAX 1000);
SELECT dictGetString('database_for_dict.dictionary_with_hierarchy', 'RegionName', toUInt64(2));
SELECT dictGetHierarchy('database_for_dict.dictionary_with_hierarchy', toUInt64(3));
SELECT dictIsIn('database_for_dict.dictionary_with_hierarchy', toUInt64(3), toUInt64(2));
SELECT dictIsIn('database_for_dict.dictionary_with_hierarchy', toUInt64(7), toUInt64(10000));
SELECT dictIsIn('database_for_dict.dictionary_with_hierarchy', toUInt64(1), toUInt64(5));
SELECT dictGetString({CLICKHOUSE_DATABASE:String} || '.dictionary_with_hierarchy', 'RegionName', toUInt64(2));
SELECT dictGetHierarchy({CLICKHOUSE_DATABASE:String} || '.dictionary_with_hierarchy', toUInt64(3));
SELECT dictIsIn({CLICKHOUSE_DATABASE:String} || '.dictionary_with_hierarchy', toUInt64(3), toUInt64(2));
SELECT dictIsIn({CLICKHOUSE_DATABASE:String} || '.dictionary_with_hierarchy', toUInt64(7), toUInt64(10000));
SELECT dictIsIn({CLICKHOUSE_DATABASE:String} || '.dictionary_with_hierarchy', toUInt64(1), toUInt64(5));
DROP DATABASE IF EXISTS database_for_dict;
DROP DATABASE IF EXISTS {CLICKHOUSE_DATABASE:Identifier};

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
-- Tags: no-parallel
CREATE TABLE test
(

View File

@ -1,12 +1,7 @@
-- Tags: no-parallel
SET send_logs_level = 'fatal';
DROP DATABASE IF EXISTS database_for_dict;
CREATE DATABASE database_for_dict;
CREATE TABLE database_for_dict.table_for_dict
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.table_for_dict
(
key_column UInt64,
second_column UInt8,
@ -15,34 +10,34 @@ CREATE TABLE database_for_dict.table_for_dict
ENGINE = MergeTree()
ORDER BY key_column;
INSERT INTO database_for_dict.table_for_dict VALUES (1, 100, 'Hello world');
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.table_for_dict VALUES (1, 100, 'Hello world');
DROP DATABASE IF EXISTS ordinary_db;
DROP DATABASE IF EXISTS {CLICKHOUSE_DATABASE_1:Identifier};
CREATE DATABASE ordinary_db;
CREATE DATABASE {CLICKHOUSE_DATABASE_1:Identifier};
CREATE DICTIONARY ordinary_db.dict1
CREATE DICTIONARY {CLICKHOUSE_DATABASE_1:Identifier}.dict1
(
key_column UInt64 DEFAULT 0,
second_column UInt8 DEFAULT 1,
third_column String DEFAULT 'qqq'
)
PRIMARY KEY key_column
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict'))
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB currentDatabase()))
LIFETIME(MIN 1 MAX 10)
LAYOUT(FLAT());
SELECT 'INITIALIZING DICTIONARY';
SELECT dictGetUInt8('ordinary_db.dict1', 'second_column', toUInt64(100500));
SELECT dictGetUInt8({CLICKHOUSE_DATABASE_1:String}||'.dict1', 'second_column', toUInt64(100500));
SELECT lifetime_min, lifetime_max FROM system.dictionaries WHERE database='ordinary_db' AND name = 'dict1';
SELECT lifetime_min, lifetime_max FROM system.dictionaries WHERE database={CLICKHOUSE_DATABASE_1:String} AND name = 'dict1';
DROP DICTIONARY IF EXISTS ordinary_db.dict1;
DROP DICTIONARY IF EXISTS {CLICKHOUSE_DATABASE_1:Identifier}.dict1;
DROP DATABASE IF EXISTS ordinary_db;
DROP DATABASE IF EXISTS {CLICKHOUSE_DATABASE_1:Identifier};
DROP TABLE IF EXISTS database_for_dict.table_for_dict;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.table_for_dict;
DROP DATABASE IF EXISTS database_for_dict;
DROP DATABASE IF EXISTS {CLICKHOUSE_DATABASE:Identifier};

View File

@ -1,10 +1,5 @@
-- Tags: no-parallel
DROP DATABASE IF EXISTS dictdb;
CREATE DATABASE dictdb;
CREATE TABLE dictdb.table_for_dict
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.table_for_dict
(
key_column UInt64,
value Float64
@ -12,33 +7,32 @@ CREATE TABLE dictdb.table_for_dict
ENGINE = MergeTree()
ORDER BY key_column;
INSERT INTO dictdb.table_for_dict VALUES (1, 1.1);
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.table_for_dict VALUES (1, 1.1);
CREATE DICTIONARY IF NOT EXISTS dictdb.dict_exists
CREATE DICTIONARY IF NOT EXISTS {CLICKHOUSE_DATABASE:Identifier}.dict_exists
(
key_column UInt64,
value Float64 DEFAULT 77.77
)
PRIMARY KEY key_column
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB 'dictdb'))
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB currentDatabase()))
LIFETIME(1)
LAYOUT(FLAT());
SELECT dictGetFloat64('dictdb.dict_exists', 'value', toUInt64(1));
SELECT dictGetFloat64({CLICKHOUSE_DATABASE:String} || '.dict_exists', 'value', toUInt64(1));
CREATE DICTIONARY IF NOT EXISTS dictdb.dict_exists
CREATE DICTIONARY IF NOT EXISTS {CLICKHOUSE_DATABASE:Identifier}.dict_exists
(
key_column UInt64,
value Float64 DEFAULT 77.77
)
PRIMARY KEY key_column
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB 'dictdb'))
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB currentDatabase()))
LIFETIME(1)
LAYOUT(FLAT());
SELECT dictGetFloat64('dictdb.dict_exists', 'value', toUInt64(1));
SELECT dictGetFloat64({CLICKHOUSE_DATABASE:String} || '.dict_exists', 'value', toUInt64(1));
DROP DICTIONARY dictdb.dict_exists;
DROP TABLE dictdb.table_for_dict;
DROP DATABASE dictdb;
DROP DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.dict_exists;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.table_for_dict;

View File

@ -1,13 +1,9 @@
-- Tags: no-parallel
DROP DATABASE IF EXISTS dictdb_01043;
CREATE DATABASE dictdb_01043;
CREATE TABLE dictdb_01043.dicttbl(key Int64, value_default String, value_expression String) ENGINE = MergeTree ORDER BY tuple();
INSERT INTO dictdb_01043.dicttbl VALUES (12, 'hello', '55:66:77');
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.dicttbl(key Int64, value_default String, value_expression String) ENGINE = MergeTree ORDER BY tuple();
INSERT INTO {CLICKHOUSE_DATABASE:Identifier}.dicttbl VALUES (12, 'hello', '55:66:77');
CREATE DICTIONARY dictdb_01043.dict
CREATE DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.dict
(
key Int64 DEFAULT -1,
value_default String DEFAULT 'world',
@ -15,15 +11,13 @@ CREATE DICTIONARY dictdb_01043.dict
)
PRIMARY KEY key
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'dicttbl' DB 'dictdb_01043'))
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'dicttbl' DB currentDatabase()))
LAYOUT(FLAT())
LIFETIME(1);
SELECT dictGetString('dictdb_01043.dict', 'value_default', toUInt64(12));
SELECT dictGetString('dictdb_01043.dict', 'value_default', toUInt64(14));
SELECT dictGetString({CLICKHOUSE_DATABASE:String} || '.dict', 'value_default', toUInt64(12));
SELECT dictGetString({CLICKHOUSE_DATABASE:String} || '.dict', 'value_default', toUInt64(14));
SELECT dictGetString('dictdb_01043.dict', 'value_expression', toUInt64(12));
SELECT dictGetString('dictdb_01043.dict', 'value_expression', toUInt64(14));
DROP DATABASE IF EXISTS dictdb_01043;
SELECT dictGetString({CLICKHOUSE_DATABASE:String} || '.dict', 'value_expression', toUInt64(12));
SELECT dictGetString({CLICKHOUSE_DATABASE:String} || '.dict', 'value_expression', toUInt64(14));

View File

@ -1,10 +1,5 @@
-- Tags: no-parallel
DROP DATABASE IF EXISTS dictdb_01045;
CREATE DATABASE dictdb_01045;
CREATE DICTIONARY dictdb_01045.restricted_dict (
CREATE DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.restricted_dict (
key UInt64,
value String
)
@ -14,10 +9,9 @@ LIFETIME(MIN 0 MAX 1)
LAYOUT(CACHE(SIZE_IN_CELLS 10));
-- because of lazy load we can check only in dictGet query
select dictGetString('dictdb_01045.restricted_dict', 'value', toUInt64(1)); -- {serverError 482}
select dictGetString({CLICKHOUSE_DATABASE:String} || '.restricted_dict', 'value', toUInt64(1)); -- {serverError 482}
select 'Ok.';
DROP DICTIONARY IF EXISTS dictdb_01045.restricted_dict;
DROP DICTIONARY IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.restricted_dict;
DROP DATABASE IF EXISTS dictdb_01045;

View File

@ -1,32 +1,32 @@
---TUMBLE---
||---WINDOW COLUMN NAME---
CREATE TABLE test_01047.`.inner.wv`\n(\n `windowID(timestamp, toIntervalSecond(\'1\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY `windowID(timestamp, toIntervalSecond(\'1\'))`\nSETTINGS index_granularity = 8192
CREATE TABLE default.`.inner.wv`\n(\n `windowID(timestamp, toIntervalSecond(\'1\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY `windowID(timestamp, toIntervalSecond(\'1\'))`\nSETTINGS index_granularity = 8192
||---WINDOW COLUMN ALIAS---
CREATE TABLE test_01047.`.inner.wv`\n(\n `windowID(timestamp, toIntervalSecond(\'1\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY `windowID(timestamp, toIntervalSecond(\'1\'))`\nSETTINGS index_granularity = 8192
CREATE TABLE default.`.inner.wv`\n(\n `windowID(timestamp, toIntervalSecond(\'1\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY `windowID(timestamp, toIntervalSecond(\'1\'))`\nSETTINGS index_granularity = 8192
||---DATA COLUMN ALIAS---
CREATE TABLE test_01047.`.inner.wv`\n(\n `b` Int32,\n `windowID(timestamp, toIntervalSecond(\'1\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY b\nSETTINGS index_granularity = 8192
CREATE TABLE default.`.inner.wv`\n(\n `b` Int32,\n `windowID(timestamp, toIntervalSecond(\'1\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY b\nSETTINGS index_granularity = 8192
||---IDENTIFIER---
CREATE TABLE test_01047.`.inner.wv`\n(\n `b` Int32,\n `windowID(timestamp, toIntervalSecond(\'1\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nPRIMARY KEY `windowID(timestamp, toIntervalSecond(\'1\'))`\nORDER BY (`windowID(timestamp, toIntervalSecond(\'1\'))`, b)\nSETTINGS index_granularity = 8192
CREATE TABLE default.`.inner.wv`\n(\n `b` Int32,\n `windowID(timestamp, toIntervalSecond(\'1\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nPRIMARY KEY `windowID(timestamp, toIntervalSecond(\'1\'))`\nORDER BY (`windowID(timestamp, toIntervalSecond(\'1\'))`, b)\nSETTINGS index_granularity = 8192
||---FUNCTION---
CREATE TABLE test_01047.`.inner.wv`\n(\n `plus(a, b)` Int64,\n `windowID(timestamp, toIntervalSecond(\'1\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nPRIMARY KEY `windowID(timestamp, toIntervalSecond(\'1\'))`\nORDER BY (`windowID(timestamp, toIntervalSecond(\'1\'))`, `plus(a, b)`)\nSETTINGS index_granularity = 8192
CREATE TABLE default.`.inner.wv`\n(\n `plus(a, b)` Int64,\n `windowID(timestamp, toIntervalSecond(\'1\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nPRIMARY KEY `windowID(timestamp, toIntervalSecond(\'1\'))`\nORDER BY (`windowID(timestamp, toIntervalSecond(\'1\'))`, `plus(a, b)`)\nSETTINGS index_granularity = 8192
||---PARTITION---
CREATE TABLE test_01047.`.inner.wv`\n(\n `count(a)` AggregateFunction(count, Int32),\n `windowID(____timestamp, toIntervalSecond(\'1\'))` UInt32\n)\nENGINE = AggregatingMergeTree\nPARTITION BY `windowID(____timestamp, toIntervalSecond(\'1\'))`\nORDER BY `windowID(____timestamp, toIntervalSecond(\'1\'))`\nSETTINGS index_granularity = 8192
CREATE TABLE default.`.inner.wv`\n(\n `count(a)` AggregateFunction(count, Int32),\n `windowID(____timestamp, toIntervalSecond(\'1\'))` UInt32\n)\nENGINE = AggregatingMergeTree\nPARTITION BY `windowID(____timestamp, toIntervalSecond(\'1\'))`\nORDER BY `windowID(____timestamp, toIntervalSecond(\'1\'))`\nSETTINGS index_granularity = 8192
||---JOIN---
CREATE TABLE test_01047.`.inner.wv`\n(\n `windowID(timestamp, toIntervalSecond(\'1\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32),\n `count(mt_2.b)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY `windowID(timestamp, toIntervalSecond(\'1\'))`\nSETTINGS index_granularity = 8192
CREATE TABLE test_01047.`.inner.wv`\n(\n `windowID(timestamp, toIntervalSecond(\'1\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32),\n `count(mt_2.b)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY `windowID(timestamp, toIntervalSecond(\'1\'))`\nSETTINGS index_granularity = 8192
CREATE TABLE default.`.inner.wv`\n(\n `windowID(timestamp, toIntervalSecond(\'1\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32),\n `count(mt_2.b)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY `windowID(timestamp, toIntervalSecond(\'1\'))`\nSETTINGS index_granularity = 8192
CREATE TABLE default.`.inner.wv`\n(\n `windowID(timestamp, toIntervalSecond(\'1\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32),\n `count(mt_2.b)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY `windowID(timestamp, toIntervalSecond(\'1\'))`\nSETTINGS index_granularity = 8192
---HOP---
||---WINDOW COLUMN NAME---
CREATE TABLE test_01047.`.inner.wv`\n(\n `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`\nSETTINGS index_granularity = 8192
CREATE TABLE default.`.inner.wv`\n(\n `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`\nSETTINGS index_granularity = 8192
||---WINDOW COLUMN ALIAS---
CREATE TABLE test_01047.`.inner.wv`\n(\n `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`\nSETTINGS index_granularity = 8192
CREATE TABLE default.`.inner.wv`\n(\n `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`\nSETTINGS index_granularity = 8192
||---DATA COLUMN ALIAS---
CREATE TABLE test_01047.`.inner.wv`\n(\n `b` Int32,\n `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY b\nSETTINGS index_granularity = 8192
CREATE TABLE default.`.inner.wv`\n(\n `b` Int32,\n `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY b\nSETTINGS index_granularity = 8192
||---IDENTIFIER---
CREATE TABLE test_01047.`.inner.wv`\n(\n `b` Int32,\n `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nPRIMARY KEY `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`\nORDER BY (`windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`, b)\nSETTINGS index_granularity = 8192
CREATE TABLE default.`.inner.wv`\n(\n `b` Int32,\n `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nPRIMARY KEY `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`\nORDER BY (`windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`, b)\nSETTINGS index_granularity = 8192
||---FUNCTION---
CREATE TABLE test_01047.`.inner.wv`\n(\n `plus(a, b)` Int64,\n `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nPRIMARY KEY `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`\nORDER BY (`windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`, `plus(a, b)`)\nSETTINGS index_granularity = 8192
CREATE TABLE default.`.inner.wv`\n(\n `plus(a, b)` Int64,\n `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nPRIMARY KEY `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`\nORDER BY (`windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`, `plus(a, b)`)\nSETTINGS index_granularity = 8192
||---PARTITION---
CREATE TABLE test_01047.`.inner.wv`\n(\n `count(a)` AggregateFunction(count, Int32),\n `windowID(____timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))` UInt32\n)\nENGINE = AggregatingMergeTree\nPARTITION BY `windowID(____timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`\nORDER BY `windowID(____timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`\nSETTINGS index_granularity = 8192
CREATE TABLE default.`.inner.wv`\n(\n `count(a)` AggregateFunction(count, Int32),\n `windowID(____timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))` UInt32\n)\nENGINE = AggregatingMergeTree\nPARTITION BY `windowID(____timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`\nORDER BY `windowID(____timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`\nSETTINGS index_granularity = 8192
||---JOIN---
CREATE TABLE test_01047.`.inner.wv`\n(\n `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32),\n `count(mt_2.b)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`\nSETTINGS index_granularity = 8192
CREATE TABLE test_01047.`.inner.wv`\n(\n `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32),\n `count(mt_2.b)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`\nSETTINGS index_granularity = 8192
CREATE TABLE default.`.inner.wv`\n(\n `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32),\n `count(mt_2.b)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`\nSETTINGS index_granularity = 8192
CREATE TABLE default.`.inner.wv`\n(\n `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))` UInt32,\n `count(a)` AggregateFunction(count, Int32),\n `count(mt_2.b)` AggregateFunction(count, Int32)\n)\nENGINE = AggregatingMergeTree\nORDER BY `windowID(timestamp, toIntervalSecond(\'1\'), toIntervalSecond(\'3\'))`\nSETTINGS index_granularity = 8192

View File

@ -1,110 +1,109 @@
-- Tags: no-parallel
SET allow_experimental_analyzer = 0;
SET allow_experimental_window_view = 1;
DROP DATABASE IF EXISTS test_01047;
DROP DATABASE IF EXISTS {CLICKHOUSE_DATABASE:Identifier};
set allow_deprecated_database_ordinary=1;
CREATE DATABASE test_01047 ENGINE=Ordinary;
CREATE DATABASE {CLICKHOUSE_DATABASE:Identifier} ENGINE=Ordinary;
DROP TABLE IF EXISTS test_01047.mt;
DROP TABLE IF EXISTS test_01047.mt_2;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.mt;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.mt_2;
CREATE TABLE test_01047.mt(a Int32, b Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();
CREATE TABLE test_01047.mt_2(a Int32, b Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.mt(a Int32, b Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.mt_2(a Int32, b Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();
SELECT '---TUMBLE---';
SELECT '||---WINDOW COLUMN NAME---';
DROP TABLE IF EXISTS test_01047.wv;
DROP TABLE IF EXISTS test_01047.`.inner.wv`;
CREATE WINDOW VIEW test_01047.wv INNER ENGINE AggregatingMergeTree ORDER BY tumble(timestamp, INTERVAL '1' SECOND) ENGINE Memory AS SELECT count(a), tumbleEnd(wid) AS count FROM test_01047.mt GROUP BY tumble(timestamp, INTERVAL '1' SECOND) as wid;
SHOW CREATE TABLE test_01047.`.inner.wv`;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv INNER ENGINE AggregatingMergeTree ORDER BY tumble(timestamp, INTERVAL '1' SECOND) ENGINE Memory AS SELECT count(a), tumbleEnd(wid) AS count FROM {CLICKHOUSE_DATABASE:Identifier}.mt GROUP BY tumble(timestamp, INTERVAL '1' SECOND) as wid;
SHOW CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
SELECT '||---WINDOW COLUMN ALIAS---';
DROP TABLE IF EXISTS test_01047.wv;
DROP TABLE IF EXISTS test_01047.`.inner.wv`;
CREATE WINDOW VIEW test_01047.wv INNER ENGINE AggregatingMergeTree ORDER BY wid ENGINE Memory AS SELECT count(a) AS count, tumble(timestamp, INTERVAL '1' SECOND) AS wid FROM test_01047.mt GROUP BY wid;
SHOW CREATE TABLE test_01047.`.inner.wv`;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv INNER ENGINE AggregatingMergeTree ORDER BY wid ENGINE Memory AS SELECT count(a) AS count, tumble(timestamp, INTERVAL '1' SECOND) AS wid FROM {CLICKHOUSE_DATABASE:Identifier}.mt GROUP BY wid;
SHOW CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
SELECT '||---DATA COLUMN ALIAS---';
DROP TABLE IF EXISTS test_01047.wv;
DROP TABLE IF EXISTS test_01047.`.inner.wv`;
CREATE WINDOW VIEW test_01047.wv INNER ENGINE AggregatingMergeTree ORDER BY id ENGINE Memory AS SELECT count(a) AS count, b as id FROM test_01047.mt GROUP BY id, tumble(timestamp, INTERVAL '1' SECOND);
SHOW CREATE TABLE test_01047.`.inner.wv`;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv INNER ENGINE AggregatingMergeTree ORDER BY id ENGINE Memory AS SELECT count(a) AS count, b as id FROM {CLICKHOUSE_DATABASE:Identifier}.mt GROUP BY id, tumble(timestamp, INTERVAL '1' SECOND);
SHOW CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
SELECT '||---IDENTIFIER---';
DROP TABLE IF EXISTS test_01047.wv;
DROP TABLE IF EXISTS test_01047.`.inner.wv`;
CREATE WINDOW VIEW test_01047.wv INNER ENGINE AggregatingMergeTree ORDER BY (tumble(timestamp, INTERVAL '1' SECOND), b) PRIMARY KEY tumble(timestamp, INTERVAL '1' SECOND) ENGINE Memory AS SELECT count(a) AS count FROM test_01047.mt GROUP BY b, tumble(timestamp, INTERVAL '1' SECOND) AS wid;
SHOW CREATE TABLE test_01047.`.inner.wv`;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv INNER ENGINE AggregatingMergeTree ORDER BY (tumble(timestamp, INTERVAL '1' SECOND), b) PRIMARY KEY tumble(timestamp, INTERVAL '1' SECOND) ENGINE Memory AS SELECT count(a) AS count FROM {CLICKHOUSE_DATABASE:Identifier}.mt GROUP BY b, tumble(timestamp, INTERVAL '1' SECOND) AS wid;
SHOW CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
SELECT '||---FUNCTION---';
DROP TABLE IF EXISTS test_01047.wv;
DROP TABLE IF EXISTS test_01047.`.inner.wv`;
CREATE WINDOW VIEW test_01047.wv INNER ENGINE AggregatingMergeTree ORDER BY (tumble(timestamp, INTERVAL '1' SECOND), plus(a, b)) PRIMARY KEY tumble(timestamp, INTERVAL '1' SECOND) ENGINE Memory AS SELECT count(a) AS count FROM test_01047.mt GROUP BY plus(a, b) as _type, tumble(timestamp, INTERVAL '1' SECOND) AS wid;
SHOW CREATE TABLE test_01047.`.inner.wv`;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv INNER ENGINE AggregatingMergeTree ORDER BY (tumble(timestamp, INTERVAL '1' SECOND), plus(a, b)) PRIMARY KEY tumble(timestamp, INTERVAL '1' SECOND) ENGINE Memory AS SELECT count(a) AS count FROM {CLICKHOUSE_DATABASE:Identifier}.mt GROUP BY plus(a, b) as _type, tumble(timestamp, INTERVAL '1' SECOND) AS wid;
SHOW CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
SELECT '||---PARTITION---';
DROP TABLE IF EXISTS test_01047.wv;
DROP TABLE IF EXISTS test_01047.`.inner.wv`;
CREATE WINDOW VIEW test_01047.wv INNER ENGINE AggregatingMergeTree ORDER BY wid PARTITION BY wid ENGINE Memory AS SELECT count(a) AS count, tumble(now(), INTERVAL '1' SECOND) AS wid FROM test_01047.mt GROUP BY wid;
SHOW CREATE TABLE test_01047.`.inner.wv`;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv INNER ENGINE AggregatingMergeTree ORDER BY wid PARTITION BY wid ENGINE Memory AS SELECT count(a) AS count, tumble(now(), INTERVAL '1' SECOND) AS wid FROM {CLICKHOUSE_DATABASE:Identifier}.mt GROUP BY wid;
SHOW CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
SELECT '||---JOIN---';
DROP TABLE IF EXISTS test_01047.wv;
CREATE WINDOW VIEW test_01047.wv INNER ENGINE AggregatingMergeTree ORDER BY tumble(test_01047.mt.timestamp, INTERVAL '1' SECOND) ENGINE Memory AS SELECT count(test_01047.mt.a), count(test_01047.mt_2.b), wid FROM test_01047.mt JOIN test_01047.mt_2 ON test_01047.mt.timestamp = test_01047.mt_2.timestamp GROUP BY tumble(test_01047.mt.timestamp, INTERVAL '1' SECOND) AS wid;
SHOW CREATE TABLE test_01047.`.inner.wv`;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv INNER ENGINE AggregatingMergeTree ORDER BY tumble({CLICKHOUSE_DATABASE:Identifier}.mt.timestamp, INTERVAL '1' SECOND) ENGINE Memory AS SELECT count({CLICKHOUSE_DATABASE:Identifier}.mt.a), count({CLICKHOUSE_DATABASE:Identifier}.mt_2.b), wid FROM {CLICKHOUSE_DATABASE:Identifier}.mt JOIN {CLICKHOUSE_DATABASE:Identifier}.mt_2 ON {CLICKHOUSE_DATABASE:Identifier}.mt.timestamp = {CLICKHOUSE_DATABASE:Identifier}.mt_2.timestamp GROUP BY tumble({CLICKHOUSE_DATABASE:Identifier}.mt.timestamp, INTERVAL '1' SECOND) AS wid;
SHOW CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
DROP TABLE IF EXISTS test_01047.wv;
CREATE WINDOW VIEW test_01047.wv INNER ENGINE AggregatingMergeTree ORDER BY wid ENGINE Memory AS SELECT count(test_01047.mt.a), count(test_01047.mt_2.b), wid FROM test_01047.mt JOIN test_01047.mt_2 ON test_01047.mt.timestamp = test_01047.mt_2.timestamp GROUP BY tumble(test_01047.mt.timestamp, INTERVAL '1' SECOND) AS wid;
SHOW CREATE TABLE test_01047.`.inner.wv`;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv INNER ENGINE AggregatingMergeTree ORDER BY wid ENGINE Memory AS SELECT count({CLICKHOUSE_DATABASE:Identifier}.mt.a), count({CLICKHOUSE_DATABASE:Identifier}.mt_2.b), wid FROM {CLICKHOUSE_DATABASE:Identifier}.mt JOIN {CLICKHOUSE_DATABASE:Identifier}.mt_2 ON {CLICKHOUSE_DATABASE:Identifier}.mt.timestamp = {CLICKHOUSE_DATABASE:Identifier}.mt_2.timestamp GROUP BY tumble({CLICKHOUSE_DATABASE:Identifier}.mt.timestamp, INTERVAL '1' SECOND) AS wid;
SHOW CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
SELECT '---HOP---';
SELECT '||---WINDOW COLUMN NAME---';
DROP TABLE IF EXISTS test_01047.wv;
DROP TABLE IF EXISTS test_01047.`.inner.wv`;
CREATE WINDOW VIEW test_01047.wv INNER ENGINE AggregatingMergeTree ORDER BY hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) ENGINE Memory AS SELECT count(a) AS count, hopEnd(wid) FROM test_01047.mt GROUP BY hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) as wid;
SHOW CREATE TABLE test_01047.`.inner.wv`;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv INNER ENGINE AggregatingMergeTree ORDER BY hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) ENGINE Memory AS SELECT count(a) AS count, hopEnd(wid) FROM {CLICKHOUSE_DATABASE:Identifier}.mt GROUP BY hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) as wid;
SHOW CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
SELECT '||---WINDOW COLUMN ALIAS---';
DROP TABLE IF EXISTS test_01047.wv;
DROP TABLE IF EXISTS test_01047.`.inner.wv`;
CREATE WINDOW VIEW test_01047.wv INNER ENGINE AggregatingMergeTree ORDER BY wid ENGINE Memory AS SELECT count(a) AS count, hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid FROM test_01047.mt GROUP BY wid;
SHOW CREATE TABLE test_01047.`.inner.wv`;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv INNER ENGINE AggregatingMergeTree ORDER BY wid ENGINE Memory AS SELECT count(a) AS count, hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid FROM {CLICKHOUSE_DATABASE:Identifier}.mt GROUP BY wid;
SHOW CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
SELECT '||---DATA COLUMN ALIAS---';
DROP TABLE IF EXISTS test_01047.wv;
DROP TABLE IF EXISTS test_01047.`.inner.wv`;
CREATE WINDOW VIEW test_01047.wv INNER ENGINE AggregatingMergeTree ORDER BY id ENGINE Memory AS SELECT count(a) AS count, b as id FROM test_01047.mt GROUP BY id, hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND);
SHOW CREATE TABLE test_01047.`.inner.wv`;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv INNER ENGINE AggregatingMergeTree ORDER BY id ENGINE Memory AS SELECT count(a) AS count, b as id FROM {CLICKHOUSE_DATABASE:Identifier}.mt GROUP BY id, hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND);
SHOW CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
SELECT '||---IDENTIFIER---';
DROP TABLE IF EXISTS test_01047.wv;
DROP TABLE IF EXISTS test_01047.`.inner.wv`;
CREATE WINDOW VIEW test_01047.wv INNER ENGINE AggregatingMergeTree ORDER BY (hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND), b) PRIMARY KEY hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) ENGINE Memory AS SELECT count(a) AS count FROM test_01047.mt GROUP BY b, hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid;
SHOW CREATE TABLE test_01047.`.inner.wv`;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv INNER ENGINE AggregatingMergeTree ORDER BY (hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND), b) PRIMARY KEY hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) ENGINE Memory AS SELECT count(a) AS count FROM {CLICKHOUSE_DATABASE:Identifier}.mt GROUP BY b, hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid;
SHOW CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
SELECT '||---FUNCTION---';
DROP TABLE IF EXISTS test_01047.wv;
DROP TABLE IF EXISTS test_01047.`.inner.wv`;
CREATE WINDOW VIEW test_01047.wv INNER ENGINE AggregatingMergeTree ORDER BY (hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND), plus(a, b)) PRIMARY KEY hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) ENGINE Memory AS SELECT count(a) AS count FROM test_01047.mt GROUP BY plus(a, b) as _type, hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid;
SHOW CREATE TABLE test_01047.`.inner.wv`;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv INNER ENGINE AggregatingMergeTree ORDER BY (hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND), plus(a, b)) PRIMARY KEY hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) ENGINE Memory AS SELECT count(a) AS count FROM {CLICKHOUSE_DATABASE:Identifier}.mt GROUP BY plus(a, b) as _type, hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid;
SHOW CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
SELECT '||---PARTITION---';
DROP TABLE IF EXISTS test_01047.wv;
DROP TABLE IF EXISTS test_01047.`.inner.wv`;
CREATE WINDOW VIEW test_01047.wv INNER ENGINE AggregatingMergeTree ORDER BY wid PARTITION BY wid ENGINE Memory AS SELECT count(a) AS count, hopEnd(wid) FROM test_01047.mt GROUP BY hop(now(), INTERVAL '1' SECOND, INTERVAL '3' SECOND) as wid;
SHOW CREATE TABLE test_01047.`.inner.wv`;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv INNER ENGINE AggregatingMergeTree ORDER BY wid PARTITION BY wid ENGINE Memory AS SELECT count(a) AS count, hopEnd(wid) FROM {CLICKHOUSE_DATABASE:Identifier}.mt GROUP BY hop(now(), INTERVAL '1' SECOND, INTERVAL '3' SECOND) as wid;
SHOW CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
SELECT '||---JOIN---';
DROP TABLE IF EXISTS test_01047.wv;
CREATE WINDOW VIEW test_01047.wv INNER ENGINE AggregatingMergeTree ORDER BY hop(test_01047.mt.timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) ENGINE Memory AS SELECT count(test_01047.mt.a), count(test_01047.mt_2.b), wid FROM test_01047.mt JOIN test_01047.mt_2 ON test_01047.mt.timestamp = test_01047.mt_2.timestamp GROUP BY hop(test_01047.mt.timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid;
SHOW CREATE TABLE test_01047.`.inner.wv`;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv INNER ENGINE AggregatingMergeTree ORDER BY hop({CLICKHOUSE_DATABASE:Identifier}.mt.timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) ENGINE Memory AS SELECT count({CLICKHOUSE_DATABASE:Identifier}.mt.a), count({CLICKHOUSE_DATABASE:Identifier}.mt_2.b), wid FROM {CLICKHOUSE_DATABASE:Identifier}.mt JOIN {CLICKHOUSE_DATABASE:Identifier}.mt_2 ON {CLICKHOUSE_DATABASE:Identifier}.mt.timestamp = {CLICKHOUSE_DATABASE:Identifier}.mt_2.timestamp GROUP BY hop({CLICKHOUSE_DATABASE:Identifier}.mt.timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid;
SHOW CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
DROP TABLE IF EXISTS test_01047.wv;
CREATE WINDOW VIEW test_01047.wv INNER ENGINE AggregatingMergeTree ORDER BY wid ENGINE Memory AS SELECT count(test_01047.mt.a), count(test_01047.mt_2.b), wid FROM test_01047.mt JOIN test_01047.mt_2 ON test_01047.mt.timestamp = test_01047.mt_2.timestamp GROUP BY hop(test_01047.mt.timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid;
SHOW CREATE TABLE test_01047.`.inner.wv`;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv INNER ENGINE AggregatingMergeTree ORDER BY wid ENGINE Memory AS SELECT count({CLICKHOUSE_DATABASE:Identifier}.mt.a), count({CLICKHOUSE_DATABASE:Identifier}.mt_2.b), wid FROM {CLICKHOUSE_DATABASE:Identifier}.mt JOIN {CLICKHOUSE_DATABASE:Identifier}.mt_2 ON {CLICKHOUSE_DATABASE:Identifier}.mt.timestamp = {CLICKHOUSE_DATABASE:Identifier}.mt_2.timestamp GROUP BY hop({CLICKHOUSE_DATABASE:Identifier}.mt.timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid;
SHOW CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.`.inner.wv`;
DROP TABLE test_01047.wv;
DROP TABLE test_01047.mt;
DROP TABLE test_01047.mt_2;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.wv;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.mt;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.mt_2;

View File

@ -1,18 +1,17 @@
-- Tags: no-parallel
drop dictionary if exists default.test_dict_01051_d;
drop table if exists default.test_01051_d;
drop table if exists default.test_view_01051_d;
drop dictionary if exists {CLICKHOUSE_DATABASE:Identifier}.test_dict_01051_d;
drop table if exists {CLICKHOUSE_DATABASE:Identifier}.test_01051_d;
drop table if exists {CLICKHOUSE_DATABASE:Identifier}.test_view_01051_d;
create table default.test_01051_d (key UInt64, value String) engine = MergeTree order by key;
create view default.test_view_01051_d (key UInt64, value String) as select k2 + 1 as key, v2 || '_x' as value from (select key + 2 as k2, value || '_y' as v2 from default.test_01051_d);
create table {CLICKHOUSE_DATABASE:Identifier}.test_01051_d (key UInt64, value String) engine = MergeTree order by key;
create view {CLICKHOUSE_DATABASE:Identifier}.test_view_01051_d (key UInt64, value String) as select k2 + 1 as key, v2 || '_x' as value from (select key + 2 as k2, value || '_y' as v2 from test_01051_d);
insert into default.test_01051_d values (1, 'a');
insert into {CLICKHOUSE_DATABASE:Identifier}.test_01051_d values (1, 'a');
create dictionary default.test_dict_01051_d (key UInt64, value String) primary key key source(clickhouse(host 'localhost' port '9000' user 'default' password '' db 'default' table 'test_view_01051_d')) layout(flat()) lifetime(100500);
create dictionary {CLICKHOUSE_DATABASE:Identifier}.test_dict_01051_d (key UInt64, value String) primary key key source(clickhouse(host 'localhost' port '9000' user 'default' password '' db currentDatabase() table 'test_view_01051_d')) layout(flat()) lifetime(100500);
select dictGet('default.test_dict_01051_d', 'value', toUInt64(4));
select dictGet({CLICKHOUSE_DATABASE:String} || '.test_dict_01051_d', 'value', toUInt64(4));
drop dictionary if exists default.test_dict_01051_d;
drop table if exists default.test_01051_d;
drop table if exists default.test_view_01051_d;
drop dictionary if exists {CLICKHOUSE_DATABASE:Identifier}.test_dict_01051_d;
drop table if exists {CLICKHOUSE_DATABASE:Identifier}.test_01051_d;
drop table if exists {CLICKHOUSE_DATABASE:Identifier}.test_view_01051_d;

View File

@ -1,14 +1,13 @@
-- Tags: no-parallel
DROP DATABASE IF EXISTS some_tests;
DROP DATABASE IF EXISTS {CLICKHOUSE_DATABASE:Identifier};
set allow_deprecated_database_ordinary=1;
CREATE DATABASE some_tests ENGINE=Ordinary; -- Different inner table name with Atomic
CREATE DATABASE {CLICKHOUSE_DATABASE:Identifier} ENGINE=Ordinary; -- Different inner table name with Atomic
set allow_deprecated_syntax_for_merge_tree=1;
create table some_tests.my_table ENGINE = MergeTree(day, (day), 8192) as select today() as day, 'mystring' as str;
show tables from some_tests;
create materialized view some_tests.my_materialized_view ENGINE = MergeTree(day, (day), 8192) as select * from some_tests.my_table;
show tables from some_tests;
select * from some_tests.my_materialized_view;
create table {CLICKHOUSE_DATABASE:Identifier}.my_table ENGINE = MergeTree(day, (day), 8192) as select today() as day, 'mystring' as str;
show tables from {CLICKHOUSE_DATABASE:Identifier};
create materialized view {CLICKHOUSE_DATABASE:Identifier}.my_materialized_view ENGINE = MergeTree(day, (day), 8192) as select * from {CLICKHOUSE_DATABASE:Identifier}.my_table;
show tables from {CLICKHOUSE_DATABASE:Identifier};
select * from {CLICKHOUSE_DATABASE:Identifier}.my_materialized_view;
DROP DATABASE some_tests;
DROP DATABASE {CLICKHOUSE_DATABASE:Identifier};

View File

@ -1,4 +1,3 @@
-- Tags: no-parallel
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
@ -23,9 +22,9 @@ DROP TABLE v;
-- dictionary
DROP DICTIONARY IF EXISTS dict;
DROP DATABASE if exists test_01056_dict_data;
CREATE DATABASE test_01056_dict_data;
CREATE TABLE test_01056_dict_data.dict_data (key Int, value UInt16) Engine=Memory();
DROP DATABASE if exists {CLICKHOUSE_DATABASE_1:Identifier};
CREATE DATABASE {CLICKHOUSE_DATABASE_1:Identifier};
CREATE TABLE {CLICKHOUSE_DATABASE_1:Identifier}.dict_data (key Int, value UInt16) Engine=Memory();
CREATE DICTIONARY dict
(
`key` UInt64,
@ -34,7 +33,7 @@ CREATE DICTIONARY dict
PRIMARY KEY key
SOURCE(CLICKHOUSE(
HOST '127.0.0.1' PORT tcpPort()
TABLE 'dict_data' DB 'test_01056_dict_data' USER 'default' PASSWORD ''))
TABLE 'dict_data' DB concat(currentDatabase(), '_1') USER 'default' PASSWORD ''))
LIFETIME(MIN 0 MAX 0)
LAYOUT(SPARSE_HASHED());
CREATE TABLE t3 AS dict; -- { serverError 80 }
@ -42,9 +41,9 @@ CREATE TABLE t3 AS dict; -- { serverError 80 }
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t3;
DROP DICTIONARY dict;
DROP TABLE test_01056_dict_data.dict_data;
DROP TABLE {CLICKHOUSE_DATABASE_1:Identifier}.dict_data;
DROP DATABASE test_01056_dict_data;
DROP DATABASE {CLICKHOUSE_DATABASE_1:Identifier};
CREATE TABLE t1 (x String) ENGINE = Memory AS SELECT 1;
SELECT x, toTypeName(x) FROM t1;

View File

@ -1,4 +1,3 @@
-- Tags: no-parallel
set allow_deprecated_syntax_for_merge_tree=1;
CREATE TABLE old_syntax_01071_test (date Date, id UInt8) ENGINE = MergeTree(date, id, 8192);

View File

@ -1,4 +1,3 @@
-- Tags: no-parallel
CREATE TABLE aine (a Int) ENGINE = Log;
ATTACH TABLE aine; -- { serverError 57 }

View File

@ -1,11 +1,6 @@
-- Tags: no-parallel
SHOW TABLES NOT LIKE '%';
DROP DATABASE IF EXISTS test_01073;
CREATE DATABASE test_01073;
USE test_01073;
SHOW TABLES;
SELECT '---';
CREATE TABLE test1 (x UInt8) ENGINE = Memory;
@ -22,14 +17,14 @@ SELECT '--';
SHOW TABLES NOT LIKE 'tes%2';
SELECT '---';
SHOW TABLES FROM test_01073;
SHOW TABLES FROM {CLICKHOUSE_DATABASE:Identifier};
SELECT '--';
SHOW TABLES FROM test_01073 LIKE 'tes%';
SHOW TABLES FROM {CLICKHOUSE_DATABASE:Identifier} LIKE 'tes%';
SELECT '--';
SHOW TABLES FROM test_01073 NOT LIKE 'tes%';
SHOW TABLES FROM {CLICKHOUSE_DATABASE:Identifier} NOT LIKE 'tes%';
SELECT '--';
SHOW TABLES FROM test_01073 LIKE 'tes%1';
SHOW TABLES FROM {CLICKHOUSE_DATABASE:Identifier} LIKE 'tes%1';
SELECT '--';
SHOW TABLES FROM test_01073 NOT LIKE 'tes%2';
SHOW TABLES FROM {CLICKHOUSE_DATABASE:Identifier} NOT LIKE 'tes%2';
DROP DATABASE test_01073;
DROP DATABASE {CLICKHOUSE_DATABASE:Identifier};

View File

@ -1,40 +1,33 @@
-- Tags: no-parallel
-- TODO: can't just remove default prefix, it breaks the test!
drop table if exists {CLICKHOUSE_DATABASE:Identifier}.test_table_01080;
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.test_table_01080 (dim_key Int64, dim_id String) ENGINE = MergeTree Order by (dim_key);
insert into {CLICKHOUSE_DATABASE:Identifier}.test_table_01080 values(1,'test1');
drop database if exists db_01080;
create database db_01080;
drop DICTIONARY if exists {CLICKHOUSE_DATABASE:Identifier}.test_dict_01080;
drop table if exists db_01080.test_table_01080;
CREATE TABLE db_01080.test_table_01080 (dim_key Int64, dim_id String) ENGINE = MergeTree Order by (dim_key);
insert into db_01080.test_table_01080 values(1,'test1');
drop DICTIONARY if exists db_01080.test_dict_01080;
CREATE DICTIONARY db_01080.test_dict_01080 ( dim_key Int64, dim_id String )
CREATE DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.test_dict_01080 ( dim_key Int64, dim_id String )
PRIMARY KEY dim_key
source(clickhouse(host 'localhost' port tcpPort() user 'default' password '' db 'db_01080' table 'test_table_01080'))
source(clickhouse(host 'localhost' port tcpPort() user 'default' password '' db currentDatabase() table 'test_table_01080'))
LIFETIME(MIN 0 MAX 0) LAYOUT(complex_key_hashed());
SELECT dictGetString('db_01080.test_dict_01080', 'dim_id', tuple(toInt64(1)));
SELECT dictGetString({CLICKHOUSE_DATABASE:String} || '.test_dict_01080', 'dim_id', tuple(toInt64(1)));
SELECT dictGetString('db_01080.test_dict_01080', 'dim_id', tuple(toInt64(0)));
SELECT dictGetString({CLICKHOUSE_DATABASE:String} || '.test_dict_01080', 'dim_id', tuple(toInt64(0)));
select dictGetString('db_01080.test_dict_01080', 'dim_id', x) from (select tuple(toInt64(0)) as x);
select dictGetString({CLICKHOUSE_DATABASE:String} || '.test_dict_01080', 'dim_id', x) from (select tuple(toInt64(0)) as x);
select dictGetString('db_01080.test_dict_01080', 'dim_id', x) from (select tuple(toInt64(1)) as x);
select dictGetString({CLICKHOUSE_DATABASE:String} || '.test_dict_01080', 'dim_id', x) from (select tuple(toInt64(1)) as x);
select dictGetString('db_01080.test_dict_01080', 'dim_id', x) from (select tuple(toInt64(number)) as x from numbers(5));
select dictGetString({CLICKHOUSE_DATABASE:String} || '.test_dict_01080', 'dim_id', x) from (select tuple(toInt64(number)) as x from numbers(5));
select dictGetString('db_01080.test_dict_01080', 'dim_id', x) from (select tuple(toInt64(rand64()*0)) as x);
select dictGetString({CLICKHOUSE_DATABASE:String} || '.test_dict_01080', 'dim_id', x) from (select tuple(toInt64(rand64()*0)) as x);
select dictGetString('db_01080.test_dict_01080', 'dim_id', x) from (select tuple(toInt64(blockSize()=0)) as x);
select dictGetString({CLICKHOUSE_DATABASE:String} || '.test_dict_01080', 'dim_id', x) from (select tuple(toInt64(blockSize()=0)) as x);
select dictGetString('db_01080.test_dict_01080', 'dim_id', x) from (select tuple(toInt64(materialize(0))) as x);
select dictGetString({CLICKHOUSE_DATABASE:String} || '.test_dict_01080', 'dim_id', x) from (select tuple(toInt64(materialize(0))) as x);
select dictGetString('db_01080.test_dict_01080', 'dim_id', x) from (select tuple(toInt64(materialize(1))) as x);
select dictGetString({CLICKHOUSE_DATABASE:String} || '.test_dict_01080', 'dim_id', x) from (select tuple(toInt64(materialize(1))) as x);
drop DICTIONARY db_01080.test_dict_01080;
drop table db_01080.test_table_01080;
drop database db_01080;
drop DICTIONARY {CLICKHOUSE_DATABASE:Identifier}.test_dict_01080;
drop table {CLICKHOUSE_DATABASE:Identifier}.test_table_01080;

View File

@ -1,10 +1,9 @@
-- Tags: no-parallel
DROP DATABASE IF EXISTS test_01084;
CREATE DATABASE test_01084;
USE test_01084;
DROP DATABASE IF EXISTS {CLICKHOUSE_DATABASE_1:Identifier};
CREATE DATABASE {CLICKHOUSE_DATABASE_1:Identifier};
USE {CLICKHOUSE_DATABASE_1:Identifier};
CREATE TABLE t (x UInt8) ENGINE = Memory;
SELECT * FROM merge('', '');
DROP DATABASE test_01084;
DROP DATABASE {CLICKHOUSE_DATABASE_1:Identifier};

View File

@ -1,30 +1,29 @@
-- Tags: no-parallel
SET allow_experimental_analyzer = 0;
SET allow_experimental_window_view = 1;
DROP DATABASE IF EXISTS test_01085;
DROP DATABASE IF EXISTS {CLICKHOUSE_DATABASE:Identifier};
set allow_deprecated_database_ordinary=1;
CREATE DATABASE test_01085 ENGINE=Ordinary;
CREATE DATABASE {CLICKHOUSE_DATABASE:Identifier} ENGINE=Ordinary;
DROP TABLE IF EXISTS test_01085.mt;
DROP TABLE IF EXISTS test_01085.wv;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.mt;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
CREATE TABLE test_01085.mt(a Int32, market Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();
CREATE WINDOW VIEW test_01085.wv ENGINE Memory WATERMARK=ASCENDING AS SELECT count(a) AS count, market, tumbleEnd(wid) AS w_end FROM test_01085.mt GROUP BY tumble(timestamp, INTERVAL '5' SECOND) AS wid, market;
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.mt(a Int32, market Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv ENGINE Memory WATERMARK=ASCENDING AS SELECT count(a) AS count, market, tumbleEnd(wid) AS w_end FROM {CLICKHOUSE_DATABASE:Identifier}.mt GROUP BY tumble(timestamp, INTERVAL '5' SECOND) AS wid, market;
SHOW tables FROM test_01085;
SHOW tables FROM {CLICKHOUSE_DATABASE:Identifier};
DROP TABLE test_01085.wv SYNC;
SHOW tables FROM test_01085;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.wv SYNC;
SHOW tables FROM {CLICKHOUSE_DATABASE:Identifier};
CREATE WINDOW VIEW test_01085.wv ENGINE Memory WATERMARK=ASCENDING AS SELECT count(a) AS count, market, tumbleEnd(wid) AS w_end FROM test_01085.mt GROUP BY tumble(timestamp, INTERVAL '5' SECOND) AS wid, market;
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv ENGINE Memory WATERMARK=ASCENDING AS SELECT count(a) AS count, market, tumbleEnd(wid) AS w_end FROM {CLICKHOUSE_DATABASE:Identifier}.mt GROUP BY tumble(timestamp, INTERVAL '5' SECOND) AS wid, market;
DETACH TABLE test_01085.wv;
SHOW tables FROM test_01085;
DETACH TABLE {CLICKHOUSE_DATABASE:Identifier}.wv;
SHOW tables FROM {CLICKHOUSE_DATABASE:Identifier};
ATTACH TABLE test_01085.wv;
SHOW tables FROM test_01085;
ATTACH TABLE {CLICKHOUSE_DATABASE:Identifier}.wv;
SHOW tables FROM {CLICKHOUSE_DATABASE:Identifier};
DROP TABLE test_01085.wv SYNC;
SHOW tables FROM test_01085;
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.wv SYNC;
SHOW tables FROM {CLICKHOUSE_DATABASE:Identifier};