-
Notifications
You must be signed in to change notification settings - Fork 84
refactor!: update ScanMetadata
to struct with new FilteredEngineData
type
#768
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
Changes from 2 commits
714428d
92a820e
773df8f
2180603
83a876e
c281162
473a548
48c2bdc
f50b299
bdd8720
6c5139b
6e0c9f5
e676d5e
12514c6
8ffe070
c7618fc
ddba939
d75bc64
86d03af
267cffb
90354a3
1b07cfd
3b55ae1
a6bc8d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ use crate::actions::deletion_vector::{ | |
deletion_treemap_to_bools, split_vector, DeletionVectorDescriptor, | ||
}; | ||
use crate::actions::{get_log_schema, ADD_NAME, REMOVE_NAME, SIDECAR_NAME}; | ||
use crate::engine_data::FilteredEngineData; | ||
use crate::expressions::{ColumnName, Expression, ExpressionRef, ExpressionTransform, Scalar}; | ||
use crate::predicates::{DefaultPredicateEvaluator, EmptyColumnResolver}; | ||
use crate::scan::state::{DvInfo, Stats}; | ||
|
@@ -320,10 +321,15 @@ pub(crate) enum TransformExpr { | |
Partition(usize), | ||
} | ||
|
||
// TODO(nick): Make this a struct in a follow-on PR | ||
// (data, deletion_vec, transforms) | ||
pub type ScanData = (Box<dyn EngineData>, Vec<bool>, Vec<Option<ExpressionRef>>); | ||
/// Result of a data scan operation containing filtered data and associated transformations. | ||
pub struct ScanData { | ||
zachschuermann marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/// Engine data with its selection vector indicating relevant rows | ||
pub filtered_data: FilteredEngineData, | ||
sebastiantia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// Row-level transformations where each expression must be applied to its corresponding row in | ||
/// the `filtered_data`. If an expression is `None`, no transformation is needed for that row. | ||
pub transforms: Vec<Option<ExpressionRef>>, | ||
sebastiantia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
/// The result of building a scan over a table. This can be used to get the actual data from | ||
/// scanning the table. | ||
pub struct Scan { | ||
|
@@ -493,15 +499,16 @@ impl Scan { | |
let table_root = self.snapshot.table_root().clone(); | ||
let physical_predicate = self.physical_predicate(); | ||
|
||
let scan_data = self.scan_data(engine.as_ref())?; | ||
let scan_files_iter = scan_data | ||
let scan_data_iter = self.scan_data(engine.as_ref())?; | ||
let scan_files_iter = scan_data_iter | ||
.map(|res| { | ||
let (data, vec, transforms) = res?; | ||
let scan_data = res?; | ||
let (data, sel_vec) = scan_data.filtered_data; | ||
let scan_files = vec![]; | ||
state::visit_scan_files( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about updating There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. discussed a little offline: i'm kinda partial to a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implemented @zachschuermann 's approach |
||
data.as_ref(), | ||
&vec, | ||
&transforms, | ||
&sel_vec, | ||
&scan_data.transforms, | ||
scan_files, | ||
scan_data_callback, | ||
) | ||
|
@@ -792,12 +799,13 @@ pub(crate) mod test_utils { | |
); | ||
let mut batch_count = 0; | ||
for res in iter { | ||
let (batch, sel, transforms) = res.unwrap(); | ||
assert_eq!(sel, expected_sel_vec); | ||
let scan_data = res.unwrap(); | ||
let (batch, sel_vec) = scan_data.filtered_data; | ||
assert_eq!(sel_vec, expected_sel_vec); | ||
crate::scan::state::visit_scan_files( | ||
batch.as_ref(), | ||
&sel, | ||
&transforms, | ||
&sel_vec, | ||
&scan_data.transforms, | ||
context.clone(), | ||
validate_callback, | ||
) | ||
|
@@ -1005,11 +1013,12 @@ mod tests { | |
} | ||
let mut files = vec![]; | ||
for data in scan_data { | ||
let (data, vec, transforms) = data?; | ||
let scan_data = data?; | ||
let (data, sel_vec) = scan_data.filtered_data; | ||
files = state::visit_scan_files( | ||
data.as_ref(), | ||
&vec, | ||
&transforms, | ||
&sel_vec, | ||
&scan_data.transforms, | ||
files, | ||
scan_data_callback, | ||
)?; | ||
|
Uh oh!
There was an error while loading. Please reload this page.