DictionarySource unknown column name in dictionary fix

This commit is contained in:
Maksim Kita 2021-10-27 11:51:47 +03:00
parent 2811a0ae7d
commit 9e5337b5d4

View File

@ -7,6 +7,7 @@ namespace DB
namespace ErrorCodes
{
extern const int LOGICAL_ERROR;
extern const int UNSUPPORTED_METHOD;
}
bool DictionarySourceCoordinator::getKeyColumnsNextRangeToRead(ColumnsWithTypeAndName & key_columns, ColumnsWithTypeAndName & data_columns)
@ -56,7 +57,7 @@ void DictionarySourceCoordinator::initialize(const Names & column_names)
{
column_with_type.type = dictionary_structure.range_max->type;
}
else
else if (dictionary_structure.key.has_value())
{
const auto & dictionary_key_attributes = *dictionary_structure.key;
for (const auto & attribute : dictionary_key_attributes)
@ -68,6 +69,12 @@ void DictionarySourceCoordinator::initialize(const Names & column_names)
}
}
}
else
{
throw Exception(ErrorCodes::UNSUPPORTED_METHOD, "No such column name {} in dictionary {}",
column_name,
dictionary->getDictionaryID().getNameForLogs());
}
}
else
{