Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
refine comment and add more tests
  • Loading branch information
wgtmac committed May 22, 2025
commit 35c0f8794778786c36d0e97255371fa76a4160c0
3 changes: 1 addition & 2 deletions src/iceberg/schema_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,9 @@ Result<FieldProjection> ProjectNested(const Type& expected_type, const Type& sou

if (auto iter = source_field_map.find(field_id); iter != source_field_map.cend()) {
if (expected_field.type()->is_nested()) {
ICEBERG_ASSIGN_OR_RAISE(auto nested_projection,
ICEBERG_ASSIGN_OR_RAISE(child_projection,
ProjectNested(*expected_field.type(),
*iter->second.field->type(), prune_source));
child_projection.children.emplace_back(std::move(nested_projection));
} else {
ICEBERG_RETURN_UNEXPECTED(
ValidateSchemaEvolution(*expected_field.type(), *iter->second.field->type()));
Expand Down
10 changes: 6 additions & 4 deletions src/iceberg/schema_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ struct ICEBERG_EXPORT FieldProjection {
/// \brief How the field is projected.
enum class Kind {
/// \brief The field is projected from the source with possible conversion for
/// supported
/// schema evolution.
/// supported schema evolution.
kProjected,
/// \brief Metadata column whose value is generated on demand.
kMetadata,
Expand Down Expand Up @@ -84,8 +83,11 @@ struct ICEBERG_EXPORT SchemaProjection {
///
/// \param expected_schema The expected schema.
/// \param source_schema The source schema.
/// \param prune_source Whether to prune the source schema. If true, the source
/// schema will be pruned to match the expected schema.
/// \param prune_source Whether the source schema can be pruned to project the expected
/// schema on it. For example, literally a Parquet reader implementation is capable of
/// column pruning, so `prune_source` is set to true in this case such that the `from`
/// field in `FieldProjection` exactly reflects the position (relative to its nesting
/// level) to get the column value from the reader.
/// \return The projection result.
ICEBERG_EXPORT Result<SchemaProjection> Project(const Schema& expected_schema,
const Schema& source_schema,
Expand Down
Loading
Loading