Skip to content

Commit

Permalink
Update to fix precision on float32 arrays.
Browse files Browse the repository at this point in the history
  • Loading branch information
paddyhoran committed Nov 18, 2019
1 parent bb9f3b9 commit 42210fc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rust/arrow/src/datatypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl ArrowNativeType for u64 {

impl ArrowNativeType for f32 {
fn into_json_value(self) -> Option<Value> {
Number::from_f64(self as f64).map(|num| VNumber(num))
Number::from_f64(f64::round(self as f64 * 1000.0) / 1000.0).map(|num| VNumber(num))
}
}

Expand Down
2 changes: 1 addition & 1 deletion rust/arrow/src/util/integration_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl ArrowJsonSchema {
}

impl ArrowJsonBatch {
/// Comapre the Arrow JSON record batch with a `RecordBatch`
/// Compare the Arrow JSON record batch with a `RecordBatch`
fn equals_batch(&self, batch: &RecordBatch) -> bool {
if self.count != batch.num_rows() {
return false;
Expand Down

0 comments on commit 42210fc

Please sign in to comment.