This is an automated email from the ASF dual-hosted git repository.
viirya pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new 5ecb0e075 Fix clippy errors (#3352)
5ecb0e075 is described below
commit 5ecb0e075c81ef497b1568d7d36210d56e1d691d
Author: Liang-Chi Hsieh <[email protected]>
AuthorDate: Thu Dec 15 15:06:54 2022 -0800
Fix clippy errors (#3352)
---
arrow-array/src/builder/union_builder.rs | 2 +-
arrow-array/src/types.rs | 2 +-
arrow-cast/src/cast.rs | 17 ++++++++---------
arrow-data/src/data.rs | 4 ++--
arrow-ipc/src/convert.rs | 4 ++--
arrow/src/array/ffi.rs | 8 ++++----
arrow/src/compute/kernels/temporal.rs | 20 ++++++--------------
arrow/src/util/data_gen.rs | 2 +-
arrow/src/util/pretty.rs | 4 ++--
arrow/src/util/test_util.rs | 2 +-
arrow/tests/array_validation.rs | 14 +++++++-------
parquet/src/arrow/arrow_reader/mod.rs | 22 +++++++++++-----------
parquet/src/arrow/arrow_writer/byte_array.rs | 4 ++--
parquet/src/arrow/async_reader.rs | 2 +-
parquet/src/bloom_filter/mod.rs | 2 +-
parquet/src/encodings/decoding.rs | 2 +-
parquet/src/encodings/encoding/dict_encoder.rs | 4 ++--
parquet/src/encodings/rle.rs | 2 +-
parquet/src/schema/types.rs | 2 +-
parquet/src/util/bit_util.rs | 8 ++++----
20 files changed, 59 insertions(+), 68 deletions(-)
diff --git a/arrow-array/src/builder/union_builder.rs
b/arrow-array/src/builder/union_builder.rs
index def1e1eca..28fb7e5d9 100644
--- a/arrow-array/src/builder/union_builder.rs
+++ b/arrow-array/src/builder/union_builder.rs
@@ -296,7 +296,7 @@ impl UnionBuilder {
let arr_data_ref = unsafe { arr_data_builder.build_unchecked() };
let array_ref = make_array(arr_data_ref);
- children.push((type_id, (Field::new(&name, data_type, false),
array_ref)))
+ children.push((type_id, (Field::new(name, data_type, false),
array_ref)))
}
children.sort_by(|a, b| {
diff --git a/arrow-array/src/types.rs b/arrow-array/src/types.rs
index 0646a7f29..e36f850f2 100644
--- a/arrow-array/src/types.rs
+++ b/arrow-array/src/types.rs
@@ -483,7 +483,7 @@ impl Date64Type {
/// * `i` - The Date64Type to convert
pub fn to_naive_date(i: <Date64Type as ArrowPrimitiveType>::Native) ->
NaiveDate {
let epoch = NaiveDate::from_ymd_opt(1970, 1, 1).unwrap();
- epoch.add(Duration::milliseconds(i as i64))
+ epoch.add(Duration::milliseconds(i))
}
/// Converts a chrono::NaiveDate into an arrow Date64Type
diff --git a/arrow-cast/src/cast.rs b/arrow-cast/src/cast.rs
index 8bd71245c..f3dbdb8e0 100644
--- a/arrow-cast/src/cast.rs
+++ b/arrow-cast/src/cast.rs
@@ -798,7 +798,7 @@ pub fn cast_with_options(
}
Float64 => {
cast_decimal_to_float::<Decimal128Type, Float64Type,
_>(array, |x| {
- (x as f64 / 10_f64.powi(*scale as i32)) as f64
+ x as f64 / 10_f64.powi(*scale as i32)
})
}
Null => Ok(new_null_array(to_type, array.len())),
@@ -866,7 +866,7 @@ pub fn cast_with_options(
}
Float64 => {
cast_decimal_to_float::<Decimal256Type, Float64Type,
_>(array, |x| {
- (x.to_f64().unwrap() / 10_f64.powi(*scale as i32)) as
f64
+ x.to_f64().unwrap() / 10_f64.powi(*scale as i32)
})
}
Null => Ok(new_null_array(to_type, array.len())),
@@ -5946,8 +5946,7 @@ mod tests {
#[test]
fn test_cast_from_uint32() {
- let u32_values: Vec<u32> =
- vec![0, u8::MAX as u32, u16::MAX as u32, u32::MAX as u32];
+ let u32_values: Vec<u32> = vec![0, u8::MAX as u32, u16::MAX as u32,
u32::MAX];
let u32_array: ArrayRef = Arc::new(UInt32Array::from(u32_values));
let f64_expected = vec!["0.0", "255.0", "65535.0", "4294967295.0"];
@@ -6013,7 +6012,7 @@ mod tests {
#[test]
fn test_cast_from_uint16() {
- let u16_values: Vec<u16> = vec![0, u8::MAX as u16, u16::MAX as u16];
+ let u16_values: Vec<u16> = vec![0, u8::MAX as u16, u16::MAX];
let u16_array: ArrayRef = Arc::new(UInt16Array::from(u16_values));
let f64_expected = vec!["0.0", "255.0", "65535.0"];
@@ -6301,13 +6300,13 @@ mod tests {
#[test]
fn test_cast_from_int32() {
let i32_values: Vec<i32> = vec![
- i32::MIN as i32,
+ i32::MIN,
i16::MIN as i32,
i8::MIN as i32,
0,
i8::MAX as i32,
i16::MAX as i32,
- i32::MAX as i32,
+ i32::MAX,
];
let i32_array: ArrayRef = Arc::new(Int32Array::from(i32_values));
@@ -6463,13 +6462,13 @@ mod tests {
#[test]
fn test_cast_from_date32() {
let i32_values: Vec<i32> = vec![
- i32::MIN as i32,
+ i32::MIN,
i16::MIN as i32,
i8::MIN as i32,
0,
i8::MAX as i32,
i16::MAX as i32,
- i32::MAX as i32,
+ i32::MAX,
];
let date32_array: ArrayRef = Arc::new(Date32Array::from(i32_values));
diff --git a/arrow-data/src/data.rs b/arrow-data/src/data.rs
index b38321aac..918ecae84 100644
--- a/arrow-data/src/data.rs
+++ b/arrow-data/src/data.rs
@@ -1657,12 +1657,12 @@ mod tests {
/// returns a buffer initialized with some constant value for tests
fn make_i32_buffer(n: usize) -> Buffer {
- Buffer::from_slice_ref(&vec![42i32; n])
+ Buffer::from_slice_ref(vec![42i32; n])
}
/// returns a buffer initialized with some constant value for tests
fn make_f32_buffer(n: usize) -> Buffer {
- Buffer::from_slice_ref(&vec![42f32; n])
+ Buffer::from_slice_ref(vec![42f32; n])
}
#[test]
diff --git a/arrow-ipc/src/convert.rs b/arrow-ipc/src/convert.rs
index e5522303d..a60a19b86 100644
--- a/arrow-ipc/src/convert.rs
+++ b/arrow-ipc/src/convert.rs
@@ -573,7 +573,7 @@ pub(crate) fn get_fb_field_type<'a>(
},
FixedSizeBinary(len) => {
let mut builder = crate::FixedSizeBinaryBuilder::new(fbb);
- builder.add_byteWidth(*len as i32);
+ builder.add_byteWidth(*len);
FBFieldType {
type_type: crate::Type::FixedSizeBinary,
type_: builder.finish().as_union_value(),
@@ -692,7 +692,7 @@ pub(crate) fn get_fb_field_type<'a>(
FixedSizeList(ref list_type, len) => {
let child = build_field(fbb, list_type);
let mut builder = crate::FixedSizeListBuilder::new(fbb);
- builder.add_listSize(*len as i32);
+ builder.add_listSize(*len);
FBFieldType {
type_type: crate::Type::FixedSizeList,
type_: builder.finish().as_union_value(),
diff --git a/arrow/src/array/ffi.rs b/arrow/src/array/ffi.rs
index a18f408a4..fb7771ac6 100644
--- a/arrow/src/array/ffi.rs
+++ b/arrow/src/array/ffi.rs
@@ -224,7 +224,7 @@ mod tests {
let v: Vec<i64> = (0..9).into_iter().collect();
let value_data = ArrayData::builder(DataType::Int64)
.len(9)
- .add_buffer(Buffer::from_slice_ref(&v))
+ .add_buffer(Buffer::from_slice_ref(v))
.build()?;
let list_data_type =
DataType::FixedSizeList(Box::new(Field::new("f", DataType::Int64,
false)), 3);
@@ -249,7 +249,7 @@ mod tests {
let v: Vec<i16> = (0..16).into_iter().collect();
let value_data = ArrayData::builder(DataType::Int16)
.len(16)
- .add_buffer(Buffer::from_slice_ref(&v))
+ .add_buffer(Buffer::from_slice_ref(v))
.build()?;
let list_data_type =
DataType::FixedSizeList(Box::new(Field::new("f", DataType::Int16,
false)), 2);
@@ -269,11 +269,11 @@ mod tests {
let v: Vec<i32> = (0..16).into_iter().collect();
let value_data = ArrayData::builder(DataType::Int32)
.len(16)
- .add_buffer(Buffer::from_slice_ref(&v))
+ .add_buffer(Buffer::from_slice_ref(v))
.build()?;
let offsets: Vec<i32> = vec![0, 2, 4, 6, 8, 10, 12, 14, 16];
- let value_offsets = Buffer::from_slice_ref(&offsets);
+ let value_offsets = Buffer::from_slice_ref(offsets);
let inner_list_data_type =
DataType::List(Box::new(Field::new("item", DataType::Int32,
false)));
let inner_list_data = ArrayData::builder(inner_list_data_type.clone())
diff --git a/arrow/src/compute/kernels/temporal.rs
b/arrow/src/compute/kernels/temporal.rs
index cea0a6afc..15d56f703 100644
--- a/arrow/src/compute/kernels/temporal.rs
+++ b/arrow/src/compute/kernels/temporal.rs
@@ -241,7 +241,7 @@ where
/// If the given array isn't temporal primitive or dictionary array,
/// an `Err` will be returned.
pub fn year_dyn(array: &dyn Array) -> Result<ArrayRef> {
- time_fraction_dyn(array, "year", |t| t.year() as i32)
+ time_fraction_dyn(array, "year", |t| t.year())
}
/// Extracts the years of a given temporal primitive array as an array of
integers
@@ -250,7 +250,7 @@ where
T: ArrowTemporalType + ArrowNumericType,
i64: From<T::Native>,
{
- time_fraction_internal(array, "year", |t| t.year() as i32)
+ time_fraction_internal(array, "year", |t| t.year())
}
/// Extracts the quarter of a given temporal array as an array of integersa
within
@@ -297,9 +297,7 @@ where
/// If the given array isn't temporal primitive or dictionary array,
/// an `Err` will be returned.
pub fn num_days_from_monday_dyn(array: &dyn Array) -> Result<ArrayRef> {
- time_fraction_dyn(array, "num_days_from_monday", |t| {
- t.num_days_from_monday() as i32
- })
+ time_fraction_dyn(array, "num_days_from_monday", |t|
t.num_days_from_monday())
}
/// Extracts the day of week of a given temporal primitive array as an array of
@@ -313,9 +311,7 @@ where
T: ArrowTemporalType + ArrowNumericType,
i64: From<T::Native>,
{
- time_fraction_internal(array, "num_days_from_monday", |t| {
- t.num_days_from_monday() as i32
- })
+ time_fraction_internal(array, "num_days_from_monday", |t|
t.num_days_from_monday())
}
/// Extracts the day of week of a given temporal array as an array of
@@ -328,9 +324,7 @@ where
/// If the given array isn't temporal primitive or dictionary array,
/// an `Err` will be returned.
pub fn num_days_from_sunday_dyn(array: &dyn Array) -> Result<ArrayRef> {
- time_fraction_dyn(array, "num_days_from_sunday", |t| {
- t.num_days_from_sunday() as i32
- })
+ time_fraction_dyn(array, "num_days_from_sunday", |t|
t.num_days_from_sunday())
}
/// Extracts the day of week of a given temporal primitive array as an array of
@@ -344,9 +338,7 @@ where
T: ArrowTemporalType + ArrowNumericType,
i64: From<T::Native>,
{
- time_fraction_internal(array, "num_days_from_sunday", |t| {
- t.num_days_from_sunday() as i32
- })
+ time_fraction_internal(array, "num_days_from_sunday", |t|
t.num_days_from_sunday())
}
/// Extracts the day of a given temporal array as an array of integers.
diff --git a/arrow/src/util/data_gen.rs b/arrow/src/util/data_gen.rs
index 5dda410f0..01f4ef5c7 100644
--- a/arrow/src/util/data_gen.rs
+++ b/arrow/src/util/data_gen.rs
@@ -194,7 +194,7 @@ fn create_random_list_array(
// Create list's child data
let child_array =
- create_random_array(list_field, child_len as usize, null_density,
true_density)?;
+ create_random_array(list_field, child_len, null_density,
true_density)?;
let child_data = child_array.data();
// Create list's null buffers, if it is nullable
let null_buffer = match field.is_nullable() {
diff --git a/arrow/src/util/pretty.rs b/arrow/src/util/pretty.rs
index 7e8378d15..859053352 100644
--- a/arrow/src/util/pretty.rs
+++ b/arrow/src/util/pretty.rs
@@ -73,7 +73,7 @@ fn create_table(results: &[RecordBatch]) -> Result<Table> {
let mut cells = Vec::new();
for col in 0..batch.num_columns() {
let column = batch.column(col);
- cells.push(Cell::new(&array_value_to_string(column, row)?));
+ cells.push(Cell::new(array_value_to_string(column, row)?));
}
table.add_row(cells);
}
@@ -95,7 +95,7 @@ fn create_column(field: &str, columns: &[ArrayRef]) ->
Result<Table> {
for col in columns {
for row in 0..col.len() {
- let cells = vec![Cell::new(&array_value_to_string(col, row)?)];
+ let cells = vec![Cell::new(array_value_to_string(col, row)?)];
table.add_row(cells);
}
}
diff --git a/arrow/src/util/test_util.rs b/arrow/src/util/test_util.rs
index 836bda6f9..83107aa79 100644
--- a/arrow/src/util/test_util.rs
+++ b/arrow/src/util/test_util.rs
@@ -196,7 +196,7 @@ impl<T: Clone> Iterator for BadIterator<T> {
/// report whatever the iterator says to
fn size_hint(&self) -> (usize, Option<usize>) {
- (0, Some(self.claimed as usize))
+ (0, Some(self.claimed))
}
}
diff --git a/arrow/tests/array_validation.rs b/arrow/tests/array_validation.rs
index 64c433a66..3cdec46b5 100644
--- a/arrow/tests/array_validation.rs
+++ b/arrow/tests/array_validation.rs
@@ -427,7 +427,7 @@ fn check_utf8_validation<T: ArrowNativeType>(data_type:
DataType) {
.map(|&v| T::from_usize(v).unwrap())
.collect();
- let offsets_buffer = Buffer::from_slice_ref(&offsets);
+ let offsets_buffer = Buffer::from_slice_ref(offsets);
ArrayData::try_new(
data_type,
2,
@@ -459,7 +459,7 @@ fn check_utf8_char_boundary<T: ArrowNativeType>(data_type:
DataType) {
.map(|&v| T::from_usize(v).unwrap())
.collect();
- let offsets_buffer = Buffer::from_slice_ref(&offsets);
+ let offsets_buffer = Buffer::from_slice_ref(offsets);
ArrayData::try_new(
data_type,
2,
@@ -492,7 +492,7 @@ fn check_index_out_of_bounds_validation<T:
ArrowNativeType>(data_type: DataType)
.map(|&v| T::from_usize(v).unwrap())
.collect();
- let offsets_buffer = Buffer::from_slice_ref(&offsets);
+ let offsets_buffer = Buffer::from_slice_ref(offsets);
ArrayData::try_new(
data_type,
4,
@@ -545,7 +545,7 @@ fn check_index_backwards_validation<T:
ArrowNativeType>(data_type: DataType) {
.map(|&v| T::from_usize(v).unwrap())
.collect();
- let offsets_buffer = Buffer::from_slice_ref(&offsets);
+ let offsets_buffer = Buffer::from_slice_ref(offsets);
ArrayData::try_new(
data_type,
4,
@@ -697,7 +697,7 @@ fn check_list_offsets<T: ArrowNativeType>(data_type:
DataType) {
.iter()
.map(|&v| T::from_usize(v).unwrap())
.collect();
- let offsets_buffer = Buffer::from_slice_ref(&offsets);
+ let offsets_buffer = Buffer::from_slice_ref(offsets);
ArrayData::try_new(
data_type,
@@ -740,7 +740,7 @@ fn test_validate_list_negative_offsets() {
// -1 is an invalid offset any way you look at it
let offsets: Vec<i32> = vec![0, 2, -1, 4];
- let offsets_buffer = Buffer::from_slice_ref(&offsets);
+ let offsets_buffer = Buffer::from_slice_ref(offsets);
ArrayData::try_new(
data_type,
@@ -755,7 +755,7 @@ fn test_validate_list_negative_offsets() {
/// returns a buffer initialized with some constant value for tests
fn make_i32_buffer(n: usize) -> Buffer {
- Buffer::from_slice_ref(&vec![42i32; n])
+ Buffer::from_slice_ref(vec![42i32; n])
}
#[test]
diff --git a/parquet/src/arrow/arrow_reader/mod.rs
b/parquet/src/arrow/arrow_reader/mod.rs
index e89ddaffe..df38e554f 100644
--- a/parquet/src/arrow/arrow_reader/mod.rs
+++ b/parquet/src/arrow/arrow_reader/mod.rs
@@ -1162,7 +1162,7 @@ mod tests {
];
for (prefix, target_precision) in file_variants {
let path = format!("{}/{}_decimal.parquet", testdata, prefix);
- let file = File::open(&path).unwrap();
+ let file = File::open(path).unwrap();
let mut record_reader = ParquetRecordBatchReader::try_new(file,
32).unwrap();
let batch = record_reader.next().unwrap().unwrap();
@@ -1777,7 +1777,7 @@ mod tests {
fn test_read_maps() {
let testdata = arrow::util::test_util::parquet_test_data();
let path = format!("{}/nested_maps.snappy.parquet", testdata);
- let file = File::open(&path).unwrap();
+ let file = File::open(path).unwrap();
let record_batch_reader = ParquetRecordBatchReader::try_new(file,
60).unwrap();
for batch in record_batch_reader {
@@ -1969,7 +1969,7 @@ mod tests {
fn test_read_null_list() {
let testdata = arrow::util::test_util::parquet_test_data();
let path = format!("{}/null_list.parquet", testdata);
- let file = File::open(&path).unwrap();
+ let file = File::open(path).unwrap();
let mut record_batch_reader =
ParquetRecordBatchReader::try_new(file, 60).unwrap();
@@ -1994,7 +1994,7 @@ mod tests {
fn test_null_schema_inference() {
let testdata = arrow::util::test_util::parquet_test_data();
let path = format!("{}/null_list.parquet", testdata);
- let file = File::open(&path).unwrap();
+ let file = File::open(path).unwrap();
let arrow_field = Field::new(
"emptylist",
@@ -2085,7 +2085,7 @@ mod tests {
fn test_empty_projection() {
let testdata = arrow::util::test_util::parquet_test_data();
let path = format!("{}/alltypes_plain.parquet", testdata);
- let file = File::open(&path).unwrap();
+ let file = File::open(path).unwrap();
let builder = ParquetRecordBatchReaderBuilder::try_new(file).unwrap();
let file_metadata = builder.metadata().file_metadata();
@@ -2260,7 +2260,7 @@ mod tests {
let test_file = File::open(&path).unwrap();
let mut serial_reader =
- ParquetRecordBatchReader::try_new(File::open(path).unwrap(),
7300).unwrap();
+ ParquetRecordBatchReader::try_new(File::open(&path).unwrap(),
7300).unwrap();
let data = serial_reader.next().unwrap().unwrap();
let do_test = |batch_size: usize, selection_len: usize| {
@@ -2316,7 +2316,7 @@ mod tests {
let testdata = arrow::util::test_util::parquet_test_data();
// `alltypes_plain.parquet` only have 8 rows
let path = format!("{}/alltypes_plain.parquet", testdata);
- let test_file = File::open(&path).unwrap();
+ let test_file = File::open(path).unwrap();
let builder =
ParquetRecordBatchReaderBuilder::try_new(test_file).unwrap();
let num_rows = builder.metadata.file_metadata().num_rows();
@@ -2395,7 +2395,7 @@ mod tests {
fn test_read_lz4_raw() {
let testdata = arrow::util::test_util::parquet_test_data();
let path = format!("{}/lz4_raw_compressed.parquet", testdata);
- let file = File::open(&path).unwrap();
+ let file = File::open(path).unwrap();
let batches = ParquetRecordBatchReader::try_new(file, 1024)
.unwrap()
@@ -2439,7 +2439,7 @@ mod tests {
] {
let testdata = arrow::util::test_util::parquet_test_data();
let path = format!("{}/{}", testdata, file);
- let file = File::open(&path).unwrap();
+ let file = File::open(path).unwrap();
let expected_rows = 4;
let batches = ParquetRecordBatchReader::try_new(file,
expected_rows)
@@ -2471,7 +2471,7 @@ mod tests {
fn test_read_lz4_hadoop_large() {
let testdata = arrow::util::test_util::parquet_test_data();
let path = format!("{}/hadoop_lz4_compressed_larger.parquet",
testdata);
- let file = File::open(&path).unwrap();
+ let file = File::open(path).unwrap();
let expected_rows = 10000;
let batches = ParquetRecordBatchReader::try_new(file, expected_rows)
@@ -2497,7 +2497,7 @@ mod tests {
fn test_read_nested_lists() {
let testdata = arrow::util::test_util::parquet_test_data();
let path = format!("{}/nested_lists.snappy.parquet", testdata);
- let file = File::open(&path).unwrap();
+ let file = File::open(path).unwrap();
let f = file.try_clone().unwrap();
let mut reader = ParquetRecordBatchReader::try_new(f, 60).unwrap();
diff --git a/parquet/src/arrow/arrow_writer/byte_array.rs
b/parquet/src/arrow/arrow_writer/byte_array.rs
index c3a9f83d1..4b9d91334 100644
--- a/parquet/src/arrow/arrow_writer/byte_array.rs
+++ b/parquet/src/arrow/arrow_writer/byte_array.rs
@@ -405,11 +405,11 @@ impl DictEncoder {
let num_values = self.indices.len();
let buffer_len = self.estimated_data_page_size();
let mut buffer = Vec::with_capacity(buffer_len);
- buffer.push(self.bit_width() as u8);
+ buffer.push(self.bit_width());
let mut encoder = RleEncoder::new_from_buf(self.bit_width(), buffer);
for index in &self.indices {
- encoder.put(*index as u64)
+ encoder.put(*index)
}
self.indices.clear();
diff --git a/parquet/src/arrow/async_reader.rs
b/parquet/src/arrow/async_reader.rs
index 7602d54a5..4285a1c17 100644
--- a/parquet/src/arrow/async_reader.rs
+++ b/parquet/src/arrow/async_reader.rs
@@ -1360,6 +1360,6 @@ mod tests {
.build()
.unwrap();
assert_ne!(1024, file_rows);
- assert_eq!(stream.batch_size, file_rows as usize);
+ assert_eq!(stream.batch_size, file_rows);
}
}
diff --git a/parquet/src/bloom_filter/mod.rs b/parquet/src/bloom_filter/mod.rs
index 1a561bf16..a6620fc14 100644
--- a/parquet/src/bloom_filter/mod.rs
+++ b/parquet/src/bloom_filter/mod.rs
@@ -141,7 +141,7 @@ fn chunk_read_bloom_filter_header_and_offset<R:
ChunkReader>(
offset: u64,
reader: Arc<R>,
) -> Result<(BloomFilterHeader, u64), ParquetError> {
- let buffer = reader.get_bytes(offset as u64, SBBF_HEADER_SIZE_ESTIMATE)?;
+ let buffer = reader.get_bytes(offset, SBBF_HEADER_SIZE_ESTIMATE)?;
let (header, length) = read_bloom_filter_header_and_length(buffer)?;
Ok((header, offset + length))
}
diff --git a/parquet/src/encodings/decoding.rs
b/parquet/src/encodings/decoding.rs
index bbc119c36..7e3058ba7 100644
--- a/parquet/src/encodings/decoding.rs
+++ b/parquet/src/encodings/decoding.rs
@@ -557,7 +557,7 @@ where
self.mini_block_bit_widths.clear();
self.bit_reader.get_aligned_bytes(
&mut self.mini_block_bit_widths,
- self.mini_blocks_per_block as usize,
+ self.mini_blocks_per_block,
);
let mut offset = self.bit_reader.get_byte_offset();
diff --git a/parquet/src/encodings/encoding/dict_encoder.rs
b/parquet/src/encodings/encoding/dict_encoder.rs
index 1b5164520..4f4a6ab4f 100644
--- a/parquet/src/encodings/encoding/dict_encoder.rs
+++ b/parquet/src/encodings/encoding/dict_encoder.rs
@@ -123,12 +123,12 @@ impl<T: DataType> DictEncoder<T> {
pub fn write_indices(&mut self) -> Result<ByteBufferPtr> {
let buffer_len = self.estimated_data_encoded_size();
let mut buffer = Vec::with_capacity(buffer_len);
- buffer.push(self.bit_width() as u8);
+ buffer.push(self.bit_width());
// Write bit width in the first byte
let mut encoder = RleEncoder::new_from_buf(self.bit_width(), buffer);
for index in &self.indices {
- encoder.put(*index as u64)
+ encoder.put(*index)
}
self.indices.clear();
Ok(ByteBufferPtr::new(encoder.consume()))
diff --git a/parquet/src/encodings/rle.rs b/parquet/src/encodings/rle.rs
index 25c3c81a7..77b76d0e7 100644
--- a/parquet/src/encodings/rle.rs
+++ b/parquet/src/encodings/rle.rs
@@ -823,7 +823,7 @@ mod tests {
values.push(i % 2);
}
let num_groups = bit_util::ceil(100, 8) as u8;
- expected_buffer.push(((num_groups << 1) as u8) | 1);
+ expected_buffer.push((num_groups << 1) | 1);
expected_buffer.resize(expected_buffer.len() + 100 / 8, 0b10101010);
// For the last 4 0 and 1's, padded with 0.
diff --git a/parquet/src/schema/types.rs b/parquet/src/schema/types.rs
index 9f8023c91..4501e7e31 100644
--- a/parquet/src/schema/types.rs
+++ b/parquet/src/schema/types.rs
@@ -1103,7 +1103,7 @@ fn from_thrift_helper(
let mut fields = vec![];
let mut next_index = index + 1;
for _ in 0..n {
- let child_result = from_thrift_helper(elements, next_index as
usize)?;
+ let child_result = from_thrift_helper(elements, next_index)?;
next_index = child_result.0;
fields.push(child_result.1);
}
diff --git a/parquet/src/util/bit_util.rs b/parquet/src/util/bit_util.rs
index 68b2f2b25..cfbd521e9 100644
--- a/parquet/src/util/bit_util.rs
+++ b/parquet/src/util/bit_util.rs
@@ -918,12 +918,12 @@ mod tests {
fn test_put_value_rand_numbers(total: usize, num_bits: usize) {
assert!(num_bits < 64);
let num_bytes = ceil(num_bits, 8);
- let mut writer = BitWriter::new(num_bytes as usize * total);
+ let mut writer = BitWriter::new(num_bytes * total);
let values: Vec<u64> = random_numbers::<u64>(total)
.iter()
.map(|v| v & ((1 << num_bits) - 1))
.collect();
- (0..total).for_each(|i| writer.put_value(values[i] as u64, num_bits));
+ (0..total).for_each(|i| writer.put_value(values[i], num_bits));
let mut reader = BitReader::from(writer.consume());
(0..total).for_each(|i| {
@@ -959,7 +959,7 @@ mod tests {
{
assert!(num_bits <= 64);
let num_bytes = ceil(num_bits, 8);
- let mut writer = BitWriter::new(num_bytes as usize * total);
+ let mut writer = BitWriter::new(num_bytes * total);
let mask = match num_bits {
64 => u64::MAX,
@@ -975,7 +975,7 @@ mod tests {
let expected_values: Vec<T> =
values.iter().map(|v| from_ne_slice(v.as_bytes())).collect();
- (0..total).for_each(|i| writer.put_value(values[i] as u64, num_bits));
+ (0..total).for_each(|i| writer.put_value(values[i], num_bits));
let buf = writer.consume();
let mut reader = BitReader::from(buf);