This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ff8f7d
commit bbe607c
Showing
16 changed files
with
284 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use arrow2::{ | ||
datatypes::DataType, | ||
scalar::{BinaryScalar, Scalar}, | ||
}; | ||
|
||
#[allow(clippy::eq_op)] | ||
#[test] | ||
fn equal() { | ||
let a = BinaryScalar::<i32>::from(Some("a")); | ||
let b = BinaryScalar::<i32>::from(None::<&str>); | ||
assert_eq!(a, a); | ||
assert_eq!(b, b); | ||
assert!(a != b); | ||
let b = BinaryScalar::<i32>::from(Some("b")); | ||
assert!(a != b); | ||
assert_eq!(b, b); | ||
} | ||
|
||
#[test] | ||
fn basics() { | ||
let a = BinaryScalar::<i32>::from(Some("a")); | ||
|
||
assert_eq!(a.value(), b"a"); | ||
assert_eq!(a.data_type(), &DataType::Binary); | ||
assert!(a.is_valid()); | ||
|
||
let a = BinaryScalar::<i64>::from(None::<&str>); | ||
|
||
assert_eq!(a.data_type(), &DataType::LargeBinary); | ||
assert!(!a.is_valid()); | ||
|
||
let _: &dyn std::any::Any = a.as_any(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use arrow2::{ | ||
datatypes::DataType, | ||
scalar::{BooleanScalar, Scalar}, | ||
}; | ||
|
||
#[allow(clippy::eq_op)] | ||
#[test] | ||
fn equal() { | ||
let a = BooleanScalar::from(Some(true)); | ||
let b = BooleanScalar::from(None); | ||
assert_eq!(a, a); | ||
assert_eq!(b, b); | ||
assert!(a != b); | ||
let b = BooleanScalar::from(Some(false)); | ||
assert!(a != b); | ||
assert_eq!(b, b); | ||
} | ||
|
||
#[test] | ||
fn basics() { | ||
let a = BooleanScalar::new(Some(true)); | ||
|
||
assert!(a.value()); | ||
assert_eq!(a.data_type(), &DataType::Boolean); | ||
assert!(a.is_valid()); | ||
|
||
let _: &dyn std::any::Any = a.as_any(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use std::sync::Arc; | ||
|
||
use arrow2::{ | ||
array::{Array, BooleanArray}, | ||
datatypes::{DataType, Field}, | ||
scalar::{ListScalar, Scalar}, | ||
}; | ||
|
||
#[allow(clippy::eq_op)] | ||
#[test] | ||
fn equal() { | ||
let dt = DataType::List(Box::new(Field::new("a", DataType::Boolean, true))); | ||
let a = ListScalar::<i32>::new( | ||
dt.clone(), | ||
Some(Arc::new(BooleanArray::from_slice([true, false])) as Arc<dyn Array>), | ||
); | ||
let b = ListScalar::<i32>::new(dt.clone(), None); | ||
assert_eq!(a, a); | ||
assert_eq!(b, b); | ||
assert!(a != b); | ||
let b = ListScalar::<i32>::new( | ||
dt, | ||
Some(Arc::new(BooleanArray::from_slice([true, true])) as Arc<dyn Array>), | ||
); | ||
assert!(a != b); | ||
assert_eq!(b, b); | ||
} | ||
|
||
#[test] | ||
fn basics() { | ||
let dt = DataType::List(Box::new(Field::new("a", DataType::Boolean, true))); | ||
let a = ListScalar::<i32>::new( | ||
dt.clone(), | ||
Some(Arc::new(BooleanArray::from_slice([true, false])) as Arc<dyn Array>), | ||
); | ||
|
||
assert_eq!(BooleanArray::from_slice([true, false]), a.values().as_ref()); | ||
assert_eq!(a.data_type(), &dt); | ||
assert!(a.is_valid()); | ||
|
||
let _: &dyn std::any::Any = a.as_any(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
mod binary; | ||
mod boolean; | ||
mod list; | ||
mod null; | ||
mod primitive; | ||
mod struct_; | ||
mod utf8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use arrow2::{ | ||
datatypes::DataType, | ||
scalar::{NullScalar, Scalar}, | ||
}; | ||
|
||
#[allow(clippy::eq_op)] | ||
#[test] | ||
fn equal() { | ||
let a = NullScalar::new(); | ||
assert_eq!(a, a); | ||
} | ||
|
||
#[test] | ||
fn basics() { | ||
let a = NullScalar::default(); | ||
|
||
assert_eq!(a.data_type(), &DataType::Null); | ||
assert!(!a.is_valid()); | ||
|
||
let _: &dyn std::any::Any = a.as_any(); | ||
} |
Oops, something went wrong.