-
Notifications
You must be signed in to change notification settings - Fork 33
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
Showing
35 changed files
with
477 additions
and
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ mod compress; | |
mod compute; | ||
mod dict; | ||
mod stats; | ||
mod variants; |
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,23 @@ | ||
use vortex::variants::{ArrayVariants, BinaryArrayTrait, PrimitiveArrayTrait, Utf8ArrayTrait}; | ||
|
||
use crate::DictArray; | ||
|
||
impl ArrayVariants for DictArray { | ||
fn as_primitive_array(&self) -> Option<&dyn PrimitiveArrayTrait> { | ||
Some(self) | ||
} | ||
|
||
fn as_utf8_array(&self) -> Option<&dyn Utf8ArrayTrait> { | ||
Some(self) | ||
} | ||
|
||
fn as_binary_array(&self) -> Option<&dyn BinaryArrayTrait> { | ||
Some(self) | ||
} | ||
} | ||
|
||
impl PrimitiveArrayTrait for DictArray {} | ||
|
||
impl Utf8ArrayTrait for DictArray {} | ||
|
||
impl BinaryArrayTrait for DictArray {} |
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
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,69 @@ | ||
use crate::array::chunked::ChunkedArray; | ||
use crate::variants::{ | ||
ArrayVariants, BinaryArrayTrait, BoolArrayTrait, ExtensionArrayTrait, ListArrayTrait, | ||
NullArrayTrait, PrimitiveArrayTrait, StructArrayTrait, Utf8ArrayTrait, | ||
}; | ||
use crate::{Array, ArrayDType, IntoArray}; | ||
|
||
/// Chunked arrays support all DTypes | ||
impl ArrayVariants for ChunkedArray { | ||
fn as_null_array(&self) -> Option<&dyn NullArrayTrait> { | ||
Some(self) | ||
} | ||
|
||
fn as_bool_array(&self) -> Option<&dyn BoolArrayTrait> { | ||
Some(self) | ||
} | ||
|
||
fn as_primitive_array(&self) -> Option<&dyn PrimitiveArrayTrait> { | ||
Some(self) | ||
} | ||
|
||
fn as_utf8_array(&self) -> Option<&dyn Utf8ArrayTrait> { | ||
Some(self) | ||
} | ||
|
||
fn as_binary_array(&self) -> Option<&dyn BinaryArrayTrait> { | ||
Some(self) | ||
} | ||
|
||
fn as_struct_array(&self) -> Option<&dyn StructArrayTrait> { | ||
Some(self) | ||
} | ||
|
||
fn as_list_array(&self) -> Option<&dyn ListArrayTrait> { | ||
Some(self) | ||
} | ||
|
||
fn as_extension_array(&self) -> Option<&dyn ExtensionArrayTrait> { | ||
Some(self) | ||
} | ||
} | ||
|
||
impl NullArrayTrait for ChunkedArray {} | ||
|
||
impl BoolArrayTrait for ChunkedArray {} | ||
|
||
impl PrimitiveArrayTrait for ChunkedArray {} | ||
|
||
impl Utf8ArrayTrait for ChunkedArray {} | ||
|
||
impl BinaryArrayTrait for ChunkedArray {} | ||
|
||
impl StructArrayTrait for ChunkedArray { | ||
fn field(&self, idx: usize) -> Option<Array> { | ||
let mut chunks = Vec::with_capacity(self.nchunks()); | ||
for chunk in self.chunks() { | ||
let array = chunk.with_dyn(|a| a.as_struct_array().and_then(|s| s.field(idx)))?; | ||
chunks.push(array); | ||
} | ||
let chunked = ChunkedArray::try_new(chunks, self.dtype().clone()) | ||
.expect("should be correct dtype") | ||
.into_array(); | ||
Some(chunked) | ||
} | ||
} | ||
|
||
impl ListArrayTrait for ChunkedArray {} | ||
|
||
impl ExtensionArrayTrait for ChunkedArray {} |
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
Oops, something went wrong.