iceberg-cpp
Loading...
Searching...
No Matches
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 <vector>
29
32#include "iceberg/result.h"
33#include "iceberg/type_fwd.h"
34
35namespace iceberg {
36
38struct ICEBERG_DATA_EXPORT WriteResult {
42 std::vector<std::shared_ptr<DataFile>> data_files;
44 std::vector<std::string> referenced_data_files;
46 std::vector<std::shared_ptr<DataFile>> rewritten_delete_files;
47};
48
50class ICEBERG_DATA_EXPORT FileWriter {
51 public:
52 virtual ~FileWriter();
53
56 virtual Status Write(ArrowArray* data) = 0;
57
59 virtual Result<int64_t> Length() const = 0;
60
62 virtual Status Close() = 0;
63
67};
68
69} // namespace iceberg
Base interface for data file writers.
Definition writer.h:50
virtual Status Close()=0
Close the writer and finalize the file.
virtual Result< WriteResult > Metadata()=0
Get file metadata for all files produced by this writer.
virtual Status Write(ArrowArray *data)=0
Write a batch of records.
virtual Result< int64_t > Length() const =0
Get the current number of bytes written.
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
File metadata for files produced by a writer.
Definition writer.h:38
std::vector< std::shared_ptr< DataFile > > rewritten_delete_files
Previously written delete files that were merged and should be removed.
Definition writer.h:46
std::vector< std::string > referenced_data_files
Data files referenced by the produced delete files.
Definition writer.h:44
std::vector< std::shared_ptr< DataFile > > data_files
Definition writer.h:42