Skip to content

Deprecated the public expose of test_util package #7375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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: 2 additions & 0 deletions arrow-integration-testing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use arrow::datatypes::{DataType, Field, Fields, Schema};
use arrow::error::{ArrowError, Result};
use arrow::ffi::{from_ffi_and_data_type, FFI_ArrowArray, FFI_ArrowSchema};
use arrow::record_batch::RecordBatch;
#[allow(deprecated)]
use arrow::util::test_util::arrow_test_data;
use arrow_integration_test::*;
use std::collections::HashMap;
Expand Down Expand Up @@ -148,6 +149,7 @@ pub fn open_json_file(json_name: &str) -> Result<ArrowFile> {
///
/// Returns the contents of
/// `arrow-ipc-stream/integration/0.17.1/generated_union.json.gz`
#[allow(deprecated)]
pub fn read_gzip_json(version: &str, path: &str) -> ArrowJson {
use flate2::read::GzDecoder;
use std::io::Read;
Expand Down
6 changes: 6 additions & 0 deletions arrow-integration-testing/tests/ipc_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@

use arrow::error::ArrowError;
use arrow::ipc::reader::{FileReader, StreamDecoder, StreamReader};
#[allow(deprecated)]
use arrow::util::test_util::arrow_test_data;
use arrow_buffer::Buffer;
use arrow_integration_testing::read_gzip_json;
use std::fs::File;
use std::io::Read;

#[test]
#[allow(deprecated)]
fn read_0_1_4() {
let testdata = arrow_test_data();
let version = "0.14.1";
Expand All @@ -48,6 +50,7 @@ fn read_0_1_4() {
}

#[test]
#[allow(deprecated)]
fn read_0_1_7() {
let testdata = arrow_test_data();
let version = "0.17.1";
Expand All @@ -59,6 +62,7 @@ fn read_0_1_7() {
}

#[test]
#[allow(deprecated)]
fn read_1_0_0_bigendian() {
let testdata = arrow_test_data();
let paths = [
Expand Down Expand Up @@ -90,6 +94,7 @@ fn read_1_0_0_bigendian() {
}

#[test]
#[allow(deprecated)]
fn read_1_0_0_littleendian() {
let testdata = arrow_test_data();
let version = "1.0.0-littleendian";
Expand Down Expand Up @@ -125,6 +130,7 @@ fn read_1_0_0_littleendian() {
}

#[test]
#[allow(deprecated)]
fn read_2_0_0_compression() {
let testdata = arrow_test_data();
let version = "2.0.0-compression";
Expand Down
5 changes: 5 additions & 0 deletions arrow-integration-testing/tests/ipc_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
use arrow::ipc;
use arrow::ipc::reader::{FileReader, StreamReader};
use arrow::ipc::writer::{FileWriter, IpcWriteOptions, StreamWriter};
#[allow(deprecated)]
use arrow::util::test_util::arrow_test_data;
use arrow_integration_testing::read_gzip_json;
use std::fs::File;
use std::io::Seek;

#[test]
#[allow(deprecated)]
fn write_0_1_4() {
let testdata = arrow_test_data();
let version = "0.14.1";
Expand All @@ -45,6 +47,7 @@ fn write_0_1_4() {
}

#[test]
#[allow(deprecated)]
fn write_0_1_7() {
let testdata = arrow_test_data();
let version = "0.17.1";
Expand All @@ -56,6 +59,7 @@ fn write_0_1_7() {
}

#[test]
#[allow(deprecated)]
fn write_1_0_0_littleendian() {
let testdata = arrow_test_data();
let version = "1.0.0-littleendian";
Expand Down Expand Up @@ -91,6 +95,7 @@ fn write_1_0_0_littleendian() {
}

#[test]
#[allow(deprecated)]
fn write_2_0_0_compression() {
let testdata = arrow_test_data();
let version = "2.0.0-compression";
Expand Down
2 changes: 2 additions & 0 deletions arrow/benches/bitwise_kernel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use rand::RngCore;
extern crate arrow;

use arrow::util::bench_util::create_primitive_array;
#[allow(deprecated)]
use arrow::util::test_util::seedable_rng;

fn bitwise_array_benchmark(c: &mut Criterion) {
Expand Down Expand Up @@ -75,6 +76,7 @@ fn bitwise_array_benchmark(c: &mut Criterion) {
group.finish();
}

#[allow(deprecated)]
fn bitwise_array_scalar_benchmark(c: &mut Criterion) {
let size = 64 * 1024_usize;
let array_without_null = create_primitive_array::<Int64Type>(size, 0 as f32);
Expand Down
3 changes: 3 additions & 0 deletions arrow/benches/buffer_create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#[macro_use]
extern crate criterion;
#[allow(deprecated)]
use arrow::util::test_util::seedable_rng;
use criterion::Criterion;
use rand::distr::Uniform;
Expand Down Expand Up @@ -108,6 +109,7 @@ fn from_slice(data: &[Vec<u32>], capacity: usize) -> Buffer {
})
}

#[allow(deprecated)]
fn create_data(size: usize) -> Vec<Vec<u32>> {
let rng = &mut seedable_rng();
let range = Uniform::new(0, 33).unwrap();
Expand All @@ -123,6 +125,7 @@ fn create_data(size: usize) -> Vec<Vec<u32>> {
.collect()
}

#[allow(deprecated)]
fn create_data_bool(size: usize) -> Vec<Vec<bool>> {
let rng = &mut seedable_rng();
let range = Uniform::new(0, 33).unwrap();
Expand Down
2 changes: 2 additions & 0 deletions arrow/benches/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use criterion::*;
use rand::distr::StandardUniform;

use arrow::array::*;
#[allow(deprecated)]
use arrow::util::test_util::seedable_rng;
use arrow_buffer::i256;
use rand::Rng;
Expand Down Expand Up @@ -66,6 +67,7 @@ fn bench_primitive_nulls(c: &mut Criterion) {
group.finish();
}

#[allow(deprecated)]
fn bench_bool(c: &mut Criterion) {
let data: Vec<bool> = seedable_rng()
.sample_iter(&StandardUniform)
Expand Down
5 changes: 5 additions & 0 deletions arrow/benches/cast_kernels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use arrow::array::*;
use arrow::compute::cast;
use arrow::datatypes::*;
use arrow::util::bench_util::*;
#[allow(deprecated)]
use arrow::util::test_util::seedable_rng;

fn build_array<T: ArrowPrimitiveType>(size: usize) -> ArrayRef
Expand All @@ -40,6 +41,7 @@ where
Arc::new(array)
}

#[allow(deprecated)]
fn build_utf8_date_array(size: usize, with_nulls: bool) -> ArrayRef {
use chrono::NaiveDate;

Expand All @@ -62,6 +64,7 @@ fn build_utf8_date_array(size: usize, with_nulls: bool) -> ArrayRef {
Arc::new(builder.finish())
}

#[allow(deprecated)]
fn build_utf8_date_time_array(size: usize, with_nulls: bool) -> ArrayRef {
// use random numbers to avoid spurious compiler optimizations wrt to branching
let mut rng = seedable_rng();
Expand All @@ -82,6 +85,7 @@ fn build_utf8_date_time_array(size: usize, with_nulls: bool) -> ArrayRef {
Arc::new(builder.finish())
}

#[allow(deprecated)]
fn build_decimal128_array(size: usize, precision: u8, scale: i8) -> ArrayRef {
let mut rng = seedable_rng();
let mut builder = Decimal128Builder::with_capacity(size);
Expand All @@ -97,6 +101,7 @@ fn build_decimal128_array(size: usize, precision: u8, scale: i8) -> ArrayRef {
)
}

#[allow(deprecated)]
fn build_decimal256_array(size: usize, precision: u8, scale: i8) -> ArrayRef {
let mut rng = seedable_rng();
let mut builder = Decimal256Builder::with_capacity(size);
Expand Down
2 changes: 2 additions & 0 deletions arrow/benches/comparison_kernels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ extern crate criterion;

use arrow::compute::kernels::cmp::*;
use arrow::util::bench_util::*;
#[allow(deprecated)]
use arrow::util::test_util::seedable_rng;
use arrow::{array::*, datatypes::Float32Type, datatypes::Int32Type};
use arrow_buffer::IntervalMonthDayNano;
Expand Down Expand Up @@ -78,6 +79,7 @@ fn make_string_array(size: usize, rng: &mut StdRng) -> impl Iterator<Item = Opti
})
}

#[allow(deprecated)]
fn add_benchmark(c: &mut Criterion) {
let arr_a = create_primitive_array_with_seed::<Float32Type>(SIZE, 0.0, 42);
let arr_b = create_primitive_array_with_seed::<Float32Type>(SIZE, 0.0, 43);
Expand Down
2 changes: 2 additions & 0 deletions arrow/benches/csv_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use arrow::array::*;
use arrow::csv;
use arrow::datatypes::*;
use arrow::util::bench_util::{create_primitive_array, create_string_array_with_len};
#[allow(deprecated)]
use arrow::util::test_util::seedable_rng;

fn do_bench(c: &mut Criterion, name: &str, cols: Vec<ArrayRef>) {
Expand Down Expand Up @@ -57,6 +58,7 @@ fn do_bench(c: &mut Criterion, name: &str, cols: Vec<ArrayRef>) {
}
}

#[allow(deprecated)]
fn criterion_benchmark(c: &mut Criterion) {
let mut rng = seedable_rng();

Expand Down
2 changes: 2 additions & 0 deletions arrow/benches/interleave_kernels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use rand::Rng;
extern crate arrow;

use arrow::datatypes::*;
#[allow(deprecated)]
use arrow::util::test_util::seedable_rng;
use arrow::{array::*, util::bench_util::*};
use arrow_select::interleave::interleave;
Expand All @@ -50,6 +51,7 @@ fn do_bench(
);
}

#[allow(deprecated)]
fn bench_values(c: &mut Criterion, name: &str, len: usize, values: &[&dyn Array]) {
let mut rng = seedable_rng();
let indices: Vec<_> = (0..len)
Expand Down
3 changes: 3 additions & 0 deletions arrow/benches/json_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use arrow::util::bench_util::{
create_primitive_array, create_string_array, create_string_array_with_len,
create_string_dict_array,
};
#[allow(deprecated)]
use arrow::util::test_util::seedable_rng;
use arrow_array::{Array, ListArray, RecordBatch, StructArray};
use arrow_buffer::{BooleanBuffer, NullBuffer, OffsetBuffer};
Expand Down Expand Up @@ -59,11 +60,13 @@ fn create_mixed(len: usize) -> RecordBatch {
.unwrap()
}

#[allow(deprecated)]
fn create_nulls(len: usize) -> NullBuffer {
let mut rng = seedable_rng();
BooleanBuffer::from_iter((0..len).map(|_| rng.random_bool(0.2))).into()
}

#[allow(deprecated)]
fn create_offsets(len: usize) -> (usize, OffsetBuffer<i32>) {
let mut rng = seedable_rng();
let mut last_offset = 0;
Expand Down
2 changes: 2 additions & 0 deletions arrow/benches/mutable_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ use rand::Rng;

extern crate arrow;

#[allow(deprecated)]
use arrow::util::test_util::seedable_rng;
use arrow::{array::*, util::bench_util::create_string_array};

#[allow(deprecated)]
fn create_slices(size: usize) -> Vec<(usize, usize)> {
let rng = &mut seedable_rng();

Expand Down
2 changes: 2 additions & 0 deletions arrow/benches/primitive_run_take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ use arrow::array::UInt32Builder;
use arrow::compute::take;
use arrow::datatypes::{Int32Type, Int64Type};
use arrow::util::bench_util::*;
#[allow(deprecated)]
use arrow::util::test_util::seedable_rng;
use arrow_array::UInt32Array;
use criterion::{criterion_group, criterion_main, Criterion};
use rand::Rng;

#[allow(deprecated)]
fn create_random_index(size: usize, null_density: f32, max_value: usize) -> UInt32Array {
let mut rng = seedable_rng();
let mut builder = UInt32Builder::with_capacity(size);
Expand Down
2 changes: 2 additions & 0 deletions arrow/benches/take_kernels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ extern crate arrow;

use arrow::compute::{take, TakeOptions};
use arrow::datatypes::*;
#[allow(deprecated)]
use arrow::util::test_util::seedable_rng;
use arrow::{array::*, util::bench_util::*};

#[allow(deprecated)]
fn create_random_index(size: usize, null_density: f32) -> UInt32Array {
let mut rng = seedable_rng();
let mut builder = UInt32Builder::with_capacity(size);
Expand Down
Loading
Loading