Skip to content

Commit 4662318

Browse files
committed
fix[file]: keep the Columnar constant fast path, read row 0 in the Canonical arm
Address review from #8369: retain the Columnar::Constant fast path and read the row-0 scalar directly in the Canonical arm, dropping the redundant into_bool round-trip. Signed-off-by: Thomas Santerre <thomas@santerre.xyz>
1 parent c28c458 commit 4662318

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

vortex-file/src/file.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::sync::OnceLock;
1212

1313
use itertools::Itertools;
1414
use vortex_array::ArrayRef;
15-
use vortex_array::Canonical;
15+
use vortex_array::Columnar;
1616
use vortex_array::IntoArray;
1717
use vortex_array::VortexSessionExecute;
1818
use vortex_array::arrays::ConstantArray;
@@ -245,12 +245,16 @@ impl VortexFile {
245245
let applied = substitute_row_count(applied, &row_count_replacement)?;
246246

247247
let mut ctx = self.session.create_execution_ctx();
248-
let result = applied
249-
.execute::<Canonical>(&mut ctx)?
250-
.into_bool()
251-
.into_array()
252-
.execute_scalar(0, &mut ctx)?;
253-
Ok(result.as_bool().value() == Some(true))
248+
Ok(match applied.execute::<Columnar>(&mut ctx)? {
249+
Columnar::Constant(s) => s.scalar().as_bool().value() == Some(true),
250+
Columnar::Canonical(c) => {
251+
c.into_array()
252+
.execute_scalar(0, &mut ctx)?
253+
.as_bool()
254+
.value()
255+
== Some(true)
256+
}
257+
})
254258
}
255259

256260
pub fn splits(&self) -> VortexResult<Vec<Range<u64>>> {

0 commit comments

Comments
 (0)