You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2023/04/25 18:01:07 UTC

[arrow-datafusion] branch main updated: Update to arrow 38 (#6115)

This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 451e81eafe Update to arrow 38 (#6115)
451e81eafe is described below

commit 451e81eafe5e404de50f6ede1bebf25ed90f5eb0
Author: Raphael Taylor-Davies <17...@users.noreply.github.com>
AuthorDate: Tue Apr 25 14:01:01 2023 -0400

    Update to arrow 38 (#6115)
    
    * Update to arrow 38
    
    * Further fixes
    
    * Update sqllogictest
---
 Cargo.toml                                         |  12 +-
 datafusion-cli/Cargo.lock                          |  60 +++++-----
 datafusion-cli/Cargo.toml                          |   2 +-
 datafusion-examples/examples/flight_sql_server.rs  |  26 ++++-
 datafusion/common/src/scalar.rs                    |  22 ++--
 .../core/src/physical_plan/file_format/json.rs     |   6 +-
 datafusion/core/src/physical_plan/sorts/sort.rs    |   2 +-
 .../sqllogictests/test_files/arrow_typeof.slt      |   2 +-
 datafusion/physical-expr/src/expressions/binary.rs | 124 +++++++++++----------
 9 files changed, 141 insertions(+), 115 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index c5100041b2..7c1e13500c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -46,12 +46,12 @@ repository = "https://github.com/apache/arrow-datafusion"
 rust-version = "1.64"
 
 [workspace.dependencies]
-arrow = { version = "37.0.0", features = ["prettyprint"] }
-arrow-flight = { version = "37.0.0", features = ["flight-sql-experimental"] }
-arrow-buffer = { version = "37.0.0", default-features = false }
-arrow-schema = { version = "37.0.0", default-features = false }
-arrow-array = { version = "37.0.0", default-features = false, features = ["chrono-tz"] }
-parquet = { version = "37.0.0", features = ["arrow", "async"] }
+arrow = { version = "38.0.0", features = ["prettyprint"] }
+arrow-flight = { version = "38.0.0", features = ["flight-sql-experimental"] }
+arrow-buffer = { version = "38.0.0", default-features = false }
+arrow-schema = { version = "38.0.0", default-features = false }
+arrow-array = { version = "38.0.0", default-features = false, features = ["chrono-tz"] }
+parquet = { version = "38.0.0", features = ["arrow", "async"] }
 
 [profile.release]
 codegen-units = 1
diff --git a/datafusion-cli/Cargo.lock b/datafusion-cli/Cargo.lock
index 556a296274..dd541ab2f8 100644
--- a/datafusion-cli/Cargo.lock
+++ b/datafusion-cli/Cargo.lock
@@ -68,9 +68,9 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
 
 [[package]]
 name = "arrow"
-version = "37.0.0"
+version = "38.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1aea9fcb25bbb70f7f922f95b99ca29c1013dab47f6df61a6f24861842dd7f2e"
+checksum = "c107a57b5913d852da9d5a40e280e4695f2258b5b87733c13b770c63a7117287"
 dependencies = [
  "ahash",
  "arrow-arith",
@@ -90,9 +90,9 @@ dependencies = [
 
 [[package]]
 name = "arrow-arith"
-version = "37.0.0"
+version = "38.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8d967b42f7b12c91fd78acd396b20c2973b184c8866846674abbb00c963e93ab"
+checksum = "ace6aa3d5617c5d03041a05e01c6819428a8ddf49dd0b055df9b40fef9d96094"
 dependencies = [
  "arrow-array",
  "arrow-buffer",
@@ -105,9 +105,9 @@ dependencies = [
 
 [[package]]
 name = "arrow-array"
-version = "37.0.0"
+version = "38.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3190f208ee7aa0f3596fa0098d42911dec5e123ca88c002a08b24877ad14c71e"
+checksum = "104a04520692cc674e6afd7682f213ca41f9b13ff1873f63a5a2857a590b87b3"
 dependencies = [
  "ahash",
  "arrow-buffer",
@@ -122,9 +122,9 @@ dependencies = [
 
 [[package]]
 name = "arrow-buffer"
-version = "37.0.0"
+version = "38.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d33c733c5b6c44a0fc526f29c09546e04eb56772a7a21e48e602f368be381f6"
+checksum = "72c875bcb9530ec403998fb0b2dc6d180a7c64563ca4bc22b90eafb84b113143"
 dependencies = [
  "half",
  "num",
@@ -132,9 +132,9 @@ dependencies = [
 
 [[package]]
 name = "arrow-cast"
-version = "37.0.0"
+version = "38.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "abd349520b6a1ed4924ae2afc9d23330a3044319e4ec3d5b124c09e4d440ae87"
+checksum = "d6d6e18281636c8fc0b93be59834da6bf9a72bb70fd0c98ddfdaf124da466c28"
 dependencies = [
  "arrow-array",
  "arrow-buffer",
@@ -149,9 +149,9 @@ dependencies = [
 
 [[package]]
 name = "arrow-csv"
-version = "37.0.0"
+version = "38.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c80af3c3e290a2a7e1cc518f1471dff331878cb4af9a5b088bf030b89debf649"
+checksum = "3197dab0963a236ff8e7c82e2272535745955ac1321eb740c29f2f88b353f54e"
 dependencies = [
  "arrow-array",
  "arrow-buffer",
@@ -168,9 +168,9 @@ dependencies = [
 
 [[package]]
 name = "arrow-data"
-version = "37.0.0"
+version = "38.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1c8361947aaa96d331da9df3f7a08bdd8ab805a449994c97f5c4d24c4b7e2cf"
+checksum = "eb68113d6ecdbe8bba48b2c4042c151bf9e1c61244e45072a50250a6fc59bafe"
 dependencies = [
  "arrow-buffer",
  "arrow-schema",
@@ -180,9 +180,9 @@ dependencies = [
 
 [[package]]
 name = "arrow-ipc"
-version = "37.0.0"
+version = "38.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a46ee000b9fbd1e8db6e8b26acb8c760838512b39d8c9f9d73892cb55351d50"
+checksum = "eab4bbf2dd3078facb5ce0a9641316a64f42bfd8cf357e6775c8a5e6708e3a8d"
 dependencies = [
  "arrow-array",
  "arrow-buffer",
@@ -194,9 +194,9 @@ dependencies = [
 
 [[package]]
 name = "arrow-json"
-version = "37.0.0"
+version = "38.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4bf2366607be867ced681ad7f272371a5cf1fc2941328eef7b4fee14565166fb"
+checksum = "48c5b650d23746a494665d914a7fa3d21d939153cff9d53bdebe39bffa88f263"
 dependencies = [
  "arrow-array",
  "arrow-buffer",
@@ -214,9 +214,9 @@ dependencies = [
 
 [[package]]
 name = "arrow-ord"
-version = "37.0.0"
+version = "38.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "304069901c867200e21ec868ae7521165875470ef2f1f6d58f979a443d63997e"
+checksum = "68c6fce28e5011e30acc7466b5efcb8ed0197c396240bd2b10e167f275a3c208"
 dependencies = [
  "arrow-array",
  "arrow-buffer",
@@ -229,9 +229,9 @@ dependencies = [
 
 [[package]]
 name = "arrow-row"
-version = "37.0.0"
+version = "38.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d57fe8ceef3392fdd493269d8a2d589de17bafce151aacbffbddac7a57f441a"
+checksum = "f20a421f19799d8b93eb8edde5217e910fa1e2d6ceb3c529f000e57b6db144c0"
 dependencies = [
  "ahash",
  "arrow-array",
@@ -244,15 +244,15 @@ dependencies = [
 
 [[package]]
 name = "arrow-schema"
-version = "37.0.0"
+version = "38.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a16b88a93ac8350f0200b1cd336a1f887315925b8dd7aa145a37b8bdbd8497a4"
+checksum = "bc85923d8d6662cc66ac6602c7d1876872e671002d60993dfdf492a6badeae92"
 
 [[package]]
 name = "arrow-select"
-version = "37.0.0"
+version = "38.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "98e8a4d6ca37d5212439b24caad4d80743fcbb706706200dd174bb98e68fe9d8"
+checksum = "f6ab6613ce65b61d85a3410241744e84e48fbab0fe06e1251b4429d21b3470fd"
 dependencies = [
  "arrow-array",
  "arrow-buffer",
@@ -263,9 +263,9 @@ dependencies = [
 
 [[package]]
 name = "arrow-string"
-version = "37.0.0"
+version = "38.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cbb594efa397eb6a546f42b1f8df3d242ea84dbfda5232e06035dc2b2e2c8459"
+checksum = "f3008641239e884aefba66d8b8532da6af40d14296349fcc85935de4ba67b89e"
 dependencies = [
  "arrow-array",
  "arrow-buffer",
@@ -1817,9 +1817,9 @@ dependencies = [
 
 [[package]]
 name = "parquet"
-version = "37.0.0"
+version = "38.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5022d98333271f4ca3e87bab760498e61726bf5a6ca919123c80517e20ded29"
+checksum = "4cbd51311f8d9ff3d2697b1522b18a588782e097d313a1a278b0faf2ccf2d3f6"
 dependencies = [
  "ahash",
  "arrow-array",
diff --git a/datafusion-cli/Cargo.toml b/datafusion-cli/Cargo.toml
index 69d676d632..d20f4f8a9e 100644
--- a/datafusion-cli/Cargo.toml
+++ b/datafusion-cli/Cargo.toml
@@ -29,7 +29,7 @@ rust-version = "1.62"
 readme = "README.md"
 
 [dependencies]
-arrow = "37.0.0"
+arrow = "38.0.0"
 async-trait = "0.1.41"
 clap = { version = "3", features = ["derive", "cargo"] }
 datafusion = { path = "../datafusion/core", version = "23.0.0" }
diff --git a/datafusion-examples/examples/flight_sql_server.rs b/datafusion-examples/examples/flight_sql_server.rs
index a2a2fc0881..db5e9ce517 100644
--- a/datafusion-examples/examples/flight_sql_server.rs
+++ b/datafusion-examples/examples/flight_sql_server.rs
@@ -26,9 +26,9 @@ use arrow_flight::sql::{
     ActionCreatePreparedStatementResult, Any, CommandGetCatalogs,
     CommandGetCrossReference, CommandGetDbSchemas, CommandGetExportedKeys,
     CommandGetImportedKeys, CommandGetPrimaryKeys, CommandGetSqlInfo,
-    CommandGetTableTypes, CommandGetTables, CommandPreparedStatementQuery,
-    CommandPreparedStatementUpdate, CommandStatementQuery, CommandStatementUpdate,
-    ProstMessageExt, SqlInfo, TicketStatementQuery,
+    CommandGetTableTypes, CommandGetTables, CommandGetXdbcTypeInfo,
+    CommandPreparedStatementQuery, CommandPreparedStatementUpdate, CommandStatementQuery,
+    CommandStatementUpdate, ProstMessageExt, SqlInfo, TicketStatementQuery,
 };
 use arrow_flight::{
     Action, FlightData, FlightDescriptor, FlightEndpoint, FlightInfo, HandshakeRequest,
@@ -408,6 +408,17 @@ impl FlightSqlService for FlightSqlServiceImpl {
         ))
     }
 
+    async fn get_flight_info_xdbc_type_info(
+        &self,
+        _query: CommandGetXdbcTypeInfo,
+        _request: Request<FlightDescriptor>,
+    ) -> Result<Response<FlightInfo>, Status> {
+        info!("get_flight_info_xdbc_type_info");
+        Err(Status::unimplemented(
+            "Implement get_flight_info_xdbc_type_info",
+        ))
+    }
+
     async fn do_get_statement(
         &self,
         _ticket: TicketStatementQuery,
@@ -507,6 +518,15 @@ impl FlightSqlService for FlightSqlServiceImpl {
         Err(Status::unimplemented("Implement do_get_cross_reference"))
     }
 
+    async fn do_get_xdbc_type_info(
+        &self,
+        _query: CommandGetXdbcTypeInfo,
+        _request: Request<Ticket>,
+    ) -> Result<Response<<Self as FlightService>::DoGetStream>, Status> {
+        info!("do_get_xdbc_type_info");
+        Err(Status::unimplemented("Implement do_get_xdbc_type_info"))
+    }
+
     async fn do_put_statement_update(
         &self,
         _ticket: CommandStatementUpdate,
diff --git a/datafusion/common/src/scalar.rs b/datafusion/common/src/scalar.rs
index 4a6acdb4a0..0d436fa5c0 100644
--- a/datafusion/common/src/scalar.rs
+++ b/datafusion/common/src/scalar.rs
@@ -1472,7 +1472,7 @@ fn dict_from_scalar<K: ArrowDictionaryKeyType>(
     // APIs and skipping validation, if it every comes up in
     // performance traces.
     Arc::new(
-        DictionaryArray::<K>::try_new(&key_array, &values_array)
+        DictionaryArray::<K>::try_new(key_array, values_array)
             // should always be valid by construction above
             .expect("Can not construct dictionary array"),
     )
@@ -1480,7 +1480,7 @@ fn dict_from_scalar<K: ArrowDictionaryKeyType>(
 
 /// Create a dictionary array representing all the values in values
 fn dict_from_values<K: ArrowDictionaryKeyType>(
-    values_array: &dyn Array,
+    values_array: ArrayRef,
 ) -> Result<ArrayRef> {
     // Create a key array with `size` elements of 0..array_len for all
     // non-null value elements
@@ -1508,7 +1508,7 @@ fn dict_from_values<K: ArrowDictionaryKeyType>(
     // Note: this path could be made faster by using the ArrayData
     // APIs and skipping validation, if it every comes up in
     // performance traces.
-    let dict_array = DictionaryArray::<K>::try_new(&key_array, values_array)?;
+    let dict_array = DictionaryArray::<K>::try_new(key_array, values_array)?;
     Ok(Arc::new(dict_array))
 }
 
@@ -2406,14 +2406,14 @@ impl ScalarValue {
                 assert_eq!(values.data_type(), value_type.as_ref());
 
                 match key_type.as_ref() {
-                    DataType::Int8 => dict_from_values::<Int8Type>(&values)?,
-                    DataType::Int16 => dict_from_values::<Int16Type>(&values)?,
-                    DataType::Int32 => dict_from_values::<Int32Type>(&values)?,
-                    DataType::Int64 => dict_from_values::<Int64Type>(&values)?,
-                    DataType::UInt8 => dict_from_values::<UInt8Type>(&values)?,
-                    DataType::UInt16 => dict_from_values::<UInt16Type>(&values)?,
-                    DataType::UInt32 => dict_from_values::<UInt32Type>(&values)?,
-                    DataType::UInt64 => dict_from_values::<UInt64Type>(&values)?,
+                    DataType::Int8 => dict_from_values::<Int8Type>(values)?,
+                    DataType::Int16 => dict_from_values::<Int16Type>(values)?,
+                    DataType::Int32 => dict_from_values::<Int32Type>(values)?,
+                    DataType::Int64 => dict_from_values::<Int64Type>(values)?,
+                    DataType::UInt8 => dict_from_values::<UInt8Type>(values)?,
+                    DataType::UInt16 => dict_from_values::<UInt16Type>(values)?,
+                    DataType::UInt32 => dict_from_values::<UInt32Type>(values)?,
+                    DataType::UInt64 => dict_from_values::<UInt64Type>(values)?,
                     _ => unreachable!("Invalid dictionary keys type: {:?}", key_type),
                 }
             }
diff --git a/datafusion/core/src/physical_plan/file_format/json.rs b/datafusion/core/src/physical_plan/file_format/json.rs
index 95d9785666..61ca912ef9 100644
--- a/datafusion/core/src/physical_plan/file_format/json.rs
+++ b/datafusion/core/src/physical_plan/file_format/json.rs
@@ -33,7 +33,7 @@ use arrow::{datatypes::SchemaRef, json};
 use bytes::{Buf, Bytes};
 
 use crate::physical_plan::common::AbortOnDropSingle;
-use arrow::json::RawReaderBuilder;
+use arrow::json::ReaderBuilder;
 use futures::{ready, stream, StreamExt, TryStreamExt};
 use object_store::{GetResult, ObjectStore};
 use std::any::Any;
@@ -198,13 +198,13 @@ impl FileOpener for JsonOpener {
             match store.get(file_meta.location()).await? {
                 GetResult::File(file, _) => {
                     let bytes = file_compression_type.convert_read(file)?;
-                    let reader = RawReaderBuilder::new(schema)
+                    let reader = ReaderBuilder::new(schema)
                         .with_batch_size(batch_size)
                         .build(BufReader::new(bytes))?;
                     Ok(futures::stream::iter(reader).boxed())
                 }
                 GetResult::Stream(s) => {
-                    let mut decoder = RawReaderBuilder::new(schema)
+                    let mut decoder = ReaderBuilder::new(schema)
                         .with_batch_size(batch_size)
                         .build_decoder()?;
 
diff --git a/datafusion/core/src/physical_plan/sorts/sort.rs b/datafusion/core/src/physical_plan/sorts/sort.rs
index 1651ed1c6c..9196f520ad 100644
--- a/datafusion/core/src/physical_plan/sorts/sort.rs
+++ b/datafusion/core/src/physical_plan/sorts/sort.rs
@@ -1089,7 +1089,7 @@ mod tests {
     #[tokio::test]
     async fn test_sort_fetch_memory_calculation() -> Result<()> {
         // This test mirrors down the size from the example above.
-        let avg_batch_size = 6000;
+        let avg_batch_size = 5000;
         let partitions = 4;
 
         // A tuple of (fetch, expect_spillage)
diff --git a/datafusion/core/tests/sqllogictests/test_files/arrow_typeof.slt b/datafusion/core/tests/sqllogictests/test_files/arrow_typeof.slt
index b17521aeea..42c586f3c9 100644
--- a/datafusion/core/tests/sqllogictests/test_files/arrow_typeof.slt
+++ b/datafusion/core/tests/sqllogictests/test_files/arrow_typeof.slt
@@ -303,7 +303,7 @@ select arrow_cast('30 minutes', 'Interval(MonthDayNano)');
 
 ## Duration
 
-query error DataFusion error: Error during planning: Cannot automatically convert Interval\(MonthDayNano\) to Duration\(Second\)
+query error DataFusion error: This feature is not implemented: Can't create a scalar from array of type "Duration\(Second\)"
 ---
 select arrow_cast(interval '30 minutes', 'Duration(Second)');
 
diff --git a/datafusion/physical-expr/src/expressions/binary.rs b/datafusion/physical-expr/src/expressions/binary.rs
index b1e5c9a2d6..5a82be5e2e 100644
--- a/datafusion/physical-expr/src/expressions/binary.rs
+++ b/datafusion/physical-expr/src/expressions/binary.rs
@@ -2616,11 +2616,11 @@ mod tests {
 
         let a = Int32Array::from(vec![1, 2, 3, 4, 5]);
         let keys = Int8Array::from(vec![Some(0), None, Some(1), Some(3), None]);
-        let a = DictionaryArray::try_new(&keys, &a)?;
+        let a = DictionaryArray::try_new(keys, Arc::new(a))?;
 
         let b = Int32Array::from(vec![1, 2, 4, 8, 16]);
         let keys = Int8Array::from(vec![0, 1, 1, 2, 1]);
-        let b = DictionaryArray::try_new(&keys, &b)?;
+        let b = DictionaryArray::try_new(keys, Arc::new(b))?;
 
         apply_arithmetic::<Int32Type>(
             Arc::new(schema),
@@ -2664,13 +2664,13 @@ mod tests {
             ],
             10,
             0,
-        )) as ArrayRef;
+        ));
 
         let keys = Int8Array::from(vec![Some(0), Some(2), None, Some(3), Some(0)]);
-        let a = DictionaryArray::try_new(&keys, &decimal_array)?;
+        let a = DictionaryArray::try_new(keys, decimal_array)?;
 
         let keys = Int8Array::from(vec![Some(0), None, Some(3), Some(2), Some(2)]);
-        let decimal_array = create_decimal_array(
+        let decimal_array = Arc::new(create_decimal_array(
             &[
                 Some(value + 1),
                 Some(value + 3),
@@ -2679,8 +2679,8 @@ mod tests {
             ],
             10,
             0,
-        );
-        let b = DictionaryArray::try_new(&keys, &decimal_array)?;
+        ));
+        let b = DictionaryArray::try_new(keys, decimal_array)?;
 
         apply_arithmetic(
             Arc::new(schema),
@@ -2763,18 +2763,18 @@ mod tests {
             &[Some(value), None, Some(value - 1), Some(value + 1)],
             10,
             0,
-        )) as ArrayRef;
+        ));
 
         let keys = Int8Array::from(vec![0, 2, 1, 3, 0]);
-        let a = DictionaryArray::try_new(&keys, &decimal_array)?;
+        let a = DictionaryArray::try_new(keys, decimal_array)?;
 
         let keys = Int8Array::from(vec![0, 2, 1, 3, 0]);
-        let decimal_array = create_decimal_array(
+        let decimal_array = Arc::new(create_decimal_array(
             &[Some(value + 1), None, Some(value), Some(value + 2)],
             11,
             0,
-        );
-        let expected = DictionaryArray::try_new(&keys, &decimal_array)?;
+        ));
+        let expected = DictionaryArray::try_new(keys, decimal_array)?;
 
         apply_arithmetic_scalar(
             Arc::new(schema),
@@ -2835,11 +2835,11 @@ mod tests {
 
         let a = Int32Array::from(vec![1, 2, 3, 4, 5]);
         let keys = Int8Array::from(vec![Some(0), None, Some(1), Some(3), None]);
-        let a = DictionaryArray::try_new(&keys, &a)?;
+        let a = DictionaryArray::try_new(keys, Arc::new(a))?;
 
         let b = Int32Array::from(vec![1, 2, 4, 8, 16]);
         let keys = Int8Array::from(vec![0, 1, 1, 2, 1]);
-        let b = DictionaryArray::try_new(&keys, &b)?;
+        let b = DictionaryArray::try_new(keys, Arc::new(b))?;
 
         apply_arithmetic::<Int32Type>(
             Arc::new(schema),
@@ -2883,13 +2883,13 @@ mod tests {
             ],
             10,
             0,
-        )) as ArrayRef;
+        ));
 
         let keys = Int8Array::from(vec![Some(0), Some(2), None, Some(3), Some(0)]);
-        let a = DictionaryArray::try_new(&keys, &decimal_array)?;
+        let a = DictionaryArray::try_new(keys, decimal_array)?;
 
         let keys = Int8Array::from(vec![Some(0), None, Some(3), Some(2), Some(2)]);
-        let decimal_array = create_decimal_array(
+        let decimal_array = Arc::new(create_decimal_array(
             &[
                 Some(value + 1),
                 Some(value + 3),
@@ -2898,8 +2898,8 @@ mod tests {
             ],
             10,
             0,
-        );
-        let b = DictionaryArray::try_new(&keys, &decimal_array)?;
+        ));
+        let b = DictionaryArray::try_new(keys, decimal_array)?;
 
         apply_arithmetic(
             Arc::new(schema),
@@ -2982,18 +2982,18 @@ mod tests {
             &[Some(value), None, Some(value - 1), Some(value + 1)],
             10,
             0,
-        )) as ArrayRef;
+        ));
 
         let keys = Int8Array::from(vec![0, 2, 1, 3, 0]);
-        let a = DictionaryArray::try_new(&keys, &decimal_array)?;
+        let a = DictionaryArray::try_new(keys, decimal_array)?;
 
         let keys = Int8Array::from(vec![0, 2, 1, 3, 0]);
-        let decimal_array = create_decimal_array(
+        let decimal_array = Arc::new(create_decimal_array(
             &[Some(value - 1), None, Some(value - 2), Some(value)],
             11,
             0,
-        );
-        let expected = DictionaryArray::try_new(&keys, &decimal_array)?;
+        ));
+        let expected = DictionaryArray::try_new(keys, decimal_array)?;
 
         apply_arithmetic_scalar(
             Arc::new(schema),
@@ -3046,11 +3046,11 @@ mod tests {
 
         let a = Int32Array::from(vec![1, 2, 3, 4, 5]);
         let keys = Int8Array::from(vec![Some(0), None, Some(1), Some(3), None]);
-        let a = DictionaryArray::try_new(&keys, &a)?;
+        let a = DictionaryArray::try_new(keys, Arc::new(a))?;
 
         let b = Int32Array::from(vec![1, 2, 4, 8, 16]);
         let keys = Int8Array::from(vec![0, 1, 1, 2, 1]);
-        let b = DictionaryArray::try_new(&keys, &b)?;
+        let b = DictionaryArray::try_new(keys, Arc::new(b))?;
 
         apply_arithmetic::<Int32Type>(
             Arc::new(schema),
@@ -3097,10 +3097,10 @@ mod tests {
         )) as ArrayRef;
 
         let keys = Int8Array::from(vec![Some(0), Some(2), None, Some(3), Some(0)]);
-        let a = DictionaryArray::try_new(&keys, &decimal_array)?;
+        let a = DictionaryArray::try_new(keys, decimal_array)?;
 
         let keys = Int8Array::from(vec![Some(0), None, Some(3), Some(2), Some(2)]);
-        let decimal_array = create_decimal_array(
+        let decimal_array = Arc::new(create_decimal_array(
             &[
                 Some(value + 1),
                 Some(value + 3),
@@ -3109,8 +3109,8 @@ mod tests {
             ],
             10,
             0,
-        );
-        let b = DictionaryArray::try_new(&keys, &decimal_array)?;
+        ));
+        let b = DictionaryArray::try_new(keys, decimal_array)?;
 
         apply_arithmetic(
             Arc::new(schema),
@@ -3197,15 +3197,18 @@ mod tests {
             &[Some(value), None, Some(value - 1), Some(value + 1)],
             10,
             0,
-        )) as ArrayRef;
+        ));
 
         let keys = Int8Array::from(vec![0, 2, 1, 3, 0]);
-        let a = DictionaryArray::try_new(&keys, &decimal_array)?;
+        let a = DictionaryArray::try_new(keys, decimal_array)?;
 
         let keys = Int8Array::from(vec![0, 2, 1, 3, 0]);
-        let decimal_array =
-            create_decimal_array(&[Some(246), None, Some(244), Some(248)], 21, 0);
-        let expected = DictionaryArray::try_new(&keys, &decimal_array)?;
+        let decimal_array = Arc::new(create_decimal_array(
+            &[Some(246), None, Some(244), Some(248)],
+            21,
+            0,
+        ));
+        let expected = DictionaryArray::try_new(keys, decimal_array)?;
 
         apply_arithmetic_scalar(
             Arc::new(schema),
@@ -3268,7 +3271,7 @@ mod tests {
 
         let b = Int32Array::from(vec![1, 2, 4, 8, 16]);
         let keys = Int8Array::from(vec![0, 1, 1, 2, 1]);
-        let b = DictionaryArray::try_new(&keys, &b)?;
+        let b = DictionaryArray::try_new(keys, Arc::new(b))?;
 
         apply_arithmetic::<Int32Type>(
             Arc::new(schema),
@@ -3312,13 +3315,13 @@ mod tests {
             ],
             10,
             0,
-        )) as ArrayRef;
+        ));
 
         let keys = Int8Array::from(vec![Some(0), Some(2), None, Some(3), Some(0)]);
-        let a = DictionaryArray::try_new(&keys, &decimal_array)?;
+        let a = DictionaryArray::try_new(keys, decimal_array)?;
 
         let keys = Int8Array::from(vec![Some(0), None, Some(3), Some(2), Some(2)]);
-        let decimal_array = create_decimal_array(
+        let decimal_array = Arc::new(create_decimal_array(
             &[
                 Some(value + 1),
                 Some(value + 3),
@@ -3327,8 +3330,8 @@ mod tests {
             ],
             10,
             0,
-        );
-        let b = DictionaryArray::try_new(&keys, &decimal_array)?;
+        ));
+        let b = DictionaryArray::try_new(keys, decimal_array)?;
 
         apply_arithmetic(
             Arc::new(schema),
@@ -3421,13 +3424,13 @@ mod tests {
             &[Some(value), None, Some(value - 1), Some(value + 1)],
             10,
             0,
-        )) as ArrayRef;
+        ));
 
         let keys = Int8Array::from(vec![0, 2, 1, 3, 0]);
-        let a = DictionaryArray::try_new(&keys, &decimal_array)?;
+        let a = DictionaryArray::try_new(keys, decimal_array)?;
 
         let keys = Int8Array::from(vec![0, 2, 1, 3, 0]);
-        let decimal_array = create_decimal_array(
+        let decimal_array = Arc::new(create_decimal_array(
             &[
                 Some(6150000000000),
                 None,
@@ -3436,8 +3439,8 @@ mod tests {
             ],
             21,
             11,
-        );
-        let expected = DictionaryArray::try_new(&keys, &decimal_array)?;
+        ));
+        let expected = DictionaryArray::try_new(keys, decimal_array)?;
 
         apply_arithmetic_scalar(
             Arc::new(schema),
@@ -3500,7 +3503,7 @@ mod tests {
 
         let b = Int32Array::from(vec![1, 2, 4, 8, 16]);
         let keys = Int8Array::from(vec![0, 1, 1, 2, 1]);
-        let b = DictionaryArray::try_new(&keys, &b)?;
+        let b = DictionaryArray::try_new(keys, Arc::new(b))?;
 
         apply_arithmetic::<Int32Type>(
             Arc::new(schema),
@@ -3544,13 +3547,13 @@ mod tests {
             ],
             10,
             0,
-        )) as ArrayRef;
+        ));
 
         let keys = Int8Array::from(vec![Some(0), Some(2), None, Some(3), Some(0)]);
-        let a = DictionaryArray::try_new(&keys, &decimal_array)?;
+        let a = DictionaryArray::try_new(keys, decimal_array)?;
 
         let keys = Int8Array::from(vec![Some(0), None, Some(3), Some(2), Some(2)]);
-        let decimal_array = create_decimal_array(
+        let decimal_array = Arc::new(create_decimal_array(
             &[
                 Some(value + 1),
                 Some(value + 3),
@@ -3559,8 +3562,8 @@ mod tests {
             ],
             10,
             0,
-        );
-        let b = DictionaryArray::try_new(&keys, &decimal_array)?;
+        ));
+        let b = DictionaryArray::try_new(keys, decimal_array)?;
 
         apply_arithmetic(
             Arc::new(schema),
@@ -3643,15 +3646,18 @@ mod tests {
             &[Some(value), None, Some(value - 1), Some(value + 1)],
             10,
             0,
-        )) as ArrayRef;
+        ));
 
         let keys = Int8Array::from(vec![0, 2, 1, 3, 0]);
-        let a = DictionaryArray::try_new(&keys, &decimal_array)?;
+        let a = DictionaryArray::try_new(keys, decimal_array)?;
 
         let keys = Int8Array::from(vec![0, 2, 1, 3, 0]);
-        let decimal_array =
-            create_decimal_array(&[Some(1), None, Some(0), Some(0)], 10, 0);
-        let expected = DictionaryArray::try_new(&keys, &decimal_array)?;
+        let decimal_array = Arc::new(create_decimal_array(
+            &[Some(1), None, Some(0), Some(0)],
+            10,
+            0,
+        ));
+        let expected = DictionaryArray::try_new(keys, decimal_array)?;
 
         apply_arithmetic_scalar(
             Arc::new(schema),
@@ -4393,11 +4399,11 @@ mod tests {
             ],
             25,
             3,
-        )) as ArrayRef;
+        ));
 
         let keys = Int8Array::from(vec![Some(0), None, Some(2), Some(3)]);
         let dictionary =
-            Arc::new(DictionaryArray::try_new(&keys, &decimal_array)?) as ArrayRef;
+            Arc::new(DictionaryArray::try_new(keys, decimal_array)?) as ArrayRef;
 
         // array = scalar
         apply_logic_op_arr_scalar(