-
-
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: use null type when read from unknown row (#12128)
- Loading branch information
Showing
6 changed files
with
75 additions
and
6 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,37 @@ | ||
use arrow::legacy::array::null::MutableNullArray; | ||
|
||
use super::*; | ||
use crate::series::implementations::null::NullChunked; | ||
|
||
#[derive(Clone)] | ||
pub struct NullChunkedBuilder { | ||
array_builder: MutableNullArray, | ||
pub(crate) field: Field, | ||
} | ||
|
||
impl NullChunkedBuilder { | ||
pub fn new(name: &str, len: usize) -> Self { | ||
let array_builder = MutableNullArray::new(len); | ||
|
||
NullChunkedBuilder { | ||
array_builder, | ||
field: Field::new(name, DataType::Null), | ||
} | ||
} | ||
|
||
/// Appends a null slot into the builder | ||
#[inline] | ||
pub fn append_null(&mut self) { | ||
self.array_builder.push_null() | ||
} | ||
|
||
pub fn finish(mut self) -> NullChunked { | ||
let arr = self.array_builder.as_box(); | ||
let ca = NullChunked::new(Arc::from(self.field.name.as_str()), arr.len()); | ||
ca | ||
} | ||
|
||
pub fn shrink_to_fit(&mut self) { | ||
self.array_builder.shrink_to_fit() | ||
} | ||
} |
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