chore: update rust 2024 edition (#1371)

* Cargo fmt on rust 2024

* Update example to rust2024
diff --git a/Cargo.toml b/Cargo.toml
index f4e8575..44bb881 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,8 +24,8 @@
 description = "Apache DataFusion DataFrame and SQL Query Engine"
 readme = "README.md"
 license = "Apache-2.0"
-edition = "2021"
-rust-version = "1.78"
+edition = "2024"
+rust-version = "1.88"
 include = [
   "/src",
   "/datafusion",
diff --git a/examples/datafusion-ffi-example/Cargo.toml b/examples/datafusion-ffi-example/Cargo.toml
index d54add5..15c11ea 100644
--- a/examples/datafusion-ffi-example/Cargo.toml
+++ b/examples/datafusion-ffi-example/Cargo.toml
@@ -18,7 +18,7 @@
 [package]
 name = "datafusion-ffi-example"
 version = "0.2.0"
-edition = "2021"
+edition = "2024"
 
 [dependencies]
 datafusion-catalog = { version = "52", default-features = false }
diff --git a/examples/datafusion-ffi-example/src/aggregate_udf.rs b/examples/datafusion-ffi-example/src/aggregate_udf.rs
index 4eeb992..276ad02 100644
--- a/examples/datafusion-ffi-example/src/aggregate_udf.rs
+++ b/examples/datafusion-ffi-example/src/aggregate_udf.rs
@@ -25,7 +25,7 @@
 use datafusion_ffi::udaf::FFI_AggregateUDF;
 use datafusion_functions_aggregate::sum::Sum;
 use pyo3::types::PyCapsule;
-use pyo3::{pyclass, pymethods, Bound, PyResult, Python};
+use pyo3::{Bound, PyResult, Python, pyclass, pymethods};
 
 #[pyclass(name = "MySumUDF", module = "datafusion_ffi_example", subclass)]
 #[derive(Debug, Clone, Eq, PartialEq, Hash)]
diff --git a/examples/datafusion-ffi-example/src/catalog_provider.rs b/examples/datafusion-ffi-example/src/catalog_provider.rs
index aee2360..3dc111c 100644
--- a/examples/datafusion-ffi-example/src/catalog_provider.rs
+++ b/examples/datafusion-ffi-example/src/catalog_provider.rs
@@ -30,7 +30,7 @@
 use datafusion_ffi::catalog_provider_list::FFI_CatalogProviderList;
 use datafusion_ffi::schema_provider::FFI_SchemaProvider;
 use pyo3::types::PyCapsule;
-use pyo3::{pyclass, pymethods, Bound, PyAny, PyResult, Python};
+use pyo3::{Bound, PyAny, PyResult, Python, pyclass, pymethods};
 
 use crate::utils::ffi_logical_codec_from_pycapsule;
 
diff --git a/examples/datafusion-ffi-example/src/scalar_udf.rs b/examples/datafusion-ffi-example/src/scalar_udf.rs
index b3dd059..089d32d 100644
--- a/examples/datafusion-ffi-example/src/scalar_udf.rs
+++ b/examples/datafusion-ffi-example/src/scalar_udf.rs
@@ -20,15 +20,15 @@
 
 use arrow_array::{Array, BooleanArray};
 use arrow_schema::DataType;
-use datafusion_common::error::Result as DataFusionResult;
 use datafusion_common::ScalarValue;
+use datafusion_common::error::Result as DataFusionResult;
 use datafusion_expr::{
     ColumnarValue, ScalarFunctionArgs, ScalarUDF, ScalarUDFImpl, Signature, TypeSignature,
     Volatility,
 };
 use datafusion_ffi::udf::FFI_ScalarUDF;
 use pyo3::types::PyCapsule;
-use pyo3::{pyclass, pymethods, Bound, PyResult, Python};
+use pyo3::{Bound, PyResult, Python, pyclass, pymethods};
 
 #[pyclass(name = "IsNullUDF", module = "datafusion_ffi_example", subclass)]
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
diff --git a/examples/datafusion-ffi-example/src/table_function.rs b/examples/datafusion-ffi-example/src/table_function.rs
index 275759f..1cddb9e 100644
--- a/examples/datafusion-ffi-example/src/table_function.rs
+++ b/examples/datafusion-ffi-example/src/table_function.rs
@@ -22,7 +22,7 @@
 use datafusion_expr::Expr;
 use datafusion_ffi::udtf::FFI_TableFunction;
 use pyo3::types::PyCapsule;
-use pyo3::{pyclass, pymethods, Bound, PyAny, PyResult, Python};
+use pyo3::{Bound, PyAny, PyResult, Python, pyclass, pymethods};
 
 use crate::table_provider::MyTableProvider;
 use crate::utils::ffi_logical_codec_from_pycapsule;
diff --git a/examples/datafusion-ffi-example/src/table_provider.rs b/examples/datafusion-ffi-example/src/table_provider.rs
index a7138b0..887b2c6 100644
--- a/examples/datafusion-ffi-example/src/table_provider.rs
+++ b/examples/datafusion-ffi-example/src/table_provider.rs
@@ -24,7 +24,7 @@
 use datafusion_ffi::table_provider::FFI_TableProvider;
 use pyo3::exceptions::PyRuntimeError;
 use pyo3::types::PyCapsule;
-use pyo3::{pyclass, pymethods, Bound, PyAny, PyResult, Python};
+use pyo3::{Bound, PyAny, PyResult, Python, pyclass, pymethods};
 
 use crate::utils::ffi_logical_codec_from_pycapsule;
 
diff --git a/examples/datafusion-ffi-example/src/window_udf.rs b/examples/datafusion-ffi-example/src/window_udf.rs
index 187ea68..f3f5652 100644
--- a/examples/datafusion-ffi-example/src/window_udf.rs
+++ b/examples/datafusion-ffi-example/src/window_udf.rs
@@ -25,7 +25,7 @@
 use datafusion_ffi::udwf::FFI_WindowUDF;
 use datafusion_functions_window::rank::rank_udwf;
 use pyo3::types::PyCapsule;
-use pyo3::{pyclass, pymethods, Bound, PyResult, Python};
+use pyo3::{Bound, PyResult, Python, pyclass, pymethods};
 
 #[pyclass(name = "MyRankUDF", module = "datafusion_ffi_example", subclass)]
 #[derive(Debug, Clone, Eq, PartialEq, Hash)]
diff --git a/src/array.rs b/src/array.rs
index 4dbd708..8be9a01 100644
--- a/src/array.rs
+++ b/src/array.rs
@@ -23,7 +23,7 @@
 use arrow::pyarrow::ToPyArrow;
 use pyo3::prelude::{PyAnyMethods, PyCapsuleMethods};
 use pyo3::types::PyCapsule;
-use pyo3::{pyclass, pymethods, Bound, PyAny, PyResult, Python};
+use pyo3::{Bound, PyAny, PyResult, Python, pyclass, pymethods};
 
 use crate::errors::PyDataFusionResult;
 use crate::utils::validate_pycapsule;
diff --git a/src/catalog.rs b/src/catalog.rs
index d10d5b8..29d95ea 100644
--- a/src/catalog.rs
+++ b/src/catalog.rs
@@ -29,13 +29,13 @@
 use datafusion_ffi::catalog_provider::FFI_CatalogProvider;
 use datafusion_ffi::proto::logical_extension_codec::FFI_LogicalExtensionCodec;
 use datafusion_ffi::schema_provider::FFI_SchemaProvider;
+use pyo3::IntoPyObjectExt;
 use pyo3::exceptions::PyKeyError;
 use pyo3::prelude::*;
 use pyo3::types::PyCapsule;
-use pyo3::IntoPyObjectExt;
 
 use crate::dataset::Dataset;
-use crate::errors::{py_datafusion_err, to_datafusion_err, PyDataFusionError, PyDataFusionResult};
+use crate::errors::{PyDataFusionError, PyDataFusionResult, py_datafusion_err, to_datafusion_err};
 use crate::table::PyTable;
 use crate::utils::{
     create_logical_extension_capsule, extract_logical_extension_codec, validate_pycapsule,
diff --git a/src/context.rs b/src/context.rs
index fc3d595..336ce02 100644
--- a/src/context.rs
+++ b/src/context.rs
@@ -27,13 +27,14 @@
 use datafusion::arrow::pyarrow::PyArrowType;
 use datafusion::arrow::record_batch::RecordBatch;
 use datafusion::catalog::{CatalogProvider, CatalogProviderList};
-use datafusion::common::{exec_err, ScalarValue, TableReference};
+use datafusion::common::{ScalarValue, TableReference, exec_err};
 use datafusion::datasource::file_format::file_compression_type::FileCompressionType;
 use datafusion::datasource::file_format::parquet::ParquetFormat;
 use datafusion::datasource::listing::{
     ListingOptions, ListingTable, ListingTableConfig, ListingTableUrl,
 };
 use datafusion::datasource::{MemTable, TableProvider};
+use datafusion::execution::TaskContextProvider;
 use datafusion::execution::context::{
     DataFilePaths, SQLOptions, SessionConfig, SessionContext, TaskContext,
 };
@@ -42,7 +43,6 @@
 use datafusion::execution::options::ReadOptions;
 use datafusion::execution::runtime_env::RuntimeEnvBuilder;
 use datafusion::execution::session_state::SessionStateBuilder;
-use datafusion::execution::TaskContextProvider;
 use datafusion::prelude::{
     AvroReadOptions, CsvReadOptions, DataFrame, NdJsonReadOptions, ParquetReadOptions,
 };
@@ -52,10 +52,10 @@
 use datafusion_ffi::proto::logical_extension_codec::FFI_LogicalExtensionCodec;
 use datafusion_proto::logical_plan::DefaultLogicalExtensionCodec;
 use object_store::ObjectStore;
+use pyo3::IntoPyObjectExt;
 use pyo3::exceptions::{PyKeyError, PyValueError};
 use pyo3::prelude::*;
 use pyo3::types::{PyCapsule, PyDict, PyList, PyTuple};
-use pyo3::IntoPyObjectExt;
 use url::Url;
 use uuid::Uuid;
 
@@ -66,7 +66,7 @@
 use crate::dataframe::PyDataFrame;
 use crate::dataset::Dataset;
 use crate::errors::{
-    from_datafusion_error, py_datafusion_err, PyDataFusionError, PyDataFusionResult,
+    PyDataFusionError, PyDataFusionResult, from_datafusion_error, py_datafusion_err,
 };
 use crate::expr::sort_expr::PySortExpr;
 use crate::options::PyCsvReadOptions;
@@ -939,10 +939,10 @@
         match res {
             Ok(df) => Ok(PyDataFrame::new(df)),
             Err(e) => {
-                if let datafusion::error::DataFusionError::Plan(msg) = &e {
-                    if msg.contains("No table named") {
-                        return Err(PyKeyError::new_err(msg.to_string()));
-                    }
+                if let datafusion::error::DataFusionError::Plan(msg) = &e
+                    && msg.contains("No table named")
+                {
+                    return Err(PyKeyError::new_err(msg.to_string()));
                 }
                 Err(py_datafusion_err(e))
             }
diff --git a/src/dataframe.rs b/src/dataframe.rs
index 94105d7..fe03959 100644
--- a/src/dataframe.rs
+++ b/src/dataframe.rs
@@ -20,7 +20,7 @@
 use std::str::FromStr;
 use std::sync::Arc;
 
-use arrow::array::{new_null_array, Array, ArrayRef, RecordBatch, RecordBatchReader};
+use arrow::array::{Array, ArrayRef, RecordBatch, RecordBatchReader, new_null_array};
 use arrow::compute::can_cast_types;
 use arrow::error::ArrowError;
 use arrow::ffi::FFI_ArrowSchema;
@@ -36,23 +36,23 @@
 use datafusion::dataframe::{DataFrame, DataFrameWriteOptions};
 use datafusion::error::DataFusionError;
 use datafusion::execution::SendableRecordBatchStream;
-use datafusion::logical_expr::dml::InsertOp;
 use datafusion::logical_expr::SortExpr;
+use datafusion::logical_expr::dml::InsertOp;
 use datafusion::parquet::basic::{BrotliLevel, Compression, GzipLevel, ZstdLevel};
 use datafusion::prelude::*;
 use futures::{StreamExt, TryStreamExt};
 use parking_lot::Mutex;
+use pyo3::PyErr;
 use pyo3::exceptions::PyValueError;
 use pyo3::prelude::*;
 use pyo3::pybacked::PyBackedStr;
 use pyo3::types::{PyCapsule, PyList, PyTuple, PyTupleMethods};
-use pyo3::PyErr;
 
-use crate::errors::{py_datafusion_err, PyDataFusionError, PyDataFusionResult};
-use crate::expr::sort_expr::{to_sort_expressions, PySortExpr};
+use crate::errors::{PyDataFusionError, PyDataFusionResult, py_datafusion_err};
 use crate::expr::PyExpr;
+use crate::expr::sort_expr::{PySortExpr, to_sort_expressions};
 use crate::physical_plan::PyExecutionPlan;
-use crate::record_batch::{poll_next_batch, PyRecordBatchStream};
+use crate::record_batch::{PyRecordBatchStream, poll_next_batch};
 use crate::sql::logical::PyLogicalPlan;
 use crate::table::{PyTable, TempViewTable};
 use crate::utils::{
@@ -1328,7 +1328,10 @@
             } else if field.is_nullable() {
                 data_arrays.push(new_null_array(desired_data_type, array_size));
             } else {
-                return Err(ArrowError::CastError(format!("Attempting to cast to non-nullable and non-castable field {} during schema projection.", field.name())));
+                return Err(ArrowError::CastError(format!(
+                    "Attempting to cast to non-nullable and non-castable field {} during schema projection.",
+                    field.name()
+                )));
             }
         } else {
             if !field.is_nullable() {
diff --git a/src/dataset_exec.rs b/src/dataset_exec.rs
index a83b109..61e1544 100644
--- a/src/dataset_exec.rs
+++ b/src/dataset_exec.rs
@@ -24,8 +24,8 @@
 use datafusion::arrow::record_batch::RecordBatch;
 use datafusion::error::{DataFusionError as InnerDataFusionError, Result as DFResult};
 use datafusion::execution::context::TaskContext;
-use datafusion::logical_expr::utils::conjunction;
 use datafusion::logical_expr::Expr;
+use datafusion::logical_expr::utils::conjunction;
 use datafusion::physical_expr::{EquivalenceProperties, LexOrdering};
 use datafusion::physical_plan::execution_plan::{Boundedness, EmissionType};
 use datafusion::physical_plan::stream::RecordBatchStreamAdapter;
@@ -33,7 +33,7 @@
     DisplayAs, DisplayFormatType, ExecutionPlan, ExecutionPlanProperties, Partitioning,
     SendableRecordBatchStream, Statistics,
 };
-use futures::{stream, TryStreamExt};
+use futures::{TryStreamExt, stream};
 /// Implements a Datafusion physical ExecutionPlan that delegates to a PyArrow Dataset
 /// This actually performs the projection, filtering and scanning of a Dataset
 use pyo3::prelude::*;
diff --git a/src/errors.rs b/src/errors.rs
index 1080721..0d25c88 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -22,8 +22,8 @@
 use datafusion::arrow::error::ArrowError;
 use datafusion::error::DataFusionError as InnerDataFusionError;
 use prost::EncodeError;
-use pyo3::exceptions::{PyException, PyValueError};
 use pyo3::PyErr;
+use pyo3::exceptions::{PyException, PyValueError};
 
 pub type PyDataFusionResult<T> = std::result::Result<T, PyDataFusionError>;
 
diff --git a/src/expr.rs b/src/expr.rs
index c5776c5..9191740 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -28,12 +28,12 @@
 };
 use datafusion::logical_expr::utils::exprlist_to_fields;
 use datafusion::logical_expr::{
-    col, lit, lit_with_metadata, Between, BinaryExpr, Case, Cast, Expr, ExprFuncBuilder,
-    ExprFunctionExt, Like, LogicalPlan, Operator, TryCast, WindowFunctionDefinition,
+    Between, BinaryExpr, Case, Cast, Expr, ExprFuncBuilder, ExprFunctionExt, Like, LogicalPlan,
+    Operator, TryCast, WindowFunctionDefinition, col, lit, lit_with_metadata,
 };
+use pyo3::IntoPyObjectExt;
 use pyo3::basic::CompareOp;
 use pyo3::prelude::*;
-use pyo3::IntoPyObjectExt;
 use window::PyWindowFrame;
 
 use self::alias::PyAlias;
@@ -44,7 +44,7 @@
 use self::like::{PyILike, PyLike, PySimilarTo};
 use self::scalar_variable::PyScalarVariable;
 use crate::common::data_type::{DataTypeMap, NullTreatment, PyScalarValue, RexType};
-use crate::errors::{py_runtime_err, py_type_err, py_unsupported_variant_err, PyDataFusionResult};
+use crate::errors::{PyDataFusionResult, py_runtime_err, py_type_err, py_unsupported_variant_err};
 use crate::expr::aggregate_expr::PyAggregateFunction;
 use crate::expr::binary_expr::PyBinaryExpr;
 use crate::expr::column::PyColumn;
@@ -111,7 +111,7 @@
 pub mod values;
 pub mod window;
 
-use sort_expr::{to_sort_expressions, PySortExpr};
+use sort_expr::{PySortExpr, to_sort_expressions};
 
 /// A PyExpr that can be used on a DataFrame
 #[pyclass(frozen, name = "RawExpr", module = "datafusion.expr", subclass)]
@@ -141,15 +141,18 @@
 impl PyExpr {
     /// Return the specific expression
     fn to_variant<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
-        Python::attach(|_| {
-            match &self.expr {
+        Python::attach(|_| match &self.expr {
             Expr::Alias(alias) => Ok(PyAlias::from(alias.clone()).into_bound_py_any(py)?),
             Expr::Column(col) => Ok(PyColumn::from(col.clone()).into_bound_py_any(py)?),
             Expr::ScalarVariable(field, variables) => {
                 Ok(PyScalarVariable::new(field, variables).into_bound_py_any(py)?)
             }
             Expr::Like(value) => Ok(PyLike::from(value.clone()).into_bound_py_any(py)?),
-            Expr::Literal(value, metadata) => Ok(PyLiteral::new_with_metadata(value.clone(), metadata.clone()).into_bound_py_any(py)?),
+            Expr::Literal(value, metadata) => Ok(PyLiteral::new_with_metadata(
+                value.clone(),
+                metadata.clone(),
+            )
+            .into_bound_py_any(py)?),
             Expr::BinaryExpr(expr) => Ok(PyBinaryExpr::from(expr.clone()).into_bound_py_any(py)?),
             Expr::Not(expr) => Ok(PyNot::new(*expr.clone()).into_bound_py_any(py)?),
             Expr::IsNotNull(expr) => Ok(PyIsNotNull::new(*expr.clone()).into_bound_py_any(py)?),
@@ -159,13 +162,17 @@
             Expr::IsUnknown(expr) => Ok(PyIsUnknown::new(*expr.clone()).into_bound_py_any(py)?),
             Expr::IsNotTrue(expr) => Ok(PyIsNotTrue::new(*expr.clone()).into_bound_py_any(py)?),
             Expr::IsNotFalse(expr) => Ok(PyIsNotFalse::new(*expr.clone()).into_bound_py_any(py)?),
-            Expr::IsNotUnknown(expr) => Ok(PyIsNotUnknown::new(*expr.clone()).into_bound_py_any(py)?),
+            Expr::IsNotUnknown(expr) => {
+                Ok(PyIsNotUnknown::new(*expr.clone()).into_bound_py_any(py)?)
+            }
             Expr::Negative(expr) => Ok(PyNegative::new(*expr.clone()).into_bound_py_any(py)?),
             Expr::AggregateFunction(expr) => {
                 Ok(PyAggregateFunction::from(expr.clone()).into_bound_py_any(py)?)
             }
             Expr::SimilarTo(value) => Ok(PySimilarTo::from(value.clone()).into_bound_py_any(py)?),
-            Expr::Between(value) => Ok(between::PyBetween::from(value.clone()).into_bound_py_any(py)?),
+            Expr::Between(value) => {
+                Ok(between::PyBetween::from(value.clone()).into_bound_py_any(py)?)
+            }
             Expr::Case(value) => Ok(case::PyCase::from(value.clone()).into_bound_py_any(py)?),
             Expr::Cast(value) => Ok(cast::PyCast::from(value.clone()).into_bound_py_any(py)?),
             Expr::TryCast(value) => Ok(cast::PyTryCast::from(value.clone()).into_bound_py_any(py)?),
@@ -175,7 +182,9 @@
             Expr::WindowFunction(value) => Err(py_unsupported_variant_err(format!(
                 "Converting Expr::WindowFunction to a Python object is not implemented: {value:?}"
             ))),
-            Expr::InList(value) => Ok(in_list::PyInList::from(value.clone()).into_bound_py_any(py)?),
+            Expr::InList(value) => {
+                Ok(in_list::PyInList::from(value.clone()).into_bound_py_any(py)?)
+            }
             Expr::Exists(value) => Ok(exists::PyExists::from(value.clone()).into_bound_py_any(py)?),
             Expr::InSubquery(value) => {
                 Ok(in_subquery::PyInSubquery::from(value.clone()).into_bound_py_any(py)?)
@@ -193,11 +202,14 @@
             Expr::Placeholder(value) => {
                 Ok(placeholder::PyPlaceholder::from(value.clone()).into_bound_py_any(py)?)
             }
-            Expr::OuterReferenceColumn(data_type, column) => Err(py_unsupported_variant_err(format!(
-                "Converting Expr::OuterReferenceColumn to a Python object is not implemented: {data_type:?} - {column:?}"
-            ))),
-            Expr::Unnest(value) => Ok(unnest_expr::PyUnnestExpr::from(value.clone()).into_bound_py_any(py)?),
-        }
+            Expr::OuterReferenceColumn(data_type, column) => {
+                Err(py_unsupported_variant_err(format!(
+                    "Converting Expr::OuterReferenceColumn to a Python object is not implemented: {data_type:?} - {column:?}"
+                )))
+            }
+            Expr::Unnest(value) => {
+                Ok(unnest_expr::PyUnnestExpr::from(value.clone()).into_bound_py_any(py)?)
+            }
         })
     }
 
@@ -368,7 +380,7 @@
             Expr::ScalarSubquery(..) => RexType::ScalarSubquery,
             #[allow(deprecated)]
             Expr::Wildcard { .. } => {
-                return Err(py_unsupported_variant_err("Expr::Wildcard is unsupported"))
+                return Err(py_unsupported_variant_err("Expr::Wildcard is unsupported"));
             }
         })
     }
@@ -555,7 +567,7 @@
                 return Err(py_type_err(format!(
                     "Catch all triggered in get_operator_name: {:?}",
                     &self.expr
-                )))
+                )));
             }
         })
     }
