Skip to content

Commit

Permalink
revert changes to CopyExec
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed Sep 24, 2024
1 parent b14497a commit b09ee52
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions native/core/src/execution/operators/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ pub struct CopyExec {

#[derive(Debug, PartialEq, Clone)]
pub enum CopyMode {
/// Perform a deep copy but do not unpack dictionaries
DeepCopy,
/// Perform a deep copy and also unpack dictionaries
UnpackOrDeepCopy,
/// Perform a clone and also unpack dictionaries
Expand All @@ -68,7 +66,7 @@ impl CopyExec {
.fields
.iter()
.map(|f: &FieldRef| match f.data_type() {
DataType::Dictionary(_, value_type) if mode != CopyMode::DeepCopy => {
DataType::Dictionary(_, value_type) => {
Field::new(f.name(), value_type.as_ref().clone(), f.is_nullable())
}
_ => f.as_ref().clone(),
Expand Down Expand Up @@ -262,15 +260,15 @@ fn copy_array(array: &dyn Array) -> ArrayRef {
/// array is a primitive array, we simply copy the array.
fn copy_or_unpack_array(array: &Arc<dyn Array>, mode: &CopyMode) -> Result<ArrayRef, ArrowError> {
match array.data_type() {
DataType::Dictionary(_, value_type) if mode != &CopyMode::DeepCopy => {
DataType::Dictionary(_, value_type) => {
let options = CastOptions::default();
cast_with_options(array, value_type.as_ref(), &options)
}
_ => {
if mode == &CopyMode::UnpackOrClone {
Ok(Arc::clone(array))
} else {
if mode == &CopyMode::UnpackOrDeepCopy {
Ok(copy_array(array))
} else {
Ok(Arc::clone(array))
}
}
}
Expand Down

0 comments on commit b09ee52

Please sign in to comment.