Skip to content

Commit

Permalink
run cargo +stable fmt (and clippy)
Browse files Browse the repository at this point in the history
  • Loading branch information
nevi-me committed Oct 6, 2020
1 parent 75ebf01 commit f65b2ba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 3 additions & 1 deletion rust/arrow/src/ipc/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,9 @@ pub(crate) fn build_field<'a: 'b, 'b>(

let mut field_builder = ipc::FieldBuilder::new(fbb);
field_builder.add_name(fb_field_name);
fb_dictionary.map(|dictionary| field_builder.add_dictionary(dictionary));
if let Some(dictionary) = fb_dictionary {
field_builder.add_dictionary(dictionary)
}
field_builder.add_type_type(field_type.type_type);
field_builder.add_nullable(field.is_nullable());
match field_type.children {
Expand Down
16 changes: 9 additions & 7 deletions rust/parquet/src/arrow/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ where
let mut metadata = parse_key_value_metadata(key_value_metadata).unwrap_or_default();
let arrow_schema_metadata = metadata
.remove(super::ARROW_SCHEMA_META_KEY)
.map(|encoded| get_arrow_schema_from_metadata(&encoded)).unwrap_or_default();
.map(|encoded| get_arrow_schema_from_metadata(&encoded))
.unwrap_or_default();

let mut base_nodes = Vec::new();
let mut base_nodes_set = HashSet::new();
Expand All @@ -83,7 +84,10 @@ where
let column = parquet_schema.column(c);
let name = column.name();

if let Some(field) = arrow_schema_metadata.as_ref().and_then(|schema| schema.field_with_name(name).ok().cloned()) {
if let Some(field) = arrow_schema_metadata
.as_ref()
.and_then(|schema| schema.field_with_name(name).ok().cloned())
{
base_nodes.push(FieldType::Arrow(field));
} else {
let column = column.self_type() as *const Type;
Expand All @@ -100,11 +104,9 @@ where

base_nodes
.into_iter()
.map(|t| {
match t {
FieldType::Parquet(t) => ParquetTypeConverter::new(t, &leaves).to_field(),
FieldType::Arrow(f) => Ok(Some(f)),
}
.map(|t| match t {
FieldType::Parquet(t) => ParquetTypeConverter::new(t, &leaves).to_field(),
FieldType::Arrow(f) => Ok(Some(f)),
})
.collect::<Result<Vec<Option<Field>>>>()
.map(|result| result.into_iter().filter_map(|f| f).collect::<Vec<Field>>())
Expand Down

0 comments on commit f65b2ba

Please sign in to comment.