diff --git a/src/expr/aggregate.rs b/src/expr/aggregate.rs
index 4cb41b2..9ff280f 100644
--- a/src/expr/aggregate.rs
+++ b/src/expr/aggregate.rs
@@ -18,11 +18,11 @@
 use std::fmt::{self, Display, Formatter};
 
 use datafusion::common::DataFusionError;
+use datafusion::logical_expr::Expr;
 use datafusion::logical_expr::expr::{AggregateFunction, AggregateFunctionParams, Alias};
 use datafusion::logical_expr::logical_plan::Aggregate;
-use datafusion::logical_expr::Expr;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::common::df_schema::PyDFSchema;
diff --git a/src/expr/analyze.rs b/src/expr/analyze.rs
index 05ec8dc..3aae6f3 100644
--- a/src/expr/analyze.rs
+++ b/src/expr/analyze.rs
@@ -18,8 +18,8 @@
 use std::fmt::{self, Display, Formatter};
 
 use datafusion::logical_expr::logical_plan::Analyze;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::common::df_schema::PyDFSchema;
diff --git a/src/expr/copy_to.rs b/src/expr/copy_to.rs
index 0b874e3..807104f 100644
--- a/src/expr/copy_to.rs
+++ b/src/expr/copy_to.rs
@@ -21,8 +21,8 @@
 
 use datafusion::common::file_options::file_type::FileType;
 use datafusion::logical_expr::dml::CopyTo;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::sql::logical::PyLogicalPlan;
