Skip to content

Commit edd45fc

Browse files
committed
tests
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
1 parent 0a01a79 commit edd45fc

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

vortex-duckdb-ext/src/duckdb/value.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,23 @@ impl From<&[u8]> for Value {
201201
unsafe { Self::own(cpp::duckdb_create_blob(value.as_ptr(), value.len() as _)) }
202202
}
203203
}
204+
205+
#[cfg(test)]
206+
mod tests {
207+
208+
use crate::duckdb::i128_from_parts;
209+
210+
#[test]
211+
fn test_huge_int_from_parts() {
212+
assert_eq!(i128_from_parts(0, 0), 0i128);
213+
assert_eq!(i128_from_parts(0, 34534912), 34534912i128);
214+
assert_eq!(i128_from_parts(i64::MIN, 0), i128::MIN);
215+
assert_eq!(i128_from_parts(i64::MAX, u64::MAX), i128::MAX);
216+
217+
assert_eq!(i128_from_parts(0, u64::MAX), u64::MAX as i128);
218+
assert_eq!(
219+
i128_from_parts(1, u64::MAX),
220+
(1i128 << 64) + (u64::MAX as i128)
221+
);
222+
}
223+
}

vortex-scalar/src/extension.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ impl<'a> TryFrom<&'a Scalar> for ExtScalar<'a> {
122122

123123
impl Scalar {
124124
pub fn extension(ext_dtype: Arc<ExtDType>, value: Scalar) -> Self {
125-
assert_eq!(ext_dtype.storage_dtype(), value.dtype());
125+
// TODO(joe): enable once we use rust duckdb
126+
// assert_eq!(ext_dtype.storage_dtype(), value.dtype());
126127
Self {
127128
dtype: DType::Extension(ext_dtype),
128129
value: value.value().clone(),

0 commit comments

Comments
 (0)