Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove arrow-cast dependency from arrow-ipc (#3044) #3053

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion arrow-ipc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ bench = false
[dependencies]
arrow-array = { version = "26.0.0", path = "../arrow-array" }
arrow-buffer = { version = "26.0.0", path = "../arrow-buffer" }
arrow-cast = { version = "26.0.0", path = "../arrow-cast" }
arrow-data = { version = "26.0.0", path = "../arrow-data" }
arrow-schema = { version = "26.0.0", path = "../arrow-schema" }
flatbuffers = { version = "22.9.2", default-features = false, features = ["thiserror"] }
Expand Down
18 changes: 9 additions & 9 deletions arrow-ipc/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ use std::fmt;
use std::io::{BufReader, Read, Seek, SeekFrom};
use std::sync::Arc;

use arrow_array::types::{Float32Type, Int32Type};
use arrow_array::*;
use arrow_buffer::{Buffer, MutableBuffer};
use arrow_cast::cast;
use arrow_data::ArrayData;
use arrow_schema::*;

Expand Down Expand Up @@ -436,10 +436,10 @@ fn create_primitive_array(
.null_bit_buffer(null_buffer)
.build()
.unwrap();
let values = Arc::new(Int64Array::from(data)) as ArrayRef;
// this cast is infallible, the unwrap is safe
let casted = cast(&values, data_type).unwrap();
casted.into_data()

Int64Array::from(data)
.unary::<_, Int32Type>(|x| x as _)
.into_data()
} else {
ArrayData::builder(data_type.clone())
.len(length)
Expand All @@ -458,10 +458,10 @@ fn create_primitive_array(
.null_bit_buffer(null_buffer)
.build()
.unwrap();
let values = Arc::new(Float64Array::from(data)) as ArrayRef;
// this cast is infallible, the unwrap is safe
let casted = cast(&values, data_type).unwrap();
casted.into_data()

Float64Array::from(data)
.unary::<_, Float32Type>(|x| x as _)
.into_data()
} else {
ArrayData::builder(data_type.clone())
.len(length)
Expand Down