diff --git a/src/expr/create_catalog.rs b/src/expr/create_catalog.rs
index 400246a..0131014 100644
--- a/src/expr/create_catalog.rs
+++ b/src/expr/create_catalog.rs
@@ -19,8 +19,8 @@
 use std::sync::Arc;
 
 use datafusion::logical_expr::CreateCatalog;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::common::df_schema::PyDFSchema;
diff --git a/src/expr/create_catalog_schema.rs b/src/expr/create_catalog_schema.rs
index 641e211..63ed3a2 100644
--- a/src/expr/create_catalog_schema.rs
+++ b/src/expr/create_catalog_schema.rs
@@ -19,8 +19,8 @@
 use std::sync::Arc;
 
 use datafusion::logical_expr::CreateCatalogSchema;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::common::df_schema::PyDFSchema;
diff --git a/src/expr/create_external_table.rs b/src/expr/create_external_table.rs
index 05f9249..cb4bb78 100644
--- a/src/expr/create_external_table.rs
+++ b/src/expr/create_external_table.rs
@@ -20,8 +20,8 @@
 use std::sync::Arc;
 
 use datafusion::logical_expr::CreateExternalTable;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use super::sort_expr::PySortExpr;
diff --git a/src/expr/create_function.rs b/src/expr/create_function.rs
index 2a35635..3433363 100644
--- a/src/expr/create_function.rs
+++ b/src/expr/create_function.rs
@@ -21,11 +21,11 @@
 use datafusion::logical_expr::{
     CreateFunction, CreateFunctionBody, OperateFunctionArg, Volatility,
 };
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
-use super::logical_node::LogicalNode;
 use super::PyExpr;
