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

refactor: minor refactor to allow I/O scheduler to be cloned in page schedulers #2432

Merged
Merged
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
2 changes: 1 addition & 1 deletion rust/lance-encoding/src/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ pub trait PageScheduler: Send + Sync + std::fmt::Debug {
fn schedule_ranges(
&self,
ranges: &[Range<u32>],
scheduler: &dyn EncodingsIo,
scheduler: &Arc<dyn EncodingsIo>,
top_level_row: u64,
) -> BoxFuture<'static, Result<Box<dyn PhysicalPageDecoder>>>;
}
Expand Down
9 changes: 4 additions & 5 deletions rust/lance-encoding/src/encodings/logical/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,10 @@ impl<'a> SchedulingJob for PrimitiveFieldSchedulingJob<'a> {
self.global_row_offset += cur_page.num_rows as u64;
self.page_idx += 1;

let physical_decoder = cur_page.scheduler.schedule_ranges(
&ranges_in_page,
context.io().as_ref(),
top_level_row,
);
let physical_decoder =
cur_page
.scheduler
.schedule_ranges(&ranges_in_page, context.io(), top_level_row);

let logical_decoder = PrimitiveFieldDecoder {
data_type: self.scheduler.data_type.clone(),
Expand Down
2 changes: 1 addition & 1 deletion rust/lance-encoding/src/encodings/physical/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl PageScheduler for BasicPageScheduler {
fn schedule_ranges(
&self,
ranges: &[std::ops::Range<u32>],
scheduler: &dyn EncodingsIo,
scheduler: &Arc<dyn EncodingsIo>,
top_level_row: u64,
) -> BoxFuture<'static, Result<Box<dyn PhysicalPageDecoder>>> {
let validity_future = match &self.mode {
Expand Down
4 changes: 2 additions & 2 deletions rust/lance-encoding/src/encodings/physical/bitmap.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright The Lance Authors

use std::ops::Range;
use std::{ops::Range, sync::Arc};

use arrow_buffer::BooleanBufferBuilder;
use bytes::{Bytes, BytesMut};
Expand Down Expand Up @@ -34,7 +34,7 @@ impl PageScheduler for DenseBitmapScheduler {
fn schedule_ranges(
&self,
ranges: &[Range<u32>],
scheduler: &dyn EncodingsIo,
scheduler: &Arc<dyn EncodingsIo>,
top_level_row: u64,
) -> BoxFuture<'static, Result<Box<dyn PhysicalPageDecoder>>> {
let mut min = u64::MAX;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright The Lance Authors

use std::sync::Arc;

use arrow_array::{cast::AsArray, ArrayRef};
use futures::{future::BoxFuture, FutureExt};
use lance_core::Result;
Expand Down Expand Up @@ -35,7 +37,7 @@ impl PageScheduler for FixedListScheduler {
fn schedule_ranges(
&self,
ranges: &[std::ops::Range<u32>],
scheduler: &dyn EncodingsIo,
scheduler: &Arc<dyn EncodingsIo>,
top_level_row: u64,
) -> BoxFuture<'static, Result<Box<dyn PhysicalPageDecoder>>> {
let expanded_ranges = ranges
Expand Down
2 changes: 1 addition & 1 deletion rust/lance-encoding/src/encodings/physical/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl PageScheduler for ValuePageScheduler {
fn schedule_ranges(
&self,
ranges: &[std::ops::Range<u32>],
scheduler: &dyn EncodingsIo,
scheduler: &Arc<dyn EncodingsIo>,
top_level_row: u64,
) -> BoxFuture<'static, Result<Box<dyn PhysicalPageDecoder>>> {
let (mut min, mut max) = (u64::MAX, 0);
Expand Down
Loading