Skip to content

Commit 35c0f87

Browse files
committed
refine comment and add more tests
1 parent b0fd1ea commit 35c0f87

File tree

3 files changed

+273
-133
lines changed

3 files changed

+273
-133
lines changed

src/iceberg/schema_util.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,9 @@ Result<FieldProjection> ProjectNested(const Type& expected_type, const Type& sou
138138

139139
if (auto iter = source_field_map.find(field_id); iter != source_field_map.cend()) {
140140
if (expected_field.type()->is_nested()) {
141-
ICEBERG_ASSIGN_OR_RAISE(auto nested_projection,
141+
ICEBERG_ASSIGN_OR_RAISE(child_projection,
142142
ProjectNested(*expected_field.type(),
143143
*iter->second.field->type(), prune_source));
144-
child_projection.children.emplace_back(std::move(nested_projection));
145144
} else {
146145
ICEBERG_RETURN_UNEXPECTED(
147146
ValidateSchemaEvolution(*expected_field.type(), *iter->second.field->type()));

src/iceberg/schema_util.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ struct ICEBERG_EXPORT FieldProjection {
3636
/// \brief How the field is projected.
3737
enum class Kind {
3838
/// \brief The field is projected from the source with possible conversion for
39-
/// supported
40-
/// schema evolution.
39+
/// supported schema evolution.
4140
kProjected,
4241
/// \brief Metadata column whose value is generated on demand.
4342
kMetadata,
@@ -84,8 +83,11 @@ struct ICEBERG_EXPORT SchemaProjection {
8483
///
8584
/// \param expected_schema The expected schema.
8685
/// \param source_schema The source schema.
87-
/// \param prune_source Whether to prune the source schema. If true, the source
88-
/// schema will be pruned to match the expected schema.
86+
/// \param prune_source Whether the source schema can be pruned to project the expected
87+
/// schema on it. For example, literally a Parquet reader implementation is capable of
88+
/// column pruning, so `prune_source` is set to true in this case such that the `from`
89+
/// field in `FieldProjection` exactly reflects the position (relative to its nesting
90+
/// level) to get the column value from the reader.
8991
/// \return The projection result.
9092
ICEBERG_EXPORT Result<SchemaProjection> Project(const Schema& expected_schema,
9193
const Schema& source_schema,

0 commit comments

Comments
 (0)