+use super::logical_node::LogicalNode;
 use crate::common::data_type::PyDataType;
 use crate::common::df_schema::PyDFSchema;
 use crate::sql::logical::PyLogicalPlan;
diff --git a/src/expr/create_index.rs b/src/expr/create_index.rs
index 5c37833..ebe0620 100644
--- a/src/expr/create_index.rs
+++ b/src/expr/create_index.rs
@@ -19,8 +19,8 @@
 use std::sync::Arc;
 
 use datafusion::logical_expr::CreateIndex;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use super::sort_expr::PySortExpr;
diff --git a/src/expr/create_memory_table.rs b/src/expr/create_memory_table.rs
index 7759eb4..c11a816 100644
--- a/src/expr/create_memory_table.rs
+++ b/src/expr/create_memory_table.rs
@@ -18,8 +18,8 @@
 use std::fmt::{self, Display, Formatter};
 
 use datafusion::logical_expr::CreateMemoryTable;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::sql::logical::PyLogicalPlan;
diff --git a/src/expr/create_view.rs b/src/expr/create_view.rs
index 16faaf9..52882dd 100644
--- a/src/expr/create_view.rs
+++ b/src/expr/create_view.rs
@@ -18,8 +18,8 @@
 use std::fmt::{self, Display, Formatter};
 
 use datafusion::logical_expr::{CreateView, DdlStatement, LogicalPlan};
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::errors::py_type_err;
diff --git a/src/expr/describe_table.rs b/src/expr/describe_table.rs
index 9b139ed..721c13a 100644
--- a/src/expr/describe_table.rs
+++ b/src/expr/describe_table.rs
@@ -21,8 +21,8 @@
 use arrow::datatypes::Schema;
 use arrow::pyarrow::PyArrowType;
 use datafusion::logical_expr::DescribeTable;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::common::df_schema::PyDFSchema;
diff --git a/src/expr/distinct.rs b/src/expr/distinct.rs
index 1505ec3..c7da9c7 100644
--- a/src/expr/distinct.rs
+++ b/src/expr/distinct.rs
@@ -18,8 +18,8 @@
 use std::fmt::{self, Display, Formatter};
 
 use datafusion::logical_expr::Distinct;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::sql::logical::PyLogicalPlan;
diff --git a/src/expr/dml.rs b/src/expr/dml.rs
index 091dcbc..84a34e6 100644
--- a/src/expr/dml.rs
+++ b/src/expr/dml.rs
@@ -17,8 +17,8 @@
 
 use datafusion::logical_expr::dml::InsertOp;
 use datafusion::logical_expr::{DmlStatement, WriteOp};
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::common::df_schema::PyDFSchema;
diff --git a/src/expr/drop_catalog_schema.rs b/src/expr/drop_catalog_schema.rs
index db6041a..339e119 100644
--- a/src/expr/drop_catalog_schema.rs
+++ b/src/expr/drop_catalog_schema.rs
@@ -21,9 +21,9 @@
 use datafusion::common::SchemaReference;
 use datafusion::logical_expr::DropCatalogSchema;
 use datafusion::sql::TableReference;
+use pyo3::IntoPyObjectExt;
 use pyo3::exceptions::PyValueError;
 use pyo3::prelude::*;
-use pyo3::IntoPyObjectExt;
 
 use super::logical_node::LogicalNode;
 use crate::common::df_schema::PyDFSchema;
diff --git a/src/expr/drop_function.rs b/src/expr/drop_function.rs
index 070d157..db0942a 100644
--- a/src/expr/drop_function.rs
+++ b/src/expr/drop_function.rs
@@ -19,8 +19,8 @@
 use std::sync::Arc;
 
 use datafusion::logical_expr::DropFunction;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::common::df_schema::PyDFSchema;
