Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/iceberg/arrow_c_data_guard_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

#include <nanoarrow/nanoarrow.h>

#include "iceberg/arrow_c_data.h"
#include "iceberg/iceberg_export.h"

namespace iceberg::internal {

class ArrowArrayGuard {
class ICEBERG_EXPORT ArrowArrayGuard {
public:
explicit ArrowArrayGuard(ArrowArray* array) : array_(array) {}
~ArrowArrayGuard();
Expand All @@ -34,7 +34,7 @@ class ArrowArrayGuard {
ArrowArray* array_;
};

class ArrowSchemaGuard {
class ICEBERG_EXPORT ArrowSchemaGuard {
public:
explicit ArrowSchemaGuard(ArrowSchema* schema) : schema_(schema) {}
~ArrowSchemaGuard();
Expand All @@ -43,7 +43,7 @@ class ArrowSchemaGuard {
ArrowSchema* schema_;
};

class ArrowArrayViewGuard {
class ICEBERG_EXPORT ArrowArrayViewGuard {
public:
explicit ArrowArrayViewGuard(ArrowArrayView* view) : view_(view) {}
~ArrowArrayViewGuard();
Expand All @@ -52,7 +52,7 @@ class ArrowArrayViewGuard {
ArrowArrayView* view_;
};

class ArrowArrayBufferGuard {
class ICEBERG_EXPORT ArrowArrayBufferGuard {
public:
explicit ArrowArrayBufferGuard(ArrowBuffer* buffer) : buffer_(buffer) {}
~ArrowArrayBufferGuard();
Expand Down
16 changes: 9 additions & 7 deletions src/iceberg/avro/avro_data_util_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <arrow/array/builder_base.h>
#include <avro/GenericDatum.hh>

#include "iceberg/iceberg_bundle_export.h"
#include "iceberg/schema_util.h"

namespace iceberg::avro {
Expand All @@ -37,19 +38,20 @@ namespace iceberg::avro {
/// \param projected_schema The projected schema
/// \param array_builder The Arrow array builder to append to (must be a struct builder)
/// \return Status indicating success or failure
Status AppendDatumToBuilder(const ::avro::NodePtr& avro_node,
const ::avro::GenericDatum& avro_datum,
const SchemaProjection& projection,
const Schema& projected_schema,
::arrow::ArrayBuilder* array_builder);
ICEBERG_BUNDLE_EXPORT Status AppendDatumToBuilder(const ::avro::NodePtr& avro_node,
const ::avro::GenericDatum& avro_datum,
const SchemaProjection& projection,
const Schema& projected_schema,
::arrow::ArrayBuilder* array_builder);

/// \brief Extract an Avro datum from an Arrow array.
///
/// \param array The Arrow array to extract from.
/// \param index The index of the element to extract.
/// \param datum The Avro datum to extract to. Its Avro type should be consistent with the
/// Arrow type.
Status ExtractDatumFromArray(const ::arrow::Array& array, int64_t index,
::avro::GenericDatum* datum);
ICEBERG_BUNDLE_EXPORT Status ExtractDatumFromArray(const ::arrow::Array& array,
int64_t index,
::avro::GenericDatum* datum);

} // namespace iceberg::avro
18 changes: 10 additions & 8 deletions src/iceberg/avro/avro_schema_util_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <avro/Node.hh>

#include "iceberg/iceberg_bundle_export.h"
#include "iceberg/name_mapping.h"
#include "iceberg/result.h"
#include "iceberg/schema_util.h"
Expand All @@ -40,7 +41,7 @@ struct MapLogicalType : public ::avro::CustomLogicalType {
};

/// \brief A visitor that converts an Iceberg type to an Avro node.
class ToAvroNodeVisitor {
class ICEBERG_BUNDLE_EXPORT ToAvroNodeVisitor {
public:
Status Visit(const BooleanType& type, ::avro::NodePtr* node);
Status Visit(const IntType& type, ::avro::NodePtr* node);
Expand All @@ -67,7 +68,7 @@ class ToAvroNodeVisitor {
};

/// \brief A visitor that checks the presence of field IDs in an Avro schema.
class HasIdVisitor {
class ICEBERG_BUNDLE_EXPORT HasIdVisitor {
public:
HasIdVisitor() = default;

Expand Down Expand Up @@ -137,8 +138,9 @@ class HasIdVisitor {
/// \param avro_node The Avro node to read data from.
/// \param prune_source Whether the source schema can be pruned.
/// \return The schema projection result.
Result<SchemaProjection> Project(const Schema& expected_schema,
const ::avro::NodePtr& avro_node, bool prune_source);
ICEBERG_BUNDLE_EXPORT Result<SchemaProjection> Project(const Schema& expected_schema,
const ::avro::NodePtr& avro_node,
bool prune_source);

std::string ToString(const ::avro::NodePtr& node);
std::string ToString(const ::avro::LogicalType& logical_type);
Expand All @@ -157,14 +159,14 @@ bool HasMapLogicalType(const ::avro::NodePtr& node);
///
/// \param name The name to check.
/// \return True if the name is valid, false otherwise.
bool ValidAvroName(std::string_view name);
ICEBERG_BUNDLE_EXPORT bool ValidAvroName(std::string_view name);

/// \brief Create a new Avro node with field IDs from name mapping.
/// \param original_node The original Avro node to copy.
/// \param mapping The name mapping to apply field IDs from.
/// \return A new Avro node with field IDs applied, or an error.
Result<::avro::NodePtr> MakeAvroNodeWithFieldIds(const ::avro::NodePtr& original_node,
const NameMapping& mapping);
ICEBERG_BUNDLE_EXPORT Result<::avro::NodePtr> MakeAvroNodeWithFieldIds(
const ::avro::NodePtr& original_node, const NameMapping& mapping);

/// \brief Sanitize a field name to make it compatible with Avro field name requirements.
///
Expand All @@ -187,6 +189,6 @@ Result<::avro::NodePtr> MakeAvroNodeWithFieldIds(const ::avro::NodePtr& original
///
/// \param field_name The original field name to sanitize.
/// \return A sanitized field name that follows Avro naming conventions.
std::string SanitizeFieldName(std::string_view field_name);
ICEBERG_BUNDLE_EXPORT std::string SanitizeFieldName(std::string_view field_name);

} // namespace iceberg::avro
6 changes: 4 additions & 2 deletions src/iceberg/avro/avro_stream_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
#include <arrow/io/interfaces.h>
#include <avro/Stream.hh>

#include "iceberg/iceberg_bundle_export.h"

namespace iceberg::avro {

class AvroInputStream : public ::avro::SeekableInputStream {
class ICEBERG_BUNDLE_EXPORT AvroInputStream : public ::avro::SeekableInputStream {
public:
explicit AvroInputStream(std::shared_ptr<::arrow::io::RandomAccessFile> input_stream,
int64_t buffer_size);
Expand Down Expand Up @@ -62,7 +64,7 @@ class AvroInputStream : public ::avro::SeekableInputStream {
size_t available_bytes_ = 0; // bytes available in the buffer
};

class AvroOutputStream : public ::avro::OutputStream {
class ICEBERG_BUNDLE_EXPORT AvroOutputStream : public ::avro::OutputStream {
public:
explicit AvroOutputStream(std::shared_ptr<::arrow::io::OutputStream> output_stream,
int64_t buffer_size);
Expand Down
2 changes: 1 addition & 1 deletion src/iceberg/file_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct ICEBERG_EXPORT Split {
size_t length;
};

class ReaderProperties : public ConfigBase<ReaderProperties> {
class ICEBERG_EXPORT ReaderProperties : public ConfigBase<ReaderProperties> {
public:
template <typename T>
using Entry = const ConfigBase<ReaderProperties>::Entry<T>;
Expand Down
2 changes: 1 addition & 1 deletion src/iceberg/file_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

namespace iceberg {

class WriterProperties : public ConfigBase<WriterProperties> {
class ICEBERG_EXPORT WriterProperties : public ConfigBase<WriterProperties> {
public:
template <typename T>
using Entry = const ConfigBase<WriterProperties>::Entry<T>;
Expand Down
3 changes: 2 additions & 1 deletion src/iceberg/parquet/parquet_data_util_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <arrow/type_fwd.h>

#include "iceberg/iceberg_bundle_export.h"
#include "iceberg/schema_util.h"

namespace iceberg::parquet {
Expand All @@ -33,7 +34,7 @@ namespace iceberg::parquet {
/// \param projection The projection from projected Iceberg schema to the record batch.
/// \param pool The arrow memory pool.
/// \return The converted record batch.
Result<std::shared_ptr<::arrow::RecordBatch>> ProjectRecordBatch(
ICEBERG_BUNDLE_EXPORT Result<std::shared_ptr<::arrow::RecordBatch>> ProjectRecordBatch(
std::shared_ptr<::arrow::RecordBatch> record_batch,
const std::shared_ptr<::arrow::Schema>& output_arrow_schema,
const Schema& projected_schema, const SchemaProjection& projection,
Expand Down
11 changes: 7 additions & 4 deletions src/iceberg/parquet/parquet_schema_util_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <parquet/arrow/schema.h>

#include "iceberg/iceberg_bundle_export.h"
#include "iceberg/schema.h"
#include "iceberg/schema_util.h"

Expand All @@ -47,19 +48,21 @@ struct ParquetExtraAttributes : public FieldProjection::ExtraAttributes {
/// \param parquet_schema The Parquet schema to read data from.
/// \return The schema projection result with column indices of projected Parquet columns
/// specified via ParquetExtraAttributes.
Result<SchemaProjection> Project(const Schema& expected_schema,
const ::parquet::arrow::SchemaManifest& parquet_schema);
ICEBERG_BUNDLE_EXPORT Result<SchemaProjection> Project(
const Schema& expected_schema,
const ::parquet::arrow::SchemaManifest& parquet_schema);

/// \brief Get the selected column indices by walking through the projection result.
///
/// \param projection The schema projection result.
/// \return The selected column indices.
std::vector<int32_t> SelectedColumnIndices(const SchemaProjection& projection);
ICEBERG_BUNDLE_EXPORT std::vector<int32_t> SelectedColumnIndices(
const SchemaProjection& projection);

/// \brief Check whether the Parquet schema has field IDs.
///
/// \param root_node The root node of the Parquet schema.
/// \return True if the Parquet schema has field IDs, false otherwise.
bool HasFieldIds(const ::parquet::schema::NodePtr& root_node);
ICEBERG_BUNDLE_EXPORT bool HasFieldIds(const ::parquet::schema::NodePtr& root_node);

} // namespace iceberg::parquet
4 changes: 2 additions & 2 deletions src/iceberg/schema_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ ICEBERG_EXPORT Status ToArrowSchema(const Schema& schema, ArrowSchema* out);
/// \param[in] schema The Arrow schema to convert.
/// \param[in] schema_id The schema ID of the Iceberg schema.
/// \return The Iceberg schema or an error if the conversion fails.
Result<std::unique_ptr<Schema>> FromArrowSchema(const ArrowSchema& schema,
std::optional<int32_t> schema_id);
ICEBERG_EXPORT Result<std::unique_ptr<Schema>> FromArrowSchema(
const ArrowSchema& schema, std::optional<int32_t> schema_id);

/// \brief Convert a struct type to an Iceberg schema.
///
Expand Down
3 changes: 2 additions & 1 deletion src/iceberg/util/gzip_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
#include <memory>
#include <string>

#include "iceberg/iceberg_export.h"
#include "iceberg/result.h"

namespace iceberg {

class ZlibImpl;

class GZipDecompressor {
class ICEBERG_EXPORT GZipDecompressor {
public:
GZipDecompressor();

Expand Down
5 changes: 3 additions & 2 deletions src/iceberg/v1_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@

#pragma once

#include "iceberg/iceberg_export.h"
#include "iceberg/manifest_adapter.h"

/// \file iceberg/v1_metadata.h

namespace iceberg {

/// \brief Adapter to convert V1 ManifestEntry to `ArrowArray`.
class ManifestEntryAdapterV1 : public ManifestEntryAdapter {
class ICEBERG_EXPORT ManifestEntryAdapterV1 : public ManifestEntryAdapter {
public:
ManifestEntryAdapterV1(std::optional<int64_t> snapshot_id,
std::shared_ptr<PartitionSpec> partition_spec,
Expand All @@ -45,7 +46,7 @@ class ManifestEntryAdapterV1 : public ManifestEntryAdapter {
};

/// \brief Adapter to convert V1 ManifestFile to `ArrowArray`.
class ManifestFileAdapterV1 : public ManifestFileAdapter {
class ICEBERG_EXPORT ManifestFileAdapterV1 : public ManifestFileAdapter {
public:
ManifestFileAdapterV1(int64_t snapshot_id, std::optional<int64_t> parent_snapshot_id)
: snapshot_id_(snapshot_id), parent_snapshot_id_(parent_snapshot_id) {}
Expand Down
5 changes: 3 additions & 2 deletions src/iceberg/v2_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@

/// \file iceberg/v2_metadata.h

#include "iceberg/iceberg_export.h"
#include "iceberg/manifest_adapter.h"

namespace iceberg {

/// \brief Adapter to convert V2 ManifestEntry to `ArrowArray`.
class ManifestEntryAdapterV2 : public ManifestEntryAdapter {
class ICEBERG_EXPORT ManifestEntryAdapterV2 : public ManifestEntryAdapter {
public:
ManifestEntryAdapterV2(std::optional<int64_t> snapshot_id,
std::shared_ptr<PartitionSpec> partition_spec,
Expand All @@ -51,7 +52,7 @@ class ManifestEntryAdapterV2 : public ManifestEntryAdapter {
};

/// \brief Adapter to convert V2 ManifestFile to `ArrowArray`.
class ManifestFileAdapterV2 : public ManifestFileAdapter {
class ICEBERG_EXPORT ManifestFileAdapterV2 : public ManifestFileAdapter {
public:
ManifestFileAdapterV2(int64_t snapshot_id, std::optional<int64_t> parent_snapshot_id,
int64_t sequence_number)
Expand Down
5 changes: 3 additions & 2 deletions src/iceberg/v3_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@

/// \file iceberg/v3_metadata.h

#include "iceberg/iceberg_export.h"
#include "iceberg/manifest_adapter.h"

namespace iceberg {

/// \brief Adapter to convert V3 ManifestEntry to `ArrowArray`.
class ManifestEntryAdapterV3 : public ManifestEntryAdapter {
class ICEBERG_EXPORT ManifestEntryAdapterV3 : public ManifestEntryAdapter {
public:
ManifestEntryAdapterV3(std::optional<int64_t> snapshot_id,
std::optional<int64_t> first_row_id,
Expand Down Expand Up @@ -57,7 +58,7 @@ class ManifestEntryAdapterV3 : public ManifestEntryAdapter {
};

/// \brief Adapter to convert V3 ManifestFile to `ArrowArray`.
class ManifestFileAdapterV3 : public ManifestFileAdapter {
class ICEBERG_EXPORT ManifestFileAdapterV3 : public ManifestFileAdapter {
public:
ManifestFileAdapterV3(int64_t snapshot_id, std::optional<int64_t> parent_snapshot_id,
int64_t sequence_number, int64_t first_row_id)
Expand Down
Loading