Merge pull request #27905 from kitaisreal/dictionary-empty-attribute-list

Dictionary empty attribute list
This commit is contained in:
Ilya Yatsishin 2021-08-20 19:28:06 +03:00 committed by GitHub
commit e146afec79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 8 deletions

View File

@ -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))
access_to_key_from_attributes = true;
}

View File

@ -496,9 +496,6 @@ void checkAST(const ASTCreateQuery & query)
if (!query.is_dictionary || query.dictionary == nullptr)
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)
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)
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)

View File

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