diff --git a/src/expr/drop_table.rs b/src/expr/drop_table.rs
index ffb56e4..9bf2c65 100644
--- a/src/expr/drop_table.rs
+++ b/src/expr/drop_table.rs
@@ -18,8 +18,8 @@
 use std::fmt::{self, Display, Formatter};
 
 use datafusion::logical_expr::logical_plan::DropTable;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::sql::logical::PyLogicalPlan;
diff --git a/src/expr/drop_view.rs b/src/expr/drop_view.rs
index 9d72f20..187865f 100644
--- a/src/expr/drop_view.rs
+++ b/src/expr/drop_view.rs
@@ -19,8 +19,8 @@
 use std::sync::Arc;
 
 use datafusion::logical_expr::DropView;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::common::df_schema::PyDFSchema;
diff --git a/src/expr/empty_relation.rs b/src/expr/empty_relation.rs
index 35c3fa7..4a9e823 100644
--- a/src/expr/empty_relation.rs
+++ b/src/expr/empty_relation.rs
@@ -18,8 +18,8 @@
 use std::fmt::{self, Display, Formatter};
 
 use datafusion::logical_expr::EmptyRelation;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::common::df_schema::PyDFSchema;
diff --git a/src/expr/explain.rs b/src/expr/explain.rs
index c6884e9..2100df5 100644
--- a/src/expr/explain.rs
+++ b/src/expr/explain.rs
@@ -17,10 +17,10 @@
 
 use std::fmt::{self, Display, Formatter};
 
-use datafusion::logical_expr::logical_plan::Explain;
 use datafusion::logical_expr::LogicalPlan;
-use pyo3::prelude::*;
+use datafusion::logical_expr::logical_plan::Explain;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::common::df_schema::PyDFSchema;
diff --git a/src/expr/extension.rs b/src/expr/extension.rs
index b4c688b..2d9ac45 100644
--- a/src/expr/extension.rs
+++ b/src/expr/extension.rs
@@ -16,8 +16,8 @@
 // under the License.
 
 use datafusion::logical_expr::Extension;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::sql::logical::PyLogicalPlan;
diff --git a/src/expr/filter.rs b/src/expr/filter.rs
index 25a1e76..bee1805 100644
--- a/src/expr/filter.rs
+++ b/src/expr/filter.rs
@@ -18,12 +18,12 @@
 use std::fmt::{self, Display, Formatter};
 
 use datafusion::logical_expr::logical_plan::Filter;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use crate::common::df_schema::PyDFSchema;
-use crate::expr::logical_node::LogicalNode;
 use crate::expr::PyExpr;
+use crate::expr::logical_node::LogicalNode;
 use crate::sql::logical::PyLogicalPlan;
 
 #[pyclass(frozen, name = "Filter", module = "datafusion.expr", subclass)]
diff --git a/src/expr/in_subquery.rs b/src/expr/in_subquery.rs
index 5cff86c..139e837 100644
--- a/src/expr/in_subquery.rs
+++ b/src/expr/in_subquery.rs
@@ -18,8 +18,8 @@
 use datafusion::logical_expr::expr::InSubquery;
 use pyo3::prelude::*;
 
-use super::subquery::PySubquery;
 use super::PyExpr;
+use super::subquery::PySubquery;
 
 #[pyclass(frozen, name = "InSubquery", module = "datafusion.expr", subclass)]
 #[derive(Clone)]
diff --git a/src/expr/join.rs b/src/expr/join.rs
index 82cc2a6..2cfd8cc 100644
--- a/src/expr/join.rs
+++ b/src/expr/join.rs
@@ -19,12 +19,12 @@
 
 use datafusion::common::NullEquality;
 use datafusion::logical_expr::logical_plan::{Join, JoinConstraint, JoinType};
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use crate::common::df_schema::PyDFSchema;
-use crate::expr::logical_node::LogicalNode;
 use crate::expr::PyExpr;
+use crate::expr::logical_node::LogicalNode;
 use crate::sql::logical::PyLogicalPlan;
 
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
diff --git a/src/expr/limit.rs b/src/expr/limit.rs
index 9318eff..aad9216 100644
--- a/src/expr/limit.rs
+++ b/src/expr/limit.rs
@@ -18,8 +18,8 @@
 use std::fmt::{self, Display, Formatter};
 
 use datafusion::logical_expr::logical_plan::Limit;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use crate::common::df_schema::PyDFSchema;
 use crate::expr::logical_node::LogicalNode;
diff --git a/src/expr/literal.rs b/src/expr/literal.rs
index 3e8e229..f97c2b4 100644
--- a/src/expr/literal.rs
+++ b/src/expr/literal.rs
@@ -17,8 +17,8 @@
 
 use datafusion::common::ScalarValue;
 use datafusion::logical_expr::expr::FieldMetadata;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use crate::errors::PyDataFusionError;
 
diff --git a/src/expr/projection.rs b/src/expr/projection.rs
index bd21418..1bce338 100644
--- a/src/expr/projection.rs
+++ b/src/expr/projection.rs
@@ -17,14 +17,14 @@
 
 use std::fmt::{self, Display, Formatter};
 
-use datafusion::logical_expr::logical_plan::Projection;
 use datafusion::logical_expr::Expr;
-use pyo3::prelude::*;
+use datafusion::logical_expr::logical_plan::Projection;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use crate::common::df_schema::PyDFSchema;
-use crate::expr::logical_node::LogicalNode;
 use crate::expr::PyExpr;
+use crate::expr::logical_node::LogicalNode;
 use crate::sql::logical::PyLogicalPlan;
 
 #[pyclass(frozen, name = "Projection", module = "datafusion.expr", subclass)]
diff --git a/src/expr/recursive_query.rs b/src/expr/recursive_query.rs
index 0e1171e..3f6d065 100644
--- a/src/expr/recursive_query.rs
+++ b/src/expr/recursive_query.rs
@@ -18,8 +18,8 @@
 use std::fmt::{self, Display, Formatter};
 
 use datafusion::logical_expr::RecursiveQuery;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::sql::logical::PyLogicalPlan;
diff --git a/src/expr/repartition.rs b/src/expr/repartition.rs
index 0b3cc4b..b4fd78b 100644
--- a/src/expr/repartition.rs
+++ b/src/expr/repartition.rs
@@ -19,11 +19,11 @@
 
 use datafusion::logical_expr::logical_plan::Repartition;
 use datafusion::logical_expr::{Expr, Partitioning};
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
-use super::logical_node::LogicalNode;
 use super::PyExpr;
+use super::logical_node::LogicalNode;
 use crate::errors::py_type_err;
 use crate::sql::logical::PyLogicalPlan;
 
diff --git a/src/expr/sort.rs b/src/expr/sort.rs
index 8914c8f..db2f870 100644
--- a/src/expr/sort.rs
+++ b/src/expr/sort.rs
@@ -19,8 +19,8 @@
 
 use datafusion::common::DataFusionError;
 use datafusion::logical_expr::logical_plan::Sort;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use crate::common::df_schema::PyDFSchema;
 use crate::expr::logical_node::LogicalNode;
diff --git a/src/expr/statement.rs b/src/expr/statement.rs
index 3d8c3c1..8f362e6 100644
--- a/src/expr/statement.rs
+++ b/src/expr/statement.rs
@@ -23,11 +23,11 @@
     Deallocate, Execute, Prepare, ResetVariable, SetVariable, TransactionAccessMode,
     TransactionConclusion, TransactionEnd, TransactionIsolationLevel, TransactionStart,
 };
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
-use super::logical_node::LogicalNode;
 use super::PyExpr;
