mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 03:22:14 +00:00
fixed bug for issue #1336
This commit is contained in:
parent
119312091c
commit
d8eef2e7f2
@ -534,7 +534,13 @@ bool SubString::convertImpl(String & out,IParser::Pos & pos)
|
||||
{
|
||||
++pos;
|
||||
auto length = getConvertedArgument(fn_name, pos);
|
||||
out = "substr("+ source + ", " + startingIndex + " + 1, " + length + ")";
|
||||
|
||||
if(startingIndex.empty())
|
||||
return false;
|
||||
else if(startingIndex[0] == '-')
|
||||
out = "substr("+ source + ", " + startingIndex + ", " + length + ")";
|
||||
else
|
||||
out = "substr("+ source + ", " + startingIndex + " + 1, " + length + ")";
|
||||
}
|
||||
else
|
||||
out = "substr("+ source + "," + startingIndex + " + 1)";
|
||||
|
Loading…
Reference in New Issue
Block a user