You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2023/06/17 19:55:59 UTC
[arrow-rs] branch master updated: fix float cast (#4427)
This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new 15e0e76bf fix float cast (#4427)
15e0e76bf is described below
commit 15e0e76bfb6500799a43991f1339e69464c513f8
Author: ming08108 <mi...@users.noreply.github.com>
AuthorDate: Sat Jun 17 14:55:52 2023 -0500
fix float cast (#4427)
Co-authored-by: Guoming Yang <gu...@gmail.com>
---
arrow-ipc/src/reader.rs | 21 +--------------------
1 file changed, 1 insertion(+), 20 deletions(-)
diff --git a/arrow-ipc/src/reader.rs b/arrow-ipc/src/reader.rs
index 92a7a0dcc..0908d580d 100644
--- a/arrow-ipc/src/reader.rs
+++ b/arrow-ipc/src/reader.rs
@@ -29,7 +29,6 @@ use std::sync::Arc;
use arrow_array::*;
use arrow_buffer::{Buffer, MutableBuffer};
-use arrow_cast::cast;
use arrow_data::ArrayData;
use arrow_schema::*;
@@ -248,6 +247,7 @@ fn create_primitive_array(
| Boolean
| Int64
| UInt64
+ | Float32
| Float64
| Time64(_)
| Timestamp(_, _)
@@ -260,25 +260,6 @@ fn create_primitive_array(
.null_bit_buffer(null_buffer)
.build()?
}
- Float32 => {
- if buffers[1].len() / 8 == length && length != 1 {
- // interpret as a f64, and cast appropriately
- let data = ArrayData::builder(DataType::Float64)
- .len(length)
- .add_buffer(buffers[1].clone())
- .null_bit_buffer(null_buffer)
- .build()?;
- let values = Arc::new(Float64Array::from(data)) as ArrayRef;
- let casted = cast(&values, data_type)?;
- casted.into_data()
- } else {
- ArrayData::builder(data_type.clone())
- .len(length)
- .add_buffer(buffers[1].clone())
- .null_bit_buffer(null_buffer)
- .build()?
- }
- }
Interval(IntervalUnit::MonthDayNano) | Decimal128(_, _) => {
let buffer = get_aligned_buffer::<i128>(&buffers[1], length);