Skip to content

Commit

Permalink
return false on unkown prop in logical expr eval.
Browse files Browse the repository at this point in the history
  • Loading branch information
xtcyclist committed Nov 10, 2022
1 parent d9c4a6c commit 299f672
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/common/datatypes/Value.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ struct Value {
bool isNull() const {
return type_ == Type::NULLVALUE;
}
bool isUnkonwnProp() const {
auto& null = value_.nVal;
return null == NullType::UNKNOWN_PROP;
}
bool isBadNull() const {
if (!isNull()) {
return false;
Expand Down
5 changes: 4 additions & 1 deletion src/common/expression/LogicalExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ const Value &LogicalExpression::evalAnd(ExpressionContext &ctx) {
result_ = true;
for (auto i = 0u; i < operands_.size(); i++) {
auto &value = operands_[i]->eval(ctx);
if (value.isBadNull() || (value.isImplicitBool() && !value.implicitBool())) {
if (value.isUnkonwnProp()) {
result_ = false;
return result_;
} else if (value.isBadNull() || (value.isImplicitBool() && !value.implicitBool())) {
result_ = value;
return result_;
}
Expand Down
1 change: 1 addition & 0 deletions src/graph/util/ExpressionUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ Expression *ExpressionUtils::rewriteRelExpr(const Expression *expr) {
if (simplifiedExpr) {
return simplifiedExpr;
}

// Move all evaluable expression to the right side
auto relRightOperandExpr = relExpr->right()->clone();
auto relLeftOperandExpr = rewriteRelExprHelper(relExpr->left(), relRightOperandExpr);
Expand Down

0 comments on commit 299f672

Please sign in to comment.