Skip to content

Commit d50a20c

Browse files
author
xiao.dong
committed
fix schema
1 parent bcd4066 commit d50a20c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/iceberg/avro/avro_writer.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include "iceberg/avro/avro_schema_util_internal.h"
3434
#include "iceberg/avro/avro_stream_internal.h"
3535
#include "iceberg/schema.h"
36-
#include "iceberg/schema_internal.h"
3736
#include "iceberg/util/checked_cast.h"
3837
#include "iceberg/util/macros.h"
3938

@@ -60,8 +59,7 @@ struct WriteContext {};
6059
class AvroWriter::Impl {
6160
public:
6261
Status Open(const WriterOptions& options) {
63-
write_arrow_schema_ = options.schema;
64-
ICEBERG_ASSIGN_OR_RAISE(write_schema_, FromArrowSchema(options.schema, std::nullopt));
62+
write_schema_ = options.schema;
6563

6664
auto root = std::make_shared<::avro::NodeRecord>();
6765
ToAvroNodeVisitor visitor;
@@ -103,7 +101,6 @@ class AvroWriter::Impl {
103101
Status InitWriteContext() { return {}; }
104102

105103
private:
106-
ArrowSchema write_arrow_schema_;
107104
// The schema to write.
108105
std::shared_ptr<::iceberg::Schema> write_schema_;
109106
// The avro schema to write.

src/iceberg/file_writer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "iceberg/arrow_c_data.h"
3030
#include "iceberg/file_format.h"
3131
#include "iceberg/result.h"
32+
#include "iceberg/schema.h"
3233
#include "iceberg/type_fwd.h"
3334

3435
namespace iceberg {
@@ -38,7 +39,7 @@ struct ICEBERG_EXPORT WriterOptions {
3839
/// \brief The path to the file to write.
3940
std::string path;
4041
/// \brief The schema of the data to write.
41-
ArrowSchema schema;
42+
std::shared_ptr<Schema> schema;
4243
/// \brief FileIO instance to open the file. Writer implementations should down cast it
4344
/// to the specific FileIO implementation. By default, the `iceberg-bundle` library uses
4445
/// `ArrowFileSystemFileIO` as the default implementation.

src/iceberg/manifest_writer.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeWriter(
3737
ICEBERG_ASSIGN_OR_RAISE(
3838
auto writer, WriterFactoryRegistry::Open(FileFormatType::kAvro,
3939
{.path = std::string(manifest_location),
40+
.schema = schema,
4041
.io = std::move(file_io)}));
4142
return std::make_unique<ManifestWriterImpl>(std::move(writer), std::move(schema));
4243
}
@@ -49,6 +50,7 @@ Result<std::unique_ptr<ManifestListWriter>> ManifestListWriter::MakeWriter(
4950
ICEBERG_ASSIGN_OR_RAISE(auto writer, WriterFactoryRegistry::Open(
5051
FileFormatType::kAvro,
5152
{.path = std::string(manifest_list_location),
53+
.schema = schema,
5254
.io = std::move(file_io)}));
5355
return std::make_unique<ManifestListWriterImpl>(std::move(writer), std::move(schema));
5456
}

0 commit comments

Comments
 (0)