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,8 +259,8 @@ 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);
/// TODO: Check that attribute type is same as result type
@ -314,8 +314,8 @@ 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)
{
@ -357,7 +357,7 @@ ColumnPtr CacheDictionary::getColumn(
};
callOnDictionaryAttributeType(attribute.type, type_call);
return result;
}

View File

@ -86,7 +86,7 @@ ColumnPtr ComplexKeyCacheDictionary::getColumn(
/// TODO: Check that attribute type is same as result type
/// TODO: Check if const will work as expected
auto keys_size = key_columns.front()->size();
auto type_call = [&](const auto &dictionary_attribute_type)
@ -136,8 +136,8 @@ 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)
{
@ -179,7 +179,7 @@ ColumnPtr ComplexKeyCacheDictionary::getColumn(
};
callOnDictionaryAttributeType(attribute.type, type_call);
return result;
}
@ -362,7 +362,7 @@ void ComplexKeyCacheDictionary::setDefaultAttributeValue(Attribute & attribute,
}
else
{
std::get<ContainerPtrType<AttributeType>>(attribute.arrays)[idx] = std::get<AttributeType>(attribute.null_values);
std::get<ContainerPtrType<AttributeType>>(attribute.arrays)[idx] = std::get<AttributeType>(attribute.null_values);
}
};

View File

@ -98,7 +98,7 @@ public:
const DataTypes & key_types,
const ColumnPtr default_untyped) const override;
ColumnUInt8::Ptr has(const Columns & key_columns, const DataTypes & key_types) const override;
ColumnUInt8::Ptr has(const Columns & key_columns, const DataTypes & key_types) const override;
BlockInputStreamPtr getBlockInputStream(const Names & column_names, size_t max_block_size) const override;

View File

@ -47,10 +47,10 @@ ColumnPtr ComplexKeyDirectDictionary::getColumn(
/// TODO: Check that attribute type is same as result type
/// TODO: Check if const will work as expected
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;
@ -125,8 +125,8 @@ 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)
{
@ -168,7 +168,7 @@ ColumnPtr ComplexKeyDirectDictionary::getColumn(
};
callOnDictionaryAttributeType(attribute.type, type_call);
return result;
}

View File

@ -49,7 +49,7 @@ ColumnPtr ComplexKeyHashedDictionary::getColumn(
/// TODO: Check that attribute type is same as result type
/// TODO: Check if const will work as expected
auto size = key_columns.front()->size();
auto type_call = [&](const auto &dictionary_attribute_type)
@ -111,8 +111,8 @@ 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)
{
@ -154,7 +154,7 @@ ColumnPtr ComplexKeyHashedDictionary::getColumn(
};
callOnDictionaryAttributeType(attribute.type, type_call);
return result;
}

View File

@ -328,7 +328,7 @@ std::vector<DictionaryAttribute> DictionaryStructure::getAttributes(
is_array = true;
type = array_type->getNestedType();
}
if (type->isNullable())
{
is_nullable = true;

View File

@ -138,8 +138,8 @@ 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);
/// TODO: Check that attribute type is same as result type
@ -222,8 +222,8 @@ 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)
{
@ -265,7 +265,7 @@ ColumnPtr DirectDictionary::getColumn(
};
callOnDictionaryAttributeType(attribute.type, type_call);
return result;
}

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,8 +114,8 @@ 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);
/// TODO: Check that attribute type is same as result type
@ -183,8 +182,8 @@ 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)
{
@ -226,7 +225,7 @@ ColumnPtr FlatDictionary::getColumn(
};
callOnDictionaryAttributeType(attribute.type, type_call);
return result;
}

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;
@ -205,8 +205,8 @@ 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)
{
@ -248,7 +248,7 @@ ColumnPtr HashedDictionary::getColumn(
};
callOnDictionaryAttributeType(attribute.type, type_call);
return result;
}
@ -706,14 +706,14 @@ template <>
PaddedPODArray<HashedDictionary::Key> HashedDictionary::getIds<String>(const Attribute & attribute) const
{
return getIds<StringRef>(attribute);
}
}
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

@ -282,7 +282,7 @@ ColumnPtr IPAddressDictionary::getColumn(
/// TODO: Check that attribute type is same as result type
/// TODO: Check if const will work as expected
auto size = key_columns.front()->size();
auto type_call = [&](const auto &dictionary_attribute_type)
@ -344,8 +344,8 @@ 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)
{
@ -387,7 +387,7 @@ ColumnPtr IPAddressDictionary::getColumn(
};
callOnDictionaryAttributeType(attribute.type, type_call);
return result;
}
@ -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;
@ -848,7 +849,7 @@ void IPAddressDictionary::setAttributeValue(Attribute & attribute, const Field &
{
const auto & string = value.get<String>();
const auto * string_in_arena = attribute.string_arena->insert(string.data(), string.size());
setAttributeValueImpl<StringRef>(attribute, StringRef{string_in_arena, string.size()});
setAttributeValueImpl<StringRef>(attribute, StringRef{string_in_arena, string.size()});
}
else
{

View File

@ -70,7 +70,7 @@ public:
const DataTypes & key_types,
const ColumnPtr default_untyped) const override;
ColumnUInt8::Ptr has(const Columns & key_columns, const DataTypes & key_types) const override;
ColumnUInt8::Ptr has(const Columns & key_columns, const DataTypes & key_types) const override;
BlockInputStreamPtr getBlockInputStream(const Names & column_names, size_t max_block_size) const override;

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); },
@ -169,8 +169,8 @@ 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)
{
@ -212,7 +212,7 @@ ColumnPtr IPolygonDictionary::getColumn(
};
callOnDictionaryAttributeType(dict_struct.attributes[index].underlying_type, type_call);
return result;
}

View File

@ -162,8 +162,8 @@ 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)
{
@ -205,7 +205,7 @@ ColumnPtr RangeHashedDictionary::getColumn(
};
callOnDictionaryAttributeType(attribute.type, type_call);
return result;
}
@ -304,7 +304,7 @@ void RangeHashedDictionary::calculateBytesAllocated()
for (const auto & attribute : attributes)
{
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

@ -1338,8 +1338,8 @@ 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);
/// TODO: Check that attribute type is same as result type
@ -1393,8 +1393,8 @@ 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)
{
@ -1436,7 +1436,7 @@ ColumnPtr SSDCacheDictionary::getColumn(
};
callOnDictionaryAttributeType(dict_struct.attributes[index].underlying_type, type_call);
return result;
}

View File

@ -1392,7 +1392,7 @@ ColumnPtr SSDComplexKeyCacheDictionary::getColumn(
/// TODO: Check that attribute type is same as result type
/// TODO: Check if const will work as expected
auto keys_size = key_columns.front()->size();
auto type_call = [&](const auto &dictionary_attribute_type)
@ -1442,8 +1442,8 @@ 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)
{
@ -1488,7 +1488,7 @@ ColumnPtr SSDComplexKeyCacheDictionary::getColumn(
};
callOnDictionaryAttributeType(dict_struct.attributes[index].underlying_type, type_call);
return result;
}

View File

@ -578,7 +578,7 @@ public:
const DataTypes & key_types,
const ColumnPtr default_untyped) const override;
ColumnUInt8::Ptr has(const Columns & key_columns, const DataTypes & key_types) const override;
ColumnUInt8::Ptr has(const Columns & key_columns, const DataTypes & key_types) const override;
template <typename T>
using ResultArrayType = SSDComplexKeyCacheStorage::ResultArrayType<T>;

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;