Skip to content

Commit

Permalink
Some small fixes (#1631)
Browse files Browse the repository at this point in the history
  • Loading branch information
gatesn authored Dec 10, 2024
1 parent 3de4b29 commit f8a2980
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
5 changes: 3 additions & 2 deletions vortex-array/src/array/chunked/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ impl ChunkedArray {
vortex_bail!("chunk index {} > num chunks ({})", idx, self.nchunks());
}

let chunk_start = usize::try_from(&scalar_at(self.chunk_offsets(), idx)?)?;
let chunk_end = usize::try_from(&scalar_at(self.chunk_offsets(), idx + 1)?)?;
let chunk_offsets = self.chunk_offsets();
let chunk_start = usize::try_from(&scalar_at(&chunk_offsets, idx)?)?;
let chunk_end = usize::try_from(&scalar_at(&chunk_offsets, idx + 1)?)?;

// Offset the index since chunk_ends is child 0.
self.as_ref()
Expand Down
8 changes: 1 addition & 7 deletions vortex-scalar/src/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ use std::any::type_name;
use num_traits::{FromPrimitive, NumCast};
use vortex_dtype::half::f16;
use vortex_dtype::{match_each_native_ptype, DType, NativePType, Nullability, PType};
use vortex_error::{
vortex_bail, vortex_err, vortex_panic, VortexError, VortexResult, VortexUnwrap,
};
use vortex_error::{vortex_err, vortex_panic, VortexError, VortexResult, VortexUnwrap};

use crate::pvalue::PValue;
use crate::value::ScalarValue;
Expand All @@ -20,10 +18,6 @@ pub struct PrimitiveScalar<'a> {

impl<'a> PrimitiveScalar<'a> {
pub fn try_new(dtype: &'a DType, value: &ScalarValue) -> VortexResult<Self> {
if !matches!(dtype, DType::Primitive(..)) {
vortex_bail!("Expected primitive scalar, found {}", dtype)
}

let ptype = PType::try_from(dtype)?;

// Read the serialized value into the correct PValue.
Expand Down

0 comments on commit f8a2980

Please sign in to comment.