From c05ee9517012661c3459dc3de4db6196568851f8 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Fri, 15 Mar 2024 07:34:12 -0400 Subject: [PATCH 1/2] alamb/less_subcrate --- datafusion/functions/Cargo.toml | 2 -- datafusion/functions/benches/make_date.rs | 2 +- datafusion/functions/benches/regx.rs | 4 ++-- datafusion/functions/benches/to_char.rs | 2 +- datafusion/functions/benches/to_timestamp.rs | 4 ++-- datafusion/functions/src/core/getfield.rs | 2 +- datafusion/functions/src/core/struct.rs | 4 ++-- datafusion/functions/src/datetime/common.rs | 6 +++--- datafusion/functions/src/datetime/date_bin.rs | 20 +++++++++---------- .../functions/src/datetime/date_part.rs | 4 ++-- .../functions/src/datetime/date_trunc.rs | 20 +++++++++---------- .../functions/src/datetime/make_date.rs | 10 +++++----- datafusion/functions/src/datetime/to_char.rs | 15 ++++++++------ datafusion/functions/src/datetime/to_date.rs | 2 +- .../functions/src/datetime/to_timestamp.rs | 8 ++++---- datafusion/functions/src/regex/regexplike.rs | 2 +- datafusion/functions/src/regex/regexpmatch.rs | 2 +- 17 files changed, 55 insertions(+), 54 deletions(-) diff --git a/datafusion/functions/Cargo.toml b/datafusion/functions/Cargo.toml index d40ad60d76b6..5a6da5345d7c 100644 --- a/datafusion/functions/Cargo.toml +++ b/datafusion/functions/Cargo.toml @@ -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 } diff --git a/datafusion/functions/benches/make_date.rs b/datafusion/functions/benches/make_date.rs index 7c75277b913e..cb8f1abe6d5d 100644 --- a/datafusion/functions/benches/make_date.rs +++ b/datafusion/functions/benches/make_date.rs @@ -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; diff --git a/datafusion/functions/benches/regx.rs b/datafusion/functions/benches/regx.rs index 153cd4efe2c8..5831e263b4eb 100644 --- a/datafusion/functions/benches/regx.rs +++ b/datafusion/functions/benches/regx.rs @@ -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; diff --git a/datafusion/functions/benches/to_char.rs b/datafusion/functions/benches/to_char.rs index cb0374c95bb3..45a40f175da4 100644 --- a/datafusion/functions/benches/to_char.rs +++ b/datafusion/functions/benches/to_char.rs @@ -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}; diff --git a/datafusion/functions/benches/to_timestamp.rs b/datafusion/functions/benches/to_timestamp.rs index 31d609dee9bc..e734b6832f29 100644 --- a/datafusion/functions/benches/to_timestamp.rs +++ b/datafusion/functions/benches/to_timestamp.rs @@ -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; diff --git a/datafusion/functions/src/core/getfield.rs b/datafusion/functions/src/core/getfield.rs index 0a99cccf9e1c..e6313423867a 100644 --- a/datafusion/functions/src/core/getfield.rs +++ b/datafusion/functions/src/core/getfield.rs @@ -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; diff --git a/datafusion/functions/src/core/struct.rs b/datafusion/functions/src/core/struct.rs index 406e402ccd85..2a8622f0a1ec 100644 --- a/datafusion/functions/src/core/struct.rs +++ b/datafusion/functions/src/core/struct.rs @@ -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}; @@ -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; diff --git a/datafusion/functions/src/datetime/common.rs b/datafusion/functions/src/datetime/common.rs index e888241d2552..007ffd35ca3a 100644 --- a/datafusion/functions/src/datetime/common.rs +++ b/datafusion/functions/src/datetime/common.rs @@ -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; diff --git a/datafusion/functions/src/datetime/date_bin.rs b/datafusion/functions/src/datetime/date_bin.rs index 8472c346f183..b7f20f68e89c 100644 --- a/datafusion/functions/src/datetime/date_bin.rs +++ b/datafusion/functions/src/datetime/date_bin.rs @@ -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; @@ -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; @@ -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); diff --git a/datafusion/functions/src/datetime/date_part.rs b/datafusion/functions/src/datetime/date_part.rs index 200dcff6d46e..1f00f5bc3137 100644 --- a/datafusion/functions/src/datetime/date_part.rs +++ b/datafusion/functions/src/datetime/date_part.rs @@ -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, diff --git a/datafusion/functions/src/datetime/date_trunc.rs b/datafusion/functions/src/datetime/date_trunc.rs index 307510712686..b4b25666516d 100644 --- a/datafusion/functions/src/datetime/date_trunc.rs +++ b/datafusion/functions/src/datetime/date_trunc.rs @@ -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, }; @@ -405,11 +405,11 @@ fn parse_tz(tz: &Option>) -> Result> { #[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; diff --git a/datafusion/functions/src/datetime/make_date.rs b/datafusion/functions/src/datetime/make_date.rs index b8010f64d270..c94e21a0b89b 100644 --- a/datafusion/functions/src/datetime/make_date.rs +++ b/datafusion/functions/src/datetime/make_date.rs @@ -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}; @@ -185,7 +185,7 @@ impl ScalarUDFImpl for MakeDateFunc { #[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; diff --git a/datafusion/functions/src/datetime/to_char.rs b/datafusion/functions/src/datetime/to_char.rs index 90b3a1d35353..3ca098b1f99b 100644 --- a/datafusion/functions/src/datetime/to_char.rs +++ b/datafusion/functions/src/datetime/to_char.rs @@ -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; @@ -178,7 +181,7 @@ fn _to_char_scalar( }; let formatter = ArrayFormatter::try_new(array.as_ref(), &format_options)?; - let formatted: Result, arrow_schema::ArrowError> = (0..array.len()) + let formatted: Result, ArrowError> = (0..array.len()) .map(|i| formatter.value(i).try_to_string()) .collect(); @@ -236,7 +239,7 @@ fn _to_char_array(args: &[ColumnarValue]) -> Result { #[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, diff --git a/datafusion/functions/src/datetime/to_date.rs b/datafusion/functions/src/datetime/to_date.rs index 3756566d4204..077ad8f087b3 100644 --- a/datafusion/functions/src/datetime/to_date.rs +++ b/datafusion/functions/src/datetime/to_date.rs @@ -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}; diff --git a/datafusion/functions/src/datetime/to_timestamp.rs b/datafusion/functions/src/datetime/to_timestamp.rs index 2eb21c5cdaec..b9cf8f3c604b 100644 --- a/datafusion/functions/src/datetime/to_timestamp.rs +++ b/datafusion/functions/src/datetime/to_timestamp.rs @@ -369,13 +369,13 @@ fn to_timestamp_impl>( 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}; diff --git a/datafusion/functions/src/regex/regexplike.rs b/datafusion/functions/src/regex/regexplike.rs index b0abad318058..94dd7529e8ff 100644 --- a/datafusion/functions/src/regex/regexplike.rs +++ b/datafusion/functions/src/regex/regexplike.rs @@ -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; diff --git a/datafusion/functions/src/regex/regexpmatch.rs b/datafusion/functions/src/regex/regexpmatch.rs index f34502af35b7..5178188424fb 100644 --- a/datafusion/functions/src/regex/regexpmatch.rs +++ b/datafusion/functions/src/regex/regexpmatch.rs @@ -142,8 +142,8 @@ pub fn regexp_match(args: &[ArrayRef]) -> Result { #[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] From 993d8910fc7917d8b2e2900d6de1d01773c78b1a Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Fri, 15 Mar 2024 10:38:54 -0400 Subject: [PATCH 2/2] fix datafusion-cli/Cargo.locl --- datafusion-cli/Cargo.lock | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/datafusion-cli/Cargo.lock b/datafusion-cli/Cargo.lock index 7c6286abb83e..deda497d9dd3 100644 --- a/datafusion-cli/Cargo.lock +++ b/datafusion-cli/Cargo.lock @@ -873,9 +873,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.34" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" +checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" dependencies = [ "android-tzdata", "iana-time-zone", @@ -1247,8 +1247,6 @@ name = "datafusion-functions" version = "36.0.0" dependencies = [ "arrow", - "arrow-array", - "arrow-schema", "base64 0.22.0", "blake2", "blake3", @@ -3526,9 +3524,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" dependencies = [ "futures-core", "pin-project-lite",