Skip to content

Commit

Permalink
Remove unused import detected by nightly rust (apache#5477)
Browse files Browse the repository at this point in the history
* remove unused import

* remove more unused code

* suppress warning on make_fixed_len_byte_array_reader

* update fmt

* Update parquet/src/arrow/array_reader/mod.rs

Co-authored-by: Raphael Taylor-Davies <[email protected]>

* add back the lz4_codec

---------

Co-authored-by: Raphael Taylor-Davies <[email protected]>
  • Loading branch information
XiangpengHao and tustvold authored Mar 11, 2024
1 parent 94da02f commit aad42b5
Show file tree
Hide file tree
Showing 75 changed files with 52 additions and 184 deletions.
2 changes: 0 additions & 2 deletions arrow-arith/src/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use arrow_array::iterator::ArrayIter;
use arrow_array::*;
use arrow_buffer::{ArrowNativeType, NullBuffer};
use arrow_data::bit_iterator::try_for_each_valid_idx;
use arrow_schema::ArrowError;
use arrow_schema::*;
use std::borrow::BorrowMut;
use std::ops::{BitAnd, BitOr, BitXor};
Expand Down Expand Up @@ -729,7 +728,6 @@ where
mod tests {
use super::*;
use arrow_array::types::*;
use arrow_buffer::NullBuffer;
use std::sync::Arc;

#[test]
Expand Down
6 changes: 1 addition & 5 deletions arrow-array/src/array/dictionary_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ use crate::cast::AsArray;
use crate::iterator::ArrayIter;
use crate::types::*;
use crate::{
make_array, Array, ArrayAccessor, ArrayRef, ArrowNativeTypeOp, ArrowPrimitiveType,
PrimitiveArray, StringArray,
make_array, Array, ArrayAccessor, ArrayRef, ArrowNativeTypeOp, PrimitiveArray, StringArray,
};
use arrow_buffer::bit_util::set_bit;
use arrow_buffer::buffer::NullBuffer;
Expand Down Expand Up @@ -1007,12 +1006,9 @@ impl<K: ArrowDictionaryKeyType> AnyDictionaryArray for DictionaryArray<K> {
#[cfg(test)]
mod tests {
use super::*;
use crate::builder::PrimitiveDictionaryBuilder;
use crate::cast::as_dictionary_array;
use crate::types::{Int32Type, Int8Type, UInt32Type, UInt8Type};
use crate::{Int16Array, Int32Array, Int8Array};
use arrow_buffer::{Buffer, ToByteSlice};
use std::sync::Arc;

#[test]
fn test_dictionary_array() {
Expand Down
1 change: 0 additions & 1 deletion arrow-array/src/array/fixed_size_binary_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,6 @@ impl<'a> IntoIterator for &'a FixedSizeBinaryArray {
mod tests {
use crate::RecordBatch;
use arrow_schema::{Field, Schema};
use std::sync::Arc;

use super::*;

Expand Down
1 change: 0 additions & 1 deletion arrow-array/src/array/map_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ mod tests {
use crate::types::UInt32Type;
use crate::{Int32Array, UInt32Array};
use arrow_schema::Fields;
use std::sync::Arc;

use super::*;

Expand Down
3 changes: 1 addition & 2 deletions arrow-array/src/array/primitive_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1501,9 +1501,8 @@ mod tests {
use super::*;
use crate::builder::{Decimal128Builder, Decimal256Builder};
use crate::cast::downcast_array;
use crate::{ArrayRef, BooleanArray};
use crate::BooleanArray;
use arrow_schema::TimeUnit;
use std::sync::Arc;

#[test]
fn test_primitive_array_from_vec() {
Expand Down
6 changes: 2 additions & 4 deletions arrow-array/src/array/run_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,17 +654,15 @@ where

#[cfg(test)]
mod tests {
use std::sync::Arc;

use rand::seq::SliceRandom;
use rand::thread_rng;
use rand::Rng;

use super::*;
use crate::builder::PrimitiveRunBuilder;
use crate::cast::AsArray;
use crate::types::{Int16Type, Int32Type, Int8Type, UInt32Type};
use crate::{Array, Int32Array, StringArray};
use crate::types::{Int8Type, UInt32Type};
use crate::{Int32Array, StringArray};

fn build_input_array(size: usize) -> Vec<Option<i32>> {
// The input array is created by shuffling and repeating
Expand Down
1 change: 0 additions & 1 deletion arrow-array/src/array/struct_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,6 @@ mod tests {

use crate::{BooleanArray, Float32Array, Float64Array, Int32Array, Int64Array, StringArray};
use arrow_buffer::ToByteSlice;
use std::sync::Arc;

#[test]
fn test_struct_array_builder() {
Expand Down
1 change: 0 additions & 1 deletion arrow-array/src/array/union_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,6 @@ mod tests {
use crate::RecordBatch;
use crate::{Float64Array, Int32Array, Int64Array, StringArray};
use arrow_schema::Schema;
use std::sync::Arc;

#[test]
fn test_dense_i32() {
Expand Down
1 change: 0 additions & 1 deletion arrow-array/src/builder/boolean_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ impl Extend<Option<bool>> for BooleanBuilder {
mod tests {
use super::*;
use crate::Array;
use arrow_buffer::Buffer;

#[test]
fn test_boolean_array_builder() {
Expand Down
1 change: 0 additions & 1 deletion arrow-array/src/builder/buffer_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// specific language governing permissions and limitations
// under the License.

use crate::array::ArrowPrimitiveType;
pub use arrow_buffer::BufferBuilder;
use half::f16;

Expand Down
2 changes: 0 additions & 2 deletions arrow-array/src/builder/fixed_size_binary_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ mod tests {
use super::*;

use crate::Array;
use crate::FixedSizeBinaryArray;
use arrow_schema::DataType;

#[test]
fn test_fixed_size_binary_builder() {
Expand Down
2 changes: 1 addition & 1 deletion arrow-array/src/builder/generic_bytes_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ pub type GenericBinaryBuilder<O> = GenericByteBuilder<GenericBinaryType<O>>;
#[cfg(test)]
mod tests {
use super::*;
use crate::array::{Array, OffsetSizeTrait};
use crate::array::Array;
use crate::GenericStringArray;

fn _test_generic_binary_builder<O: OffsetSizeTrait>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ pub type LargeBinaryDictionaryBuilder<K> = GenericByteDictionaryBuilder<K, Gener
mod tests {
use super::*;

use crate::array::Array;
use crate::array::Int8Array;
use crate::types::{Int16Type, Int32Type, Int8Type, Utf8Type};
use crate::{BinaryArray, StringArray};
Expand Down
2 changes: 1 addition & 1 deletion arrow-array/src/builder/generic_list_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ mod tests {
use crate::builder::{make_builder, Int32Builder, ListBuilder};
use crate::cast::AsArray;
use crate::types::Int32Type;
use crate::{Array, Int32Array};
use crate::Int32Array;
use arrow_schema::DataType;

fn _test_generic_list_array_builder<O: OffsetSizeTrait>() {
Expand Down
4 changes: 1 addition & 3 deletions arrow-array/src/builder/primitive_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

use crate::builder::{ArrayBuilder, BufferBuilder};
use crate::types::*;
use crate::{ArrayRef, ArrowPrimitiveType, PrimitiveArray};
use crate::{ArrayRef, PrimitiveArray};
use arrow_buffer::NullBufferBuilder;
use arrow_buffer::{Buffer, MutableBuffer};
use arrow_data::ArrayData;
Expand Down Expand Up @@ -359,15 +359,13 @@ impl<P: ArrowPrimitiveType> Extend<Option<P::Native>> for PrimitiveBuilder<P> {
#[cfg(test)]
mod tests {
use super::*;
use arrow_buffer::Buffer;
use arrow_schema::TimeUnit;

use crate::array::Array;
use crate::array::BooleanArray;
use crate::array::Date32Array;
use crate::array::Int32Array;
use crate::array::TimestampSecondArray;
use crate::builder::Int32Builder;

#[test]
fn test_primitive_array_builder_i32() {
Expand Down
1 change: 0 additions & 1 deletion arrow-array/src/builder/primitive_dictionary_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ impl<K: ArrowDictionaryKeyType, P: ArrowPrimitiveType> Extend<Option<P::Native>>
mod tests {
use super::*;

use crate::array::Array;
use crate::array::UInt32Array;
use crate::array::UInt8Array;
use crate::builder::Decimal128Builder;
Expand Down
3 changes: 1 addition & 2 deletions arrow-array/src/builder/struct_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
// under the License.

use crate::builder::*;
use crate::{ArrayRef, StructArray};
use crate::StructArray;
use arrow_buffer::NullBufferBuilder;
use arrow_schema::{DataType, Fields, IntervalUnit, SchemaBuilder, TimeUnit};
use std::any::Any;
use std::sync::Arc;

/// Builder for [`StructArray`]
Expand Down
2 changes: 1 addition & 1 deletion arrow-array/src/timezone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ mod private {
mod private {
use super::*;
use chrono::offset::TimeZone;
use chrono::{FixedOffset, LocalResult, NaiveDate, NaiveDateTime, Offset};
use chrono::{LocalResult, NaiveDate, NaiveDateTime, Offset};
use std::str::FromStr;

/// An [`Offset`] for [`Tz`]
Expand Down
3 changes: 1 addition & 2 deletions arrow-buffer/src/bigint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -838,9 +838,8 @@ impl ToPrimitive for i256 {
#[cfg(all(test, not(miri)))] // llvm.x86.subborrow.64 not supported by MIRI
mod tests {
use super::*;
use num::{BigInt, FromPrimitive, Signed, ToPrimitive};
use num::Signed;
use rand::{thread_rng, Rng};
use std::ops::Neg;

#[test]
fn test_signed_cmp() {
Expand Down
1 change: 0 additions & 1 deletion arrow-buffer/src/buffer/immutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

use std::alloc::Layout;
use std::fmt::Debug;
use std::iter::FromIterator;
use std::ptr::NonNull;
use std::sync::Arc;

Expand Down
1 change: 0 additions & 1 deletion arrow-cast/src/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ pub fn b64_decode<E: Engine, O: OffsetSizeTrait>(
mod tests {
use super::*;
use arrow_array::BinaryArray;
use base64::prelude::{BASE64_STANDARD, BASE64_STANDARD_NO_PAD};
use rand::{thread_rng, Rng};

fn test_engine<E: Engine>(e: &E, a: &BinaryArray) {
Expand Down
3 changes: 1 addition & 2 deletions arrow-cast/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

use arrow_array::timezone::Tz;
use arrow_array::types::*;
use arrow_array::{ArrowNativeTypeOp, ArrowPrimitiveType};
use arrow_array::ArrowNativeTypeOp;
use arrow_buffer::ArrowNativeType;
use arrow_schema::ArrowError;
use chrono::prelude::*;
Expand Down Expand Up @@ -1222,7 +1222,6 @@ fn parse_interval_components(
mod tests {
use super::*;
use arrow_array::temporal_conversions::date32_to_datetime;
use arrow_array::timezone::Tz;
use arrow_buffer::i256;

#[test]
Expand Down
1 change: 0 additions & 1 deletion arrow-data/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use crate::bit_iterator::BitSliceIterator;
use arrow_buffer::buffer::{BooleanBuffer, NullBuffer};
use arrow_buffer::{bit_util, i256, ArrowNativeType, Buffer, MutableBuffer};
use arrow_schema::{ArrowError, DataType, UnionMode};
use std::convert::TryInto;
use std::mem;
use std::ops::Range;
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion arrow-flight/src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use arrow_buffer::Buffer;
use arrow_schema::{Schema, SchemaRef};
use bytes::Bytes;
use futures::{ready, stream::BoxStream, Stream, StreamExt};
use std::{collections::HashMap, convert::TryFrom, fmt::Debug, pin::Pin, sync::Arc, task::Poll};
use std::{collections::HashMap, fmt::Debug, pin::Pin, sync::Arc, task::Poll};
use tonic::metadata::MetadataMap;

use crate::error::{FlightError, Result};
Expand Down
6 changes: 1 addition & 5 deletions arrow-flight/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ use base64::prelude::BASE64_STANDARD;
use base64::Engine;
use bytes::Bytes;
use prost_types::Timestamp;
use std::{
convert::{TryFrom, TryInto},
fmt,
ops::Deref,
};
use std::{fmt, ops::Deref};

type ArrowResult<T> = std::result::Result<T, ArrowError>;

Expand Down
5 changes: 0 additions & 5 deletions arrow-integration-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ use arrow::buffer::{Buffer, MutableBuffer};
use arrow::compute;
use arrow::datatypes::*;
use arrow::error::{ArrowError, Result};
use arrow::record_batch::{RecordBatch, RecordBatchReader};
use arrow::util::bit_util;
use arrow_buffer::i256;

mod datatype;
mod field;
Expand Down Expand Up @@ -1011,9 +1009,6 @@ mod tests {

use std::fs::File;
use std::io::Read;
use std::sync::Arc;

use arrow::buffer::Buffer;

#[test]
fn test_schema_equality() {
Expand Down
2 changes: 1 addition & 1 deletion arrow-integration-test/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ struct MetadataKeyValue {
#[cfg(test)]
mod tests {
use super::*;
use arrow::datatypes::{DataType, Field, Fields, IntervalUnit, TimeUnit};
use arrow::datatypes::{DataType, Field, IntervalUnit, TimeUnit};
use serde_json::Value;
use std::sync::Arc;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// under the License.

use std::collections::HashMap;
use std::convert::TryFrom;
use std::pin::Pin;
use std::sync::Arc;

Expand All @@ -35,7 +34,6 @@ use arrow_flight::{
PollInfo, PutResult, SchemaAsIpc, SchemaResult, Ticket,
};
use futures::{channel::mpsc, sink::SinkExt, Stream, StreamExt};
use std::convert::TryInto;
use tokio::sync::Mutex;
use tonic::{transport::Server, Request, Response, Status, Streaming};

Expand Down
1 change: 0 additions & 1 deletion arrow-ipc/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,6 @@ mod tests {
use crate::root_as_message;
use arrow_array::builder::{PrimitiveRunBuilder, UnionBuilder};
use arrow_array::types::*;
use arrow_buffer::ArrowNativeType;
use arrow_data::ArrayDataBuilder;

fn create_test_projection_schema() -> Schema {
Expand Down
2 changes: 0 additions & 2 deletions arrow-ipc/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1421,14 +1421,12 @@ fn pad_to_8(len: u32) -> usize {
mod tests {
use std::io::Cursor;
use std::io::Seek;
use std::sync::Arc;

use arrow_array::builder::GenericListBuilder;
use arrow_array::builder::MapBuilder;
use arrow_array::builder::UnionBuilder;
use arrow_array::builder::{PrimitiveRunBuilder, UInt32Builder};
use arrow_array::types::*;
use arrow_schema::DataType;

use crate::reader::*;
use crate::MetadataVersion;
Expand Down
5 changes: 1 addition & 4 deletions arrow-json/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,7 @@ impl JsonSerializable for f64 {
mod tests {
use super::*;

use serde_json::{
Number,
Value::{Bool, Number as VNumber, String as VString},
};
use serde_json::Value::{Bool, Number as VNumber, String as VString};

#[test]
fn test_arrow_native_type_to_json() {
Expand Down
12 changes: 2 additions & 10 deletions arrow-json/src/reader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ use chrono::Utc;
use serde::Serialize;

use arrow_array::timezone::Tz;
use arrow_array::types::Float32Type;
use arrow_array::types::*;
use arrow_array::{downcast_integer, make_array, RecordBatch, RecordBatchReader, StructArray};
use arrow_data::ArrayData;
Expand Down Expand Up @@ -713,20 +712,13 @@ mod tests {
use serde_json::json;
use std::fs::File;
use std::io::{BufReader, Cursor, Seek};
use std::sync::Arc;

use arrow_array::cast::AsArray;
use arrow_array::types::Int32Type;
use arrow_array::{
make_array, Array, BooleanArray, Float64Array, ListArray, StringArray, StructArray,
};
use arrow_array::{Array, BooleanArray, Float64Array, ListArray, StringArray};
use arrow_buffer::{ArrowNativeType, Buffer};
use arrow_cast::display::{ArrayFormatter, FormatOptions};
use arrow_data::ArrayDataBuilder;
use arrow_schema::{DataType, Field, FieldRef, Schema};

use crate::reader::infer_json_schema;
use crate::ReaderBuilder;
use arrow_schema::Field;

use super::*;

Expand Down
Loading

0 comments on commit aad42b5

Please sign in to comment.