|
| 1 | +// Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +// or more contributor license agreements. See the NOTICE file |
| 3 | +// distributed with this work for additional information |
| 4 | +// regarding copyright ownership. The ASF licenses this file |
| 5 | +// to you under the Apache License, Version 2.0 (the |
| 6 | +// "License"); you may not use this file except in compliance |
| 7 | +// with the License. You may obtain a copy of the License at |
| 8 | +// |
| 9 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +// |
| 11 | +// Unless required by applicable law or agreed to in writing, |
| 12 | +// software distributed under the License is distributed on an |
| 13 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +// KIND, either express or implied. See the License for the |
| 15 | +// specific language governing permissions and limitations |
| 16 | +// under the License. |
| 17 | + |
| 18 | +use crate::delete_vector::DeleteVector; |
| 19 | +use crate::expr::BoundPredicate; |
| 20 | +use crate::io::FileIO; |
| 21 | +use crate::scan::{ArrowRecordBatchStream, FileScanTaskDeleteFile}; |
| 22 | +use crate::spec::SchemaRef; |
| 23 | +use crate::{Error, ErrorKind, Result}; |
| 24 | + |
| 25 | +#[allow(unused)] |
| 26 | +pub trait DeleteFileManager { |
| 27 | + /// Read the delete file referred to in the task |
| 28 | + /// |
| 29 | + /// Returns the raw contents of the delete file as a RecordBatch stream |
| 30 | + fn read_delete_file(task: &FileScanTaskDeleteFile) -> Result<ArrowRecordBatchStream>; |
| 31 | +} |
| 32 | + |
| 33 | +#[allow(unused)] |
| 34 | +#[derive(Clone, Debug)] |
| 35 | +pub(crate) struct CachingDeleteFileManager { |
| 36 | + file_io: FileIO, |
| 37 | + concurrency_limit_data_files: usize, |
| 38 | +} |
| 39 | + |
| 40 | +impl DeleteFileManager for CachingDeleteFileManager { |
| 41 | + fn read_delete_file(_task: &FileScanTaskDeleteFile) -> Result<ArrowRecordBatchStream> { |
| 42 | + // TODO, implementation in https://github.com/apache/iceberg-rust/pull/982 |
| 43 | + |
| 44 | + Err(Error::new( |
| 45 | + ErrorKind::FeatureUnsupported, |
| 46 | + "Reading delete files is not yet supported", |
| 47 | + )) |
| 48 | + } |
| 49 | +} |
| 50 | + |
| 51 | +#[allow(unused_variables)] |
| 52 | +impl CachingDeleteFileManager { |
| 53 | + pub fn new(file_io: FileIO, concurrency_limit_data_files: usize) -> CachingDeleteFileManager { |
| 54 | + Self { |
| 55 | + file_io, |
| 56 | + concurrency_limit_data_files, |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + pub(crate) async fn load_deletes( |
| 61 | + &self, |
| 62 | + delete_file_entries: Vec<FileScanTaskDeleteFile>, |
| 63 | + ) -> Result<()> { |
| 64 | + // TODO |
| 65 | + |
| 66 | + if !delete_file_entries.is_empty() { |
| 67 | + Err(Error::new( |
| 68 | + ErrorKind::FeatureUnsupported, |
| 69 | + "Reading delete files is not yet supported", |
| 70 | + )) |
| 71 | + } else { |
| 72 | + Ok(()) |
| 73 | + } |
| 74 | + } |
| 75 | + |
| 76 | + pub(crate) fn build_delete_predicate( |
| 77 | + &self, |
| 78 | + snapshot_schema: SchemaRef, |
| 79 | + ) -> Result<Option<BoundPredicate>> { |
| 80 | + // TODO |
| 81 | + |
| 82 | + Ok(None) |
| 83 | + } |
| 84 | + |
| 85 | + pub(crate) fn get_positional_delete_indexes_for_data_file( |
| 86 | + &self, |
| 87 | + data_file_path: &str, |
| 88 | + ) -> Option<DeleteVector> { |
| 89 | + // TODO |
| 90 | + |
| 91 | + None |
| 92 | + } |
| 93 | +} |
0 commit comments