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.
Added support to read Map from parquet
- Loading branch information
1 parent
d607c33
commit 1ed9f14
Showing
10 changed files
with
344 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
use crate::{ | ||
array::{Array, MapArray, MutableArray}, | ||
datatypes::DataType, | ||
error::Error, | ||
}; | ||
|
||
use super::make_mutable; | ||
|
||
#[derive(Debug)] | ||
pub struct DynMutableMapArray { | ||
data_type: DataType, | ||
pub inner: Box<dyn MutableArray>, | ||
} | ||
|
||
impl DynMutableMapArray { | ||
pub fn try_with_capacity(data_type: DataType, capacity: usize) -> Result<Self, Error> { | ||
let inner = match data_type.to_logical_type() { | ||
DataType::Map(inner, _) => inner, | ||
_ => unreachable!(), | ||
}; | ||
let inner = make_mutable(inner.data_type(), capacity)?; | ||
|
||
Ok(Self { data_type, inner }) | ||
} | ||
} | ||
|
||
impl MutableArray for DynMutableMapArray { | ||
fn data_type(&self) -> &DataType { | ||
&self.data_type | ||
} | ||
|
||
fn len(&self) -> usize { | ||
self.inner.len() | ||
} | ||
|
||
fn validity(&self) -> Option<&crate::bitmap::MutableBitmap> { | ||
None | ||
} | ||
|
||
fn as_box(&mut self) -> Box<dyn Array> { | ||
Box::new(MapArray::new( | ||
self.data_type.clone(), | ||
vec![0, self.inner.len() as i32].into(), | ||
self.inner.as_arc(), | ||
None, | ||
)) | ||
} | ||
|
||
fn as_any(&self) -> &dyn std::any::Any { | ||
self | ||
} | ||
|
||
fn as_mut_any(&mut self) -> &mut dyn std::any::Any { | ||
self | ||
} | ||
|
||
fn push_null(&mut self) { | ||
todo!() | ||
} | ||
|
||
fn shrink_to_fit(&mut self) { | ||
todo!() | ||
} | ||
} |
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.