-
Notifications
You must be signed in to change notification settings - Fork 247
Scan Delete Support Part 2: introduce DeleteFileManager
skeleton. Use in ArrowReader
#950
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 all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
use crate::delete_vector::DeleteVector; | ||
use crate::expr::BoundPredicate; | ||
use crate::io::FileIO; | ||
use crate::scan::{ArrowRecordBatchStream, FileScanTaskDeleteFile}; | ||
use crate::spec::SchemaRef; | ||
use crate::{Error, ErrorKind, Result}; | ||
|
||
#[allow(unused)] | ||
pub trait DeleteFileManager { | ||
/// Read the delete file referred to in the task | ||
/// | ||
/// Returns the raw contents of the delete file as a RecordBatch stream | ||
fn read_delete_file(task: &FileScanTaskDeleteFile) -> Result<ArrowRecordBatchStream>; | ||
} | ||
|
||
#[allow(unused)] | ||
#[derive(Clone, Debug)] | ||
pub(crate) struct CachingDeleteFileManager { | ||
file_io: FileIO, | ||
concurrency_limit_data_files: usize, | ||
} | ||
|
||
impl DeleteFileManager for CachingDeleteFileManager { | ||
fn read_delete_file(_task: &FileScanTaskDeleteFile) -> Result<ArrowRecordBatchStream> { | ||
// TODO, implementation in https://github.com/apache/iceberg-rust/pull/982 | ||
|
||
Err(Error::new( | ||
ErrorKind::FeatureUnsupported, | ||
"Reading delete files is not yet supported", | ||
)) | ||
} | ||
} | ||
|
||
#[allow(unused_variables)] | ||
impl CachingDeleteFileManager { | ||
pub fn new(file_io: FileIO, concurrency_limit_data_files: usize) -> CachingDeleteFileManager { | ||
Self { | ||
file_io, | ||
concurrency_limit_data_files, | ||
} | ||
} | ||
|
||
pub(crate) async fn load_deletes( | ||
&self, | ||
delete_file_entries: Vec<FileScanTaskDeleteFile>, | ||
) -> Result<()> { | ||
// TODO | ||
|
||
if !delete_file_entries.is_empty() { | ||
Err(Error::new( | ||
ErrorKind::FeatureUnsupported, | ||
"Reading delete files is not yet supported", | ||
)) | ||
} else { | ||
Ok(()) | ||
} | ||
} | ||
|
||
pub(crate) fn build_delete_predicate( | ||
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. I think we should return arrow record batch rather predicate here. Or we could have a method built on the one which returns arrow record batch. The reason is that different engines may evaluate it in different approaches. 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. I've indicated within the newly-added trait definition that the basic file-to-record-batch-stream functionality is coming in a follow-up PR that I'll refactor so that it is used either in a struct that implements the trait or in a default implementation for the trait. |
||
&self, | ||
snapshot_schema: SchemaRef, | ||
) -> Result<Option<BoundPredicate>> { | ||
// TODO | ||
|
||
Ok(None) | ||
} | ||
|
||
pub(crate) fn get_positional_delete_indexes_for_data_file( | ||
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. Similar to above comment, we should provide a base version with actual data (like arrow record batch) to give advanced users enough flexibility to do that. Also I don't think we should return internal data structure directly, maybe sth like following is better?
Motivated by java version 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. Regarding wrapping the Would you be ok with your proposed 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.
I'm fine with that. My concern is not exposing too much internals data structures to, and I think the 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. The third commit in this PR is focussed on changes raised by your original comment here. |
||
&self, | ||
data_file_path: &str, | ||
) -> Option<DeleteVector> { | ||
// TODO | ||
|
||
None | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should pass this in constructor, rather it should be in an argument of
load_equality_delete
method.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, see second commit in this PR.