This is an automated email from the ASF dual-hosted git repository.
jonah pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new d9450da699 Import Arc consistently (#12899)
d9450da699 is described below
commit d9450da6991a2977c617dfa789f208c53ba11421
Author: Piotr Findeisen <[email protected]>
AuthorDate: Tue Oct 15 08:40:34 2024 +0200
Import Arc consistently (#12899)
Just a code cleanup
In many places the qualified name is redundant since `Arc` is already
imported. In some `use` was added. In all cases `Arc` is unambiguous.
---
datafusion-examples/examples/custom_file_format.rs | 4 +--
datafusion/functions/src/regex/mod.rs | 4 ++-
.../optimizer/src/replace_distinct_aggregate.rs | 4 ++-
datafusion/physical-plan/src/metrics/value.rs | 4 +--
datafusion/proto/src/logical_plan/file_formats.rs | 30 ++++++++--------------
.../tests/cases/roundtrip_logical_plan.rs | 3 +--
6 files changed, 21 insertions(+), 28 deletions(-)
diff --git a/datafusion-examples/examples/custom_file_format.rs
b/datafusion-examples/examples/custom_file_format.rs
index 1d9b587f15..b85127d42f 100644
--- a/datafusion-examples/examples/custom_file_format.rs
+++ b/datafusion-examples/examples/custom_file_format.rs
@@ -154,7 +154,7 @@ impl FileFormatFactory for TSVFileFactory {
&self,
state: &SessionState,
format_options: &std::collections::HashMap<String, String>,
- ) -> Result<std::sync::Arc<dyn FileFormat>> {
+ ) -> Result<Arc<dyn FileFormat>> {
let mut new_options = format_options.clone();
new_options.insert("format.delimiter".to_string(), "\t".to_string());
@@ -164,7 +164,7 @@ impl FileFormatFactory for TSVFileFactory {
Ok(tsv_file_format)
}
- fn default(&self) -> std::sync::Arc<dyn FileFormat> {
+ fn default(&self) -> Arc<dyn FileFormat> {
todo!()
}
diff --git a/datafusion/functions/src/regex/mod.rs
b/datafusion/functions/src/regex/mod.rs
index 4afbe6cbbb..cde777311a 100644
--- a/datafusion/functions/src/regex/mod.rs
+++ b/datafusion/functions/src/regex/mod.rs
@@ -17,6 +17,8 @@
//! "regex" DataFusion functions
+use std::sync::Arc;
+
pub mod regexplike;
pub mod regexpmatch;
pub mod regexpreplace;
@@ -67,6 +69,6 @@ pub mod expr_fn {
}
/// Returns all DataFusion functions defined in this package
-pub fn functions() -> Vec<std::sync::Arc<datafusion_expr::ScalarUDF>> {
+pub fn functions() -> Vec<Arc<datafusion_expr::ScalarUDF>> {
vec![regexp_match(), regexp_like(), regexp_replace()]
}
diff --git a/datafusion/optimizer/src/replace_distinct_aggregate.rs
b/datafusion/optimizer/src/replace_distinct_aggregate.rs
index c026130c42..f3e1673e72 100644
--- a/datafusion/optimizer/src/replace_distinct_aggregate.rs
+++ b/datafusion/optimizer/src/replace_distinct_aggregate.rs
@@ -16,8 +16,10 @@
// under the License.
//! [`ReplaceDistinctWithAggregate`] replaces `DISTINCT ...` with `GROUP BY
...`
+
use crate::optimizer::{ApplyOrder, ApplyOrder::BottomUp};
use crate::{OptimizerConfig, OptimizerRule};
+use std::sync::Arc;
use datafusion_common::tree_node::Transformed;
use datafusion_common::{Column, Result};
@@ -110,7 +112,7 @@ impl OptimizerRule for ReplaceDistinctWithAggregate {
let expr_cnt = on_expr.len();
// Construct the aggregation expression to be used to fetch
the selected expressions.
- let first_value_udaf:
std::sync::Arc<datafusion_expr::AggregateUDF> =
+ let first_value_udaf: Arc<datafusion_expr::AggregateUDF> =
config.function_registry().unwrap().udaf("first_value")?;
let aggr_expr = select_expr.into_iter().map(|e| {
if let Some(order_by) = &sort_expr {
diff --git a/datafusion/physical-plan/src/metrics/value.rs
b/datafusion/physical-plan/src/metrics/value.rs
index 22db8f1e4e..5a335d9f99 100644
--- a/datafusion/physical-plan/src/metrics/value.rs
+++ b/datafusion/physical-plan/src/metrics/value.rs
@@ -37,7 +37,7 @@ use parking_lot::Mutex;
#[derive(Debug, Clone)]
pub struct Count {
/// value of the metric counter
- value: std::sync::Arc<AtomicUsize>,
+ value: Arc<AtomicUsize>,
}
impl PartialEq for Count {
@@ -86,7 +86,7 @@ impl Count {
#[derive(Debug, Clone)]
pub struct Gauge {
/// value of the metric gauge
- value: std::sync::Arc<AtomicUsize>,
+ value: Arc<AtomicUsize>,
}
impl PartialEq for Gauge {
diff --git a/datafusion/proto/src/logical_plan/file_formats.rs
b/datafusion/proto/src/logical_plan/file_formats.rs
index 0f9f9d335a..98034e3082 100644
--- a/datafusion/proto/src/logical_plan/file_formats.rs
+++ b/datafusion/proto/src/logical_plan/file_formats.rs
@@ -180,16 +180,14 @@ impl LogicalExtensionCodec for CsvLogicalExtensionCodec {
_table_ref: &TableReference,
_schema: arrow::datatypes::SchemaRef,
_ctx: &datafusion::prelude::SessionContext,
- ) -> datafusion_common::Result<
- std::sync::Arc<dyn datafusion::datasource::TableProvider>,
- > {
+ ) -> datafusion_common::Result<Arc<dyn
datafusion::datasource::TableProvider>> {
not_impl_err!("Method not implemented")
}
fn try_encode_table_provider(
&self,
_table_ref: &TableReference,
- _node: std::sync::Arc<dyn datafusion::datasource::TableProvider>,
+ _node: Arc<dyn datafusion::datasource::TableProvider>,
_buf: &mut Vec<u8>,
) -> datafusion_common::Result<()> {
not_impl_err!("Method not implemented")
@@ -292,16 +290,14 @@ impl LogicalExtensionCodec for JsonLogicalExtensionCodec {
_table_ref: &TableReference,
_schema: arrow::datatypes::SchemaRef,
_ctx: &datafusion::prelude::SessionContext,
- ) -> datafusion_common::Result<
- std::sync::Arc<dyn datafusion::datasource::TableProvider>,
- > {
+ ) -> datafusion_common::Result<Arc<dyn
datafusion::datasource::TableProvider>> {
not_impl_err!("Method not implemented")
}
fn try_encode_table_provider(
&self,
_table_ref: &TableReference,
- _node: std::sync::Arc<dyn datafusion::datasource::TableProvider>,
+ _node: Arc<dyn datafusion::datasource::TableProvider>,
_buf: &mut Vec<u8>,
) -> datafusion_common::Result<()> {
not_impl_err!("Method not implemented")
@@ -591,16 +587,14 @@ impl LogicalExtensionCodec for
ParquetLogicalExtensionCodec {
_table_ref: &TableReference,
_schema: arrow::datatypes::SchemaRef,
_ctx: &datafusion::prelude::SessionContext,
- ) -> datafusion_common::Result<
- std::sync::Arc<dyn datafusion::datasource::TableProvider>,
- > {
+ ) -> datafusion_common::Result<Arc<dyn
datafusion::datasource::TableProvider>> {
not_impl_err!("Method not implemented")
}
fn try_encode_table_provider(
&self,
_table_ref: &TableReference,
- _node: std::sync::Arc<dyn datafusion::datasource::TableProvider>,
+ _node: Arc<dyn datafusion::datasource::TableProvider>,
_buf: &mut Vec<u8>,
) -> datafusion_common::Result<()> {
not_impl_err!("Method not implemented")
@@ -681,16 +675,14 @@ impl LogicalExtensionCodec for ArrowLogicalExtensionCodec
{
_table_ref: &TableReference,
_schema: arrow::datatypes::SchemaRef,
_ctx: &datafusion::prelude::SessionContext,
- ) -> datafusion_common::Result<
- std::sync::Arc<dyn datafusion::datasource::TableProvider>,
- > {
+ ) -> datafusion_common::Result<Arc<dyn
datafusion::datasource::TableProvider>> {
not_impl_err!("Method not implemented")
}
fn try_encode_table_provider(
&self,
_table_ref: &TableReference,
- _node: std::sync::Arc<dyn datafusion::datasource::TableProvider>,
+ _node: Arc<dyn datafusion::datasource::TableProvider>,
_buf: &mut Vec<u8>,
) -> datafusion_common::Result<()> {
not_impl_err!("Method not implemented")
@@ -741,16 +733,14 @@ impl LogicalExtensionCodec for AvroLogicalExtensionCodec {
_table_ref: &TableReference,
_schema: arrow::datatypes::SchemaRef,
_cts: &datafusion::prelude::SessionContext,
- ) -> datafusion_common::Result<
- std::sync::Arc<dyn datafusion::datasource::TableProvider>,
- > {
+ ) -> datafusion_common::Result<Arc<dyn
datafusion::datasource::TableProvider>> {
not_impl_err!("Method not implemented")
}
fn try_encode_table_provider(
&self,
_table_ref: &TableReference,
- _node: std::sync::Arc<dyn datafusion::datasource::TableProvider>,
+ _node: Arc<dyn datafusion::datasource::TableProvider>,
_buf: &mut Vec<u8>,
) -> datafusion_common::Result<()> {
not_impl_err!("Method not implemented")
diff --git a/datafusion/substrait/tests/cases/roundtrip_logical_plan.rs
b/datafusion/substrait/tests/cases/roundtrip_logical_plan.rs
index 80caaafad6..75881a421d 100644
--- a/datafusion/substrait/tests/cases/roundtrip_logical_plan.rs
+++ b/datafusion/substrait/tests/cases/roundtrip_logical_plan.rs
@@ -69,8 +69,7 @@ impl SerializerRegistry for MockSerializerRegistry {
&self,
name: &str,
bytes: &[u8],
- ) -> Result<std::sync::Arc<dyn
datafusion::logical_expr::UserDefinedLogicalNode>>
- {
+ ) -> Result<Arc<dyn datafusion::logical_expr::UserDefinedLogicalNode>> {
if name == "MockUserDefinedLogicalPlan" {
MockUserDefinedLogicalPlan::deserialize(bytes)
} else {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]