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/15 19:06:11 UTC
[arrow-rs] branch master updated: fix create_primitive_array (#4412)
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 a57d718ed fix create_primitive_array (#4412)
a57d718ed is described below
commit a57d718ed8b2518d0fa920a781977a7bc0b1bcc7
Author: ming08108 <mi...@users.noreply.github.com>
AuthorDate: Thu Jun 15 14:06:05 2023 -0500
fix create_primitive_array (#4412)
---
arrow-ipc/src/reader.rs | 56 +++++++++++++++----------------------------------
1 file changed, 17 insertions(+), 39 deletions(-)
diff --git a/arrow-ipc/src/reader.rs b/arrow-ipc/src/reader.rs
index cabf81fc2..92a7a0dcc 100644
--- a/arrow-ipc/src/reader.rs
+++ b/arrow-ipc/src/reader.rs
@@ -234,14 +234,6 @@ fn create_primitive_array(
.null_bit_buffer(null_buffer)
.build()?
}
- FixedSizeBinary(_) => {
- // read 2 buffers: null buffer (optional) and data buffer
- ArrayData::builder(data_type.clone())
- .len(length)
- .add_buffer(buffers[1].clone())
- .null_bit_buffer(null_buffer)
- .build()?
- }
Int8
| Int16
| Int32
@@ -250,24 +242,23 @@ fn create_primitive_array(
| UInt32
| Time32(_)
| Date32
- | Interval(IntervalUnit::YearMonth) => {
- if buffers[1].len() / 8 == length && length != 1 {
- // interpret as a signed i64, and cast appropriately
- let data = ArrayData::builder(DataType::Int64)
- .len(length)
- .add_buffer(buffers[1].clone())
- .null_bit_buffer(null_buffer)
- .build()?;
- let values = Arc::new(Int64Array::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::YearMonth)
+ | Interval(IntervalUnit::DayTime)
+ | FixedSizeBinary(_)
+ | Boolean
+ | Int64
+ | UInt64
+ | Float64
+ | Time64(_)
+ | Timestamp(_, _)
+ | Date64
+ | Duration(_) => {
+ // read 2 buffers: null buffer (optional) and data buffer
+ ArrayData::builder(data_type.clone())
+ .len(length)
+ .add_buffer(buffers[1].clone())
+ .null_bit_buffer(null_buffer)
+ .build()?
}
Float32 => {
if buffers[1].len() / 8 == length && length != 1 {
@@ -288,19 +279,6 @@ fn create_primitive_array(
.build()?
}
}
- Boolean
- | Int64
- | UInt64
- | Float64
- | Time64(_)
- | Timestamp(_, _)
- | Date64
- | Duration(_)
- | Interval(IntervalUnit::DayTime) => 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);