-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Left join on chunked data (#3177)
- Loading branch information
Showing
50 changed files
with
1,560 additions
and
687 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
use crate::is_valid::IsValid; | ||
use arrow::{ | ||
array::{Array, BooleanArray, ListArray, PrimitiveArray, Utf8Array}, | ||
types::NativeType, | ||
}; | ||
|
||
pub trait ArrowGetItem { | ||
type Item; | ||
|
||
fn get(&self, item: usize) -> Option<Self::Item>; | ||
|
||
/// # Safety | ||
/// Get item. It is the callers resposibility that the `item < self.len()` | ||
unsafe fn get_unchecked(&self, item: usize) -> Option<Self::Item>; | ||
} | ||
|
||
impl<T: NativeType> ArrowGetItem for PrimitiveArray<T> { | ||
type Item = T; | ||
|
||
#[inline] | ||
fn get(&self, item: usize) -> Option<Self::Item> { | ||
if item >= self.len() { | ||
None | ||
} else { | ||
unsafe { self.get_unchecked(item) } | ||
} | ||
} | ||
|
||
#[inline] | ||
unsafe fn get_unchecked(&self, item: usize) -> Option<Self::Item> { | ||
if self.is_null_unchecked(item) { | ||
None | ||
} else { | ||
Some(self.value_unchecked(item)) | ||
} | ||
} | ||
} | ||
|
||
impl ArrowGetItem for BooleanArray { | ||
type Item = bool; | ||
|
||
#[inline] | ||
fn get(&self, item: usize) -> Option<Self::Item> { | ||
if item >= self.len() { | ||
None | ||
} else { | ||
unsafe { self.get_unchecked(item) } | ||
} | ||
} | ||
|
||
#[inline] | ||
unsafe fn get_unchecked(&self, item: usize) -> Option<Self::Item> { | ||
if self.is_null_unchecked(item) { | ||
None | ||
} else { | ||
Some(self.value_unchecked(item)) | ||
} | ||
} | ||
} | ||
|
||
impl<'a> ArrowGetItem for &'a Utf8Array<i64> { | ||
type Item = &'a str; | ||
|
||
#[inline] | ||
fn get(&self, item: usize) -> Option<Self::Item> { | ||
if item >= self.len() { | ||
None | ||
} else { | ||
unsafe { self.get_unchecked(item) } | ||
} | ||
} | ||
|
||
#[inline] | ||
unsafe fn get_unchecked(&self, item: usize) -> Option<Self::Item> { | ||
if self.is_null_unchecked(item) { | ||
None | ||
} else { | ||
Some(self.value_unchecked(item)) | ||
} | ||
} | ||
} | ||
|
||
impl ArrowGetItem for ListArray<i64> { | ||
type Item = Box<dyn Array>; | ||
|
||
#[inline] | ||
fn get(&self, item: usize) -> Option<Self::Item> { | ||
if item >= self.len() { | ||
None | ||
} else { | ||
unsafe { self.get_unchecked(item) } | ||
} | ||
} | ||
|
||
#[inline] | ||
unsafe fn get_unchecked(&self, item: usize) -> Option<Self::Item> { | ||
if self.is_null_unchecked(item) { | ||
None | ||
} else { | ||
Some(self.value_unchecked(item)) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.