Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@ struct ScalarFunctionWrapper {
}

impl ScalarUDFImpl for ScalarFunctionWrapper {
fn as_any(&self) -> &dyn std::any::Any {
self
}

fn name(&self) -> &str {
&self.name
}
Expand Down
5 changes: 0 additions & 5 deletions datafusion-examples/examples/data_io/json_shredding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

//! See `main.rs` for how to run it.

use std::any::Any;
use std::sync::Arc;

use arrow::array::{RecordBatch, StringArray};
Expand Down Expand Up @@ -207,10 +206,6 @@ impl Default for JsonGetStr {
}

impl ScalarUDFImpl for JsonGetStr {
fn as_any(&self) -> &dyn Any {
self
}

fn name(&self) -> &str {
"json_get_str"
}
Expand Down
5 changes: 0 additions & 5 deletions datafusion-examples/examples/query_planning/optimizer_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use datafusion::logical_expr::{
use datafusion::optimizer::ApplyOrder;
use datafusion::optimizer::{OptimizerConfig, OptimizerRule};
use datafusion::prelude::SessionContext;
use std::any::Any;
use std::sync::Arc;

/// This example demonstrates how to add your own [`OptimizerRule`]
Expand Down Expand Up @@ -190,10 +189,6 @@ impl MyEq {
}

impl ScalarUDFImpl for MyEq {
fn as_any(&self) -> &dyn Any {
self
}

fn name(&self) -> &str {
"my_eq"
}
Expand Down
5 changes: 0 additions & 5 deletions datafusion-examples/examples/udf/advanced_udf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

//! See `main.rs` for how to run it.

use std::any::Any;
use std::sync::Arc;

use arrow::array::{
Expand Down Expand Up @@ -66,10 +65,6 @@ impl PowUdf {

impl ScalarUDFImpl for PowUdf {
/// We implement as_any so that we can downcast the ScalarUDFImpl trait object
fn as_any(&self) -> &dyn Any {
self
}

/// Return the name of this function
fn name(&self) -> &str {
"pow"
Expand Down
6 changes: 1 addition & 5 deletions datafusion-examples/examples/udf/async_udf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//! making network requests. This can be used for tasks like fetching
//! data from an external API such as a LLM service or an external database.

use std::{any::Any, sync::Arc};
use std::sync::Arc;

use arrow::array::{ArrayRef, BooleanArray, Int64Array, RecordBatch, StringArray};
use arrow_schema::{DataType, Field, Schema};
Expand Down Expand Up @@ -160,10 +160,6 @@ impl AskLLM {
/// information for the function, such as its name, signature, and return type.
/// [async_trait]
impl ScalarUDFImpl for AskLLM {
fn as_any(&self) -> &dyn Any {
self
}

fn name(&self) -> &str {
"ask_llm"
}
Expand Down
4 changes: 0 additions & 4 deletions datafusion/core/tests/fuzz_cases/equivalence/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// specific language governing permissions and limitations
// under the License.

use std::any::Any;
use std::cmp::Ordering;
use std::sync::Arc;

Expand Down Expand Up @@ -531,9 +530,6 @@ impl TestScalarUDF {
}

impl ScalarUDFImpl for TestScalarUDF {
fn as_any(&self) -> &dyn Any {
self
}
fn name(&self) -> &str {
"test-scalar-udf"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// specific language governing permissions and limitations
// under the License.

use std::any::Any;
use std::sync::Arc;

use arrow::compute::SortOptions;
Expand Down Expand Up @@ -79,10 +78,6 @@ impl DummyUDF {
}

impl ScalarUDFImpl for DummyUDF {
fn as_any(&self) -> &dyn Any {
self
}

fn name(&self) -> &str {
"dummy_udf"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ impl TestAsyncUDFImpl {
}

impl ScalarUDFImpl for TestAsyncUDFImpl {
fn as_any(&self) -> &dyn std::any::Any {
self
}

fn name(&self) -> &str {
"test_async_udf"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// specific language governing permissions and limitations
// under the License.

use std::any::Any;
use std::collections::HashMap;
use std::hash::{Hash, Hasher};
use std::sync::Arc;
Expand Down Expand Up @@ -201,10 +200,6 @@ impl std::fmt::Debug for Simple0ArgsScalarUDF {
}

impl ScalarUDFImpl for Simple0ArgsScalarUDF {
fn as_any(&self) -> &dyn Any {
self
}

fn name(&self) -> &str {
&self.name
}
Expand Down Expand Up @@ -511,10 +506,6 @@ impl AddIndexToStringVolatileScalarUDF {
}

impl ScalarUDFImpl for AddIndexToStringVolatileScalarUDF {
fn as_any(&self) -> &dyn Any {
self
}

fn name(&self) -> &str {
&self.name
}
Expand Down Expand Up @@ -678,9 +669,6 @@ impl CastToI64UDF {
}

impl ScalarUDFImpl for CastToI64UDF {
fn as_any(&self) -> &dyn Any {
self
}
fn name(&self) -> &str {
"cast_to_i64"
}
Expand Down Expand Up @@ -800,9 +788,6 @@ impl TakeUDF {

/// Implement a ScalarUDFImpl whose return type is a function of the input values
impl ScalarUDFImpl for TakeUDF {
fn as_any(&self) -> &dyn Any {
self
}
fn name(&self) -> &str {
"take"
}
Expand Down Expand Up @@ -949,10 +934,6 @@ struct ScalarFunctionWrapper {
}

impl ScalarUDFImpl for ScalarFunctionWrapper {
fn as_any(&self) -> &dyn Any {
self
}

fn name(&self) -> &str {
&self.name
}
Expand Down Expand Up @@ -1441,10 +1422,6 @@ impl MyRegexUdf {
}

impl ScalarUDFImpl for MyRegexUdf {
fn as_any(&self) -> &dyn Any {
self
}

fn name(&self) -> &str {
"regex_udf"
}
Expand Down Expand Up @@ -1609,10 +1586,6 @@ impl MetadataBasedUdf {
}

impl ScalarUDFImpl for MetadataBasedUdf {
fn as_any(&self) -> &dyn Any {
self
}

fn name(&self) -> &str {
&self.name
}
Expand Down Expand Up @@ -1818,10 +1791,6 @@ impl Default for ExtensionBasedUdf {
}
}
impl ScalarUDFImpl for ExtensionBasedUdf {
fn as_any(&self) -> &dyn Any {
self
}

fn name(&self) -> &str {
&self.name
}
Expand Down Expand Up @@ -1988,9 +1957,6 @@ async fn test_config_options_work_for_scalar_func() -> Result<()> {
}

impl ScalarUDFImpl for TestScalarUDF {
fn as_any(&self) -> &dyn Any {
self
}
fn name(&self) -> &str {
"TestScalarUDF"
}
Expand Down Expand Up @@ -2052,10 +2018,6 @@ async fn test_extension_metadata_preserve_in_sql_values() -> Result<()> {
}

impl ScalarUDFImpl for MakeExtension {
fn as_any(&self) -> &dyn Any {
self
}

fn name(&self) -> &str {
"make_extension"
}
Expand Down Expand Up @@ -2133,10 +2095,6 @@ async fn test_extension_metadata_preserve_in_subquery() -> Result<()> {
}

impl ScalarUDFImpl for ExtensionScalarPredicate {
fn as_any(&self) -> &dyn Any {
self
}

fn name(&self) -> &str {
"extension_predicate"
}
Expand Down
14 changes: 1 addition & 13 deletions datafusion/expr/src/async_udf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl PartialEq for AsyncScalarUDF {
fn eq(&self, other: &Self) -> bool {
// Deconstruct to catch any new fields added in future
let Self { inner } = self;
inner.dyn_eq(other.inner.as_any())
inner.as_ref().dyn_eq(other.inner.as_ref() as &dyn Any)
}
}
impl Eq for AsyncScalarUDF {}
Expand Down Expand Up @@ -102,10 +102,6 @@ impl AsyncScalarUDF {
}

impl ScalarUDFImpl for AsyncScalarUDF {
fn as_any(&self) -> &dyn Any {
self
}

fn name(&self) -> &str {
self.inner.name()
}
Expand Down Expand Up @@ -156,10 +152,6 @@ mod tests {
}

impl ScalarUDFImpl for TestAsyncUDFImpl1 {
fn as_any(&self) -> &dyn std::any::Any {
self
}

fn name(&self) -> &str {
todo!()
}
Expand Down Expand Up @@ -193,10 +185,6 @@ mod tests {
}

impl ScalarUDFImpl for TestAsyncUDFImpl2 {
fn as_any(&self) -> &dyn std::any::Any {
self
}

fn name(&self) -> &str {
todo!()
}
Expand Down
8 changes: 0 additions & 8 deletions datafusion/expr/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3623,7 +3623,6 @@ mod test {
use arrow::datatypes::{Field, Schema};
use sqlparser::ast;
use sqlparser::ast::{Ident, IdentWithAlias};
use std::any::Any;

#[test]
fn infer_placeholder_in_clause() {
Expand Down Expand Up @@ -3868,9 +3867,6 @@ mod test {
signature: Signature,
}
impl ScalarUDFImpl for TestScalarUDF {
fn as_any(&self) -> &dyn Any {
self
}
fn name(&self) -> &str {
"TestScalarUDF"
}
Expand Down Expand Up @@ -4103,10 +4099,6 @@ mod test {
#[derive(Debug, PartialEq, Eq, Hash)]
struct TestUDF {}
impl ScalarUDFImpl for TestUDF {
fn as_any(&self) -> &dyn Any {
unimplemented!()
}

fn name(&self) -> &str {
unimplemented!()
}
Expand Down
4 changes: 0 additions & 4 deletions datafusion/expr/src/expr_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,10 +478,6 @@ impl SimpleScalarUDF {
}

impl ScalarUDFImpl for SimpleScalarUDF {
fn as_any(&self) -> &dyn Any {
self
}

fn name(&self) -> &str {
&self.name
}
Expand Down
Loading
Loading