+use super::logical_node::LogicalNode;
 use crate::sql::logical::PyLogicalPlan;
 
 #[pyclass(
diff --git a/src/expr/subquery.rs b/src/expr/subquery.rs
index 94c2583..5d50e8e 100644
--- a/src/expr/subquery.rs
+++ b/src/expr/subquery.rs
@@ -18,8 +18,8 @@
 use std::fmt::{self, Display, Formatter};
 
 use datafusion::logical_expr::Subquery;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::sql::logical::PyLogicalPlan;
diff --git a/src/expr/subquery_alias.rs b/src/expr/subquery_alias.rs
index 9bf1c9c..0170d12 100644
--- a/src/expr/subquery_alias.rs
+++ b/src/expr/subquery_alias.rs
@@ -18,8 +18,8 @@
 use std::fmt::{self, Display, Formatter};
 
 use datafusion::logical_expr::SubqueryAlias;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use super::logical_node::LogicalNode;
 use crate::common::df_schema::PyDFSchema;
diff --git a/src/expr/table_scan.rs b/src/expr/table_scan.rs
index bbf225f..94bc370 100644
--- a/src/expr/table_scan.rs
+++ b/src/expr/table_scan.rs
@@ -19,12 +19,12 @@
 
 use datafusion::common::TableReference;
 use datafusion::logical_expr::logical_plan::TableScan;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use crate::common::df_schema::PyDFSchema;
-use crate::expr::logical_node::LogicalNode;
 use crate::expr::PyExpr;
+use crate::expr::logical_node::LogicalNode;
 use crate::sql::logical::PyLogicalPlan;
 
 #[pyclass(frozen, name = "TableScan", module = "datafusion.expr", subclass)]
diff --git a/src/expr/union.rs b/src/expr/union.rs
index c74d170..41370ab 100644
--- a/src/expr/union.rs
+++ b/src/expr/union.rs
@@ -18,8 +18,8 @@
 use std::fmt::{self, Display, Formatter};
 
 use datafusion::logical_expr::logical_plan::Union;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use crate::common::df_schema::PyDFSchema;
 use crate::expr::logical_node::LogicalNode;
diff --git a/src/expr/unnest.rs b/src/expr/unnest.rs
index 7e68c15..9b7afb7 100644
--- a/src/expr/unnest.rs
+++ b/src/expr/unnest.rs
@@ -18,8 +18,8 @@
 use std::fmt::{self, Display, Formatter};
 
 use datafusion::logical_expr::logical_plan::Unnest;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use crate::common::df_schema::PyDFSchema;
 use crate::expr::logical_node::LogicalNode;
diff --git a/src/expr/values.rs b/src/expr/values.rs
index 7ae7350..d89d4f2 100644
--- a/src/expr/values.rs
+++ b/src/expr/values.rs
@@ -19,10 +19,10 @@
 
 use datafusion::logical_expr::Values;
 use pyo3::prelude::*;
-use pyo3::{pyclass, IntoPyObjectExt, PyErr, PyResult, Python};
+use pyo3::{IntoPyObjectExt, PyErr, PyResult, Python, pyclass};
 
-use super::logical_node::LogicalNode;
 use super::PyExpr;
+use super::logical_node::LogicalNode;
 use crate::common::df_schema::PyDFSchema;
 use crate::sql::logical::PyLogicalPlan;
 
diff --git a/src/expr/window.rs b/src/expr/window.rs
index b93e813..c6972b2 100644
--- a/src/expr/window.rs
+++ b/src/expr/window.rs
@@ -19,17 +19,17 @@
 
 use datafusion::common::{DataFusionError, ScalarValue};
 use datafusion::logical_expr::{Expr, Window, WindowFrame, WindowFrameBound, WindowFrameUnits};
+use pyo3::IntoPyObjectExt;
 use pyo3::exceptions::PyNotImplementedError;
 use pyo3::prelude::*;
-use pyo3::IntoPyObjectExt;
 
 use super::py_expr_list;
 use crate::common::data_type::PyScalarValue;
 use crate::common::df_schema::PyDFSchema;
-use crate::errors::{py_type_err, PyDataFusionResult};
-use crate::expr::logical_node::LogicalNode;
-use crate::expr::sort_expr::{py_sort_expr_list, PySortExpr};
+use crate::errors::{PyDataFusionResult, py_type_err};
 use crate::expr::PyExpr;
+use crate::expr::logical_node::LogicalNode;
+use crate::expr::sort_expr::{PySortExpr, py_sort_expr_list};
 use crate::sql::logical::PyLogicalPlan;
 
 #[pyclass(frozen, name = "WindowExpr", module = "datafusion.expr", subclass)]
diff --git a/src/functions.rs b/src/functions.rs
index e67781c..5c80292 100644
--- a/src/functions.rs
+++ b/src/functions.rs
@@ -24,7 +24,7 @@
 use datafusion::logical_expr::expr::{
     Alias, FieldMetadata, NullTreatment as DFNullTreatment, WindowFunction, WindowFunctionParams,
 };
-use datafusion::logical_expr::{lit, Expr, ExprFunctionExt, WindowFrame, WindowFunctionDefinition};
+use datafusion::logical_expr::{Expr, ExprFunctionExt, WindowFrame, WindowFunctionDefinition, lit};
 use datafusion::{functions, functions_aggregate, functions_window};
 use pyo3::prelude::*;
 use pyo3::wrap_pyfunction;
@@ -32,10 +32,10 @@
 use crate::common::data_type::{NullTreatment, PyScalarValue};
 use crate::context::PySessionContext;
 use crate::errors::{PyDataFusionError, PyDataFusionResult};
-use crate::expr::conditional_expr::PyCaseBuilder;
-use crate::expr::sort_expr::{to_sort_expressions, PySortExpr};
-use crate::expr::window::PyWindowFrame;
 use crate::expr::PyExpr;
+use crate::expr::conditional_expr::PyCaseBuilder;
+use crate::expr::sort_expr::{PySortExpr, to_sort_expressions};
+use crate::expr::window::PyWindowFrame;
 
 fn add_builder_fns_to_aggregate(
     agg_fn: Expr,
@@ -441,7 +441,11 @@
 expr_fn!(abs, num);
 expr_fn!(acos, num);
 expr_fn!(acosh, num);
-expr_fn!(ascii, arg1, "Returns the numeric code of the first character of the argument. In UTF8 encoding, returns the Unicode code point of the character. In other multibyte encodings, the argument must be an ASCII character.");
+expr_fn!(
+    ascii,
+    arg1,
+    "Returns the numeric code of the first character of the argument. In UTF8 encoding, returns the Unicode code point of the character. In other multibyte encodings, the argument must be an ASCII character."
+);
 expr_fn!(asin, num);
 expr_fn!(asinh, num);
 expr_fn!(atan, num);
@@ -452,7 +456,10 @@
     arg,
     "Returns number of bits in the string (8 times the octet_length)."
 );
