iceberg-cpp
Loading...
Searching...
No Matches
position_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 <string>
28#include <string_view>
29#include <unordered_map>
30
32#include "iceberg/data/writer.h"
33#include "iceberg/file_format.h"
34#include "iceberg/iceberg_data_export.h"
35#include "iceberg/result.h"
37#include "iceberg/type_fwd.h"
38
39namespace iceberg {
40
42struct ICEBERG_DATA_EXPORT PositionDeleteWriterOptions {
43 std::string path;
44 std::shared_ptr<Schema> schema;
45 std::shared_ptr<PartitionSpec> spec;
46 PartitionValues partition;
47 FileFormatType format = FileFormatType::kParquet;
48 std::shared_ptr<FileIO> io;
49 int64_t flush_threshold = 1000; // Number of buffered deletes before auto-flush
50 std::unordered_map<std::string, std::string> properties;
51};
52
54class ICEBERG_DATA_EXPORT PositionDeleteWriter : public FileWriter {
55 public:
56 ~PositionDeleteWriter() override;
57
59 static Result<std::unique_ptr<PositionDeleteWriter>> Make(
60 const PositionDeleteWriterOptions& options);
61
62 Status Write(ArrowArray* data) override;
63 Status WriteDelete(std::string_view file_path, int64_t pos);
64 Result<int64_t> Length() const override;
65 Status Close() override;
66 Result<WriteResult> Metadata() override;
67
68 private:
69 class Impl;
70 std::unique_ptr<Impl> impl_;
71
72 explicit PositionDeleteWriter(std::unique_ptr<Impl> impl);
73};
74
75} // namespace iceberg
Base interface for data file writers.
Definition writer.h:37
StructLike wrapper for a vector of literals that represent partition values.
Definition partition_values.h:36
Definition position_delete_writer.cc:40
Writer for Iceberg position delete files.
Definition position_delete_writer.h:54
Definition arrow_c_data.h:57
Options for creating a PositionDeleteWriter.
Definition position_delete_writer.h:42