-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(rust): List<null> chunked builder should take care of series name (…
- Loading branch information
Showing
4 changed files
with
48 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use super::*; | ||
|
||
pub struct ListNullChunkedBuilder { | ||
builder: LargeListNullBuilder, | ||
name: String, | ||
} | ||
|
||
impl ListNullChunkedBuilder { | ||
pub fn new(name: &str, capacity: usize) -> Self { | ||
ListNullChunkedBuilder { | ||
builder: LargeListNullBuilder::with_capacity(capacity), | ||
name: name.into(), | ||
} | ||
} | ||
} | ||
|
||
impl ListBuilderTrait for ListNullChunkedBuilder { | ||
#[inline] | ||
fn append_series(&mut self, _s: &Series) -> PolarsResult<()> { | ||
self.builder.push_null(); | ||
Ok(()) | ||
} | ||
|
||
#[inline] | ||
fn append_null(&mut self) { | ||
self.builder.push_null(); | ||
} | ||
|
||
fn finish(&mut self) -> ListChunked { | ||
unsafe { | ||
ListChunked::from_chunks_and_dtype_unchecked( | ||
&self.name, | ||
vec![self.builder.as_box()], | ||
DataType::List(Box::new(DataType::Null)), | ||
) | ||
} | ||
} | ||
} |
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