@@ -115,7 +115,8 @@ const Value& RelationalExpression::eval(ExpressionContext& ctx) {
115
115
case Kind::kContains : {
116
116
if (lhs.isBadNull () || rhs.isBadNull ()) {
117
117
result_ = Value::kNullBadType ;
118
- } else if ((!lhs.isNull () && !lhs.isStr ()) || (!rhs.isNull () && !rhs.isStr ())) {
118
+ } else if ((!lhs.isNull () && !lhs.empty () && !lhs.isStr ()) ||
119
+ (!rhs.isNull () && !rhs.empty () && !rhs.isStr ())) {
119
120
result_ = Value::kNullBadType ;
120
121
} else if (lhs.isStr () && rhs.isStr ()) {
121
122
result_ = lhs.getStr ().size () >= rhs.getStr ().size () &&
@@ -128,7 +129,8 @@ const Value& RelationalExpression::eval(ExpressionContext& ctx) {
128
129
case Kind::kNotContains : {
129
130
if (lhs.isBadNull () || rhs.isBadNull ()) {
130
131
result_ = Value::kNullBadType ;
131
- } else if ((!lhs.isNull () && !lhs.isStr ()) || (!rhs.isNull () && !rhs.isStr ())) {
132
+ } else if ((!lhs.isNull () && !lhs.empty () && !lhs.isStr ()) ||
133
+ (!rhs.isNull () && !rhs.empty () && !rhs.isStr ())) {
132
134
result_ = Value::kNullBadType ;
133
135
} else if (lhs.isStr () && rhs.isStr ()) {
134
136
result_ = !(lhs.getStr ().size () >= rhs.getStr ().size () &&
@@ -141,7 +143,8 @@ const Value& RelationalExpression::eval(ExpressionContext& ctx) {
141
143
case Kind::kStartsWith : {
142
144
if (lhs.isBadNull () || rhs.isBadNull ()) {
143
145
result_ = Value::kNullBadType ;
144
- } else if ((!lhs.isNull () && !lhs.isStr ()) || (!rhs.isNull () && !rhs.isStr ())) {
146
+ } else if ((!lhs.isNull () && !lhs.empty () && !lhs.isStr ()) ||
147
+ (!rhs.isNull () && !rhs.empty () && !rhs.isStr ())) {
145
148
result_ = Value::kNullBadType ;
146
149
} else if (lhs.isStr () && rhs.isStr ()) {
147
150
result_ =
@@ -154,7 +157,8 @@ const Value& RelationalExpression::eval(ExpressionContext& ctx) {
154
157
case Kind::kNotStartsWith : {
155
158
if (lhs.isBadNull () || rhs.isBadNull ()) {
156
159
result_ = Value::kNullBadType ;
157
- } else if ((!lhs.isNull () && !lhs.isStr ()) || (!rhs.isNull () && !rhs.isStr ())) {
160
+ } else if ((!lhs.isNull () && !lhs.empty () && !lhs.isStr ()) ||
161
+ (!rhs.isNull () && !rhs.empty () && !rhs.isStr ())) {
158
162
result_ = Value::kNullBadType ;
159
163
} else if (lhs.isStr () && rhs.isStr ()) {
160
164
result_ =
@@ -167,7 +171,8 @@ const Value& RelationalExpression::eval(ExpressionContext& ctx) {
167
171
case Kind::kEndsWith : {
168
172
if (lhs.isBadNull () || rhs.isBadNull ()) {
169
173
result_ = Value::kNullBadType ;
170
- } else if ((!lhs.isNull () && !lhs.isStr ()) || (!rhs.isNull () && !rhs.isStr ())) {
174
+ } else if ((!lhs.isNull () && !lhs.empty () && !lhs.isStr ()) ||
175
+ (!rhs.isNull () && !rhs.empty () && !rhs.isStr ())) {
171
176
result_ = Value::kNullBadType ;
172
177
} else if (lhs.isStr () && rhs.isStr ()) {
173
178
result_ =
@@ -182,7 +187,8 @@ const Value& RelationalExpression::eval(ExpressionContext& ctx) {
182
187
case Kind::kNotEndsWith : {
183
188
if (lhs.isBadNull () || rhs.isBadNull ()) {
184
189
result_ = Value::kNullBadType ;
185
- } else if ((!lhs.isNull () && !lhs.isStr ()) || (!rhs.isNull () && !rhs.isStr ())) {
190
+ } else if ((!lhs.isNull () && !lhs.empty () && !lhs.isStr ()) ||
191
+ (!rhs.isNull () && !rhs.empty () && !rhs.isStr ())) {
186
192
result_ = Value::kNullBadType ;
187
193
} else if (lhs.isStr () && rhs.isStr ()) {
188
194
result_ = !(lhs.getStr ().size () >= rhs.getStr ().size () &&
0 commit comments