Skip to content

Commit

Permalink
Minor: Remove redundant dependencies from `datafusion-functions/Cargo…
Browse files Browse the repository at this point in the history
….toml` (apache#9622)

* alamb/less_subcrate

* fix datafusion-cli/Cargo.locl
  • Loading branch information
alamb authored Mar 18, 2024
1 parent c7a72e6 commit d81e9ed
Show file tree
Hide file tree
Showing 18 changed files with 59 additions and 60 deletions.
10 changes: 4 additions & 6 deletions datafusion-cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions datafusion/functions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ path = "src/lib.rs"

[dependencies]
arrow = { workspace = true }
arrow-array = { workspace = true }
arrow-schema = { workspace = true }
base64 = { version = "0.22", optional = true }
blake2 = { version = "^0.10.2", optional = true }
blake3 = { version = "1.0", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions/benches/make_date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extern crate criterion;

use std::sync::Arc;

use arrow_array::{ArrayRef, Int32Array};
use arrow::array::{ArrayRef, Int32Array};
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use rand::rngs::ThreadRng;
use rand::Rng;
Expand Down
4 changes: 2 additions & 2 deletions datafusion/functions/benches/regx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

extern crate criterion;

use arrow_array::builder::StringBuilder;
use arrow_array::{ArrayRef, StringArray};
use arrow::array::builder::StringBuilder;
use arrow::array::{ArrayRef, StringArray};
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use datafusion_functions::regex::regexplike::regexp_like;
use datafusion_functions::regex::regexpmatch::regexp_match;
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions/benches/to_char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extern crate criterion;

use std::sync::Arc;

use arrow_array::{ArrayRef, Date32Array, StringArray};
use arrow::array::{ArrayRef, Date32Array, StringArray};
use chrono::prelude::*;
use chrono::TimeDelta;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
Expand Down
4 changes: 2 additions & 2 deletions datafusion/functions/benches/to_timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ extern crate criterion;

use std::sync::Arc;

use arrow_array::builder::StringBuilder;
use arrow_array::ArrayRef;
use arrow::array::builder::StringBuilder;
use arrow::array::ArrayRef;
use criterion::{black_box, criterion_group, criterion_main, Criterion};

use datafusion_expr::ColumnarValue;
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions/src/core/getfield.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
// specific language governing permissions and limitations
// under the License.

use arrow::array::{Scalar, StringArray};
use arrow::datatypes::DataType;
use arrow_array::{Scalar, StringArray};
use datafusion_common::cast::{as_map_array, as_struct_array};
use datafusion_common::{exec_err, ExprSchema, Result, ScalarValue};
use datafusion_expr::field_util::GetFieldAccessSchema;
Expand Down
4 changes: 2 additions & 2 deletions datafusion/functions/src/core/struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
// specific language governing permissions and limitations
// under the License.

use arrow::array::{ArrayRef, StructArray};
use arrow::datatypes::{DataType, Field, Fields};
use arrow_array::{ArrayRef, StructArray};
use datafusion_common::{exec_err, Result};
use datafusion_expr::ColumnarValue;
use datafusion_expr::{ScalarUDFImpl, Signature, Volatility};
Expand Down Expand Up @@ -102,7 +102,7 @@ impl ScalarUDFImpl for StructFunc {
#[cfg(test)]
mod tests {
use super::*;
use arrow_array::Int64Array;
use arrow::array::Int64Array;
use datafusion_common::cast::as_struct_array;
use datafusion_common::ScalarValue;

Expand Down
6 changes: 3 additions & 3 deletions datafusion/functions/src/datetime/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

use std::sync::Arc;

use arrow::compute::kernels::cast_utils::string_to_timestamp_nanos;
use arrow::datatypes::DataType;
use arrow_array::{
use arrow::array::{
Array, ArrowPrimitiveType, GenericStringArray, OffsetSizeTrait, PrimitiveArray,
};
use arrow::compute::kernels::cast_utils::string_to_timestamp_nanos;
use arrow::datatypes::DataType;
use chrono::LocalResult::Single;
use chrono::{DateTime, NaiveDateTime, TimeZone, Utc};
use itertools::Either;
Expand Down
20 changes: 10 additions & 10 deletions datafusion/functions/src/datetime/date_bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
use std::any::Any;
use std::sync::Arc;

use arrow::datatypes::DataType::{Null, Timestamp, Utf8};
use arrow::datatypes::IntervalUnit::{DayTime, MonthDayNano};
use arrow::datatypes::TimeUnit::{Microsecond, Millisecond, Nanosecond, Second};
use arrow::datatypes::{DataType, TimeUnit};
use arrow_array::temporal_conversions::NANOSECONDS;
use arrow_array::types::{
use arrow::array::temporal_conversions::NANOSECONDS;
use arrow::array::types::{
ArrowTimestampType, IntervalDayTimeType, IntervalMonthDayNanoType,
TimestampMicrosecondType, TimestampMillisecondType, TimestampNanosecondType,
TimestampSecondType,
};
use arrow_array::{ArrayRef, PrimitiveArray};
use arrow::array::{ArrayRef, PrimitiveArray};
use arrow::datatypes::DataType::{Null, Timestamp, Utf8};
use arrow::datatypes::IntervalUnit::{DayTime, MonthDayNano};
use arrow::datatypes::TimeUnit::{Microsecond, Millisecond, Nanosecond, Second};
use arrow::datatypes::{DataType, TimeUnit};
use chrono::{DateTime, Datelike, Duration, Months, TimeDelta, Utc};

use datafusion_common::cast::as_primitive_array;
Expand Down Expand Up @@ -420,10 +420,10 @@ fn date_bin_impl(
mod tests {
use std::sync::Arc;

use arrow::array::types::TimestampNanosecondType;
use arrow::array::{IntervalDayTimeArray, TimestampNanosecondArray};
use arrow::compute::kernels::cast_utils::string_to_timestamp_nanos;
use arrow::datatypes::{DataType, TimeUnit};
use arrow_array::types::TimestampNanosecondType;
use arrow_array::{IntervalDayTimeArray, TimestampNanosecondArray};
use chrono::TimeDelta;

use datafusion_common::ScalarValue;
Expand Down Expand Up @@ -695,7 +695,7 @@ mod tests {
result.data_type(),
&DataType::Timestamp(TimeUnit::Nanosecond, tz_opt.clone())
);
let left = arrow_array::cast::as_primitive_array::<
let left = arrow::array::cast::as_primitive_array::<
TimestampNanosecondType,
>(&result);
assert_eq!(left, &right);
Expand Down
4 changes: 2 additions & 2 deletions datafusion/functions/src/datetime/date_part.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
use std::any::Any;
use std::sync::Arc;

use arrow::array::types::ArrowTemporalType;
use arrow::array::{Array, ArrayRef, ArrowNumericType, Float64Array, PrimitiveArray};
use arrow::compute::cast;
use arrow::compute::kernels::temporal;
use arrow::datatypes::DataType::{Date32, Date64, Float64, Timestamp, Utf8};
use arrow::datatypes::TimeUnit::{Microsecond, Millisecond, Nanosecond, Second};
use arrow::datatypes::{DataType, TimeUnit};
use arrow_array::types::ArrowTemporalType;
use arrow_array::{Array, ArrayRef, ArrowNumericType, Float64Array, PrimitiveArray};

use datafusion_common::cast::{
as_date32_array, as_date64_array, as_timestamp_microsecond_array,
Expand Down
20 changes: 10 additions & 10 deletions datafusion/functions/src/datetime/date_trunc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ use std::ops::{Add, Sub};
use std::str::FromStr;
use std::sync::Arc;

use arrow::datatypes::DataType::{Null, Timestamp, Utf8};
use arrow::datatypes::TimeUnit::{Microsecond, Millisecond, Nanosecond, Second};
use arrow::datatypes::{DataType, TimeUnit};
use arrow_array::temporal_conversions::{
use arrow::array::temporal_conversions::{
as_datetime_with_timezone, timestamp_ns_to_datetime,
};
use arrow_array::timezone::Tz;
use arrow_array::types::{
use arrow::array::timezone::Tz;
use arrow::array::types::{
ArrowTimestampType, TimestampMicrosecondType, TimestampMillisecondType,
TimestampNanosecondType, TimestampSecondType,
};
use arrow_array::{Array, PrimitiveArray};
use arrow::array::{Array, PrimitiveArray};
use arrow::datatypes::DataType::{Null, Timestamp, Utf8};
use arrow::datatypes::TimeUnit::{Microsecond, Millisecond, Nanosecond, Second};
use arrow::datatypes::{DataType, TimeUnit};
use chrono::{
DateTime, Datelike, Duration, LocalResult, NaiveDateTime, Offset, TimeDelta, Timelike,
};
Expand Down Expand Up @@ -405,11 +405,11 @@ fn parse_tz(tz: &Option<Arc<str>>) -> Result<Option<Tz>> {
#[cfg(test)]
mod tests {
use crate::datetime::date_trunc::{date_trunc_coarse, DateTruncFunc};
use arrow::array::cast::as_primitive_array;
use arrow::array::types::TimestampNanosecondType;
use arrow::array::TimestampNanosecondArray;
use arrow::compute::kernels::cast_utils::string_to_timestamp_nanos;
use arrow::datatypes::{DataType, TimeUnit};
use arrow_array::cast::as_primitive_array;
use arrow_array::types::TimestampNanosecondType;
use arrow_array::TimestampNanosecondArray;
use datafusion_common::ScalarValue;
use datafusion_expr::{ColumnarValue, ScalarUDFImpl};
use std::sync::Arc;
Expand Down
10 changes: 5 additions & 5 deletions datafusion/functions/src/datetime/make_date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
use std::any::Any;
use std::sync::Arc;

use arrow::array::builder::PrimitiveBuilder;
use arrow::array::cast::AsArray;
use arrow::array::types::{Date32Type, Int32Type};
use arrow::array::PrimitiveArray;
use arrow::datatypes::DataType;
use arrow::datatypes::DataType::{Date32, Int32, Int64, UInt32, UInt64, Utf8};
use arrow_array::builder::PrimitiveBuilder;
use arrow_array::cast::AsArray;
use arrow_array::types::{Date32Type, Int32Type};
use arrow_array::PrimitiveArray;
use chrono::prelude::*;

use datafusion_common::{exec_err, Result, ScalarValue};
Expand Down Expand Up @@ -177,7 +177,7 @@ fn make_date_inner<F: FnMut(i32)>(
#[cfg(test)]
mod tests {
use crate::datetime::make_date::MakeDateFunc;
use arrow_array::{Array, Date32Array, Int32Array, Int64Array, UInt32Array};
use arrow::array::{Array, Date32Array, Int32Array, Int64Array, UInt32Array};
use datafusion_common::ScalarValue;
use datafusion_expr::{ColumnarValue, ScalarUDFImpl};
use std::sync::Arc;
Expand Down
15 changes: 9 additions & 6 deletions datafusion/functions/src/datetime/to_char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@
use std::any::Any;
use std::sync::Arc;

use arrow::array::cast::AsArray;
use arrow::array::{Array, ArrayRef, StringArray};
use arrow::datatypes::DataType;
use arrow::datatypes::DataType::{
Date32, Date64, Duration, Time32, Time64, Timestamp, Utf8,
};
use arrow::datatypes::TimeUnit::{Microsecond, Millisecond, Nanosecond, Second};
use arrow::error::ArrowError;
use arrow::util::display::{ArrayFormatter, DurationFormat, FormatOptions};
use arrow_array::cast::AsArray;
use arrow_array::{Array, ArrayRef, StringArray};
use arrow_schema::DataType::{Date32, Date64, Duration, Time32, Time64, Timestamp, Utf8};
use arrow_schema::TimeUnit::{Microsecond, Millisecond, Nanosecond, Second};

use datafusion_common::{exec_err, Result, ScalarValue};
use datafusion_expr::TypeSignature::Exact;
Expand Down Expand Up @@ -178,7 +181,7 @@ fn _to_char_scalar(
};

let formatter = ArrayFormatter::try_new(array.as_ref(), &format_options)?;
let formatted: Result<Vec<_>, arrow_schema::ArrowError> = (0..array.len())
let formatted: Result<Vec<_>, ArrowError> = (0..array.len())
.map(|i| formatter.value(i).try_to_string())
.collect();

Expand Down Expand Up @@ -236,7 +239,7 @@ fn _to_char_array(args: &[ColumnarValue]) -> Result<ColumnarValue> {
#[cfg(test)]
mod tests {
use crate::datetime::to_char::ToCharFunc;
use arrow_array::{
use arrow::array::{
Array, ArrayRef, Date32Array, Date64Array, StringArray, Time32MillisecondArray,
Time32SecondArray, Time64MicrosecondArray, Time64NanosecondArray,
TimestampMicrosecondArray, TimestampMillisecondArray, TimestampNanosecondArray,
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions/src/datetime/to_date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

use std::any::Any;

use arrow::array::types::Date32Type;
use arrow::datatypes::DataType;
use arrow::datatypes::DataType::Date32;
use arrow_array::types::Date32Type;

use crate::datetime::common::*;
use datafusion_common::{exec_err, internal_datafusion_err, Result};
Expand Down
8 changes: 4 additions & 4 deletions datafusion/functions/src/datetime/to_timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,13 @@ fn to_timestamp_impl<T: ArrowTimestampType + ScalarType<i64>>(
mod tests {
use std::sync::Arc;

use arrow::array::{ArrayRef, Int64Array, StringBuilder};
use arrow::datatypes::TimeUnit;
use arrow_array::types::Int64Type;
use arrow_array::{
use arrow::array::types::Int64Type;
use arrow::array::{
Array, PrimitiveArray, TimestampMicrosecondArray, TimestampMillisecondArray,
TimestampNanosecondArray, TimestampSecondArray,
};
use arrow::array::{ArrayRef, Int64Array, StringBuilder};
use arrow::datatypes::TimeUnit;
use chrono::Utc;

use datafusion_common::{assert_contains, DataFusionError, ScalarValue};
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions/src/regex/regexplike.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ mod tests {
use std::sync::Arc;

use arrow::array::BooleanBuilder;
use arrow_array::StringArray;
use arrow::array::StringArray;

use crate::regex::regexplike::regexp_like;

Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions/src/regex/regexpmatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ pub fn regexp_match<T: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef> {
#[cfg(test)]
mod tests {
use crate::regex::regexpmatch::regexp_match;
use arrow::array::StringArray;
use arrow::array::{GenericStringBuilder, ListBuilder};
use arrow_array::StringArray;
use std::sync::Arc;

#[test]
Expand Down

0 comments on commit d81e9ed

Please sign in to comment.