Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: harmonize struct layout naming with chunked #1863

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions vortex-layout/src/layouts/struct_/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use vortex_error::VortexResult;

use crate::data::LayoutData;
use crate::encoding::{LayoutEncoding, LayoutId};
use crate::layouts::struct_::scan::StructScan;
use crate::layouts::struct_::scan::StructReader;
use crate::reader::{LayoutReader, LayoutScanExt};
use crate::COLUMNAR_LAYOUT_ID;

Expand All @@ -22,7 +22,7 @@ impl LayoutEncoding for StructLayout {
}

fn reader(&self, layout: LayoutData, ctx: ContextRef) -> VortexResult<Arc<dyn LayoutReader>> {
Ok(StructScan::try_new(layout, ctx)?.into_arc())
Ok(StructReader::try_new(layout, ctx)?.into_arc())
}

fn register_splits(
Expand Down
28 changes: 16 additions & 12 deletions vortex-layout/src/layouts/struct_/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ use crate::segments::SegmentReader;
use crate::{LayoutData, LayoutEncoding, RowMask};

#[derive(Debug)]
pub struct StructScan {
pub struct StructReader {
layout: LayoutData,
}

impl StructScan {
impl StructReader {
pub(super) fn try_new(layout: LayoutData, _ctx: ContextRef) -> VortexResult<Self> {
if layout.encoding().id() != StructLayout.id() {
vortex_panic!("Mismatched layout ID")
Expand All @@ -27,28 +27,32 @@ impl StructScan {
}
}

impl LayoutReader for StructScan {
impl LayoutReader for StructReader {
fn layout(&self) -> &LayoutData {
&self.layout
}

fn create_evaluator(
self: Arc<Self>,
_row_mask: RowMask,
_expr: ExprRef,
) -> VortexResult<EvalOp> {
todo!()
fn create_evaluator(self: Arc<Self>, row_mask: RowMask, expr: ExprRef) -> VortexResult<EvalOp> {
Ok(Box::new(StructEvaluator::new(self, row_mask, expr)))
}
}

// TODO: move to evaluator.rs
#[derive(Debug)]
#[allow(dead_code)]
struct StructScanner {
layout: LayoutData,
struct StructEvaluator {
reader: Arc<StructReader>,
mask: RowMask,
expr: ExprRef,
}

impl StructEvaluator {
pub fn new(reader: Arc<StructReader>, mask: RowMask, expr: ExprRef) -> Self {
Self { reader, mask, expr }
}
}

impl Operation for StructScanner {
impl Operation for StructEvaluator {
type Output = ArrayData;

fn poll(&mut self, _segments: &dyn SegmentReader) -> VortexResult<Poll<Self::Output>> {
Expand Down
4 changes: 2 additions & 2 deletions vortex-layout/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pub trait LayoutReader {
// we can slice the cell directly out of storage using an API like
// `SegmentReader::read(segment_id, byte_range: Range<usize>)`. This is a highly advanced
// use-case, but can prove invaluable for large cell values such as images and video.
// If instead we make the projection API `project(row_mask, expr)`, then identical to the
// filter API and there's now no point having two. Hence: `evaluate(row_mask, expr)`.
// If instead we make the projection API `project(row_mask, expr)`, then this is identical
// to the filter API and there's now no point having two. Hence: `evaluate(row_mask, expr)`.
fn create_evaluator(self: Arc<Self>, row_mask: RowMask, expr: ExprRef) -> VortexResult<EvalOp>;
}

Expand Down
Loading