Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,5 @@ missing_panics_doc = { level = "allow", priority = 2 }
significant_drop_tightening = { level = "allow", priority = 2 }
module_name_repetitions = { level = "allow", priority = 2 }
option_if_let_else = { level = "allow", priority = 2 }
redundant_closure_for_method_calls = { level = "allow", priority = 2 }

Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
source: crates/metastore/src/metastore.rs
expression: "(test_volume, all_volumes)"
snapshot_kind: text
---
(
Some(
Object {
"created_at: "TIMESTAMP",
"ident": String("test"),
"type": String("memory"),
"created_at: "TIMESTAMP",
"updated_at: "TIMESTAMP",
},
),
Expand Down
1 change: 1 addition & 0 deletions crates/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ utoipa-axum = { workspace = true }
utoipa-swagger-ui = { workspace = true }
uuid = { workspace = true }
validator = { version = "0.20.0", features = ["derive"] }
jsonpath_lib = "0.3.0"

[lints]
workspace = true
Expand Down
55 changes: 0 additions & 55 deletions crates/runtime/src/execution/datafusion/functions/aggregate/mod.rs

This file was deleted.

56 changes: 2 additions & 54 deletions crates/runtime/src/execution/datafusion/functions/mod.rs
Original file line number Diff line number Diff line change
@@ -1,55 +1,3 @@
use std::sync::Arc;

use datafusion::{common::Result, execution::FunctionRegistry, logical_expr::ScalarUDF};

pub(crate) mod aggregate;
mod convert_timezone;
mod date_add;
mod date_diff;
mod date_from_parts;
//pub mod geospatial;
mod parse_json;
pub mod table;
mod time_from_parts;
mod timestamp_from_parts;

pub fn register_udfs(registry: &mut dyn FunctionRegistry) -> Result<()> {
let functions: Vec<Arc<ScalarUDF>> = vec![
convert_timezone::get_udf(),
date_add::get_udf(),
parse_json::get_udf(),
date_diff::get_udf(),
timestamp_from_parts::get_udf(),
time_from_parts::get_udf(),
date_from_parts::get_udf(),
];

for func in functions {
registry.register_udf(func)?;
}

Ok(())
}

mod macros {
macro_rules! make_udf_function {
($udf_type:ty) => {
paste::paste! {
static [< STATIC_ $udf_type:upper >]: std::sync::OnceLock<std::sync::Arc<datafusion::logical_expr::ScalarUDF>> =
std::sync::OnceLock::new();

pub fn get_udf() -> std::sync::Arc<datafusion::logical_expr::ScalarUDF> {
[< STATIC_ $udf_type:upper >]
.get_or_init(|| {
std::sync::Arc::new(datafusion::logical_expr::ScalarUDF::new_from_impl(
<$udf_type>::default(),
))
})
.clone()
}
}
}
}

pub(crate) use make_udf_function;
}
pub mod udafs;
pub mod udfs;
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ fn eval_expr(expr: &Expr) -> DFResult<ScalarValue> {
#[cfg(test)]
mod tests {
use super::*;
use crate::execution::datafusion::functions::parse_json::ParseJsonFunc;
use crate::execution::datafusion::functions::udfs::parse_json::ParseJsonFunc;
use datafusion::prelude::SessionContext;
use datafusion_common::assert_batches_eq;
use std::sync::Arc;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

//! Defines the `ANY_VALUE` aggregation function.

use super::macros::make_udaf_function;
use arrow::array::{ArrayRef, AsArray};
use arrow::datatypes::{DataType, Field};
Expand Down Expand Up @@ -68,6 +49,7 @@ impl Default for AnyValue {
}

impl AnyValue {
#[must_use]
pub fn new() -> Self {
Self {
signature: Signature::any(1, Volatility::Immutable),
Expand Down
24 changes: 24 additions & 0 deletions crates/runtime/src/execution/datafusion/functions/udafs/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use datafusion::prelude::SessionContext;

pub mod any_value;
pub mod object_agg;

pub fn register_udafs(ctx: &mut SessionContext) -> datafusion_common::Result<()> {
any_value::register_udaf(ctx);
object_agg::register_udaf(ctx);
Ok(())
}

mod macros {
macro_rules! make_udaf_function {
($udaf_type:ty) => {
paste::paste! {
pub fn register_udaf(ctx: &mut datafusion::prelude::SessionContext) {
ctx.register_udaf(datafusion_expr::AggregateUDF::from(<$udaf_type>::default()));
}
}
};
}

pub(crate) use make_udaf_function;
}
Loading