Skip to content

Commit

Permalink
fix: ScalarValue flatbuffer serde doesn't perform redundant copy (#1635)
Browse files Browse the repository at this point in the history
  • Loading branch information
robert3005 authored Dec 10, 2024
1 parent 90a23de commit 55754ed
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions vortex-scalar/src/serde/flatbuffers.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use flatbuffers::{FlatBufferBuilder, WIPOffset};
use itertools::Itertools;
use serde::{Deserialize, Serialize};
use vortex_dtype::DType;
use vortex_error::{VortexError, VortexExpect as _};
Expand All @@ -25,9 +24,7 @@ impl TryFrom<fb::ScalarValue<'_>> for ScalarValue {
type Error = VortexError;

fn try_from(value: fb::ScalarValue<'_>) -> Result<Self, Self::Error> {
// TODO(ngates): what's the point of all this if I have to copy the data into a Vec?
let flex_value = value.flex().iter().collect_vec();
let reader = flexbuffers::Reader::get_root(flex_value.as_slice())?;
let reader = flexbuffers::Reader::get_root(value.flex().bytes())?;
Ok(Self::deserialize(reader)?)
}
}
Expand Down

0 comments on commit 55754ed

Please sign in to comment.