mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-19 06:20:38 +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:
@@ -22,7 +22,7 @@ use std::sync::Arc;
|
||||
|
||||
use datafusion::arrow::datatypes::Field;
|
||||
use datafusion_common::Result;
|
||||
use datafusion_expr::function::AccumulatorArgs;
|
||||
use datafusion_expr::function::{AccumulatorArgs, StateFieldsArgs};
|
||||
use datafusion_expr::{
|
||||
Accumulator, AccumulatorFactoryFunction, AggregateUDF as DfAggregateUdf, AggregateUDFImpl,
|
||||
};
|
||||
@@ -129,13 +129,13 @@ impl AggregateUDFImpl for DfUdafAdapter {
|
||||
(self.accumulator)(acc_args)
|
||||
}
|
||||
|
||||
fn state_fields(&self, name: &str, _: ArrowDataType, _: Vec<Field>) -> Result<Vec<Field>> {
|
||||
fn state_fields(&self, args: StateFieldsArgs) -> Result<Vec<Field>> {
|
||||
let state_types = self.creator.state_types()?;
|
||||
let fields = state_types
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.map(|(i, t)| {
|
||||
let name = format!("{name}_{i}");
|
||||
let name = format!("{}_{i}", args.name);
|
||||
Field::new(name, t.as_arrow_type(), true)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
@@ -108,6 +108,10 @@ impl ScalarUDFImpl for DfUdfAdapter {
|
||||
fn invoke(&self, args: &[DfColumnarValue]) -> datafusion_common::Result<DfColumnarValue> {
|
||||
(self.fun)(args)
|
||||
}
|
||||
|
||||
fn invoke_no_args(&self, number_rows: usize) -> datafusion_common::Result<DfColumnarValue> {
|
||||
Ok((self.fun)(&[])?.into_array(number_rows)?.into())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ScalarUdf> for DfScalarUDF {
|
||||
|
||||
@@ -27,10 +27,6 @@ pub enum TypeSignature {
|
||||
/// arbitrary number of arguments of an common type out of a list of valid types
|
||||
// A function such as `concat` is `Variadic(vec![ConcreteDataType::String, ConcreteDataType::String])`
|
||||
Variadic(Vec<ConcreteDataType>),
|
||||
/// arbitrary number of arguments of an arbitrary but equal type
|
||||
// A function such as `array` is `VariadicEqual`
|
||||
// The first argument decides the type used for coercion
|
||||
VariadicEqual,
|
||||
/// One or more arguments with arbitrary types
|
||||
VariadicAny,
|
||||
/// fixed number of arguments of an arbitrary but equal type out of a list of valid types
|
||||
@@ -67,6 +63,7 @@ impl Signature {
|
||||
volatility,
|
||||
}
|
||||
}
|
||||
|
||||
/// variadic - Creates a variadic signature that represents an arbitrary number of arguments all from a type in common_types.
|
||||
pub fn variadic(common_types: Vec<ConcreteDataType>, volatility: Volatility) -> Self {
|
||||
Self {
|
||||
@@ -74,13 +71,6 @@ impl Signature {
|
||||
volatility,
|
||||
}
|
||||
}
|
||||
/// variadic_equal - Creates a variadic signature that represents an arbitrary number of arguments of the same type.
|
||||
pub fn variadic_equal(volatility: Volatility) -> Self {
|
||||
Self {
|
||||
type_signature: TypeSignature::VariadicEqual,
|
||||
volatility,
|
||||
}
|
||||
}
|
||||
|
||||
/// variadic_any - Creates a variadic signature that represents an arbitrary number of arguments of any type.
|
||||
pub fn variadic_any(volatility: Volatility) -> Self {
|
||||
@@ -131,7 +121,6 @@ impl From<TypeSignature> for DfTypeSignature {
|
||||
TypeSignature::Variadic(types) => {
|
||||
DfTypeSignature::Variadic(concrete_types_to_arrow_types(types))
|
||||
}
|
||||
TypeSignature::VariadicEqual => DfTypeSignature::VariadicEqual,
|
||||
TypeSignature::Uniform(n, types) => {
|
||||
DfTypeSignature::Uniform(n, concrete_types_to_arrow_types(types))
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ impl ExecutionPlanVisitor for MetricCollector {
|
||||
// skip if no metric available
|
||||
let Some(metric) = plan.metrics() else {
|
||||
self.record_batch_metrics.plan_metrics.push(PlanMetrics {
|
||||
plan: plan.name().to_string(),
|
||||
plan: std::any::type_name::<Self>().to_string(),
|
||||
level: self.current_level,
|
||||
metrics: vec![],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user