Skip to content

Commit ca55309

Browse files
committed
add test cases for map & list
1 parent 2f3ed21 commit ca55309

File tree

3 files changed

+409
-7
lines changed

3 files changed

+409
-7
lines changed

src/iceberg/avro/avro_data_util.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ Status AppendStructToBuilder(const ::avro::NodePtr& avro_node,
9595
/// \brief Append Avro array data to Arrow list builder.
9696
Status AppendListToBuilder(const ::avro::NodePtr& avro_node,
9797
const ::avro::GenericDatum& avro_datum,
98-
const FieldProjection& projection, const ListType& list_type,
98+
const FieldProjection& element_projection,
99+
const ListType& list_type,
99100
::arrow::ArrayBuilder* array_builder) {
100101
if (avro_node->type() != ::avro::AVRO_ARRAY) {
101102
return InvalidArgument("Expected Avro array, got type: {}", ToString(avro_node));
@@ -105,7 +106,6 @@ Status AppendListToBuilder(const ::avro::NodePtr& avro_node,
105106
auto* list_builder = internal::checked_cast<::arrow::ListBuilder*>(array_builder);
106107
ICEBERG_ARROW_RETURN_NOT_OK(list_builder->Append());
107108

108-
const auto& element_projection = projection.children[0];
109109
auto* value_builder = list_builder->value_builder();
110110
const auto& element_node = avro_node->leafAt(0);
111111
const auto& element_field = list_type.fields().back();

src/iceberg/avro/avro_schema_util.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,10 @@ Result<FieldProjection> ProjectList(const ListType& list_type,
670670
ValidateAvroSchemaEvolution(*expected_element_field.type(), element_node));
671671
}
672672

673+
// Set the element projection metadata but preserve its children
674+
element_projection.kind = FieldProjection::Kind::kProjected;
675+
element_projection.from = FieldProjection::SourceFieldIndex{0};
676+
673677
FieldProjection result;
674678
result.children.emplace_back(std::move(element_projection));
675679
return result;

0 commit comments

Comments
 (0)