Fix NONE
and NULL
less than or greater than bugs (#4658)
This commit is contained in:
parent
99356dcd49
commit
329bb74040
3 changed files with 35 additions and 11 deletions
|
@ -458,9 +458,17 @@ impl Document {
|
|||
Value::Subquery(Box::new(Subquery::Ifelse(IfelseStatement {
|
||||
exprs: vec![(
|
||||
Value::Expression(Box::new(Expression::Binary {
|
||||
l: Value::Idiom(key.clone()),
|
||||
o: Operator::MoreThan,
|
||||
r: val.clone(),
|
||||
l: Value::Expression(Box::new(Expression::Binary {
|
||||
l: Value::Idiom(key.clone()),
|
||||
o: Operator::Exact,
|
||||
r: Value::None,
|
||||
})),
|
||||
o: Operator::Or,
|
||||
r: Value::Expression(Box::new(Expression::Binary {
|
||||
l: Value::Idiom(key.clone()),
|
||||
o: Operator::MoreThan,
|
||||
r: val.clone(),
|
||||
})),
|
||||
})),
|
||||
val,
|
||||
)],
|
||||
|
@ -505,9 +513,17 @@ impl Document {
|
|||
Value::Subquery(Box::new(Subquery::Ifelse(IfelseStatement {
|
||||
exprs: vec![(
|
||||
Value::Expression(Box::new(Expression::Binary {
|
||||
l: Value::Idiom(key.clone()),
|
||||
o: Operator::LessThan,
|
||||
r: val.clone(),
|
||||
l: Value::Expression(Box::new(Expression::Binary {
|
||||
l: Value::Idiom(key.clone()),
|
||||
o: Operator::Exact,
|
||||
r: Value::None,
|
||||
})),
|
||||
o: Operator::Or,
|
||||
r: Value::Expression(Box::new(Expression::Binary {
|
||||
l: Value::Idiom(key.clone()),
|
||||
o: Operator::LessThan,
|
||||
r: val.clone(),
|
||||
})),
|
||||
})),
|
||||
val,
|
||||
)],
|
||||
|
|
|
@ -105,19 +105,19 @@ pub fn any_like(a: &Value, b: &Value) -> Result<Value, Error> {
|
|||
}
|
||||
|
||||
pub fn less_than(a: &Value, b: &Value) -> Result<Value, Error> {
|
||||
Ok((a.is_none_or_null() || b.is_none_or_null() || a.lt(b)).into())
|
||||
Ok(a.lt(b).into())
|
||||
}
|
||||
|
||||
pub fn less_than_or_equal(a: &Value, b: &Value) -> Result<Value, Error> {
|
||||
Ok((a.is_none_or_null() || b.is_none_or_null() || a.le(b)).into())
|
||||
Ok(a.le(b).into())
|
||||
}
|
||||
|
||||
pub fn more_than(a: &Value, b: &Value) -> Result<Value, Error> {
|
||||
Ok((a.is_none_or_null() || b.is_none_or_null() || a.gt(b)).into())
|
||||
Ok(a.gt(b).into())
|
||||
}
|
||||
|
||||
pub fn more_than_or_equal(a: &Value, b: &Value) -> Result<Value, Error> {
|
||||
Ok((a.is_none_or_null() || b.is_none_or_null() || a.ge(b)).into())
|
||||
Ok(a.ge(b).into())
|
||||
}
|
||||
|
||||
pub fn contain(a: &Value, b: &Value) -> Result<Value, Error> {
|
||||
|
|
|
@ -54,7 +54,15 @@ async fn define_foreign_table() -> Result<(), Error> {
|
|||
assert_eq!(tmp, val);
|
||||
//
|
||||
let tmp = res.remove(0).result?;
|
||||
let val = Value::parse("[{ id: person:one, age: 39, score: 70 }]");
|
||||
let val = Value::parse(
|
||||
"[
|
||||
{
|
||||
age: 39,
|
||||
id: person:one,
|
||||
score: 70,
|
||||
}
|
||||
]",
|
||||
);
|
||||
assert_eq!(tmp, val);
|
||||
//
|
||||
let tmp = res.remove(0).result?;
|
||||
|
|
Loading…
Reference in a new issue