Skip to content

Commit d1b3774

Browse files
committed
[FIX] fix issues with clippy errors and rename files
1 parent 4992761 commit d1b3774

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

parquet-variant/src/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717

1818
//! Encoder module for converting Variant values to other formats
1919
20-
pub mod json;
20+
pub mod variant_to_json;

parquet-variant/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ mod variant;
3737
mod utils;
3838

3939
pub use variant::*;
40-
pub use encoder::json::{variant_to_json, variant_to_json_string, variant_to_json_value};
40+
pub use encoder::variant_to_json::{variant_to_json, variant_to_json_string, variant_to_json_value};

parquet-variant/src/variant.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,7 @@ impl<'m, 'v> VariantArray<'m, 'v> {
393393
};
394394

395395
// Skip the header byte to read the num_elements
396-
if let Ok(num_elements) = num_elements_size.unpack_usize(self.value, 1, 0) {
397-
num_elements
398-
} else {
399-
0 // Return 0 if we can't parse the length
400-
}
396+
num_elements_size.unpack_usize(self.value, 1, 0).unwrap_or(0)
401397
} else {
402398
0 // Return 0 if we can't read the header
403399
}
@@ -1117,6 +1113,14 @@ impl From<(i32, u8)> for Variant<'_, '_> {
11171113
}
11181114
}
11191115
}
1116+
impl From<bool> for Variant<'_, '_> {
1117+
fn from(value: bool) -> Self {
1118+
match value {
1119+
true => Variant::BooleanTrue,
1120+
false => Variant::BooleanFalse,
1121+
}
1122+
}
1123+
}
11201124

11211125
impl From<(i64, u8)> for Variant<'_, '_> {
11221126
fn from(value: (i64, u8)) -> Self {

0 commit comments

Comments
 (0)