iceberg-cpp
Loading...
Searching...
No Matches
equality_delete_writer.h
Go to the documentation of this file.
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
24
25#include <cstdint>
26#include <memory>
27#include <optional>
28#include <span>
29#include <string>
30#include <unordered_map>
31
33#include "iceberg/data/writer.h"
34#include "iceberg/file_format.h"
36#include "iceberg/result.h"
38#include "iceberg/type_fwd.h"
39
40namespace iceberg {
41
43struct ICEBERG_DATA_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 // TODO(anyone): add key_metadata for encryption
54};
55
57class ICEBERG_DATA_EXPORT EqualityDeleteWriter : public FileWriter {
58 public:
59 ~EqualityDeleteWriter() override;
60
63 const EqualityDeleteWriterOptions& options);
64
65 Status Write(ArrowArray* data) override;
66 Result<int64_t> Length() const override;
67 Status Close() override;
69
70 std::span<const int32_t> equality_field_ids() const;
71
72 private:
73 class Impl;
74 std::unique_ptr<Impl> impl_;
75
76 explicit EqualityDeleteWriter(std::unique_ptr<Impl> impl);
77};
78
79} // namespace iceberg
Writer for Iceberg equality delete files.
Definition equality_delete_writer.h:57
Status Close() override
Close the writer and finalize the file.
Result< int64_t > Length() const override
Get the current number of bytes written.
Result< WriteResult > Metadata() override
Get file metadata for all files produced by this writer.
static Result< std::unique_ptr< EqualityDeleteWriter > > Make(const EqualityDeleteWriterOptions &options)
Create a new EqualityDeleteWriter instance.
Status Write(ArrowArray *data) override
Write a batch of records.
Base interface for data file writers.
Definition writer.h:50
StructLike wrapper for a vector of literals that represent partition values.
Definition partition_values.h:36
Define symbol visibility macros for data APIs.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:33
std::expected< T, E > Result
Result alias.
Definition result.h:88
Define Result, Status, and error helpers.
Definition arrow_c_data.h:57
Options for creating an EqualityDeleteWriter.
Definition equality_delete_writer.h:43