mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-02 12:32:04 +00:00
addressed reviewed change requests made by Yong
This commit is contained in:
parent
deae7722a3
commit
3778a8c16f
@ -17,6 +17,7 @@ namespace DB
|
|||||||
namespace ErrorCodes
|
namespace ErrorCodes
|
||||||
{
|
{
|
||||||
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
|
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
|
||||||
|
extern const int SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ArrayConcat::convertImpl(String & out, IParser::Pos & pos)
|
bool ArrayConcat::convertImpl(String & out, IParser::Pos & pos)
|
||||||
@ -270,15 +271,16 @@ bool Repeat::convertImpl(String & out, IParser::Pos & pos)
|
|||||||
if (function_name.empty())
|
if (function_name.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const auto value = getArgument(function_name, pos);
|
String value = getArgument(function_name, pos);
|
||||||
const auto count = getArgument(function_name, pos);
|
String count = getArgument(function_name, pos);
|
||||||
|
|
||||||
|
value.erase(remove(value.begin(), value.end(), ' '), value.end());
|
||||||
|
count.erase(remove(count.begin(), count.end(), ' '), count.end());
|
||||||
|
|
||||||
if(count.empty())
|
if(count.empty())
|
||||||
return false;
|
throw Exception("number of arguments do not match in function: " + function_name, ErrorCodes::SYNTAX_ERROR);
|
||||||
else if(!(count[0] >= '0' && count[0] <= '9'))
|
|
||||||
out = "toString(NULL)";
|
|
||||||
else
|
else
|
||||||
out = std::format("arrayWithConstant({1}, {0})", value, count);
|
out = "if(" + count + " < 0, [NULL], " + std::format("arrayWithConstant(abs({1}), {0}))", value, count);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user