-
-
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 melt function * update lazy melt schema
- Loading branch information
Showing
9 changed files
with
218 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use arrow::array::growable::make_growable; | ||
use arrow::array::{Array, ArrayRef}; | ||
use arrow::error::{ArrowError, Result}; | ||
use std::sync::Arc; | ||
|
||
/// Concatenate multiple [Array] of the same type into a single [`Array`]. | ||
/// This does not check the arrays types. | ||
pub fn concatenate_owned_unchecked(arrays: &[ArrayRef]) -> Result<Arc<dyn Array>> { | ||
if arrays.is_empty() { | ||
return Err(ArrowError::InvalidArgumentError( | ||
"concat requires input of at least one array".to_string(), | ||
)); | ||
} | ||
let mut arrays_ref = Vec::with_capacity(arrays.len()); | ||
let mut lengths = Vec::with_capacity(arrays.len()); | ||
let mut capacity = 0; | ||
for array in arrays { | ||
arrays_ref.push(&**array); | ||
lengths.push(array.len()); | ||
capacity += array.len(); | ||
} | ||
|
||
let mut mutable = make_growable(&arrays_ref, false, capacity); | ||
|
||
for (i, len) in lengths.iter().enumerate() { | ||
mutable.extend(i, 0, *len) | ||
} | ||
|
||
Ok(mutable.as_arc()) | ||
} |
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
Oops, something went wrong.