-
Notifications
You must be signed in to change notification settings - Fork 37
Conversation
@@ -1313,32 +1313,26 @@ FunctionManager::FunctionManager() { | |||
attr.isPure_ = true; | |||
attr.body_ = [](const auto &args) -> Value { | |||
auto argSize = args.size(); | |||
if (argSize < 2 || argSize >3) { | |||
if (argSize < 2 || argSize > 3) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The find method will check the count of arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix
LOG(ERROR) << "Unexpected arguments count " << args.size(); | ||
return Value::kNullBadData; | ||
} | ||
if (args[0].isNull()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty
is the same. but the type Signature has made sure the input args[0] must string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type Signature only use in deduce expr's type , When it encounters null, it returns directly in validator
So in the execution stage, we need to re-judge
user cannot enter EMPTY .so we not process EMPTY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the query input can be empty, such as pipe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EMPTY will do later ,all function have this problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
TEST_FUNCTION(substr, std::vector<Value>({"hello", Value::kNullValue, 2}), Value::kNullBadType); | ||
TEST_FUNCTION(substr, std::vector<Value>({"hello", 2, Value::kNullValue}), Value::kNullBadType); | ||
TEST_FUNCTION(substr, std::vector<Value>({"hello", -1, 10}), Value::kNullBadData); | ||
TEST_FUNCTION(substr, std::vector<Value>({"hello", 1, -2}), Value::kNullBadData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add test when start
large than string's size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alread exist in line 244
* fix substr crash * fix test error Co-authored-by: Yee <2520865+yixinglu@users.noreply.github.com> (cherry picked from commit c93c0e6)
refer to vesoft-inc/nebula-graph#878