File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
interactive_engine/executor/ir/graph_proxy/src/utils/expr Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ use std::convert::{TryFrom, TryInto};
20
20
21
21
use dyn_type:: arith:: { BitOperand , Exp } ;
22
22
use dyn_type:: object;
23
+ use dyn_type:: object:: RawType ;
23
24
use dyn_type:: { BorrowObject , Object } ;
24
25
use ir_common:: error:: { ParsePbError , ParsePbResult } ;
25
26
use ir_common:: expr_parse:: to_suffix_expr;
@@ -295,7 +296,9 @@ pub(crate) fn apply_logical<'a>(
295
296
if b_opt. is_some ( ) {
296
297
let b = b_opt. unwrap ( ) ;
297
298
// process null values
298
- if a. eq ( & Object :: None ) || b. eq ( & Object :: None ) {
299
+ // "a.eq(&Object::None)" has a potential bug, that if a is empty string "", it will be treated as None.
300
+ // Fix it by using raw_type() == RawType::None
301
+ if a. raw_type ( ) == RawType :: None || b. raw_type ( ) == RawType :: None {
299
302
match logical {
300
303
And => {
301
304
if ( a != Object :: None && !a. eval_bool :: < ( ) , NoneContext > ( None ) ?)
@@ -678,7 +681,7 @@ impl TryFrom<common_pb::ExprOpr> for Operand {
678
681
Ok ( Self :: VarMap ( vec) )
679
682
}
680
683
Map ( key_vals) => Operand :: try_from ( key_vals) ,
681
- _ => Err ( ParsePbError :: ParseError ( "invalid operators for an Operand" . to_string ( ) ) ) ,
684
+ _ => Err ( ParsePbError :: ParseError ( format ! ( "invalid operators for an Operand {:?}" , item ) ) ) ,
682
685
}
683
686
} else {
684
687
Err ( ParsePbError :: from ( "empty value provided" ) )
You can’t perform that action at this time.
0 commit comments