Skip to content

Commit

Permalink
fix clang-tidy check error
Browse files Browse the repository at this point in the history
  • Loading branch information
windtalker committed Jan 28, 2022
1 parent 5eb0552 commit bf731f3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions dbms/src/Flash/Coprocessor/DAGExpressionAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ String DAGExpressionAnalyzerHelper::buildRegexpFunction(
{
const String & func_name = getFunctionName(expr);
Names argument_names;
for (auto & child : expr.children())
for (const auto & child : expr.children())
{
String name = analyzer->getActions(child, actions);
argument_names.push_back(name);
Expand Down Expand Up @@ -1194,7 +1194,7 @@ void DAGExpressionAnalyzer::appendAggSelect(

NamesWithAliases DAGExpressionAnalyzer::appendFinalProjectForNonRootQueryBlock(
ExpressionActionsChain & chain,
const String & column_prefix)
const String & column_prefix) const
{
const auto & current_columns = getCurrentInputColumns();
NamesWithAliases final_project;
Expand Down
2 changes: 1 addition & 1 deletion dbms/src/Flash/Coprocessor/DAGExpressionAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class DAGExpressionAnalyzer : private boost::noncopyable

NamesWithAliases appendFinalProjectForNonRootQueryBlock(
ExpressionActionsChain & chain,
const String & column_prefix);
const String & column_prefix) const;

NamesWithAliases appendFinalProjectForRootQueryBlock(
ExpressionActionsChain & chain,
Expand Down
40 changes: 20 additions & 20 deletions dbms/src/Functions/FunctionsStringSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ static String getRE2ModeModifiers(const std::string & match_type, const std::sha
/// match_type can overwrite collator
if (!match_type.empty())
{
for (size_t i = 0; i < match_type.size(); i++)
for (const auto & c : match_type)
{
switch (match_type[i])
switch (c)
{
case 'i':
/// according to MySQL doc: if either argument is a binary string, the arguments are handled in
Expand Down Expand Up @@ -414,9 +414,9 @@ String replaceEscapeChar(String & orig_string, UInt8 escape_char)
for (size_t i = 0; i < orig_string.size(); i++)
{
auto c = orig_string[i];
if (c == escape_char)
if (static_cast<UInt8>(c) == escape_char)
{
if (i + 1 != orig_string.size() && orig_string[i + 1] == escape_char)
if (i + 1 != orig_string.size() && static_cast<UInt8>(orig_string[i + 1]) == escape_char)
{
// two successive escape char, which means it is trying to escape itself, just remove one
i++;
Expand Down Expand Up @@ -805,7 +805,7 @@ struct ReplaceRegexpImpl
{
Instructions instructions;

String now = "";
String now;
for (size_t i = 0; i < s.size(); ++i)
{
if (s[i] == '\\' && i + 1 < s.size())
Expand Down Expand Up @@ -988,7 +988,7 @@ struct ReplaceRegexpImpl
}
}

static void vector_fixed(const ColumnString::Chars_t & data,
static void vectorFixed(const ColumnString::Chars_t & data,
size_t n,
const std::string & needle,
const std::string & replacement,
Expand Down Expand Up @@ -1139,7 +1139,7 @@ struct ReplaceStringImpl
}
}

static void vector_non_const_needle(
static void vectorNonConstNeedle(
const ColumnString::Chars_t & data,
const ColumnString::Offsets & offsets,
const ColumnString::Chars_t & needle_chars,
Expand Down Expand Up @@ -1213,7 +1213,7 @@ struct ReplaceStringImpl
}
}

static void vector_non_const_replacement(
static void vectorNonConstReplacement(
const ColumnString::Chars_t & data,
const ColumnString::Offsets & offsets,
const std::string & needle,
Expand Down Expand Up @@ -1304,7 +1304,7 @@ struct ReplaceStringImpl
}
}

static void vector_non_const_needle_replacement(
static void vectorNonConstNeedleReplacement(
const ColumnString::Chars_t & data,
const ColumnString::Offsets & offsets,
const ColumnString::Chars_t & needle_chars,
Expand Down Expand Up @@ -1382,7 +1382,7 @@ struct ReplaceStringImpl

/// Note: this function converts fixed-length strings to variable-length strings
/// and each variable-length string should ends with zero byte.
static void vector_fixed(const ColumnString::Chars_t & data,
static void vectorFixed(const ColumnString::Chars_t & data,
size_t n,
const std::string & needle,
const std::string & replacement,
Expand Down Expand Up @@ -1478,7 +1478,7 @@ struct ReplaceStringImpl
}
}

static void vector_fixed_non_const_needle(
static void vectorFixedNonConstNeedle(
const ColumnString::Chars_t & data,
size_t n,
const ColumnString::Chars_t & needle_chars,
Expand Down Expand Up @@ -1553,7 +1553,7 @@ struct ReplaceStringImpl
}
}

static void vector_fixed_non_const_replacement(
static void vectorFixedNonConstReplacement(
const ColumnString::Chars_t & data,
size_t n,
const std::string & needle,
Expand Down Expand Up @@ -1654,7 +1654,7 @@ struct ReplaceStringImpl
}
}

static void vector_fixed_non_const_needle_replacement(
static void vectorFixedNonConstNeedleReplacement(
const ColumnString::Chars_t & data,
size_t n,
const ColumnString::Chars_t & needle_chars,
Expand Down Expand Up @@ -1900,7 +1900,7 @@ class FunctionStringReplace : public IFunction
else if (const ColumnFixedString * col = checkAndGetColumn<ColumnFixedString>(column_src.get()))
{
auto col_res = ColumnString::create();
Impl::vector_fixed(col->getChars(), col->getN(), needle, replacement, pos, occ, match_type, collator, col_res->getChars(), col_res->getOffsets());
Impl::vectorFixed(col->getChars(), col->getN(), needle, replacement, pos, occ, match_type, collator, col_res->getChars(), col_res->getOffsets());
column_result.column = std::move(col_res);
}
else
Expand All @@ -1927,13 +1927,13 @@ class FunctionStringReplace : public IFunction
if (const ColumnString * col = checkAndGetColumn<ColumnString>(column_src.get()))
{
auto col_res = ColumnString::create();
Impl::vector_non_const_needle(col->getChars(), col->getOffsets(), col_needle->getChars(), col_needle->getOffsets(), replacement, pos, occ, match_type, collator, col_res->getChars(), col_res->getOffsets());
Impl::vectorNonConstNeedle(col->getChars(), col->getOffsets(), col_needle->getChars(), col_needle->getOffsets(), replacement, pos, occ, match_type, collator, col_res->getChars(), col_res->getOffsets());
column_result.column = std::move(col_res);
}
else if (const ColumnFixedString * col = checkAndGetColumn<ColumnFixedString>(column_src.get()))
{
auto col_res = ColumnString::create();
Impl::vector_fixed_non_const_needle(col->getChars(), col->getN(), col_needle->getChars(), col_needle->getOffsets(), replacement, pos, occ, match_type, collator, col_res->getChars(), col_res->getOffsets());
Impl::vectorFixedNonConstNeedle(col->getChars(), col->getN(), col_needle->getChars(), col_needle->getOffsets(), replacement, pos, occ, match_type, collator, col_res->getChars(), col_res->getOffsets());
column_result.column = std::move(col_res);
}
else
Expand Down Expand Up @@ -1965,13 +1965,13 @@ class FunctionStringReplace : public IFunction
if (const ColumnString * col = checkAndGetColumn<ColumnString>(column_src.get()))
{
auto col_res = ColumnString::create();
Impl::vector_non_const_replacement(col->getChars(), col->getOffsets(), needle, col_replacement->getChars(), col_replacement->getOffsets(), pos, occ, match_type, collator, col_res->getChars(), col_res->getOffsets());
Impl::vectorNonConstReplacement(col->getChars(), col->getOffsets(), needle, col_replacement->getChars(), col_replacement->getOffsets(), pos, occ, match_type, collator, col_res->getChars(), col_res->getOffsets());
column_result.column = std::move(col_res);
}
else if (const ColumnFixedString * col = checkAndGetColumn<ColumnFixedString>(column_src.get()))
{
auto col_res = ColumnString::create();
Impl::vector_fixed_non_const_replacement(col->getChars(), col->getN(), needle, col_replacement->getChars(), col_replacement->getOffsets(), pos, occ, match_type, collator, col_res->getChars(), col_res->getOffsets());
Impl::vectorFixedNonConstReplacement(col->getChars(), col->getN(), needle, col_replacement->getChars(), col_replacement->getOffsets(), pos, occ, match_type, collator, col_res->getChars(), col_res->getOffsets());
column_result.column = std::move(col_res);
}
else
Expand Down Expand Up @@ -2002,13 +2002,13 @@ class FunctionStringReplace : public IFunction
if (const ColumnString * col = checkAndGetColumn<ColumnString>(column_src.get()))
{
auto col_res = ColumnString::create();
Impl::vector_non_const_needle_replacement(col->getChars(), col->getOffsets(), col_needle->getChars(), col_needle->getOffsets(), col_replacement->getChars(), col_replacement->getOffsets(), pos, occ, match_type, collator, col_res->getChars(), col_res->getOffsets());
Impl::vectorNonConstNeedleReplacement(col->getChars(), col->getOffsets(), col_needle->getChars(), col_needle->getOffsets(), col_replacement->getChars(), col_replacement->getOffsets(), pos, occ, match_type, collator, col_res->getChars(), col_res->getOffsets());
column_result.column = std::move(col_res);
}
else if (const ColumnFixedString * col = checkAndGetColumn<ColumnFixedString>(column_src.get()))
{
auto col_res = ColumnString::create();
Impl::vector_fixed_non_const_needle_replacement(col->getChars(), col->getN(), col_needle->getChars(), col_needle->getOffsets(), col_replacement->getChars(), col_replacement->getOffsets(), pos, occ, match_type, collator, col_res->getChars(), col_res->getOffsets());
Impl::vectorFixedNonConstNeedleReplacement(col->getChars(), col->getN(), col_needle->getChars(), col_needle->getOffsets(), col_replacement->getChars(), col_replacement->getOffsets(), pos, occ, match_type, collator, col_res->getChars(), col_res->getOffsets());
column_result.column = std::move(col_res);
}
else
Expand Down

0 comments on commit bf731f3

Please sign in to comment.