Skip to content
This repository was archived by the owner on Dec 29, 2021. It is now read-only.

Commit aa16e02

Browse files
committed
lints
1 parent 7e0d187 commit aa16e02

File tree

7 files changed

+72
-299
lines changed

7 files changed

+72
-299
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ edition = "2018"
77
[dependencies]
88
arrow = { git = "https://github.com/apache/arrow"}
99
num = "0.2"
10-
num-traits = "0.2"byteorder = "1"
10+
num-traits = "0.2"
11+
byteorder = "1"
1112
flatbuffers = "0.5"

src/dataframe.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ pub struct DataFrame {
6767
columns: Vec<Column>,
6868
}
6969

70-
struct CsvDataSource {
71-
reader: CsvReader,
72-
}
70+
// struct CsvDataSource {
71+
// reader: CsvReader,
72+
// }
7373

7474
// impl Iterator for CsvDataSource {
7575
// type Item = Result<RecordBatch, DataFrameError>;

src/functions/aggregate.rs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,20 @@ impl AggregateFunctions {
1414
T: ArrowNumericType,
1515
T::Native: std::cmp::Ord,
1616
{
17-
arrays.iter().map(|array| array_ops::max(array).unwrap()).max()
17+
arrays
18+
.iter()
19+
.map(|array| array_ops::max(array).unwrap())
20+
.max()
1821
}
1922
pub fn min<T>(arrays: Vec<&PrimitiveArray<T>>) -> Option<T::Native>
2023
where
2124
T: ArrowNumericType,
2225
T::Native: std::cmp::Ord,
2326
{
24-
arrays.iter().map(|array| array_ops::max(array).unwrap()).max()
27+
arrays
28+
.iter()
29+
.map(|array| array_ops::max(array).unwrap())
30+
.max()
2531
}
2632
// pub fn avg<T>(array: &PrimitiveArray<T>) -> Option<f64>
2733
// where
@@ -39,14 +45,16 @@ impl AggregateFunctions {
3945
// }
4046

4147
/// Count returns the number of non-null values in the array/column.
42-
///
48+
///
4349
/// For the number of all values, use `len()`
4450
pub fn count<T>(arrays: Vec<&PrimitiveArray<T>>) -> Option<i64>
4551
where
4652
T: ArrowPrimitiveType,
4753
{
4854
let mut sum = 0;
49-
arrays.iter().for_each(|array| sum += (array.len() - array.null_count()) as i64);
55+
arrays
56+
.iter()
57+
.for_each(|array| sum += (array.len() - array.null_count()) as i64);
5058

5159
Some(sum)
5260
}
@@ -57,10 +65,11 @@ impl AggregateFunctions {
5765
T::Native: Add<Output = T::Native>,
5866
{
5967
let mut sum = T::default_value();
60-
arrays.iter().for_each(|array| sum = sum + array_ops::sum(array).unwrap_or(T::default_value()));
68+
arrays
69+
.iter()
70+
.for_each(|array| sum = sum + array_ops::sum(array).unwrap_or(T::default_value()));
6171

6272
Some(sum)
63-
6473
}
6574
pub fn first() {}
6675
pub fn kurtosis() {}
@@ -90,10 +99,10 @@ mod tests {
9099
assert_eq!(b.value(0), d.value(0));
91100
}
92101

93-
#[test]
94-
fn test_aggregate_count() {
95-
let a = Int32Array::from(vec![5, 6, 7, 8, 9]);
96-
let c = AggregateFunctions::count(vec![&a]).unwrap();
97-
assert_eq!(5, c);
98-
}
102+
#[test]
103+
fn test_aggregate_count() {
104+
let a = Int32Array::from(vec![5, 6, 7, 8, 9]);
105+
let c = AggregateFunctions::count(vec![&a]).unwrap();
106+
assert_eq!(5, c);
107+
}
99108
}

src/io/feather.rs

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Feather Reader and Writer
2-
//!
2+
//!
33
//! **Feather can be considered as deprecated, and is not suitable for long term storage.
44
//! We only include its support temporarily until Arrow has more IO support.**
55
//!
@@ -74,9 +74,7 @@ fn get_data_type(dtype: fbs::Type) -> DataType {
7474
fbs::Type::DOUBLE => DataType::Float64,
7575
fbs::Type::UTF8 => DataType::Utf8,
7676
fbs::Type::BINARY => DataType::Utf8,
77-
fbs::Type::CATEGORY => {
78-
unimplemented!("Reading CATEGORY type columns not implemented")
79-
}
77+
fbs::Type::CATEGORY => unimplemented!("Reading CATEGORY type columns not implemented"),
8078
fbs::Type::TIMESTAMP | fbs::Type::DATE | fbs::Type::TIME => {
8179
unimplemented!("Reading date and time fields not implemented")
8280
}
@@ -105,9 +103,7 @@ fn get_fbs_type(dtype: DataType) -> fbs::Type {
105103
Time32(_) | Time64(_) => TIME,
106104
Interval(_) => unimplemented!("Interval type not supported"),
107105
Utf8 => UTF8,
108-
List(_) | Struct(_) => {
109-
unimplemented!("Lists and Structs types are not supported")
110-
}
106+
List(_) | Struct(_) => unimplemented!("Lists and Structs types are not supported"),
111107
}
112108
}
113109

@@ -264,10 +260,8 @@ impl<R: Read + Seek> FeatherReader<R> {
264260
let strings: Vec<String> = string_pos
265261
.windows(2)
266262
.map(|w| {
267-
String::from_utf8(
268-
buffer[(w[0] as usize)..(w[1] as usize)].to_vec(),
269-
)
270-
.unwrap()
263+
String::from_utf8(buffer[(w[0] as usize)..(w[1] as usize)].to_vec())
264+
.unwrap()
271265
})
272266
.collect();
273267

@@ -289,19 +283,15 @@ impl<R: Read + Seek> FeatherReader<R> {
289283
let arr = builder.finish();
290284
arrays.push(Arc::new(arr));
291285

292-
let field = Field::new(
293-
name,
294-
get_data_type(array.type_()),
295-
array.null_count() > 0,
296-
);
286+
let field =
287+
Field::new(name, get_data_type(array.type_()), array.null_count() > 0);
297288
fields.push(field);
298289
}
299290
fbs::TypeMetadata::TimestampMetadata
300291
| fbs::TypeMetadata::DateMetadata
301292
| fbs::TypeMetadata::TimeMetadata => {
302293
return Err(ArrowError::IoError(
303-
"Date/time Feather records are currently not supported."
304-
.to_string(),
294+
"Date/time Feather records are currently not supported.".to_string(),
305295
));
306296
}
307297
fbs::TypeMetadata::NONE => {
@@ -323,8 +313,7 @@ impl<R: Read + Seek> FeatherReader<R> {
323313
assert!(last_offset > 0);
324314

325315
// create field
326-
let field =
327-
Field::new(name, get_data_type(array.type_()), null_count > 0);
316+
let field = Field::new(name, get_data_type(array.type_()), null_count > 0);
328317
fields.push(field);
329318

330319
let array_ref = if &dtype == &DataType::Utf8 {
@@ -548,14 +537,12 @@ impl FeatherWriter for RecordBatch {
548537
}
549538
DataType::Float16 => {
550539
return Err(ArrowError::IoError(
551-
"DataType::Float16 is currently not supported by Rust Arrow"
552-
.to_string(),
540+
"DataType::Float16 is currently not supported by Rust Arrow".to_string(),
553541
));
554542
}
555543
DataType::List(_) | DataType::Struct(_) => {
556544
return Err(ArrowError::IoError(
557-
"Writing of lists and structs not supported in Feather"
558-
.to_string(),
545+
"Writing of lists and structs not supported in Feather".to_string(),
559546
));
560547
}
561548
DataType::Timestamp(_)
@@ -564,8 +551,7 @@ impl FeatherWriter for RecordBatch {
564551
| DataType::Time64(_)
565552
| DataType::Interval(_) => {
566553
return Err(ArrowError::IoError(
567-
"Date and time formats currently not supported by Rust Arrow"
568-
.to_string(),
554+
"Date and time formats currently not supported by Rust Arrow".to_string(),
569555
));
570556
}
571557
}

0 commit comments

Comments
 (0)