Skip to content
Draft
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
1 change: 1 addition & 0 deletions src/iceberg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ set(ICEBERG_SOURCES
inspect/metadata_scan_task_reader.cc
inspect/metadata_table_util.cc
inspect/refs_table.cc
inspect/position_deletes_table.cc
inspect/snapshots_table.cc
inheritable_metadata.cc
json_serde.cc
Expand Down
6 changes: 6 additions & 0 deletions src/iceberg/arrow_c_data_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ Status AppendValue(const ArrowSchema& input_schema, const ArrowArray& input_arra

} // namespace

Status AppendArrayValue(const ArrowSchema& input_schema, const ArrowArray& input_array,
const ArrowArrayView& input_view, int64_t row_index,
ArrowArray* output_array) {
return AppendValue(input_schema, input_array, input_view, row_index, output_array);
}

ProjectionContext::ProjectionContext(ProjectionContext&& other) noexcept
: selected_field_indices_(std::move(other.selected_field_indices_)),
input_arrow_schema_(other.input_arrow_schema_),
Expand Down
8 changes: 8 additions & 0 deletions src/iceberg/arrow_c_data_util_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include "iceberg/result.h"
#include "iceberg/type_fwd.h"

struct ArrowArrayView;

namespace iceberg {

/// \brief Cached state for ProjectBatch over one input/output schema pair.
Expand Down Expand Up @@ -265,4 +267,10 @@ class ICEBERG_EXPORT WriteProjection {
std::unique_ptr<Impl> impl_;
};

/// \brief Append one value from an Arrow array into a compatible nanoarrow builder.
ICEBERG_EXPORT Status AppendArrayValue(const ArrowSchema& input_schema,
const ArrowArray& input_array,
const ArrowArrayView& input_view,
int64_t row_index, ArrowArray* output_array);

} // namespace iceberg
1 change: 1 addition & 0 deletions src/iceberg/cpp20_compatibility_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
#include "iceberg/inspect/metadata_scan_task.h"
#include "iceberg/inspect/metadata_scan_task_reader.h"
#include "iceberg/inspect/metadata_table.h"
#include "iceberg/inspect/position_deletes_table.h"
#include "iceberg/inspect/refs_table.h"
#include "iceberg/inspect/snapshots_table.h"
#include "iceberg/labels.h"
Expand Down
4 changes: 4 additions & 0 deletions src/iceberg/deletes/position_delete_index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ int64_t PositionDeleteIndex::Cardinality() const {
return static_cast<int64_t>(bitmap_.Cardinality());
}

void PositionDeleteIndex::ForEach(const std::function<void(int64_t)>& fn) const {
bitmap_.ForEach(fn);
}

void PositionDeleteIndex::Merge(const PositionDeleteIndex& other) {
bitmap_.Or(other.bitmap_);
delete_files_.insert(delete_files_.end(), other.delete_files_.begin(),
Expand Down
4 changes: 4 additions & 0 deletions src/iceberg/deletes/position_delete_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
/// Index of deleted row positions for a data file.

#include <cstdint>
#include <functional>
#include <memory>
#include <span>
#include <vector>
Expand Down Expand Up @@ -66,6 +67,9 @@ class ICEBERG_EXPORT PositionDeleteIndex {
/// \brief Get the number of deleted positions.
int64_t Cardinality() const;

/// \brief Iterate over deleted positions in ascending order.
void ForEach(const std::function<void(int64_t)>& fn) const;

/// \brief Merge another index into this one.
/// \param other The index to merge (union operation)
void Merge(const PositionDeleteIndex& other);
Expand Down
6 changes: 6 additions & 0 deletions src/iceberg/file_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ class ICEBERG_EXPORT Reader {
/// Readers must reject unsupported list widths before emitting any batches.
virtual Result<ArrowSchema> Schema() = 0;

/// \brief Check whether a top-level field ID exists in the physical file schema.
/// \return Presence, or NotImplemented for readers without schema inspection.
virtual Result<bool> HasTopLevelField(int32_t field_id) {
return NotImplemented("Physical schema inspection is not supported");
}

/// \brief Get the metadata of the file.
virtual Result<std::unordered_map<std::string, std::string>> Metadata() = 0;
};
Expand Down
3 changes: 3 additions & 0 deletions src/iceberg/inspect/metadata_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "iceberg/inspect/history_table.h"
#include "iceberg/inspect/metadata_scan.h"
#include "iceberg/inspect/position_deletes_table.h"
#include "iceberg/inspect/refs_table.h"
#include "iceberg/inspect/snapshots_table.h"

Expand All @@ -39,6 +40,8 @@ Result<std::unique_ptr<MetadataTable>> MetadataTable::Make(
switch (kind) {
case MetadataTableKind::kSnapshots:
return SnapshotsTable::Make(std::move(table));
case MetadataTableKind::kPositionDeletes:
return PositionDeletesTable::Make(std::move(table));
case MetadataTableKind::kRefs:
return RefsTable::Make(std::move(table));
case MetadataTableKind::kHistory:
Expand Down
Loading