liurenjie1024 commented on code in PR #950: URL: https://github.com/apache/iceberg-rust/pull/950#discussion_r1990499327
########## crates/iceberg/src/arrow/delete_file_manager.rs: ########## @@ -0,0 +1,64 @@ +// 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 roaring::RoaringTreemap; + +use crate::expr::BoundPredicate; +use crate::io::FileIO; +use crate::scan::FileScanTaskDeleteFile; +use crate::spec::SchemaRef; +use crate::{Error, ErrorKind, Result}; + +pub(crate) struct DeleteFileManager {} Review Comment: It would be better to make this a trait rather a struct, so that compute engines could has different cache policy, this is also inspired by our previous discussion in reader module. ########## crates/iceberg/src/arrow/delete_file_manager.rs: ########## @@ -0,0 +1,64 @@ +// 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 roaring::RoaringTreemap; + +use crate::expr::BoundPredicate; +use crate::io::FileIO; +use crate::scan::FileScanTaskDeleteFile; +use crate::spec::SchemaRef; +use crate::{Error, ErrorKind, Result}; + +pub(crate) struct DeleteFileManager {} + +#[allow(unused_variables)] +impl DeleteFileManager { + pub(crate) async fn load_deletes( + delete_file_entries: Vec<FileScanTaskDeleteFile>, + file_io: FileIO, + concurrency_limit_data_files: usize, + ) -> Result<DeleteFileManager> { + // TODO + + if !delete_file_entries.is_empty() { + Err(Error::new( + ErrorKind::FeatureUnsupported, + "Reading delete files is not yet supported", + )) + } else { + Ok(DeleteFileManager {}) + } + } + + pub(crate) fn build_delete_predicate( Review Comment: 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. ########## crates/iceberg/src/arrow/delete_file_manager.rs: ########## @@ -0,0 +1,64 @@ +// 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 roaring::RoaringTreemap; + +use crate::expr::BoundPredicate; +use crate::io::FileIO; +use crate::scan::FileScanTaskDeleteFile; +use crate::spec::SchemaRef; +use crate::{Error, ErrorKind, Result}; + +pub(crate) struct DeleteFileManager {} + +#[allow(unused_variables)] +impl DeleteFileManager { + pub(crate) async fn load_deletes( + delete_file_entries: Vec<FileScanTaskDeleteFile>, + file_io: FileIO, + concurrency_limit_data_files: usize, + ) -> Result<DeleteFileManager> { + // TODO + + if !delete_file_entries.is_empty() { + Err(Error::new( + ErrorKind::FeatureUnsupported, + "Reading delete files is not yet supported", + )) + } else { + Ok(DeleteFileManager {}) + } + } + + pub(crate) fn build_delete_predicate( + &self, + snapshot_schema: SchemaRef, + ) -> Result<Option<BoundPredicate>> { + // TODO + + Ok(None) + } + + pub(crate) fn get_positional_delete_indexes_for_data_file( Review Comment: 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? ``` struct PositionDeleteIndex { bitmap: RoaringTreemap } ``` Motivated by [java version](https://github.com/apache/iceberg/blob/684f7a767c2c216a402b60b73d2d55ef605921a0/core/src/main/java/org/apache/iceberg/deletes/PositionDeleteIndex.java#L21) ########## crates/iceberg/src/arrow/delete_file_manager.rs: ########## @@ -0,0 +1,64 @@ +// 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 roaring::RoaringTreemap; + +use crate::expr::BoundPredicate; +use crate::io::FileIO; +use crate::scan::FileScanTaskDeleteFile; +use crate::spec::SchemaRef; +use crate::{Error, ErrorKind, Result}; + +pub(crate) struct DeleteFileManager {} Review Comment: Of course we could provide a simple version without any cache as default choice. ########## crates/iceberg/src/arrow/delete_file_manager.rs: ########## @@ -0,0 +1,64 @@ +// 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 roaring::RoaringTreemap; + +use crate::expr::BoundPredicate; +use crate::io::FileIO; +use crate::scan::FileScanTaskDeleteFile; +use crate::spec::SchemaRef; +use crate::{Error, ErrorKind, Result}; + +pub(crate) struct DeleteFileManager {} + +#[allow(unused_variables)] +impl DeleteFileManager { + pub(crate) async fn load_deletes( + delete_file_entries: Vec<FileScanTaskDeleteFile>, Review Comment: I don't think we should pass this in constructor, rather it should be in an argument of `load_equality_delete` method. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org