mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge pull request #27905 from kitaisreal/dictionary-empty-attribute-list
Dictionary empty attribute list
This commit is contained in:
commit
e146afec79
@ -161,9 +161,6 @@ DictionaryStructure::DictionaryStructure(const Poco::Util::AbstractConfiguration
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attributes.empty())
|
|
||||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Dictionary has no attributes defined");
|
|
||||||
|
|
||||||
if (config.getBool(config_prefix + ".layout.ip_trie.access_to_key_from_attributes", false))
|
if (config.getBool(config_prefix + ".layout.ip_trie.access_to_key_from_attributes", false))
|
||||||
access_to_key_from_attributes = true;
|
access_to_key_from_attributes = true;
|
||||||
}
|
}
|
||||||
|
@ -496,9 +496,6 @@ void checkAST(const ASTCreateQuery & query)
|
|||||||
if (!query.is_dictionary || query.dictionary == nullptr)
|
if (!query.is_dictionary || query.dictionary == nullptr)
|
||||||
throw Exception(ErrorCodes::INCORRECT_DICTIONARY_DEFINITION, "Cannot convert dictionary to configuration from non-dictionary AST.");
|
throw Exception(ErrorCodes::INCORRECT_DICTIONARY_DEFINITION, "Cannot convert dictionary to configuration from non-dictionary AST.");
|
||||||
|
|
||||||
if (query.dictionary_attributes_list == nullptr || query.dictionary_attributes_list->children.empty())
|
|
||||||
throw Exception(ErrorCodes::INCORRECT_DICTIONARY_DEFINITION, "Cannot create dictionary with empty attributes list");
|
|
||||||
|
|
||||||
if (query.dictionary->layout == nullptr)
|
if (query.dictionary->layout == nullptr)
|
||||||
throw Exception(ErrorCodes::INCORRECT_DICTIONARY_DEFINITION, "Cannot create dictionary with empty layout");
|
throw Exception(ErrorCodes::INCORRECT_DICTIONARY_DEFINITION, "Cannot create dictionary with empty layout");
|
||||||
|
|
||||||
@ -512,8 +509,6 @@ void checkAST(const ASTCreateQuery & query)
|
|||||||
|
|
||||||
if (query.dictionary->source == nullptr)
|
if (query.dictionary->source == nullptr)
|
||||||
throw Exception(ErrorCodes::INCORRECT_DICTIONARY_DEFINITION, "Cannot create dictionary with empty source");
|
throw Exception(ErrorCodes::INCORRECT_DICTIONARY_DEFINITION, "Cannot create dictionary with empty source");
|
||||||
|
|
||||||
/// Range can be empty
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkPrimaryKey(const NamesToTypeNames & all_attrs, const Names & key_attrs)
|
void checkPrimaryKey(const NamesToTypeNames & all_attrs, const Names & key_attrs)
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
0
|
||||||
|
1
|
||||||
|
0
|
@ -0,0 +1,12 @@
|
|||||||
|
DROP TABLE IF EXISTS test_table;
|
||||||
|
CREATE TABLE test_table (id UInt64) ENGINE=TinyLog;
|
||||||
|
INSERT INTO test_table VALUES (0);
|
||||||
|
|
||||||
|
DROP DICTIONARY IF EXISTS test_dictionary;
|
||||||
|
CREATE DICTIONARY test_dictionary (id UInt64) PRIMARY KEY id LAYOUT(DIRECT()) SOURCE(CLICKHOUSE(TABLE 'test_table'));
|
||||||
|
SELECT * FROM test_dictionary;
|
||||||
|
SELECT dictHas('test_dictionary', toUInt64(0));
|
||||||
|
SELECT dictHas('test_dictionary', toUInt64(1));
|
||||||
|
|
||||||
|
DROP DICTIONARY test_dictionary;
|
||||||
|
DROP TABLE test_table;
|
Loading…
Reference in New Issue
Block a user