-expr_fn_vec!(btrim, "Removes the longest string containing only characters in characters (a space by default) from the start and end of string.");
+expr_fn_vec!(
+    btrim,
+    "Removes the longest string containing only characters in characters (a space by default) from the start and end of string."
+);
 expr_fn!(cbrt, num);
 expr_fn!(ceil, num);
 expr_fn!(
@@ -475,7 +482,11 @@
 expr_fn!(factorial, num);
 expr_fn!(floor, num);
 expr_fn!(gcd, x y);
-expr_fn!(initcap, string, "Converts the first letter of each word to upper case and the rest to lower case. Words are sequences of alphanumeric characters separated by non-alphanumeric characters.");
+expr_fn!(
+    initcap,
+    string,
+    "Converts the first letter of each word to upper case and the rest to lower case. Words are sequences of alphanumeric characters separated by non-alphanumeric characters."
+);
 expr_fn!(isnan, num);
 expr_fn!(iszero, num);
 expr_fn!(levenshtein, string1 string2);
@@ -486,8 +497,14 @@
 expr_fn!(log10, num);
 expr_fn!(log2, num);
 expr_fn!(lower, arg1, "Converts the string to all lower case");
-expr_fn_vec!(lpad, "Extends the string to length length by prepending the characters fill (a space by default). If the string is already longer than length then it is truncated (on the right).");
-expr_fn_vec!(ltrim, "Removes the longest string containing only characters in characters (a space by default) from the start of string.");
+expr_fn_vec!(
+    lpad,
+    "Extends the string to length length by prepending the characters fill (a space by default). If the string is already longer than length then it is truncated (on the right)."
+);
+expr_fn_vec!(
+    ltrim,
+    "Removes the longest string containing only characters in characters (a space by default) from the start of string."
+);
 expr_fn!(
     md5,
     input_arg,
@@ -504,7 +521,11 @@
     "Returns x if x is not NULL otherwise returns y."
 );
 expr_fn!(nullif, arg_1 arg_2);
-expr_fn!(octet_length, args, "Returns number of bytes in the string. Since this version of the function accepts type character directly, it will not strip trailing spaces.");
+expr_fn!(
+    octet_length,
+    args,
+    "Returns number of bytes in the string. Since this version of the function accepts type character directly, it will not strip trailing spaces."
+);
 expr_fn_vec!(overlay);
 expr_fn!(pi);
 expr_fn!(power, base exponent);
@@ -522,8 +543,14 @@
 );
 expr_fn!(right, string n, "Returns last n characters in the string, or when n is negative, returns all but first |n| characters.");
 expr_fn_vec!(round);
-expr_fn_vec!(rpad, "Extends the string to length length by appending the characters fill (a space by default). If the string is already longer than length then it is truncated.");
-expr_fn_vec!(rtrim, "Removes the longest string containing only characters in characters (a space by default) from the end of string.");
+expr_fn_vec!(
+    rpad,
+    "Extends the string to length length by appending the characters fill (a space by default). If the string is already longer than length then it is truncated."
+);
+expr_fn_vec!(
+    rtrim,
+    "Removes the longest string containing only characters in characters (a space by default) from the end of string."
+);
 expr_fn!(sha224, input_arg1);
 expr_fn!(sha256, input_arg1);
 expr_fn!(sha384, input_arg1);
@@ -565,7 +592,10 @@
 expr_fn!(make_date, year month day);
 
 expr_fn!(translate, string from to, "Replaces each character in string that matches a character in the from set with the corresponding character in the to set. If from is longer than to, occurrences of the extra characters in from are deleted.");
-expr_fn_vec!(trim, "Removes the longest string containing only characters in characters (a space by default) from the start, end, or both ends (BOTH is the default) of string.");
+expr_fn_vec!(
+    trim,
+    "Removes the longest string containing only characters in characters (a space by default) from the start, end, or both ends (BOTH is the default) of string."
+);
 expr_fn_vec!(trunc);
 expr_fn!(upper, arg1, "Converts the string to all upper case.");
 expr_fn!(uuid);
diff --git a/src/options.rs b/src/options.rs
index a37664b..46d22b3 100644
--- a/src/options.rs
+++ b/src/options.rs
@@ -2,7 +2,7 @@
 use arrow::pyarrow::PyArrowType;
 use datafusion::prelude::CsvReadOptions;
 use pyo3::prelude::{PyModule, PyModuleMethods};
-use pyo3::{pyclass, pymethods, Bound, PyResult};
+use pyo3::{Bound, PyResult, pyclass, pymethods};
 
 use crate::context::parse_file_compression_type;
 use crate::errors::PyDataFusionError;
diff --git a/src/physical_plan.rs b/src/physical_plan.rs
index 645649e..0069e5e 100644
--- a/src/physical_plan.rs
+++ b/src/physical_plan.rs
@@ -17,7 +17,7 @@
 
 use std::sync::Arc;
 
-use datafusion::physical_plan::{displayable, ExecutionPlan, ExecutionPlanProperties};
+use datafusion::physical_plan::{ExecutionPlan, ExecutionPlanProperties, displayable};
 use datafusion_proto::physical_plan::{AsExecutionPlan, DefaultPhysicalExtensionCodec};
 use prost::Message;
 use pyo3::exceptions::PyRuntimeError;
diff --git a/src/pyarrow_filter_expression.rs b/src/pyarrow_filter_expression.rs
index c9d3df3..e3b4b60 100644
--- a/src/pyarrow_filter_expression.rs
+++ b/src/pyarrow_filter_expression.rs
@@ -22,7 +22,7 @@
 use datafusion::logical_expr::expr::InList;
 use datafusion::logical_expr::{Between, BinaryExpr, Expr, Operator};
 /// Converts a Datafusion logical plan expression (Expr) into a PyArrow compute expression
-use pyo3::{prelude::*, IntoPyObjectExt};
+use pyo3::{IntoPyObjectExt, prelude::*};
 
 use crate::errors::{PyDataFusionError, PyDataFusionResult};
 use crate::pyarrow_util::scalar_to_pyarrow;
@@ -47,7 +47,7 @@
         _ => {
             return Err(PyDataFusionError::Common(format!(
                 "Unsupported operator {operator:?}"
-            )))
+            )));
         }
     };
     Ok(py_op)
@@ -57,7 +57,7 @@
     exprs: &[Expr],
     py: Python<'py>,
 ) -> PyDataFusionResult<Vec<Bound<'py, PyAny>>> {
-    let ret = exprs
+    exprs
         .iter()
         .map(|expr| match expr {
             // TODO: should we also leverage `ScalarValue::to_pyarrow` here?
@@ -83,8 +83,7 @@
                 "Only a list of Literals are supported got {expr:?}"
             ))),
         })
