Fix style check errors.

This commit is contained in:
hexiaoting 2020-10-10 18:16:05 +08:00
parent cdb4dd57a6
commit 974352a8e1
3 changed files with 7 additions and 13 deletions

View File

@ -49,11 +49,8 @@ DataTypeMap::DataTypeMap(const DataTypes & elems_)
std::string DataTypeMap::doGetName() const
{
WriteBufferFromOwnString s;
s << "Map("
<< (typeid_cast<const DataTypeArray *>(keys.get()))->getNestedType()->getName()
<< ","
<< typeid_cast<const DataTypeArray *>(values.get())->getNestedType()->getName()
<< ")";
s << "Map(" << (typeid_cast<const DataTypeArray *>(keys.get()))->getNestedType()->getName()
<< "," << (typeid_cast<const DataTypeArray *>(values.get()))->getNestedType()->getName() << ")";
return s.str();
}
@ -380,9 +377,7 @@ static DataTypePtr create(const ASTPtr & arguments)
for (const ASTPtr & child : arguments->children)
{
if (child->as<ASTNameTypePair>())
{
throw Exception("Map arguments only support type", ErrorCodes::BAD_ARGUMENTS);
}
else
nested_types.emplace_back(DataTypeFactory::instance().get(child));
}

View File

@ -735,7 +735,7 @@ static bool getMappedKey(const ColumnArray * col_keys_untyped, Field & index, co
const ColumnArray::Offsets & offsets = col_keys_untyped->getOffsets();
size_t rows = offsets.size();
switch(key_type)
switch (key_type)
{
case TypeIndex::String:
{
@ -767,7 +767,7 @@ static bool getMappedValue(const ColumnArray * col_values_untyped, std::vector<i
const ColumnArray::Offsets & offsets = col_values_untyped->getOffsets();
size_t rows = offsets.size();
switch(value_type)
switch (value_type)
{
case TypeIndex::String:
{
@ -826,7 +826,7 @@ bool FunctionArrayElement::executeMap(Block & block, const ColumnNumbers & argum
if (!getMappedKey(col_keys_untyped, index, key_type->getTypeId(), matchedIdx))
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "key type unmatched, we need type '{}' failed", key_type->getName());
if(!getMappedValue(col_values_untyped, matchedIdx, value_type->getTypeId(), col_res_untyped.get()))
if (!getMappedValue(col_values_untyped, matchedIdx, value_type->getTypeId(), col_res_untyped.get()))
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "value type unmatched, we need type '{}' failed", value_type->getName());
}
block.getByPosition(result).column = std::move(col_res_untyped);

View File

@ -1075,8 +1075,7 @@ bool ParserCollectionOfLiterals<Collection>::parseImpl(Pos & pos, ASTPtr & node,
{
++pos;
}
else if (pos->type == TokenType::Colon &&
std::is_same_v<Collection, Map> && arr.size() % 2 == 1)
else if (pos->type == TokenType::Colon && std::is_same_v<Collection, Map> && arr.size() % 2 == 1)
{
++pos;
}