Fixes math:min in foreign table (#4017)
This commit is contained in:
parent
7776fa476d
commit
8890053176
4 changed files with 19 additions and 11 deletions
|
@ -380,7 +380,7 @@ impl Aggregator {
|
|||
collections.push("math::min".into());
|
||||
}
|
||||
if self.math_sum.is_some() {
|
||||
collections.push("math::sun".into());
|
||||
collections.push("math::sum".into());
|
||||
}
|
||||
if self.time_max.is_some() {
|
||||
collections.push("time::max".into());
|
||||
|
|
|
@ -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.lt(b).into())
|
||||
Ok((a.is_none_or_null() || b.is_none_or_null() || a.lt(b)).into())
|
||||
}
|
||||
|
||||
pub fn less_than_or_equal(a: &Value, b: &Value) -> Result<Value, Error> {
|
||||
Ok(a.le(b).into())
|
||||
Ok((a.is_none_or_null() || b.is_none_or_null() || a.le(b)).into())
|
||||
}
|
||||
|
||||
pub fn more_than(a: &Value, b: &Value) -> Result<Value, Error> {
|
||||
Ok(a.gt(b).into())
|
||||
Ok((a.is_none_or_null() || b.is_none_or_null() || a.gt(b)).into())
|
||||
}
|
||||
|
||||
pub fn more_than_or_equal(a: &Value, b: &Value) -> Result<Value, Error> {
|
||||
Ok(a.ge(b).into())
|
||||
Ok((a.is_none_or_null() || b.is_none_or_null() || a.ge(b)).into())
|
||||
}
|
||||
|
||||
pub fn contain(a: &Value, b: &Value) -> Result<Value, Error> {
|
||||
|
|
|
@ -415,10 +415,10 @@ async fn select_multi_aggregate() -> Result<(), Error> {
|
|||
'math::mean'
|
||||
],
|
||||
one: [
|
||||
'math::sun'
|
||||
'math::sum'
|
||||
],
|
||||
two: [
|
||||
'math::sun'
|
||||
'math::sum'
|
||||
]
|
||||
},
|
||||
type: 'Group'
|
||||
|
@ -567,10 +567,10 @@ async fn select_multi_aggregate_composed() -> Result<(), Error> {
|
|||
'first'
|
||||
],
|
||||
one: [
|
||||
'math::sun'
|
||||
'math::sum'
|
||||
],
|
||||
two: [
|
||||
'math::sun'
|
||||
'math::sum'
|
||||
]
|
||||
},
|
||||
type: 'Group'
|
||||
|
|
|
@ -15,7 +15,9 @@ async fn define_foreign_table() -> Result<(), Error> {
|
|||
count(),
|
||||
age,
|
||||
math::sum(age) AS total,
|
||||
math::mean(score) AS average
|
||||
math::mean(score) AS average,
|
||||
math::max(score) AS max,
|
||||
math::min(score) AS min
|
||||
FROM person
|
||||
GROUP BY age
|
||||
;
|
||||
|
@ -43,7 +45,7 @@ async fn define_foreign_table() -> Result<(), Error> {
|
|||
"{
|
||||
events: {},
|
||||
fields: {},
|
||||
tables: { person_by_age: 'DEFINE TABLE person_by_age TYPE ANY SCHEMALESS AS SELECT count(), age, math::sum(age) AS total, math::mean(score) AS average FROM person GROUP BY age PERMISSIONS NONE' },
|
||||
tables: { person_by_age: 'DEFINE TABLE person_by_age TYPE ANY SCHEMALESS AS SELECT count(), age, math::sum(age) AS total, math::mean(score) AS average, math::max(score) AS max, math::min(score) AS min FROM person GROUP BY age PERMISSIONS NONE' },
|
||||
indexes: {},
|
||||
lives: {},
|
||||
}",
|
||||
|
@ -62,6 +64,8 @@ async fn define_foreign_table() -> Result<(), Error> {
|
|||
average: 70,
|
||||
count: 1,
|
||||
id: person_by_age:[39],
|
||||
max: 70,
|
||||
min: 70,
|
||||
total: 39
|
||||
}
|
||||
]",
|
||||
|
@ -80,6 +84,8 @@ async fn define_foreign_table() -> Result<(), Error> {
|
|||
average: 75,
|
||||
count: 2,
|
||||
id: person_by_age:[39],
|
||||
max: 80,
|
||||
min: 70,
|
||||
total: 78
|
||||
}
|
||||
]",
|
||||
|
@ -98,6 +104,8 @@ async fn define_foreign_table() -> Result<(), Error> {
|
|||
average: 80,
|
||||
count: 2,
|
||||
id: person_by_age:[39],
|
||||
max: 90,
|
||||
min: 70,
|
||||
total: 78
|
||||
}
|
||||
]",
|
||||
|
|
Loading…
Reference in a new issue