Skip to content

Commit

Permalink
Fix several bugs in parquet writer statistics generation, add `Enable…
Browse files Browse the repository at this point in the history
…dStatistics` to control level of statistics generated (#2022)

* Fix parquet writer statistics

* Fix test_column_writer_precalculated_statistics

* Handle NaN floats

* Reduce code duplication

* Review feedback
  • Loading branch information
tustvold authored Jul 8, 2022
1 parent 7542f7d commit d9dbf72
Show file tree
Hide file tree
Showing 3 changed files with 191 additions and 105 deletions.
6 changes: 4 additions & 2 deletions parquet/src/arrow/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ pub(crate) fn add_encoded_arrow_schema_to_metadata(
value: Some(encoded),
};

let mut meta = props.key_value_metadata.clone().unwrap_or_default();
let meta = props
.key_value_metadata
.get_or_insert_with(Default::default);

// check if ARROW:schema exists, and overwrite it
let schema_meta = meta
.iter()
Expand All @@ -167,7 +170,6 @@ pub(crate) fn add_encoded_arrow_schema_to_metadata(
meta.push(schema_kv);
}
}
props.key_value_metadata = Some(meta);
}

/// Convert arrow schema to parquet schema
Expand Down
Loading

0 comments on commit d9dbf72

Please sign in to comment.