-        .collect();
-    ret
+        .collect()
 }
 
 impl PyArrowFilterExpression {
diff --git a/src/record_batch.rs b/src/record_batch.rs
index 2e50ba7..e8abc64 100644
--- a/src/record_batch.rs
+++ b/src/record_batch.rs
@@ -23,7 +23,7 @@
 use futures::StreamExt;
 use pyo3::exceptions::{PyStopAsyncIteration, PyStopIteration};
 use pyo3::prelude::*;
-use pyo3::{pyclass, pymethods, PyAny, PyResult, Python};
+use pyo3::{PyAny, PyResult, Python, pyclass, pymethods};
 use tokio::sync::Mutex;
 
 use crate::errors::PyDataFusionError;
diff --git a/src/sql/util.rs b/src/sql/util.rs
index 5edff00..d1e8964 100644
--- a/src/sql/util.rs
+++ b/src/sql/util.rs
@@ -17,7 +17,7 @@
 
 use std::collections::HashMap;
 
-use datafusion::common::{exec_err, plan_datafusion_err, DataFusionError};
+use datafusion::common::{DataFusionError, exec_err, plan_datafusion_err};
 use datafusion::logical_expr::sqlparser::dialect::dialect_from_str;
 use datafusion::sql::sqlparser::dialect::Dialect;
 use datafusion::sql::sqlparser::parser::Parser;
diff --git a/src/substrait.rs b/src/substrait.rs
index 7b06aff..ea8eaf5 100644
--- a/src/substrait.rs
+++ b/src/substrait.rs
@@ -23,7 +23,7 @@
 use pyo3::types::PyBytes;
 
 use crate::context::PySessionContext;
-use crate::errors::{py_datafusion_err, PyDataFusionError, PyDataFusionResult};
+use crate::errors::{PyDataFusionError, PyDataFusionResult, py_datafusion_err};
 use crate::sql::logical::PyLogicalPlan;
 use crate::utils::wait_for_future;
 
diff --git a/src/table.rs b/src/table.rs
index f414054..0683b54 100644
--- a/src/table.rs
+++ b/src/table.rs
@@ -27,8 +27,8 @@
 use datafusion::logical_expr::{Expr, LogicalPlanBuilder, TableProviderFilterPushDown};
 use datafusion::physical_plan::ExecutionPlan;
 use datafusion::prelude::DataFrame;
-use pyo3::prelude::*;
 use pyo3::IntoPyObjectExt;
+use pyo3::prelude::*;
 
 use crate::context::PySessionContext;
 use crate::dataframe::PyDataFrame;
diff --git a/src/udaf.rs b/src/udaf.rs
index 262366a..298a59b 100644
--- a/src/udaf.rs
+++ b/src/udaf.rs
@@ -23,14 +23,14 @@
 use datafusion::common::ScalarValue;
 use datafusion::error::{DataFusionError, Result};
 use datafusion::logical_expr::{
-    create_udaf, Accumulator, AccumulatorFactoryFunction, AggregateUDF, AggregateUDFImpl,
+    Accumulator, AccumulatorFactoryFunction, AggregateUDF, AggregateUDFImpl, create_udaf,
 };
 use datafusion_ffi::udaf::FFI_AggregateUDF;
 use pyo3::prelude::*;
 use pyo3::types::{PyCapsule, PyTuple};
 
 use crate::common::data_type::PyScalarValue;
-use crate::errors::{py_datafusion_err, to_datafusion_err, PyDataFusionResult};
+use crate::errors::{PyDataFusionResult, py_datafusion_err, to_datafusion_err};
 use crate::expr::PyExpr;
 use crate::utils::{parse_volatility, validate_pycapsule};
 
diff --git a/src/udf.rs b/src/udf.rs
index 3eec936..e1f8291 100644
--- a/src/udf.rs
+++ b/src/udf.rs
@@ -21,7 +21,7 @@
 
 use arrow::datatypes::{Field, FieldRef};
 use arrow::pyarrow::ToPyArrow;
-use datafusion::arrow::array::{make_array, ArrayData};
+use datafusion::arrow::array::{ArrayData, make_array};
 use datafusion::arrow::datatypes::DataType;
 use datafusion::arrow::pyarrow::{FromPyArrow, PyArrowType};
 use datafusion::common::internal_err;
@@ -35,7 +35,7 @@
 use pyo3::types::{PyCapsule, PyTuple};
 
 use crate::array::PyArrowArrayExportable;
-use crate::errors::{py_datafusion_err, to_datafusion_err, PyDataFusionResult};
+use crate::errors::{PyDataFusionResult, py_datafusion_err, to_datafusion_err};
 use crate::expr::PyExpr;
 use crate::utils::{parse_volatility, validate_pycapsule};
 
diff --git a/src/udtf.rs b/src/udtf.rs
index eee0046..24cf258 100644
--- a/src/udtf.rs
+++ b/src/udtf.rs
@@ -21,10 +21,10 @@
 use datafusion::error::Result as DataFusionResult;
 use datafusion::logical_expr::Expr;
 use datafusion_ffi::udtf::FFI_TableFunction;
+use pyo3::IntoPyObjectExt;
 use pyo3::exceptions::{PyImportError, PyTypeError};
 use pyo3::prelude::*;
 use pyo3::types::{PyCapsule, PyTuple, PyType};
-use pyo3::IntoPyObjectExt;
 
 use crate::context::PySessionContext;
 use crate::errors::{py_datafusion_err, to_datafusion_err};
diff --git a/src/udwf.rs b/src/udwf.rs
index 8631060..b5b795d 100644
--- a/src/udwf.rs
+++ b/src/udwf.rs
@@ -19,7 +19,7 @@
 use std::ops::Range;
 use std::sync::Arc;
 
-use arrow::array::{make_array, Array, ArrayData, ArrayRef};
+use arrow::array::{Array, ArrayData, ArrayRef, make_array};
 use datafusion::arrow::datatypes::DataType;
 use datafusion::arrow::pyarrow::{FromPyArrow, PyArrowType, ToPyArrow};
 use datafusion::error::{DataFusionError, Result};
@@ -36,7 +36,7 @@
 use pyo3::types::{PyCapsule, PyList, PyTuple};
 
 use crate::common::data_type::PyScalarValue;
-use crate::errors::{py_datafusion_err, to_datafusion_err, PyDataFusionResult};
+use crate::errors::{PyDataFusionResult, py_datafusion_err, to_datafusion_err};
 use crate::expr::PyExpr;
 use crate::utils::{parse_volatility, validate_pycapsule};
 
diff --git a/src/unparser/mod.rs b/src/unparser/mod.rs
index 908b59d..203e334 100644
--- a/src/unparser/mod.rs
+++ b/src/unparser/mod.rs
@@ -19,8 +19,8 @@
 
 use std::sync::Arc;
 
-use datafusion::sql::unparser::dialect::Dialect;
 use datafusion::sql::unparser::Unparser;
+use datafusion::sql::unparser::dialect::Dialect;
 use dialect::PyDialect;
 use pyo3::exceptions::PyValueError;
 use pyo3::prelude::*;
diff --git a/src/utils.rs b/src/utils.rs
index eede349..311f8fc 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -25,18 +25,18 @@
 use datafusion::logical_expr::Volatility;
 use datafusion_ffi::proto::logical_extension_codec::FFI_LogicalExtensionCodec;
 use datafusion_ffi::table_provider::FFI_TableProvider;
+use pyo3::IntoPyObjectExt;
 use pyo3::exceptions::{PyImportError, PyTypeError, PyValueError};
 use pyo3::prelude::*;
 use pyo3::types::{PyCapsule, PyType};
-use pyo3::IntoPyObjectExt;
 use tokio::runtime::Runtime;
 use tokio::task::JoinHandle;
 use tokio::time::sleep;
 
+use crate::TokioRuntime;
 use crate::common::data_type::PyScalarValue;
 use crate::context::PySessionContext;
-use crate::errors::{py_datafusion_err, to_datafusion_err, PyDataFusionError, PyDataFusionResult};
-use crate::TokioRuntime;
+use crate::errors::{PyDataFusionError, PyDataFusionResult, py_datafusion_err, to_datafusion_err};
 
 /// Utility to get the Tokio Runtime from Python
 #[inline]
@@ -147,7 +147,7 @@
             return Err(PyDataFusionError::Common(format!(
                 "Unsupported volatility type: `{value}`, supported \
                  values are: immutable, stable and volatile."
-            )))
+            )));
         }
     })
 }
@@ -224,10 +224,8 @@
         None => PySessionContext::global_ctx()?.into_bound_py_any(py)?,
     };
     let capsule = if obj.hasattr("__datafusion_logical_extension_codec__")? {
-        let capsule = obj
-            .getattr("__datafusion_logical_extension_codec__")?
-            .call0()?;
-        capsule
+        obj.getattr("__datafusion_logical_extension_codec__")?
+            .call0()?
     } else {
         obj
     };