|
| 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 | +#pragma once |
| 21 | + |
| 22 | +/// \file iceberg/data/equality_delete_writer.h |
| 23 | +/// Equality delete writer for Iceberg tables. |
| 24 | + |
| 25 | +#include <cstdint> |
| 26 | +#include <memory> |
| 27 | +#include <optional> |
| 28 | +#include <span> |
| 29 | +#include <string> |
| 30 | +#include <unordered_map> |
| 31 | + |
| 32 | +#include "iceberg/arrow_c_data.h" |
| 33 | +#include "iceberg/data/writer.h" |
| 34 | +#include "iceberg/file_format.h" |
| 35 | +#include "iceberg/iceberg_export.h" |
| 36 | +#include "iceberg/result.h" |
| 37 | +#include "iceberg/row/partition_values.h" |
| 38 | +#include "iceberg/type_fwd.h" |
| 39 | + |
| 40 | +namespace iceberg { |
| 41 | + |
| 42 | +/// \brief Options for creating an EqualityDeleteWriter. |
| 43 | +struct ICEBERG_EXPORT EqualityDeleteWriterOptions { |
| 44 | + std::string path; |
| 45 | + std::shared_ptr<Schema> schema; |
| 46 | + std::shared_ptr<PartitionSpec> spec; |
| 47 | + PartitionValues partition; |
| 48 | + FileFormatType format = FileFormatType::kParquet; |
| 49 | + std::shared_ptr<FileIO> io; |
| 50 | + std::vector<int32_t> equality_field_ids; |
| 51 | + std::optional<int32_t> sort_order_id; |
| 52 | + std::unordered_map<std::string, std::string> properties; |
| 53 | +}; |
| 54 | + |
| 55 | +/// \brief Writer for Iceberg equality delete files. |
| 56 | +class ICEBERG_EXPORT EqualityDeleteWriter : public FileWriter { |
| 57 | + public: |
| 58 | + ~EqualityDeleteWriter() override; |
| 59 | + |
| 60 | + Status Write(ArrowArray* data) override; |
| 61 | + Result<int64_t> Length() const override; |
| 62 | + Status Close() override; |
| 63 | + Result<WriteResult> Metadata() override; |
| 64 | + |
| 65 | + std::span<const int32_t> equality_field_ids() const; |
| 66 | + |
| 67 | + private: |
| 68 | + class Impl; |
| 69 | + std::unique_ptr<Impl> impl_; |
| 70 | +}; |
| 71 | + |
| 72 | +} // namespace iceberg |
0 commit comments