Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ disallowed-methods = [
{ path = "std::thread::available_parallelism", reason = "This function might do an unbounded amount of work, use `vortex_utils::parallelism::get_available_parallelism instead" },
{ path = "vortex_session::registry::Id::new", reason = "Interning a static id on every call grabs the interner lock (#8380). Use a `CachedId` static for static ids; for a dynamic string, annotate the call with `#[expect(clippy::disallowed_methods)]`.", allow-invalid = true },
{ path = "vortex_session::registry::Id::new_static", reason = "Interning a static id on every call grabs the interner lock; use a `CachedId` static instead (#8380).", allow-invalid = true },
{ path = "vortex_array::legacy_session", reason = "Relies on the hidden global session; thread an explicit `VortexSession`/`ExecutionCtx` through instead" },
]
2 changes: 2 additions & 0 deletions encodings/alp/src/alp_rd/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ impl VTable for ALPRD {
))
}

#[allow(clippy::disallowed_methods)]
fn deserialize(
&self,
dtype: &DType,
Expand Down Expand Up @@ -470,6 +471,7 @@ fn patches_from_slots(
PatchesData::patches_from_slots(patches_data, len, slots, LP_PATCH_SLOTS)
}

#[allow(clippy::disallowed_methods)]
fn validate_parts(
dtype: &DType,
len: usize,
Expand Down
1 change: 1 addition & 0 deletions encodings/alp/src/alp_rd/compute/mask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use crate::ALPRD;
use crate::ALPRDArrayExt;

impl MaskReduce for ALPRD {
#[allow(clippy::disallowed_methods)]
fn mask(array: ArrayView<'_, Self>, mask: &ArrayRef) -> VortexResult<Option<ArrayRef>> {
let masked_left_parts = MaskExpr.try_new_array(
array.left_parts().len(),
Expand Down
5 changes: 3 additions & 2 deletions encodings/fastlanes/src/delta/vtable/validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-FileCopyrightText: Copyright the Vortex contributors

use vortex_array::ArrayView;
use vortex_array::LEGACY_SESSION;
use vortex_array::VortexSessionExecute;
use vortex_array::legacy_session;
use vortex_array::validity::Validity;
use vortex_array::vtable::ValidityVTable;
use vortex_error::VortexResult;
Expand All @@ -13,13 +13,14 @@ use crate::bit_transpose::untranspose_validity;
use crate::delta::array::DeltaArrayExt;

impl ValidityVTable<Delta> for Delta {
#[allow(clippy::disallowed_methods)]
fn validity(array: ArrayView<'_, Delta>) -> VortexResult<Validity> {
let start = array.offset();
let end = start + array.len();

let validity = untranspose_validity(
&array.deltas().validity()?,
&mut LEGACY_SESSION.create_execution_ctx(),
&mut legacy_session().create_execution_ctx(),
)?;
validity.slice(start..end)
}
Expand Down
5 changes: 3 additions & 2 deletions encodings/fsst/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use vortex_array::EqMode;
use vortex_array::ExecutionCtx;
use vortex_array::ExecutionResult;
use vortex_array::IntoArray;
use vortex_array::LEGACY_SESSION;
use vortex_array::TypedArrayRef;
use vortex_array::VortexSessionExecute;
use vortex_array::arrays::VarBin;
Expand All @@ -37,6 +36,7 @@ use vortex_array::builders::VarBinViewBuilder;
use vortex_array::dtype::DType;
use vortex_array::dtype::Nullability;
use vortex_array::dtype::PType;
use vortex_array::legacy_session;
use vortex_array::serde::ArrayChildren;
use vortex_array::smallvec::smallvec;
use vortex_array::validity::Validity;
Expand Down Expand Up @@ -114,6 +114,7 @@ impl VTable for FSST {
*ID
}

#[allow(clippy::disallowed_methods)]
fn validate(
&self,
data: &Self::TypedArrayData,
Expand All @@ -122,7 +123,7 @@ impl VTable for FSST {
slots: &[Option<ArrayRef>],
) -> VortexResult<()> {
// TODO(ctx): trait fixes - VTable::validate has a fixed signature.
let mut ctx = LEGACY_SESSION.create_execution_ctx();
let mut ctx = legacy_session().create_execution_ctx();
data.validate(dtype, len, slots, &mut ctx)
}

Expand Down
5 changes: 3 additions & 2 deletions encodings/runend/src/arbitrary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use arbitrary::Arbitrary;
use arbitrary::Result;
use arbitrary::Unstructured;
use vortex_array::IntoArray;
use vortex_array::LEGACY_SESSION;
use vortex_array::VortexSessionExecute;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::arrays::arbitrary::ArbitraryArray;
Expand All @@ -14,6 +13,7 @@ use vortex_array::arrays::arbitrary::ArbitraryWith;
use vortex_array::dtype::DType;
use vortex_array::dtype::Nullability;
use vortex_array::dtype::PType;
use vortex_array::legacy_session;
use vortex_array::validity::Validity;
use vortex_buffer::Buffer;
use vortex_error::VortexExpect;
Expand All @@ -39,12 +39,13 @@ impl ArbitraryRunEndArray {
/// Generate an arbitrary RunEndArray with the given dtype for values.
///
/// The dtype must be a primitive or boolean type.
#[allow(clippy::disallowed_methods)]
pub fn with_dtype(u: &mut Unstructured, dtype: &DType, len: Option<usize>) -> Result<Self> {
// Number of runs (values/ends pairs)
let num_runs = u.int_in_range(0..=20)?;

// TODO(ctx): trait fixes - Arbitrary::arbitrary has a fixed signature.
let mut ctx = LEGACY_SESSION.create_execution_ctx();
let mut ctx = legacy_session().create_execution_ctx();
if num_runs == 0 {
// Empty RunEndArray
let ends = PrimitiveArray::from_iter(Vec::<u64>::new()).into_array();
Expand Down
5 changes: 3 additions & 2 deletions encodings/runend/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use vortex_array::EqMode;
use vortex_array::ExecutionCtx;
use vortex_array::ExecutionResult;
use vortex_array::IntoArray;
use vortex_array::LEGACY_SESSION;
use vortex_array::TypedArrayRef;
use vortex_array::VortexSessionExecute;
use vortex_array::arrays::Primitive;
Expand All @@ -28,6 +27,7 @@ use vortex_array::buffer::BufferHandle;
use vortex_array::dtype::DType;
use vortex_array::dtype::Nullability;
use vortex_array::dtype::PType;
use vortex_array::legacy_session;
use vortex_array::scalar::PValue;
use vortex_array::search_sorted::SearchSorted;
use vortex_array::search_sorted::SearchSortedSide;
Expand Down Expand Up @@ -86,6 +86,7 @@ impl VTable for RunEnd {
*ID
}

#[allow(clippy::disallowed_methods)]
fn validate(
&self,
data: &Self::TypedArrayData,
Expand All @@ -100,7 +101,7 @@ impl VTable for RunEnd {
.as_ref()
.vortex_expect("RunEndArray values slot");
// TODO(ctx): trait fixes - VTable::validate has a fixed signature.
let mut ctx = LEGACY_SESSION.create_execution_ctx();
let mut ctx = legacy_session().create_execution_ctx();
RunEndData::validate_parts(ends, values, data.offset, len, &mut ctx)?;
vortex_ensure!(
values.dtype() == dtype,
Expand Down
5 changes: 3 additions & 2 deletions encodings/runend/src/arrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use arrow_array::RunArray;
use arrow_array::types::RunEndIndexType;
use vortex_array::ArrayRef;
use vortex_array::IntoArray;
use vortex_array::LEGACY_SESSION;
use vortex_array::VortexSessionExecute;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::arrays::primitive::PrimitiveArrayExt;
use vortex_array::arrow::FromArrowArray;
use vortex_array::dtype::NativePType;
use vortex_array::legacy_session;
use vortex_array::scalar::PValue;
use vortex_array::search_sorted::SearchSorted;
use vortex_array::search_sorted::SearchSortedSide;
Expand All @@ -25,6 +25,7 @@ impl<R: RunEndIndexType> FromArrowArray<&RunArray<R>> for RunEndData
where
R::Native: NativePType,
{
#[allow(clippy::disallowed_methods)]
fn from_arrow(array: &RunArray<R>, nullable: bool) -> VortexResult<Self> {
let offset = array.run_ends().offset();
let len = array.run_ends().len();
Expand Down Expand Up @@ -57,7 +58,7 @@ where

// SAFETY: arrow-rs enforces the RunEndArray invariants, we inherit their guarantees.
// TODO(ctx): trait fixes - FromArrowArray::from_arrow has a fixed signature.
let mut ctx = LEGACY_SESSION.create_execution_ctx();
let mut ctx = legacy_session().create_execution_ctx();
RunEndData::validate_parts(&ends_slice, &values_slice, offset, len, &mut ctx)?;
Ok(unsafe { RunEndData::new_unchecked(offset) })
}
Expand Down
6 changes: 4 additions & 2 deletions encodings/zstd/src/zstd_buffers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ impl VTable for ZstdBuffers {
}

impl OperationsVTable<ZstdBuffers> for ZstdBuffers {
#[allow(clippy::disallowed_methods)]
fn scalar_at(
array: ArrayView<'_, ZstdBuffers>,
index: usize,
Expand All @@ -514,13 +515,14 @@ impl OperationsVTable<ZstdBuffers> for ZstdBuffers {
// canonical
let inner_array = ZstdBuffers::decompress_and_build_inner(
&array.into_owned(),
&vortex_array::LEGACY_SESSION,
vortex_array::legacy_session(),
)?;
inner_array.execute_scalar(index, ctx)
}
}

impl ValidityVTable<ZstdBuffers> for ZstdBuffers {
#[allow(clippy::disallowed_methods)]
fn validity(
array: ArrayView<'_, ZstdBuffers>,
) -> VortexResult<vortex_array::validity::Validity> {
Expand All @@ -530,7 +532,7 @@ impl ValidityVTable<ZstdBuffers> for ZstdBuffers {

let inner_array = ZstdBuffers::decompress_and_build_inner(
&array.into_owned(),
&vortex_array::LEGACY_SESSION,
vortex_array::legacy_session(),
)?;
inner_array.validity()
}
Expand Down
8 changes: 5 additions & 3 deletions vortex-array/src/array/erased.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use crate::Canonical;
use crate::ExecutionCtx;
use crate::ExecutionResult;
use crate::IntoArray;
use crate::LEGACY_SESSION;
use crate::VTable;
use crate::VortexSessionExecute;
use crate::aggregate_fn::fns::sum::sum;
Expand All @@ -50,6 +49,7 @@ use crate::dtype::DType;
use crate::expr::stats::Precision;
use crate::expr::stats::Stat;
use crate::expr::stats::StatsProviderExt;
use crate::legacy_session;
use crate::matcher::Matcher;
use crate::optimizer::ArrayOptimizer;
use crate::scalar::Scalar;
Expand Down Expand Up @@ -269,8 +269,9 @@ impl ArrayRef {
note = "Use `execute_scalar` instead, which allows passing an execution context for more \
efficient execution when fetching multiple scalars from the same array."
)]
#[allow(clippy::disallowed_methods)]
pub fn scalar_at(&self, index: usize) -> VortexResult<Scalar> {
self.execute_scalar(index, &mut LEGACY_SESSION.create_execution_ctx())
self.execute_scalar(index, &mut legacy_session().create_execution_ctx())
}

/// Execute the array to extract a scalar at the given index.
Expand Down Expand Up @@ -360,8 +361,9 @@ impl ArrayRef {

/// Returns the canonical representation of the array.
#[deprecated(note = "use `array.execute::<Canonical>(ctx)` instead")]
#[allow(clippy::disallowed_methods)]
pub fn into_canonical(self) -> VortexResult<Canonical> {
self.execute(&mut LEGACY_SESSION.create_execution_ctx())
self.execute(&mut legacy_session().create_execution_ctx())
}

/// Returns the canonical representation of the array.
Expand Down
5 changes: 3 additions & 2 deletions vortex-array/src/array/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ use crate::ArrayRef;
use crate::ArraySlots;
use crate::ExecutionCtx;
use crate::IntoArray;
use crate::LEGACY_SESSION;
use crate::VortexSessionExecute;
use crate::array::ArrayId;
use crate::array::ArrayView;
use crate::array::VTable;
use crate::dtype::DType;
use crate::legacy_session;
use crate::stats::ArrayStats;
use crate::stats::StatsSet;
use crate::stats::StatsSetRef;
Expand Down Expand Up @@ -382,9 +382,10 @@ impl<V: VTable> Array<V> {
note = "Use `execute_scalar` instead, which allows passing an execution context for more \
efficient execution when fetching multiple scalars from the same array."
)]
#[allow(clippy::disallowed_methods)]
pub fn scalar_at(&self, index: usize) -> VortexResult<crate::scalar::Scalar> {
self.inner
.execute_scalar(index, &mut LEGACY_SESSION.create_execution_ctx())
.execute_scalar(index, &mut legacy_session().create_execution_ctx())
}

/// Execute the array to extract a scalar at the given index.
Expand Down
5 changes: 3 additions & 2 deletions vortex-array/src/arrays/constant/compute/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ mod tests {
use rstest::rstest;

use crate::IntoArray;
use crate::LEGACY_SESSION;
use crate::VortexSessionExecute;
use crate::arrays::ConstantArray;
use crate::builtins::ArrayBuiltins;
use crate::compute::conformance::cast::test_cast_conformance;
use crate::dtype::DType;
use crate::dtype::DecimalDType;
use crate::dtype::Nullability;
use crate::legacy_session;
use crate::scalar::DecimalValue;
use crate::scalar::Scalar;

Expand All @@ -48,6 +48,7 @@ mod tests {
}

#[test]
#[allow(clippy::disallowed_methods)]
fn test_cast_constant_i64_to_decimal() {
let target_dtype = DType::Decimal(DecimalDType::new(21, 2), Nullability::NonNullable);
let casted = ConstantArray::new(Scalar::from(42i64), 5)
Expand All @@ -57,7 +58,7 @@ mod tests {

assert_eq!(casted.dtype(), &target_dtype);
let scalar = casted
.execute_scalar(0, &mut LEGACY_SESSION.create_execution_ctx())
.execute_scalar(0, &mut legacy_session().create_execution_ctx())
.unwrap();
assert_eq!(
scalar.as_decimal().decimal_value(),
Expand Down
5 changes: 3 additions & 2 deletions vortex-array/src/arrays/constant/compute/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@ use vortex_mask::AllOr;

use crate::ArrayRef;
use crate::IntoArray;
use crate::LEGACY_SESSION;
use crate::VortexSessionExecute;
use crate::array::ArrayView;
use crate::arrays::Constant;
use crate::arrays::ConstantArray;
use crate::arrays::MaskedArray;
use crate::arrays::dict::TakeReduce;
use crate::arrays::dict::TakeReduceAdaptor;
use crate::legacy_session;
use crate::optimizer::rules::ParentRuleSet;
use crate::scalar::Scalar;
use crate::validity::Validity;

impl TakeReduce for Constant {
#[allow(clippy::disallowed_methods)]
fn take(array: ArrayView<'_, Constant>, indices: &ArrayRef) -> VortexResult<Option<ArrayRef>> {
let mut ctx = LEGACY_SESSION.create_execution_ctx();
let mut ctx = legacy_session().create_execution_ctx();
let result = match indices
.validity()?
.execute_mask(indices.len(), &mut ctx)?
Expand Down
5 changes: 3 additions & 2 deletions vortex-array/src/arrays/dict/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use vortex_mask::AllOr;

use crate::ArrayRef;
use crate::ArraySlots;
use crate::LEGACY_SESSION;
#[expect(deprecated)]
use crate::ToCanonical as _;
use crate::VortexSessionExecute;
Expand All @@ -26,6 +25,7 @@ use crate::array_slots;
use crate::arrays::Dict;
use crate::dtype::DType;
use crate::dtype::PType;
use crate::legacy_session;
use crate::match_each_integer_ptype;

#[derive(Clone, prost::Message)]
Expand Down Expand Up @@ -144,11 +144,12 @@ pub trait DictArrayExt: TypedArrayRef<Dict> + DictArraySlotsExt {
Ok(())
}

#[allow(clippy::disallowed_methods)]
fn compute_referenced_values_mask(&self, referenced: bool) -> VortexResult<BitBuffer> {
let codes = self.codes();
let codes_validity = codes
.validity()?
.execute_mask(codes.len(), &mut LEGACY_SESSION.create_execution_ctx())?;
.execute_mask(codes.len(), &mut legacy_session().create_execution_ctx())?;
#[expect(deprecated)]
let codes_primitive = self.codes().to_primitive();
let values_len = self.values().len();
Expand Down
Loading
Loading