Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ derive_partial_eq_without_eq = "deny"
equatable_if_let = "deny"
exit = "deny"
expect_fun_call = "deny"
expect_used = "deny"
fallible_impl_from = "deny"
get_unwrap = "deny"
host_endian_bytes = "deny"
Expand All @@ -339,7 +338,6 @@ same_name_method = "deny"
tests_outside_test_module = "deny"
# todo = "deny"
# unimplemented = "deny"
unwrap_in_result = "deny"
unwrap_used = "deny"
use_debug = "deny"

Expand Down
4 changes: 2 additions & 2 deletions benchmarks/duckdb-bench/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl DuckClient {
path: Option<PathBuf>,
threads: Option<usize>,
) -> Result<(Database, Connection)> {
let mut config = Config::new().vortex_expect("failed to create duckdb config");
let mut config = Config::new().expect("failed to create duckdb config");

// Set DuckDB thread count if specified
if let Some(thread_count) = threads {
Expand Down Expand Up @@ -144,7 +144,7 @@ impl DuckClient {
let result = self.connection.query(query)?;
let query_time = time_instant.elapsed();

let row_count = usize::try_from(result.row_count()).vortex_expect("row count overflow");
let row_count = usize::try_from(result.row_count()).expect("row count overflow");

// TODO: Extract DuckDB's internal timing from profiling info if available
Ok((row_count, Some(query_time)))
Expand Down
1 change: 1 addition & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ single-char-binding-names-threshold = 2
disallowed-types = [
{ path = "std::collections::HashMap", reason = "Use the HashMap in vortex_utils::aliases for better performance" },
{ path = "std::collections::HashSet", reason = "Use the HashSet in vortex_utils::aliases for better performance" },
{ path = "std::result::Result", reason = "Functions should always return VortexResult, which carries a backtrace" },
{ path = "std::sync::Mutex", reason = "Prefer using parking_lot Mutex for improved ergonomics and performance" },
{ path = "std::sync::RwLock", reason = "Prefer using parking_lot RwLock for improved ergonomics and performance" },
]
Expand Down
3 changes: 1 addition & 2 deletions encodings/alp/src/alp/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ use vortex_array::vtable::ValidityVTableFromChild;
use vortex_array::vtable::VisitorVTable;
use vortex_dtype::DType;
use vortex_dtype::PType;
use vortex_error::VortexExpect;
use vortex_error::VortexResult;
use vortex_error::vortex_bail;
use vortex_error::vortex_ensure;
Expand Down Expand Up @@ -298,7 +297,7 @@ impl ALPArray {
/// See [`ALPArray::try_new`] for reference on preconditions that must pass before
/// calling this method.
pub fn new(encoded: ArrayRef, exponents: Exponents, patches: Option<Patches>) -> Self {
Self::try_new(encoded, exponents, patches).vortex_expect("ALPArray new")
Self::try_new(encoded, exponents, patches).expect("ALPArray new")
}

/// Build a new `ALPArray` from components:
Expand Down
3 changes: 1 addition & 2 deletions encodings/alp/src/alp/compute/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ mod tests {
use vortex_dtype::DType;
use vortex_dtype::Nullability;
use vortex_dtype::PType;
use vortex_error::VortexExpect;
use vortex_error::VortexResult;

use crate::alp_encode;
Expand Down Expand Up @@ -146,7 +145,7 @@ mod tests {
#[case(buffer![42.42f64].into_array())]
#[case(buffer![0.0f32, -1.5, 2.5, -3.5, 4.5].into_array())]
fn test_cast_alp_conformance(#[case] array: vortex_array::ArrayRef) -> VortexResult<()> {
let alp = alp_encode(&array.to_primitive(), None).vortex_expect("cannot fail");
let alp = alp_encode(&array.to_primitive(), None).expect("cannot fail");
test_cast_conformance(alp.as_ref());

Ok(())
Expand Down
3 changes: 1 addition & 2 deletions encodings/alp/src/alp/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

use vortex_array::scalar::Scalar;
use vortex_array::vtable::OperationsVTable;
use vortex_error::VortexExpect;
use vortex_error::VortexResult;

use crate::ALPArray;
Expand All @@ -23,7 +22,7 @@ impl OperationsVTable<ALPVTable> for ALPVTable {

Ok(match_each_alp_float_ptype!(array.ptype(), |T| {
let encoded_val: <T as ALPFloat>::ALPInt =
(&encoded_val).try_into().vortex_expect("invalid ALPInt");
(&encoded_val).try_into().expect("invalid ALPInt");
Scalar::primitive(
<T as ALPFloat>::decode_single(encoded_val, array.exponents()),
array.dtype().nullability(),
Expand Down
3 changes: 1 addition & 2 deletions encodings/alp/src/alp_rd/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ use vortex_buffer::Buffer;
use vortex_dtype::DType;
use vortex_dtype::Nullability;
use vortex_dtype::PType;
use vortex_error::VortexExpect;
use vortex_error::VortexResult;
use vortex_error::vortex_bail;
use vortex_error::vortex_ensure;
Expand Down Expand Up @@ -90,7 +89,7 @@ impl VTable for ALPRDVTable {
dict_len: array.left_parts_dictionary().len() as u32,
dict,
left_parts_ptype: PType::try_from(array.left_parts().dtype())
.vortex_expect("Must be a valid PType") as i32,
.expect("Must be a valid PType") as i32,
patches: array
.left_parts_patches()
.map(|p| p.to_metadata(array.len(), array.left_parts().dtype()))
Expand Down
13 changes: 5 additions & 8 deletions encodings/alp/src/alp_rd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ use vortex_buffer::BufferMut;
use vortex_dtype::DType;
use vortex_dtype::NativePType;
use vortex_dtype::match_each_integer_ptype;
use vortex_error::VortexExpect;
use vortex_error::VortexResult;
use vortex_error::vortex_panic;
use vortex_utils::aliases::hash_map::HashMap;
Expand Down Expand Up @@ -233,15 +232,15 @@ impl RDEncoder {
// SAFETY: by construction, all values in left_parts can be packed to left_bit_width.
let packed_left = unsafe {
bitpack_encode_unchecked(primitive_left, left_bit_width as _)
.vortex_expect("bitpack_encode_unchecked should succeed for left parts")
.expect("bitpack_encode_unchecked should succeed for left parts")
.into_array()
};

let primitive_right = PrimitiveArray::new(right_parts, Validity::NonNullable);
// SAFETY: by construction, all values in right_parts are right_bit_width + leading zeros.
let packed_right = unsafe {
bitpack_encode_unchecked(primitive_right, self.right_bit_width as _)
.vortex_expect("bitpack_encode_unchecked should succeed for right parts")
.expect("bitpack_encode_unchecked should succeed for right parts")
.into_array()
};

Expand All @@ -256,9 +255,7 @@ impl RDEncoder {
// SAFETY: We calculate bw such that it is wide enough to hold the largest position index.
let packed_pos = unsafe {
bitpack_encode_unchecked(exc_pos_array, bw)
.vortex_expect(
"bitpack_encode_unchecked should succeed for exception positions",
)
.expect("bitpack_encode_unchecked should succeed for exception positions")
.into_array()
};

Expand All @@ -270,7 +267,7 @@ impl RDEncoder {
// TODO(0ax1): handle chunk offsets
None,
)
.vortex_expect("Patches construction in encode")
.expect("Patches construction in encode")
});

ALPRDArray::try_new(
Expand All @@ -281,7 +278,7 @@ impl RDEncoder {
self.right_bit_width,
exceptions,
)
.vortex_expect("ALPRDArray construction in encode")
.expect("ALPRDArray construction in encode")
}
}

Expand Down
9 changes: 4 additions & 5 deletions encodings/alp/src/alp_rd/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
use vortex_array::Array;
use vortex_array::scalar::Scalar;
use vortex_array::vtable::OperationsVTable;
use vortex_error::VortexExpect;
use vortex_error::VortexResult;

use crate::ALPRDArray;
Expand All @@ -22,14 +21,14 @@ impl OperationsVTable<ALPRDVTable> for ALPRDVTable {
Some(patched_value) => patched_value
.as_primitive()
.as_::<u16>()
.vortex_expect("patched values must be non-null"),
.expect("patched values must be non-null"),
_ => {
let left_code: u16 = array
.left_parts()
.scalar_at(index)?
.as_primitive()
.as_::<u16>()
.vortex_expect("left_code must be non-null");
.expect("left_code must be non-null");
array.left_parts_dictionary()[left_code as usize]
}
};
Expand All @@ -41,7 +40,7 @@ impl OperationsVTable<ALPRDVTable> for ALPRDVTable {
.scalar_at(index)?
.as_primitive()
.as_::<u32>()
.vortex_expect("non-null");
.expect("non-null");
let packed = f32::from_bits((left as u32) << array.right_bit_width() | right);
Scalar::primitive(packed, array.dtype().nullability())
} else {
Expand All @@ -50,7 +49,7 @@ impl OperationsVTable<ALPRDVTable> for ALPRDVTable {
.scalar_at(index)?
.as_primitive()
.as_::<u64>()
.vortex_expect("non-null");
.expect("non-null");
let packed = f64::from_bits(((left as u64) << array.right_bit_width()) | right);
Scalar::primitive(packed, array.dtype().nullability())
})
Expand Down
2 changes: 1 addition & 1 deletion encodings/bytebool/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl VTable for ByteBoolVTable {
array.validity = if children.is_empty() {
Validity::from(array.dtype.nullability())
} else {
Validity::Array(children.into_iter().next().vortex_expect("checked"))
Validity::Array(children.into_iter().next().expect("checked"))
};

Ok(())
Expand Down
7 changes: 3 additions & 4 deletions encodings/datetime-parts/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ use vortex_array::vtable::VisitorVTable;
use vortex_dtype::DType;
use vortex_dtype::Nullability;
use vortex_dtype::PType;
use vortex_error::VortexExpect;
use vortex_error::VortexResult;
use vortex_error::vortex_bail;
use vortex_error::vortex_ensure;
Expand Down Expand Up @@ -152,9 +151,9 @@ impl VTable for DateTimePartsVTable {
);

let mut children_iter = children.into_iter();
array.days = children_iter.next().vortex_expect("checked");
array.seconds = children_iter.next().vortex_expect("checked");
array.subseconds = children_iter.next().vortex_expect("checked");
array.days = children_iter.next().expect("checked");
array.seconds = children_iter.next().expect("checked");
array.subseconds = children_iter.next().expect("checked");

Ok(())
}
Expand Down
9 changes: 3 additions & 6 deletions encodings/datetime-parts/src/canonical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn decode_to_temporal(
let days_buf = array
.days()
.cast(DType::Primitive(PType::I64, array.dtype().nullability()))
.vortex_expect("must be able to cast days to i64")
.expect("must be able to cast days to i64")
.execute::<PrimitiveArray>(ctx)?;

// We start with the days component, which is always present.
Expand All @@ -58,10 +58,7 @@ pub fn decode_to_temporal(
.map_each_in_place(|d| d * 86_400 * divisor);

if let Some(seconds) = array.seconds().as_constant() {
let seconds = seconds
.as_primitive()
.as_::<i64>()
.vortex_expect("non-nullable");
let seconds = seconds.as_primitive().as_::<i64>().expect("non-nullable");
let seconds = seconds * divisor;
for v in values.iter_mut() {
*v += seconds;
Expand All @@ -80,7 +77,7 @@ pub fn decode_to_temporal(
let subseconds = subseconds
.as_primitive()
.as_::<i64>()
.vortex_expect("non-nullable");
.expect("non-nullable");
for v in values.iter_mut() {
*v += subseconds;
}
Expand Down
5 changes: 2 additions & 3 deletions encodings/datetime-parts/src/compute/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use vortex_array::optimizer::rules::ArrayParentReduceRule;
use vortex_array::optimizer::rules::ParentRuleSet;
use vortex_dtype::DType;
use vortex_dtype::datetime::Timestamp;
use vortex_error::VortexExpect;
use vortex_error::VortexResult;

use crate::DateTimePartsArray;
Expand Down Expand Up @@ -62,12 +61,12 @@ impl ArrayParentReduceRule<DateTimePartsVTable> for DTPFilterPushDownRule {
child.dtype().clone(),
child.days().clone().filter(parent.filter_mask().clone())?,
ConstantArray::new(
child.seconds().as_constant().vortex_expect("constant"),
child.seconds().as_constant().expect("constant"),
parent.filter_mask().true_count(),
)
.into_array(),
ConstantArray::new(
child.subseconds().as_constant().vortex_expect("constant"),
child.subseconds().as_constant().expect("constant"),
parent.filter_mask().true_count(),
)
.into_array(),
Expand Down
7 changes: 3 additions & 4 deletions encodings/datetime-parts/src/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use vortex_array::scalar::Scalar;
use vortex_array::vtable::OperationsVTable;
use vortex_dtype::DType;
use vortex_dtype::datetime::Timestamp;
use vortex_error::VortexExpect;
use vortex_error::VortexResult;
use vortex_error::vortex_panic;

Expand Down Expand Up @@ -37,19 +36,19 @@ impl OperationsVTable<DateTimePartsVTable> for DateTimePartsVTable {
.scalar_at(index)?
.as_primitive()
.as_::<i64>()
.vortex_expect("days fits in i64");
.expect("days fits in i64");
let seconds: i64 = array
.seconds()
.scalar_at(index)?
.as_primitive()
.as_::<i64>()
.vortex_expect("seconds fits in i64");
.expect("seconds fits in i64");
let subseconds: i64 = array
.subseconds()
.scalar_at(index)?
.as_primitive()
.as_::<i64>()
.vortex_expect("subseconds fits in i64");
.expect("subseconds fits in i64");

let ts = timestamp::combine(
TimestampParts {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use vortex_dtype::PType;
use vortex_dtype::ToI256;
use vortex_dtype::match_each_decimal_value;
use vortex_dtype::match_each_integer_ptype;
use vortex_error::VortexExpect;
use vortex_error::VortexResult;

use crate::DecimalBytePartsVTable;
Expand All @@ -42,7 +41,7 @@ impl CompareKernel for DecimalBytePartsVTable {
let rhs_decimal = rhs_const
.as_decimal()
.decimal_value()
.vortex_expect("checked for null in entry func");
.expect("checked for null in entry func");

match decimal_value_wrapper_to_primitive(rhs_decimal, lhs.msp.as_primitive_typed().ptype())
{
Expand Down Expand Up @@ -110,19 +109,19 @@ where
let Some(encoded) = <P as NumCast>::from(decimal_v) else {
let decimal_i256 = decimal_v
.to_i256()
.vortex_expect("i256 is big enough for any DecimalValue");
.expect("i256 is big enough for any DecimalValue");
return if decimal_i256
> P::max_value()
.to_i256()
.vortex_expect("i256 is big enough for any PType")
.expect("i256 is big enough for any PType")
{
Err(Positive)
} else {
assert!(
decimal_i256
< P::min_value()
.to_i256()
.vortex_expect("i256 is big enough for any PType")
.expect("i256 is big enough for any PType")
);
Err(Negative)
};
Expand Down
7 changes: 3 additions & 4 deletions encodings/decimal-byte-parts/src/decimal_byte_parts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ use vortex_dtype::DType;
use vortex_dtype::DecimalDType;
use vortex_dtype::PType;
use vortex_dtype::match_each_signed_integer_ptype;
use vortex_error::VortexExpect;
use vortex_error::VortexResult;
use vortex_error::vortex_bail;
use vortex_error::vortex_ensure;
Expand Down Expand Up @@ -124,7 +123,7 @@ impl VTable for DecimalBytePartsVTable {
"DecimalBytePartsArray expects exactly 1 child (msp), got {}",
children.len()
);
array.msp = children.into_iter().next().vortex_expect("checked");
array.msp = children.into_iter().next().expect("checked");
Ok(())
}

Expand Down Expand Up @@ -208,7 +207,7 @@ impl DecimalBytePartsArray {
pub fn decimal_dtype(&self) -> &DecimalDType {
self.dtype
.as_decimal_opt()
.vortex_expect("must be a decimal dtype")
.expect("must be a decimal dtype")
}

pub(crate) fn msp(&self) -> &ArrayRef {
Expand Down Expand Up @@ -286,7 +285,7 @@ impl OperationsVTable<DecimalBytePartsVTable> for DecimalBytePartsVTable {
// Note. values in msp, can only be signed integers upto size i64.
let primitive_scalar = scalar.as_primitive();
// TODO(joe): extend this to support multiple parts.
let value = primitive_scalar.as_::<i64>().vortex_expect("non-null");
let value = primitive_scalar.as_::<i64>().expect("non-null");
Scalar::try_new(
array.dtype.clone(),
Some(ScalarValue::Decimal(DecimalValue::I64(value))),
Expand Down
Loading
Loading