diff --git a/arrow-cast/Cargo.toml b/arrow-cast/Cargo.toml index a62e25eb9a57..4046f5226094 100644 --- a/arrow-cast/Cargo.toml +++ b/arrow-cast/Cargo.toml @@ -77,7 +77,3 @@ harness = false [[bench]] name = "parse_decimal" harness = false - -[[bench]] -name = "cast_decimal" -harness = false diff --git a/arrow-cast/benches/cast_decimal.rs b/arrow-cast/benches/cast_decimal.rs deleted file mode 100644 index cc85fc171137..000000000000 --- a/arrow-cast/benches/cast_decimal.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -use arrow_array::{ArrayRef, Decimal128Array}; -use arrow_cast::{cast_with_options, CastOptions}; -use arrow_schema::DataType; -use criterion::*; -use std::sync::Arc; - -fn criterion_benchmark(c: &mut Criterion) { - let decimals: ArrayRef = Arc::new( - Decimal128Array::from(vec![ - 0, - 1234, - -1234, - 1234567, - -1234567, - i128::MAX, - i128::MIN, - ]) - .with_precision_and_scale(24, 2) - .unwrap(), - ); - let options = CastOptions::default(); - let d = black_box(decimals); - c.bench_function("cast_decimal", |b| { - b.iter(|| cast_with_options(&d, &DataType::Decimal128(6, 2), &options).unwrap()); - }); -} - -criterion_group!(benches, criterion_benchmark); -criterion_main!(benches); diff --git a/arrow/benches/cast_kernels.rs b/arrow/benches/cast_kernels.rs index ec7990d3d764..5c4fcff13dee 100644 --- a/arrow/benches/cast_kernels.rs +++ b/arrow/benches/cast_kernels.rs @@ -250,6 +250,9 @@ fn add_benchmark(c: &mut Criterion) { c.bench_function("cast decimal128 to decimal128 512", |b| { b.iter(|| cast_array(&decimal128_array, DataType::Decimal128(30, 5))) }); + c.bench_function("cast decimal128 to decimal128 512 lower precision", |b| { + b.iter(|| cast_array(&decimal128_array, DataType::Decimal128(6, 5))) + }); c.bench_function("cast decimal128 to decimal256 512", |b| { b.iter(|| cast_array(&decimal128_array, DataType::Decimal256(50, 5))) });