Skip to content

Commit

Permalink
perf: split MaterializeIndex stream into batches
Browse files Browse the repository at this point in the history
  • Loading branch information
wjones127 committed Aug 21, 2024
1 parent a9c678d commit 35adc71
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rust/lance/src/io/exec/scalar_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use lance_core::{
},
Error, Result, ROW_ID_FIELD,
};
use lance_datafusion::chunker::break_stream;
use lance_index::{
scalar::{
expression::{ScalarIndexExpr, ScalarIndexLoader},
Expand Down Expand Up @@ -582,9 +583,14 @@ impl ExecutionPlan for MaterializeIndexExec {
.then(|batch_fut| batch_fut.map_err(|err| err.into()))
.boxed()
as BoxStream<'static, datafusion::common::Result<RecordBatch>>;
Ok(Box::pin(RecordBatchStreamAdapter::new(
let stream = Box::pin(RecordBatchStreamAdapter::new(
MATERIALIZE_INDEX_SCHEMA.clone(),
stream,
));
let stream = break_stream(stream, 50 * 1024);
Ok(Box::pin(RecordBatchStreamAdapter::new(
MATERIALIZE_INDEX_SCHEMA.clone(),
stream.map_err(|err| err.into()),
)))
}

Expand Down

0 comments on commit 35adc71

Please sign in to comment.