Skip to content
Merged
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
2 changes: 1 addition & 1 deletion datafusion/catalog-listing/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ mod tests {
use std::ops::Not;

use super::*;
use datafusion_expr::{Expr, case, col, lit};
use datafusion_expr::{case, col};

#[test]
fn test_split_files() {
Expand Down
1 change: 0 additions & 1 deletion datafusion/catalog-listing/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,6 @@ mod tests {
use arrow::compute::SortOptions;
use datafusion_physical_expr::expressions::Column;
use datafusion_physical_expr_common::sort_expr::PhysicalSortExpr;
use std::sync::Arc;

/// Helper to create a PhysicalSortExpr
fn sort_expr(
Expand Down
2 changes: 0 additions & 2 deletions datafusion/common/src/scalar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5336,7 +5336,6 @@ impl ScalarType<i32> for Date32Type {

#[cfg(test)]
mod tests {
use std::sync::Arc;

use super::*;
use crate::cast::{as_list_array, as_map_array, as_struct_array};
Expand All @@ -5354,7 +5353,6 @@ mod tests {
};
use arrow::error::ArrowError;
use arrow::util::pretty::pretty_format_columns;
use chrono::NaiveDate;
use insta::assert_snapshot;
use rand::Rng;

Expand Down
2 changes: 1 addition & 1 deletion datafusion/common/src/types/logical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ mod tests {
LogicalField, LogicalFields, logical_boolean, logical_date, logical_float32,
logical_float64, logical_int32, logical_int64, logical_null, logical_string,
};
use arrow::datatypes::{DataType, Field, Fields};
use arrow::datatypes::{Field, Fields};
use insta::assert_snapshot;

#[test]
Expand Down
1 change: 0 additions & 1 deletion datafusion/common/src/types/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,6 @@ impl NativeType {
mod tests {
use super::*;
use crate::types::LogicalField;
use arrow::datatypes::Field;
use insta::assert_snapshot;

#[test]
Expand Down
1 change: 0 additions & 1 deletion datafusion/core/src/dataframe/parquet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ impl DataFrame {
#[cfg(test)]
mod tests {
use std::collections::HashMap;
use std::sync::Arc;

use super::super::Result;
use super::*;
Expand Down
4 changes: 0 additions & 4 deletions datafusion/core/src/datasource/listing_table_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,17 +557,13 @@ mod tests {

#[tokio::test]
async fn test_create_with_invalid_session() {
use async_trait::async_trait;
use datafusion_catalog::Session;
use datafusion_common::Result;
use datafusion_common::config::TableOptions;
use datafusion_execution::TaskContext;
use datafusion_execution::config::SessionConfig;
use datafusion_physical_expr::PhysicalExpr;
use datafusion_physical_plan::ExecutionPlan;
use std::any::Any;
use std::collections::HashMap;
use std::sync::Arc;

// A mock Session that is NOT SessionState
#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion datafusion/datasource-arrow/src/file_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ mod tests {
use datafusion_expr::execution_props::ExecutionProps;
use datafusion_expr::{AggregateUDF, Expr, LogicalPlan, ScalarUDF, WindowUDF};
use datafusion_physical_expr_common::physical_expr::PhysicalExpr;
use object_store::{chunked::ChunkedStore, memory::InMemory, path::Path};
use object_store::{chunked::ChunkedStore, memory::InMemory};

struct MockSession {
config: SessionConfig,
Expand Down
1 change: 0 additions & 1 deletion datafusion/datasource-json/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,6 @@ mod tests {
use arrow::datatypes::{DataType, Field, Schema};
use bytes::Bytes;
use datafusion_datasource::FileRange;
use futures::TryStreamExt;
use object_store::memory::InMemory;
use object_store::path::Path;
use object_store::{ObjectStoreExt, PutPayload};
Expand Down
2 changes: 0 additions & 2 deletions datafusion/datasource-parquet/src/file_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1808,11 +1808,9 @@ async fn output_single_parquet_file_parallelized(
#[cfg(test)]
mod tests {
use parquet::arrow::parquet_to_arrow_schema;
use std::sync::Arc;

use super::*;

use arrow::datatypes::DataType;
use parquet::schema::parser::parse_message_type;

#[test]
Expand Down
9 changes: 3 additions & 6 deletions datafusion/datasource-parquet/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,9 +793,7 @@ fn sorting_columns_to_physical_exprs(
#[cfg(test)]
mod tests {
use super::*;
use arrow::array::{ArrayRef, BooleanArray, Int32Array};
use datafusion_common::ScalarValue;
use std::sync::Arc;
use arrow::array::Int32Array;

#[test]
fn test_has_any_exact_match() {
Expand Down Expand Up @@ -847,12 +845,11 @@ mod tests {
mod ndv_tests {
use super::*;
use arrow::datatypes::Field;
use parquet::arrow::parquet_to_arrow_schema;
use parquet::basic::Type as PhysicalType;
use parquet::file::metadata::{ColumnChunkMetaData, RowGroupMetaData};
use parquet::file::metadata::ColumnChunkMetaData;
use parquet::file::reader::{FileReader, SerializedFileReader};
use parquet::file::statistics::Statistics as ParquetStatistics;
use parquet::schema::types::{SchemaDescriptor, Type as SchemaType};
use parquet::schema::types::Type as SchemaType;
use std::fs::File;
use std::path::PathBuf;

Expand Down
2 changes: 0 additions & 2 deletions datafusion/datasource-parquet/src/row_group_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,14 +651,12 @@ impl PruningStatistics for RowGroupPruningStatistics<'_> {
#[cfg(test)]
mod tests {
use std::ops::Rem;
use std::sync::Arc;

use super::*;
use crate::reader::ParquetFileReader;

use arrow::datatypes::DataType::Decimal128;
use arrow::datatypes::{DataType, Field};
use datafusion_common::Result;
use datafusion_expr::{Expr, cast, col, lit};
use datafusion_physical_expr::planner::logical2physical;
use datafusion_physical_plan::metrics::ExecutionPlanMetricsSet;
Expand Down
1 change: 0 additions & 1 deletion datafusion/datasource-parquet/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,6 @@ mod tests {
#[test]
fn test_reverse_scan_with_other_options() {
use arrow::datatypes::Schema;
use datafusion_common::config::TableParquetOptions;

let schema = Arc::new(Schema::empty());
let options = TableParquetOptions::default();
Expand Down
7 changes: 3 additions & 4 deletions datafusion/datasource/src/file_scan_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1540,13 +1540,12 @@ mod tests {
};

use arrow::datatypes::Field;
use datafusion_common::ColumnStatistics;
use datafusion_common::stats::Precision;
use datafusion_common::{ColumnStatistics, internal_err};
use datafusion_expr::{Operator, SortExpr};
use datafusion_expr::SortExpr;
use datafusion_physical_expr::create_physical_sort_expr;
use datafusion_physical_expr::expressions::{BinaryExpr, Column, Literal};
use datafusion_physical_expr::expressions::Literal;
use datafusion_physical_expr::projection::ProjectionExpr;
use datafusion_physical_expr_common::sort_expr::PhysicalSortExpr;

#[derive(Clone)]
struct InexactSortPushdownSource {
Expand Down
1 change: 0 additions & 1 deletion datafusion/datasource/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,6 @@ mod tests {
use datafusion_physical_plan::expressions::lit;

use datafusion_physical_plan::ExecutionPlan;
use futures::StreamExt;

#[tokio::test]
async fn exec_with_limit() -> Result<()> {
Expand Down
1 change: 0 additions & 1 deletion datafusion/datasource/src/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,6 @@ mod tests {
use std::any::Any;
use std::collections::HashMap;
use std::ops::Range;
use std::sync::Arc;
use tempfile::tempdir;

#[test]
Expand Down
5 changes: 0 additions & 5 deletions datafusion/execution/src/cache/cache_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,15 +507,12 @@ impl CacheManagerConfig {
#[cfg(test)]
mod tests {
use super::*;
use crate::cache::DefaultListFilesCache;

/// Test to verify that TTL is preserved when not explicitly set in config.
/// This fixes issue #19396 where TTL was being unset from DefaultListFilesCache
/// when CacheManagerConfig::list_files_cache_ttl was not set explicitly.
#[test]
fn test_ttl_preserved_when_not_set_in_config() {
use std::time::Duration;

// Create a cache with TTL = 1 second
let list_file_cache =
DefaultListFilesCache::new(1024, Some(Duration::from_secs(1)));
Expand Down Expand Up @@ -553,8 +550,6 @@ mod tests {
/// Test to verify that TTL can still be overridden when explicitly set in config.
#[test]
fn test_ttl_overridden_when_set_in_config() {
use std::time::Duration;

// Create a cache with TTL = 1 second
let list_file_cache =
DefaultListFilesCache::new(1024, Some(Duration::from_secs(1)));
Expand Down
2 changes: 0 additions & 2 deletions datafusion/execution/src/cache/cache_unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ impl FileStatisticsCache for DefaultFileStatisticsCache {
#[cfg(test)]
mod tests {
use super::*;
use crate::cache::CacheAccessor;
use crate::cache::cache_manager::{
CachedFileMetadata, FileStatisticsCache, FileStatisticsCacheEntry,
};
Expand All @@ -114,7 +113,6 @@ mod tests {
use datafusion_physical_expr_common::physical_expr::PhysicalExpr;
use datafusion_physical_expr_common::sort_expr::{LexOrdering, PhysicalSortExpr};
use object_store::ObjectMeta;
use object_store::path::Path;
use std::sync::Arc;

fn create_test_meta(path: &str, size: u64) -> ObjectMeta {
Expand Down
2 changes: 1 addition & 1 deletion datafusion/expr-common/src/casts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ fn try_cast_binary(
mod tests {
use super::*;
use arrow::compute::{CastOptions, cast_with_options};
use arrow::datatypes::{Field, Fields, TimeUnit};
use arrow::datatypes::{Field, Fields};
use std::sync::Arc;

#[derive(Debug, Clone)]
Expand Down
1 change: 0 additions & 1 deletion datafusion/expr/src/expr_rewriter/guarantees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ mod tests {
use super::*;

use crate::{Operator, col};
use datafusion_common::ScalarValue;
use datafusion_common::tree_node::TransformedResult;

#[test]
Expand Down
3 changes: 1 addition & 2 deletions datafusion/expr/src/expr_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,7 @@ mod tests {
use super::*;
use crate::{and, col, lit, not, or, out_ref_col_with_metadata, when};

use arrow::datatypes::FieldRef;
use datafusion_common::{DFSchema, ScalarValue, assert_or_internal_err};
use datafusion_common::{DFSchema, assert_or_internal_err};

macro_rules! test_is_expr_nullable {
($EXPR_TYPE:ident) => {{
Expand Down
2 changes: 1 addition & 1 deletion datafusion/expr/src/logical_plan/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2259,7 +2259,7 @@ mod tests {
use super::*;
use crate::lit_with_metadata;
use crate::logical_plan::StringifiedPlan;
use crate::{col, expr, expr_fn::exists, in_subquery, lit, scalar_subquery};
use crate::{col, expr, expr_fn::exists, in_subquery, scalar_subquery};

use crate::test::function_stub::sum;
use datafusion_common::{
Expand Down
2 changes: 1 addition & 1 deletion datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4343,7 +4343,7 @@ mod tests {
use datafusion_common::tree_node::{
TransformedResult, TreeNodeRewriter, TreeNodeVisitor,
};
use datafusion_common::{Constraint, ScalarValue, not_impl_err};
use datafusion_common::{Constraint, not_impl_err};
use insta::{assert_debug_snapshot, assert_snapshot};
use std::hash::DefaultHasher;

Expand Down
2 changes: 1 addition & 1 deletion datafusion/expr/src/type_coercion/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ mod tests {
use crate::Volatility;

use super::*;
use arrow::datatypes::{Field, IntervalUnit};
use arrow::datatypes::IntervalUnit;
use datafusion_common::{
assert_contains,
types::{logical_binary, logical_int64},
Expand Down
1 change: 0 additions & 1 deletion datafusion/expr/src/udf_eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ mod tests {
use datafusion_expr_common::columnar_value::ColumnarValue;
use datafusion_expr_common::signature::{Signature, Volatility};
use std::any::Any;
use std::hash::DefaultHasher;

#[derive(Debug, PartialEq, Eq, Hash)]
struct TestScalarUDF {
Expand Down
2 changes: 1 addition & 1 deletion datafusion/expr/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ mod tests {
test::function_stub::{max_udaf, min_udaf, sum_udaf},
};
use arrow::datatypes::{UnionFields, UnionMode};
use datafusion_expr_common::signature::{TypeSignature, Volatility};
use datafusion_expr_common::signature::Volatility;

#[test]
fn test_group_window_expr_by_sort_keys_empty_case() -> Result<()> {
Expand Down
2 changes: 0 additions & 2 deletions datafusion/ffi/src/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,11 +630,9 @@ impl Session for ForeignSession {

#[cfg(test)]
mod tests {
use std::sync::Arc;

use arrow_schema::{DataType, Field, Schema};
use datafusion::execution::SessionStateBuilder;
use datafusion_common::DataFusionError;
use datafusion_expr::col;
use datafusion_expr::registry::FunctionRegistry;
use datafusion_proto::logical_plan::DefaultLogicalExtensionCodec;
Expand Down
3 changes: 1 addition & 2 deletions datafusion/functions-aggregate-common/src/merge_arrays.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,12 @@ pub fn merge_ordered_arrays(
mod tests {
use super::*;

use std::collections::VecDeque;
use std::sync::Arc;

use arrow::array::{ArrayRef, Int64Array};

use datafusion_common::Result;
use datafusion_common::utils::get_row_at_idx;
use datafusion_common::{Result, ScalarValue};

#[test]
fn test_merge_asc() -> Result<()> {
Expand Down
4 changes: 1 addition & 3 deletions datafusion/functions-aggregate/src/array_agg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1146,13 +1146,11 @@ impl Accumulator for OrderSensitiveArrayAggAccumulator {
mod tests {
use super::*;
use arrow::array::{ListBuilder, StringBuilder};
use arrow::datatypes::{FieldRef, Schema};
use arrow::datatypes::Schema;
use datafusion_common::cast::as_generic_string_array;
use datafusion_common::internal_err;
use datafusion_physical_expr::PhysicalExpr;
use datafusion_physical_expr::expressions::Column;
use datafusion_physical_expr_common::sort_expr::PhysicalSortExpr;
use std::sync::Arc;

#[test]
fn no_duplicates_no_distinct() -> Result<()> {
Expand Down
1 change: 0 additions & 1 deletion datafusion/functions-aggregate/src/correlation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@ impl GroupsAccumulator for CorrelationGroupsAccumulator {
#[cfg(test)]
mod tests {
use super::*;
use arrow::array::{Float64Array, UInt64Array};

#[test]
fn test_accumulate_correlation_states() {
Expand Down
1 change: 0 additions & 1 deletion datafusion/functions-aggregate/src/min_max.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,6 @@ mod tests {
check(&mut max(), &[&[zero, neg_inf]], zero);
}

use datafusion_common::Result;
use rand::Rng;

fn get_random_vec_i32(len: usize) -> Vec<i32> {
Expand Down
1 change: 0 additions & 1 deletion datafusion/functions-aggregate/src/stddev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ mod tests {
use datafusion_expr::AggregateUDF;
use datafusion_functions_aggregate_common::utils::get_accum_scalar_values_as_arrays;
use datafusion_physical_expr::expressions::col;
use std::sync::Arc;

#[test]
fn stddev_f64_merge_1() -> Result<()> {
Expand Down
1 change: 0 additions & 1 deletion datafusion/functions-aggregate/src/string_agg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ mod tests {
use arrow::array::LargeStringArray;
use arrow::compute::SortOptions;
use arrow::datatypes::{Fields, Schema};
use datafusion_common::internal_err;
use datafusion_physical_expr::expressions::Column;
use datafusion_physical_expr_common::sort_expr::PhysicalSortExpr;
use std::sync::Arc;
Expand Down
1 change: 0 additions & 1 deletion datafusion/functions-window/src/lead_lag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,6 @@ mod tests {
use arrow::array::*;
use datafusion_common::cast::as_int32_array;
use datafusion_physical_expr::expressions::{Column, Literal};
use datafusion_physical_expr_common::physical_expr::PhysicalExpr;

fn test_i32_result(
expr: WindowShift,
Expand Down
2 changes: 0 additions & 2 deletions datafusion/functions-window/src/nth_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,6 @@ mod tests {
use arrow::array::*;
use datafusion_common::cast::as_int32_array;
use datafusion_physical_expr::expressions::{Column, Literal};
use datafusion_physical_expr_common::physical_expr::PhysicalExpr;
use std::sync::Arc;

fn test_i32_result(
expr: NthValue,
Expand Down
1 change: 0 additions & 1 deletion datafusion/functions-window/src/row_number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ impl PartitionEvaluator for NumRowsEvaluator {

#[cfg(test)]
mod tests {
use std::sync::Arc;

use datafusion_common::arrow::array::{Array, BooleanArray};
use datafusion_common::cast::as_uint64_array;
Expand Down
Loading
Loading