diff --git a/vortex-array/src/arrays/shared/array.rs b/vortex-array/src/arrays/shared/array.rs index 990f5e44a05..6ec6f7e3dd5 100644 --- a/vortex-array/src/arrays/shared/array.rs +++ b/vortex-array/src/arrays/shared/array.rs @@ -62,10 +62,14 @@ impl SharedArray { } pub(super) fn canonicalize(&self, ctx: &mut ExecutionCtx) -> VortexResult { - if let Some(existing) = self.cached() { - return Ok(existing); - } - let canonical = self.as_source().execute::(ctx)?; + let source = { + let state = self.state.read(); + match &*state { + SharedState::Cached(existing) => return Ok(existing.clone()), + SharedState::Source(source) => source.clone(), + } + }; + let canonical = source.execute::(ctx)?; Ok(self.cache_or_return(canonical)) }