Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions vortex-array/src/arrays/shared/vtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ impl VTable for Shared {
.get_or_compute(|source| source.clone().execute::<Canonical>(ctx))
.map(ExecutionResult::done)
}

fn reduce_parent(
array: ArrayView<'_, Self>,
parent: &ArrayRef,
child_idx: usize,
) -> VortexResult<Option<ArrayRef>> {
array.current_array_ref().reduce_parent(parent, child_idx)
}
}
impl OperationsVTable<Shared> for Shared {
fn scalar_at(
Expand Down
31 changes: 31 additions & 0 deletions vortex-array/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ use crate::ArrayRef;
use crate::Canonical;
use crate::IntoArray;
use crate::array::ArrayId;
use crate::arrays::Shared;
use crate::arrays::shared::SharedArrayExt;
use crate::builders::ArrayBuilder;
use crate::builders::builder_with_capacity_in;
use crate::dtype::DType;
Expand Down Expand Up @@ -568,6 +570,35 @@ fn execute_parent_for_child(
slot_idx: usize,
kernels: &ParentExecutionKernels,
ctx: &mut ExecutionCtx,
) -> VortexResult<Option<ArrayRef>> {
if let Some(result) = execute_parent_for_exact_child(parent, child, slot_idx, kernels, ctx)? {
return Ok(Some(result));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add some sort of test?


// Shared is a transparent cache wrapper. Try kernels against the wrapped source/current array
// before forcing Shared to canonicalize and populate its cache.
let mut current = child.clone();
while let Some(source) = current
.as_opt::<Shared>()
.map(|shared| shared.current_array_ref().clone())
{
if let Some(result) =
execute_parent_for_exact_child(parent, &source, slot_idx, kernels, ctx)?
{
return Ok(Some(result));
}
current = source;
}

Ok(None)
Comment on lines +580 to +593

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to register a kernel for shared for all parents? Then we can avoid this

}

fn execute_parent_for_exact_child(
parent: &ArrayRef,
child: &ArrayRef,
slot_idx: usize,
kernels: &ParentExecutionKernels,
ctx: &mut ExecutionCtx,
) -> VortexResult<Option<ArrayRef>> {
let key = execute_parent_key(parent.encoding_id(), child.encoding_id());
if let Some(plugins) = kernels.get(&key) {
Expand Down
Loading