Skip to content

Commit a0122c4

Browse files
committed
do not validate on gpu array
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
1 parent ad768f5 commit a0122c4

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

  • vortex-array/src/arrays/extension

vortex-array/src/arrays/extension/array.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ impl ExtensionArray {
7575
///
7676
/// Returns an error if the storage array in not compatible with the extension dtype.
7777
pub fn try_new(ext_dtype: ExtDTypeRef, storage_array: ArrayRef) -> VortexResult<Self> {
78-
ext_dtype.validate_storage_array(&storage_array)?;
78+
if storage_array.is_host() {
79+
ext_dtype.validate_storage_array(&storage_array)?;
80+
} else {
81+
eprintln!("Unable to validate storage array on GPU")
82+
}
7983

8084
// SAFETY: we validate that the inputs are valid above.
8185
Ok(unsafe { Self::new_unchecked(ext_dtype, storage_array) })
@@ -90,9 +94,15 @@ impl ExtensionArray {
9094
/// called successfully on this storage array.
9195
pub unsafe fn new_unchecked(ext_dtype: ExtDTypeRef, storage_array: ArrayRef) -> Self {
9296
#[cfg(debug_assertions)]
93-
ext_dtype
94-
.validate_storage_array(&storage_array)
95-
.vortex_expect("[Debug Assertion]: Invalid storage array for `ExtensionArray`");
97+
{
98+
if storage_array.is_host() {
99+
ext_dtype
100+
.validate_storage_array(&storage_array)
101+
.vortex_expect("[Debug Assertion]: Invalid storage array for `ExtensionArray`");
102+
} else {
103+
eprintln!("Unable to validate storage array on GPU")
104+
}
105+
}
96106

97107
// The dtype check is much cheaper than the storage validation, so we might as well do this.
98108
assert_eq!(

0 commit comments

Comments
 (0)