Skip to content

Commit 5a1b340

Browse files
committed
Merge remote-tracking branch 'origin/ji/fix-up-execute' into ji/fix-up-execute
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
2 parents bb09b8c + d5c6b55 commit 5a1b340

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

vortex-array/src/arrow/record_batch.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,17 @@ use crate::VortexSessionExecute;
1717
use crate::array::IntoArray;
1818
use crate::arrays::StructArray;
1919
use crate::arrow::ArrowArrayExecutor;
20-
use crate::validity::Validity;
21-
22-
// deprecated(note = "Use ArrowArrayExecutor::execute_record_batch instead")
2320
impl TryFrom<&ArrayRef> for RecordBatch {
2421
type Error = VortexError;
2522

23+
#[deprecated(note = "Use ArrowArrayExecutor::execute_record_batch instead")]
2624
fn try_from(value: &ArrayRef) -> VortexResult<Self> {
2725
let Canonical::Struct(struct_array) = value.to_canonical()? else {
2826
vortex_bail!("RecordBatch can only be constructed from ")
2927
};
3028

3129
vortex_ensure!(
32-
matches!(struct_array.validity()?, Validity::AllValid),
30+
struct_array.validity()?.no_nulls(),
3331
"RecordBatch can only be constructed from StructArray with no nulls"
3432
);
3533

vortex-array/src/validity.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ impl Validity {
112112
}
113113
}
114114

115+
/// Returns `true` if this validity guarantees no null values, i.e. it is either
116+
/// [`Validity::NonNullable`] or [`Validity::AllValid`].
117+
#[inline]
118+
pub fn no_nulls(&self) -> bool {
119+
matches!(self, Self::NonNullable | Self::AllValid)
120+
}
121+
115122
/// The union nullability and validity.
116123
#[inline]
117124
pub fn union_nullability(self, nullability: Nullability) -> Self {

0 commit comments

Comments
 (0)