|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +#include "iceberg/data/position_delete_writer.h" |
| 21 | + |
| 22 | +namespace iceberg { |
| 23 | + |
| 24 | +//============================================================================= |
| 25 | +// PositionDeleteWriter - stub implementation (to be completed in separate PR per #441) |
| 26 | +//============================================================================= |
| 27 | + |
| 28 | +class PositionDeleteWriter::Impl { |
| 29 | + public: |
| 30 | + explicit Impl(const PositionDeleteWriterOptions& options) : options_(options) {} |
| 31 | + PositionDeleteWriterOptions options_; |
| 32 | + bool is_closed_ = false; |
| 33 | +}; |
| 34 | + |
| 35 | +PositionDeleteWriter::PositionDeleteWriter(std::unique_ptr<Impl> impl) |
| 36 | + : impl_(std::move(impl)) {} |
| 37 | +PositionDeleteWriter::~PositionDeleteWriter() = default; |
| 38 | + |
| 39 | +Status PositionDeleteWriter::Write(ArrowArray* data) { |
| 40 | + if (!data) { |
| 41 | + return InvalidArgument("Cannot write null data"); |
| 42 | + } |
| 43 | + if (impl_->is_closed_) { |
| 44 | + return Invalid("Writer is already closed"); |
| 45 | + } |
| 46 | + return NotImplemented("PositionDeleteWriter not yet implemented - see #441"); |
| 47 | +} |
| 48 | + |
| 49 | +Status PositionDeleteWriter::WriteDelete(std::string_view file_path, int64_t pos) { |
| 50 | + if (file_path.empty()) { |
| 51 | + return InvalidArgument("File path cannot be empty"); |
| 52 | + } |
| 53 | + if (impl_->is_closed_) { |
| 54 | + return Invalid("Writer is already closed"); |
| 55 | + } |
| 56 | + return NotImplemented("PositionDeleteWriter not yet implemented - see #441"); |
| 57 | +} |
| 58 | + |
| 59 | +Result<int64_t> PositionDeleteWriter::Length() const { |
| 60 | + return NotImplemented("PositionDeleteWriter not yet implemented - see #441"); |
| 61 | +} |
| 62 | + |
| 63 | +Status PositionDeleteWriter::Close() { |
| 64 | + if (impl_->is_closed_) { |
| 65 | + return {}; // Close is idempotent |
| 66 | + } |
| 67 | + impl_->is_closed_ = true; |
| 68 | + return NotImplemented("PositionDeleteWriter not yet implemented - see #441"); |
| 69 | +} |
| 70 | + |
| 71 | +Result<FileWriter::WriteResult> PositionDeleteWriter::Metadata() { |
| 72 | + if (!impl_->is_closed_) { |
| 73 | + return Invalid("Writer must be closed before getting metadata"); |
| 74 | + } |
| 75 | + return NotImplemented("PositionDeleteWriter not yet implemented - see #441"); |
| 76 | +} |
| 77 | + |
| 78 | +// Internal factory function for FileWriterFactory |
| 79 | +std::unique_ptr<PositionDeleteWriter> MakePositionDeleteWriterInternal( |
| 80 | + const PositionDeleteWriterOptions& options) { |
| 81 | + auto impl = std::make_unique<PositionDeleteWriter::Impl>(options); |
| 82 | + return std::unique_ptr<PositionDeleteWriter>(new PositionDeleteWriter(std::move(impl))); |
| 83 | +} |
| 84 | + |
| 85 | +} // namespace iceberg |
0 commit comments