mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 02:21:59 +00:00
Fix segmentation fault in database factory
This commit is contained in:
parent
155731a676
commit
67ea66604f
@ -53,7 +53,10 @@ DatabasePtr DatabaseFactory::get(
|
|||||||
else if (engine_name == "MySQL")
|
else if (engine_name == "MySQL")
|
||||||
{
|
{
|
||||||
const ASTFunction * engine = engine_define->engine;
|
const ASTFunction * engine = engine_define->engine;
|
||||||
const auto & arguments = engine->arguments->children;
|
|
||||||
|
std::vector<ASTPtr> arguments;
|
||||||
|
if (engine->arguments)
|
||||||
|
arguments = engine->arguments->children;
|
||||||
|
|
||||||
if (arguments.size() != 4)
|
if (arguments.size() != 4)
|
||||||
throw Exception("MySQL Database require mysql_hostname, mysql_database_name, mysql_username, mysql_password arguments.",
|
throw Exception("MySQL Database require mysql_hostname, mysql_database_name, mysql_username, mysql_password arguments.",
|
||||||
@ -74,10 +77,13 @@ DatabasePtr DatabaseFactory::get(
|
|||||||
else if (engine_name == "Lazy")
|
else if (engine_name == "Lazy")
|
||||||
{
|
{
|
||||||
const ASTFunction * engine = engine_define->engine;
|
const ASTFunction * engine = engine_define->engine;
|
||||||
const auto & arguments = engine->arguments->children;
|
|
||||||
|
std::vector<ASTPtr> arguments;
|
||||||
|
if (engine->arguments)
|
||||||
|
arguments = engine->arguments->children;
|
||||||
|
|
||||||
if (arguments.size() != 1)
|
if (arguments.size() != 1)
|
||||||
throw Exception("Lazy database require cache_expiration_time_seconds argument.",
|
throw Exception("Lazy database require cache_expiration_time_seconds argument",
|
||||||
ErrorCodes::BAD_ARGUMENTS);
|
ErrorCodes::BAD_ARGUMENTS);
|
||||||
|
|
||||||
const auto cache_expiration_time_seconds = arguments[0]->as<ASTLiteral>()->value.safeGet<UInt64>();
|
const auto cache_expiration_time_seconds = arguments[0]->as<ASTLiteral>()->value.safeGet<UInt64>();
|
||||||
|
@ -23,3 +23,5 @@ dict2
|
|||||||
memory_db dict2
|
memory_db dict2
|
||||||
==DROP DICTIONARY
|
==DROP DICTIONARY
|
||||||
0
|
0
|
||||||
|
=DICTIONARY in Dictionary DB
|
||||||
|
=DICTIONARY in Lazy DB
|
||||||
|
@ -117,6 +117,8 @@ DROP DATABASE IF EXISTS dictionary_db;
|
|||||||
|
|
||||||
CREATE DATABASE dictionary_db ENGINE = Dictionary;
|
CREATE DATABASE dictionary_db ENGINE = Dictionary;
|
||||||
|
|
||||||
|
SELECT '=DICTIONARY in Dictionary DB';
|
||||||
|
|
||||||
CREATE DICTIONARY dictionary_db.dict2
|
CREATE DICTIONARY dictionary_db.dict2
|
||||||
(
|
(
|
||||||
key_column UInt64 DEFAULT 0 INJECTIVE HIERARCHICAL,
|
key_column UInt64 DEFAULT 0 INJECTIVE HIERARCHICAL,
|
||||||
@ -129,3 +131,23 @@ LIFETIME(MIN 1 MAX 10)
|
|||||||
LAYOUT(FLAT()); -- {serverError 1}
|
LAYOUT(FLAT()); -- {serverError 1}
|
||||||
|
|
||||||
DROP DATABASE IF EXISTS dictionary_db;
|
DROP DATABASE IF EXISTS dictionary_db;
|
||||||
|
|
||||||
|
SELECT '=DICTIONARY in Lazy DB';
|
||||||
|
|
||||||
|
DROP DATABASE IF EXISTS lazy_db;
|
||||||
|
|
||||||
|
CREATE DATABASE lazy_db ENGINE = Lazy(1);
|
||||||
|
|
||||||
|
CREATE DICTIONARY lazy_db.dict3
|
||||||
|
(
|
||||||
|
key_column UInt64 DEFAULT 0 INJECTIVE HIERARCHICAL,
|
||||||
|
second_column UInt8 DEFAULT 1 EXPRESSION rand() % 222,
|
||||||
|
third_column String DEFAULT 'qqq'
|
||||||
|
)
|
||||||
|
PRIMARY KEY key_column, second_column
|
||||||
|
SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' PASSWORD ''))
|
||||||
|
LIFETIME(MIN 1 MAX 10)
|
||||||
|
LAYOUT(FLAT()); -- {serverError 1}
|
||||||
|
|
||||||
|
DROP DATABASE IF EXISTS lazy_db;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user