mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-16 02:02:56 +00:00
build(deps): bump datafusion 20240528 (#4061)
* build(deps): bump datafusion 20240528 Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * another update Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * update expected sqlness result Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix first/last value Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * reformat comment Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix remaining errors Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * revert toml format Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix pyo3 feature Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * remove dead code Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * Apply suggestions from code review Co-authored-by: Jeremyhi <jiachun_feng@proton.me> * format file Signed-off-by: Ruihang Xia <waynestxia@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com> Co-authored-by: Jeremyhi <jiachun_feng@proton.me>
This commit is contained in:
@@ -1054,15 +1054,6 @@ ret"#
|
||||
.to_string(),
|
||||
expect: vector!(Float64Vector, [0.0, consts::LOG10_2, 0.47712125471966244,]),
|
||||
},
|
||||
CodeBlockTestCase {
|
||||
input: ronish! {},
|
||||
script: r#"
|
||||
from greptime import *
|
||||
ret = 0.0<=random(3)<=1.0
|
||||
ret"#
|
||||
.to_string(),
|
||||
expect: vector!(BooleanVector, &[true, true, true]),
|
||||
},
|
||||
CodeBlockTestCase {
|
||||
input: ronish! {
|
||||
"values": vector!(Int64Vector, [1, 2, 2, 3])
|
||||
@@ -1130,30 +1121,6 @@ ret"#
|
||||
.to_string(),
|
||||
expect: vector!(Int64Vector, [10]),
|
||||
},
|
||||
CodeBlockTestCase {
|
||||
input: ronish! {
|
||||
"a": vector!(Float64Vector, [1.0, 2.0, 3.0]),
|
||||
"b": vector!(Float64Vector, [1.0, 0.0, -1.0])
|
||||
},
|
||||
script: r#"
|
||||
from greptime import *
|
||||
ret = vector([covariance(a, b)])
|
||||
ret"#
|
||||
.to_string(),
|
||||
expect: vector!(Float64Vector, [-1.0]),
|
||||
},
|
||||
CodeBlockTestCase {
|
||||
input: ronish! {
|
||||
"a": vector!(Float64Vector, [1.0, 2.0, 3.0]),
|
||||
"b": vector!(Float64Vector, [1.0, 0.0, -1.0])
|
||||
},
|
||||
script: r#"
|
||||
from greptime import *
|
||||
ret = vector([covariance_pop(a, b)])
|
||||
ret"#
|
||||
.to_string(),
|
||||
expect: vector!(Float64Vector, [-0.6666666666666666]),
|
||||
},
|
||||
CodeBlockTestCase {
|
||||
input: ronish! {
|
||||
"a": vector!(Float64Vector, [1.0, 2.0, 3.0]),
|
||||
|
||||
@@ -100,14 +100,14 @@ pub(crate) fn greptime_builtins(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
|
||||
log10,
|
||||
random,
|
||||
approx_distinct,
|
||||
median,
|
||||
// median,
|
||||
approx_percentile_cont,
|
||||
array_agg,
|
||||
avg,
|
||||
correlation,
|
||||
count,
|
||||
covariance,
|
||||
covariance_pop,
|
||||
// covariance,
|
||||
// covariance_pop,
|
||||
max,
|
||||
min,
|
||||
stddev,
|
||||
@@ -351,7 +351,7 @@ fn approx_distinct(py: Python<'_>, v0: &PyVector) -> PyResult<PyObject> {
|
||||
*/
|
||||
bind_aggr_expr!(approx_distinct, ApproxDistinct,[v0], v0, expr0=>0);
|
||||
|
||||
bind_aggr_expr!(median, Median,[v0], v0, expr0=>0);
|
||||
// bind_aggr_expr!(median, Median,[v0], v0, expr0=>0);
|
||||
|
||||
#[pyfunction]
|
||||
fn approx_percentile_cont(py: Python<'_>, values: &PyVector, percent: f64) -> PyResult<PyObject> {
|
||||
@@ -391,9 +391,9 @@ bind_aggr_expr!(correlation, Correlation,[v0, v1], v0, expr0=>0, expr1=>1);
|
||||
|
||||
bind_aggr_expr!(count, Count,[v0], v0, expr0=>0);
|
||||
|
||||
bind_aggr_expr!(covariance, Covariance,[v0, v1], v0, expr0=>0, expr1=>1);
|
||||
// bind_aggr_expr!(covariance, Covariance,[v0, v1], v0, expr0=>0, expr1=>1);
|
||||
|
||||
bind_aggr_expr!(covariance_pop, CovariancePop,[v0, v1], v0, expr0=>0, expr1=>1);
|
||||
// bind_aggr_expr!(covariance_pop, CovariancePop,[v0, v1], v0, expr0=>0, expr1=>1);
|
||||
|
||||
bind_aggr_expr!(max, Max,[v0], v0, expr0=>0);
|
||||
|
||||
|
||||
@@ -619,17 +619,6 @@ pub(crate) mod greptime_builtin {
|
||||
);
|
||||
}
|
||||
|
||||
#[pyfunction]
|
||||
fn median(values: PyVectorRef, vm: &VirtualMachine) -> PyResult<PyObjectRef> {
|
||||
bind_aggr_fn!(
|
||||
Median,
|
||||
vm,
|
||||
&[values.to_arrow_array()],
|
||||
values.arrow_data_type(),
|
||||
expr0
|
||||
);
|
||||
}
|
||||
|
||||
/// Not implement in datafusion
|
||||
/// TODO(discord9): use greptime's own impl instead
|
||||
/*
|
||||
@@ -722,38 +711,6 @@ pub(crate) mod greptime_builtin {
|
||||
);
|
||||
}
|
||||
|
||||
#[pyfunction]
|
||||
fn covariance(
|
||||
arg0: PyVectorRef,
|
||||
arg1: PyVectorRef,
|
||||
vm: &VirtualMachine,
|
||||
) -> PyResult<PyObjectRef> {
|
||||
bind_aggr_fn!(
|
||||
Covariance,
|
||||
vm,
|
||||
&[arg0.to_arrow_array(), arg1.to_arrow_array()],
|
||||
arg0.arrow_data_type(),
|
||||
expr0,
|
||||
expr1
|
||||
);
|
||||
}
|
||||
|
||||
#[pyfunction]
|
||||
fn covariance_pop(
|
||||
arg0: PyVectorRef,
|
||||
arg1: PyVectorRef,
|
||||
vm: &VirtualMachine,
|
||||
) -> PyResult<PyObjectRef> {
|
||||
bind_aggr_fn!(
|
||||
CovariancePop,
|
||||
vm,
|
||||
&[arg0.to_arrow_array(), arg1.to_arrow_array()],
|
||||
arg0.arrow_data_type(),
|
||||
expr0,
|
||||
expr1
|
||||
);
|
||||
}
|
||||
|
||||
#[pyfunction]
|
||||
fn max(values: PyVectorRef, vm: &VirtualMachine) -> PyResult<PyObjectRef> {
|
||||
bind_aggr_fn!(
|
||||
|
||||
@@ -343,17 +343,6 @@ log10(values)"#,
|
||||
ty: Float64
|
||||
))
|
||||
),
|
||||
TestCase(
|
||||
input: {},
|
||||
script: r#"
|
||||
from greptime import *
|
||||
random(42)"#,
|
||||
expect: Ok((
|
||||
value: LenFloatVec(42),
|
||||
ty: Float64
|
||||
))
|
||||
),
|
||||
|
||||
// UDAF(Aggerate function)
|
||||
// approx function is indeterministic
|
||||
TestCase(
|
||||
@@ -468,44 +457,6 @@ count(values)"#,
|
||||
ty: Int64
|
||||
))
|
||||
),
|
||||
TestCase(
|
||||
input: {
|
||||
"a": Var(
|
||||
ty: Float64,
|
||||
value: FloatVec([1.0, 2.0, 3.0])
|
||||
),
|
||||
"b": Var(
|
||||
ty: Float64,
|
||||
value: FloatVec([1.0, 0.0, -1.0])
|
||||
),
|
||||
},
|
||||
script: r#"
|
||||
from greptime import *
|
||||
covariance(a, b)"#,
|
||||
expect: Ok((
|
||||
value: Float(-1.0),
|
||||
ty: Float64
|
||||
))
|
||||
),
|
||||
TestCase(
|
||||
input: {
|
||||
"a": Var(
|
||||
ty: Float64,
|
||||
value: FloatVec([1.0, 2.0, 3.0])
|
||||
),
|
||||
"b": Var(
|
||||
ty: Float64,
|
||||
value: FloatVec([1.0, 0.0, -1.0])
|
||||
),
|
||||
},
|
||||
script: r#"
|
||||
from greptime import *
|
||||
covariance_pop(a, b)"#,
|
||||
expect: Ok((
|
||||
value: Float(-0.6666666666666666),
|
||||
ty: Float64
|
||||
))
|
||||
),
|
||||
TestCase(
|
||||
input: {
|
||||
"values": Var(
|
||||
@@ -955,21 +906,6 @@ clip(values, lower, upper)"#,
|
||||
},
|
||||
script: r#"
|
||||
from greptime import *
|
||||
median(values)"#,
|
||||
expect: Ok((
|
||||
ty: Float64,
|
||||
value: Float(1.25)
|
||||
))
|
||||
),
|
||||
TestCase(
|
||||
input: {
|
||||
"values": Var(
|
||||
ty: Float64,
|
||||
value: FloatVec([-1.0, 2.0, 2.0, 0.5])
|
||||
)
|
||||
},
|
||||
script: r#"
|
||||
from greptime import *
|
||||
diff(values)"#,
|
||||
expect: Ok((
|
||||
ty: Float64,
|
||||
|
||||
Reference in New Issue
Block a user