Fix style issues

This commit is contained in:
Maksim Kita 2020-12-29 18:21:49 +03:00 committed by Maksim Kita
parent 8fdbde8642
commit 791c7204d7
19 changed files with 70 additions and 83 deletions

View File

@ -259,7 +259,7 @@ ColumnPtr CacheDictionary::getColumn(
ColumnPtr result;
PaddedPODArray<Key> backup_storage;
const auto& ids = getColumnDataAsPaddedPODArray(this, key_columns.front(), backup_storage);
const auto & ids = getColumnDataAsPaddedPODArray(this, key_columns.front(), backup_storage);
auto & attribute = getAttribute(attribute_name);
@ -315,7 +315,7 @@ ColumnPtr CacheDictionary::getColumn(
else if constexpr (IsNumber<AttributeType>)
column = ColumnVector<AttributeType>::create(identifiers_size);
auto& out = column->getData();
auto & out = column->getData();
if (default_untyped != nullptr)
{

View File

@ -137,7 +137,7 @@ ColumnPtr ComplexKeyCacheDictionary::getColumn(
else if constexpr (IsNumber<AttributeType>)
column = ColumnVector<AttributeType>::create(keys_size);
auto& out = column->getData();
auto & out = column->getData();
if (default_untyped != nullptr)
{

View File

@ -50,7 +50,7 @@ ColumnPtr ComplexKeyDirectDictionary::getColumn(
auto size = key_columns.front()->size();
auto type_call = [&](const auto &dictionary_attribute_type)
auto type_call = [&](const auto & dictionary_attribute_type)
{
using Type = std::decay_t<decltype(dictionary_attribute_type)>;
using AttributeType = typename Type::AttributeType;
@ -126,7 +126,7 @@ ColumnPtr ComplexKeyDirectDictionary::getColumn(
else if constexpr (IsNumber<AttributeType>)
column = ColumnVector<AttributeType>::create(size);
auto& out = column->getData();
auto & out = column->getData();
if (default_untyped != nullptr)
{

View File

@ -112,7 +112,7 @@ ColumnPtr ComplexKeyHashedDictionary::getColumn(
else if constexpr (IsNumber<AttributeType>)
column = ColumnVector<AttributeType>::create(size);
auto& out = column->getData();
auto & out = column->getData();
if (default_untyped != nullptr)
{

View File

@ -138,7 +138,7 @@ ColumnPtr DirectDictionary::getColumn(
ColumnPtr result;
PaddedPODArray<Key> backup_storage;
const auto& ids = getColumnDataAsPaddedPODArray(this, key_columns.front(), backup_storage);
const auto & ids = getColumnDataAsPaddedPODArray(this, key_columns.front(), backup_storage);
const auto & attribute = getAttribute(attribute_name);
@ -223,7 +223,7 @@ ColumnPtr DirectDictionary::getColumn(
else if constexpr (IsNumber<AttributeType>)
column = ColumnVector<AttributeType>::create(size);
auto& out = column->getData();
auto & out = column->getData();
if (default_untyped != nullptr)
{

View File

@ -16,7 +16,6 @@ namespace ErrorCodes
extern const int BAD_ARGUMENTS;
extern const int DICTIONARY_IS_EMPTY;
extern const int UNSUPPORTED_METHOD;
extern const int ILLEGAL_COLUMN;
}
static const auto initial_array_size = 1024;
@ -115,7 +114,7 @@ ColumnPtr FlatDictionary::getColumn(
ColumnPtr result;
PaddedPODArray<Key> backup_storage;
const auto& ids = getColumnDataAsPaddedPODArray(this, key_columns.front(), backup_storage);
const auto & ids = getColumnDataAsPaddedPODArray(this, key_columns.front(), backup_storage);
const auto & attribute = getAttribute(attribute_name);
@ -184,7 +183,7 @@ ColumnPtr FlatDictionary::getColumn(
else if constexpr (IsNumber<AttributeType>)
column = ColumnVector<AttributeType>::create(size);
auto& out = column->getData();
auto & out = column->getData();
if (default_untyped != nullptr)
{

View File

@ -137,14 +137,14 @@ ColumnPtr HashedDictionary::getColumn(
ColumnPtr result;
PaddedPODArray<Key> backup_storage;
const auto& ids = getColumnDataAsPaddedPODArray(this, key_columns.front(), backup_storage);
const auto & ids = getColumnDataAsPaddedPODArray(this, key_columns.front(), backup_storage);
const auto & attribute = getAttribute(attribute_name);
/// TODO: Check that attribute type is same as result type
/// TODO: Check if const will work as expected
auto type_call = [&](const auto &dictionary_attribute_type)
auto type_call = [&](const auto & dictionary_attribute_type)
{
using Type = std::decay_t<decltype(dictionary_attribute_type)>;
using AttributeType = typename Type::AttributeType;
@ -206,7 +206,7 @@ ColumnPtr HashedDictionary::getColumn(
else if constexpr (IsNumber<AttributeType>)
column = ColumnVector<AttributeType>::create(size);
auto& out = column->getData();
auto & out = column->getData();
if (default_untyped != nullptr)
{
@ -713,7 +713,7 @@ PaddedPODArray<HashedDictionary::Key> HashedDictionary::getIds() const
const auto & attribute = attributes.front();
PaddedPODArray<HashedDictionary::Key> result;
auto type_call = [&](const auto &dictionary_attribute_type)
auto type_call = [&](const auto & dictionary_attribute_type)
{
using Type = std::decay_t<decltype(dictionary_attribute_type)>;
using AttributeType = typename Type::AttributeType;

View File

@ -207,8 +207,7 @@ getColumnDataAsPaddedPODArray(const IDictionaryBase * dictionary, const ColumnPt
if (!vector_col)
{
throw Exception{
ErrorCodes::TYPE_MISMATCH,
throw Exception{ErrorCodes::TYPE_MISMATCH,
"{}: type mismatch: column has wrong type expected {}",
dictionary->getDictionaryID().getNameForLogs(),
"" /* TODO: Type name*/};

View File

@ -345,7 +345,7 @@ ColumnPtr IPAddressDictionary::getColumn(
else if constexpr (IsNumber<AttributeType>)
column = ColumnVector<AttributeType>::create(size);
auto& out = column->getData();
auto & out = column->getData();
if (default_untyped != nullptr)
{
@ -840,7 +840,8 @@ void IPAddressDictionary::setAttributeValueImpl(Attribute & attribute, const T v
void IPAddressDictionary::setAttributeValue(Attribute & attribute, const Field & value)
{
auto type_call = [&](const auto & dictionary_attribute_type) {
auto type_call = [&](const auto & dictionary_attribute_type)
{
using Type = std::decay_t<decltype(dictionary_attribute_type)>;
using AttributeType = typename Type::AttributeType;

View File

@ -134,7 +134,7 @@ ColumnPtr IPolygonDictionary::getColumn(
{
const auto & def = default_col_const->template getValue<String>();
getItemsImpl<StringRef, StringRef>(
getItemsImpl<String, StringRef>(
index,
key_columns,
[&](const size_t, const StringRef value) { out->insertData(value.data, value.size); },
@ -170,7 +170,7 @@ ColumnPtr IPolygonDictionary::getColumn(
else if constexpr (IsNumber<AttributeType>)
column = ColumnVector<AttributeType>::create(size);
auto& out = column->getData();
auto & out = column->getData();
if (default_untyped != nullptr)
{

View File

@ -163,7 +163,7 @@ ColumnPtr RangeHashedDictionary::getColumn(
else if constexpr (IsNumber<AttributeType>)
column = ColumnVector<AttributeType>::create(size);
auto& out = column->getData();
auto & out = column->getData();
if (default_untyped != nullptr)
{

View File

@ -1338,7 +1338,7 @@ ColumnPtr SSDCacheDictionary::getColumn(
ColumnPtr result;
PaddedPODArray<Key> backup_storage;
const auto& ids = getColumnDataAsPaddedPODArray(this, key_columns.front(), backup_storage);
const auto & ids = getColumnDataAsPaddedPODArray(this, key_columns.front(), backup_storage);
const auto index = getAttributeIndex(attribute_name);
@ -1394,7 +1394,7 @@ ColumnPtr SSDCacheDictionary::getColumn(
else if constexpr (IsNumber<AttributeType>)
column = ColumnVector<AttributeType>::create(identifiers_size);
auto& out = column->getData();
auto & out = column->getData();
if (default_untyped != nullptr)
{

View File

@ -1443,7 +1443,7 @@ ColumnPtr SSDComplexKeyCacheDictionary::getColumn(
else if constexpr (IsNumber<AttributeType>)
column = ColumnVector<AttributeType>::create(keys_size);
auto& out = column->getData();
auto & out = column->getData();
if (default_untyped != nullptr)
{

View File

@ -17,20 +17,11 @@ NO_COMPILER_WARNINGS()
SRCS(
CacheDictionary.cpp
CacheDictionary_generate1.cpp
CacheDictionary_generate2.cpp
CacheDictionary_generate3.cpp
CassandraBlockInputStream.cpp
CassandraDictionarySource.cpp
CassandraHelpers.cpp
ClickHouseDictionarySource.cpp
ComplexKeyCacheDictionary.cpp
ComplexKeyCacheDictionary_createAttributeWithType.cpp
ComplexKeyCacheDictionary_generate1.cpp
ComplexKeyCacheDictionary_generate2.cpp
ComplexKeyCacheDictionary_generate3.cpp
ComplexKeyCacheDictionary_setAttributeValue.cpp
ComplexKeyCacheDictionary_setDefaultAttributeValue.cpp
ComplexKeyDirectDictionary.cpp
ComplexKeyHashedDictionary.cpp
DictionaryBlockInputStreamBase.cpp

View File

@ -54,7 +54,6 @@ namespace ErrorCodes
extern const int UNSUPPORTED_METHOD;
extern const int UNKNOWN_TYPE;
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
extern const int TYPE_MISMATCH;
extern const int ILLEGAL_COLUMN;
extern const int BAD_ARGUMENTS;
}
@ -275,9 +274,8 @@ private:
/// TODO: Use accurateCast if argument is integer
if (!WhichDataType(arguments[2].type).isUInt64() && !isTuple(arguments[2].type))
throw Exception{
"Illegal type " + arguments[2].type->getName() + " of third argument of function " + getName()
+ ", must be UInt64 or tuple(...).",
throw Exception{"Illegal type " + arguments[2].type->getName() + " of third argument of function "
+ getName() + ", must be UInt64 or tuple(...).",
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT};
auto dictionary_identifier_type = dictionary->getIdentifierType();
@ -298,9 +296,8 @@ private:
range_col_type = arguments[current_arguments_index].type;
if (!(range_col_type->isValueRepresentedByInteger() && range_col_type->getSizeOfValueInMemory() <= sizeof(Int64)))
throw Exception{
"Illegal type " + range_col_type->getName() + " of fourth argument of function " + getName()
+ " must be convertible to Int64.",
throw Exception{"Illegal type " + range_col_type->getName() + " of fourth argument of function "
+ getName() + " must be convertible to Int64.",
ErrorCodes::ILLEGAL_COLUMN};
++current_arguments_index;