@@ -787,7 +787,7 @@ Result<SchemaProjection> Project(const Schema& expected_schema,
787787
788788// Helper function to create a new Avro node with field IDs from name mapping
789789Result<::avro::NodePtr> CreateAvroNodeWithFieldIds (const ::avro::NodePtr& original_node,
790- const NameMapping& name_mapping) {
790+ const NameMapping& name_mapping) {
791791 switch (original_node->type ()) {
792792 case ::avro::AVRO_RECORD:
793793 return CreateRecordNodeWithFieldIds (original_node, name_mapping);
@@ -816,7 +816,7 @@ Result<::avro::NodePtr> CreateAvroNodeWithFieldIds(const ::avro::NodePtr& origin
816816}
817817
818818Result<::avro::NodePtr> CreateRecordNodeWithFieldIds (const ::avro::NodePtr& original_node,
819- const NameMapping& name_mapping) {
819+ const NameMapping& name_mapping) {
820820 auto new_record_node = std::make_shared<::avro::NodeRecord>();
821821 new_record_node->setName (original_node->name ());
822822
@@ -830,21 +830,20 @@ Result<::avro::NodePtr> CreateRecordNodeWithFieldIds(const ::avro::NodePtr& orig
830830 // Add field ID attribute to the new node
831831 ::avro::CustomAttributes attributes;
832832 attributes.addAttribute (std::string (kFieldIdProp ),
833- std::to_string (field_ref->get ().field_id .value ()),
834- false );
833+ std::to_string (field_ref->get ().field_id .value ()), false );
835834 new_record_node->addCustomAttributesForField (attributes);
836835 }
837836
838837 // Recursively apply field IDs to nested fields if they exist
839- if (field_ref->get ().nested_mapping &&
840- field_node->type () == ::avro::AVRO_RECORD) {
838+ if (field_ref->get ().nested_mapping && field_node->type () == ::avro::AVRO_RECORD) {
841839 const auto & nested_mapping = field_ref->get ().nested_mapping ;
842840 auto fields_span = nested_mapping->fields ();
843841 std::vector<MappedField> fields_vector (fields_span.begin (), fields_span.end ());
844842 auto nested_name_mapping = NameMapping::Make (std::move (fields_vector));
845843
846- ICEBERG_ASSIGN_OR_RAISE (auto new_nested_node,
847- CreateAvroNodeWithFieldIds (field_node, *nested_name_mapping));
844+ ICEBERG_ASSIGN_OR_RAISE (
845+ auto new_nested_node,
846+ CreateAvroNodeWithFieldIds (field_node, *nested_name_mapping));
848847 new_record_node->addName (field_name);
849848 new_record_node->addLeaf (new_nested_node);
850849 } else {
@@ -867,7 +866,7 @@ Result<::avro::NodePtr> CreateRecordNodeWithFieldIds(const ::avro::NodePtr& orig
867866}
868867
869868Result<::avro::NodePtr> CreateArrayNodeWithFieldIds (const ::avro::NodePtr& original_node,
870- const NameMapping& name_mapping) {
869+ const NameMapping& name_mapping) {
871870 if (original_node->leaves () != 1 ) {
872871 return InvalidSchema (" Array type must have exactly one leaf" );
873872 }
@@ -880,8 +879,9 @@ Result<::avro::NodePtr> CreateArrayNodeWithFieldIds(const ::avro::NodePtr& origi
880879 if (original_node->logicalType ().type () == ::avro::LogicalType::CUSTOM &&
881880 original_node->logicalType ().customLogicalType () != nullptr &&
882881 original_node->logicalType ().customLogicalType ()->name () == kMapLogicalType ) {
883- ICEBERG_ASSIGN_OR_RAISE (auto new_element_node,
884- CreateAvroNodeWithFieldIds (original_node->leafAt (0 ), name_mapping));
882+ ICEBERG_ASSIGN_OR_RAISE (
883+ auto new_element_node,
884+ CreateAvroNodeWithFieldIds (original_node->leafAt (0 ), name_mapping));
885885 new_array_node->addLeaf (new_element_node);
886886 return new_array_node;
887887 }
@@ -897,14 +897,15 @@ Result<::avro::NodePtr> CreateArrayNodeWithFieldIds(const ::avro::NodePtr& origi
897897 }
898898 }
899899
900- ICEBERG_ASSIGN_OR_RAISE (auto new_element_node,
901- CreateAvroNodeWithFieldIds (original_node->leafAt (0 ), name_mapping));
900+ ICEBERG_ASSIGN_OR_RAISE (
901+ auto new_element_node,
902+ CreateAvroNodeWithFieldIds (original_node->leafAt (0 ), name_mapping));
902903 new_array_node->addLeaf (new_element_node);
903904 return new_array_node;
904905}
905906
906907Result<::avro::NodePtr> CreateMapNodeWithFieldIds (const ::avro::NodePtr& original_node,
907- const NameMapping& name_mapping) {
908+ const NameMapping& name_mapping) {
908909 if (original_node->leaves () != 2 ) {
909910 return InvalidSchema (" Map type must have exactly two leaves" );
910911 }
@@ -927,25 +928,25 @@ Result<::avro::NodePtr> CreateMapNodeWithFieldIds(const ::avro::NodePtr& origina
927928 if (value_field->get ().field_id .has_value ()) {
928929 ::avro::CustomAttributes attributes;
929930 attributes.addAttribute (std::string (kValueIdProp ),
930- std::to_string (value_field->get ().field_id .value ()),
931- false );
931+ std::to_string (value_field->get ().field_id .value ()), false );
932932 new_map_node->addCustomAttributesForField (attributes);
933933 }
934934 }
935935
936936 // Add key and value nodes
937- ICEBERG_ASSIGN_OR_RAISE (auto new_key_node,
938- CreateAvroNodeWithFieldIds (original_node->leafAt (0 ), name_mapping));
939- ICEBERG_ASSIGN_OR_RAISE (auto new_value_node,
940- CreateAvroNodeWithFieldIds (original_node->leafAt (1 ), name_mapping));
937+ ICEBERG_ASSIGN_OR_RAISE (auto new_key_node, CreateAvroNodeWithFieldIds (
938+ original_node->leafAt (0 ), name_mapping));
939+ ICEBERG_ASSIGN_OR_RAISE (
940+ auto new_value_node,
941+ CreateAvroNodeWithFieldIds (original_node->leafAt (1 ), name_mapping));
941942 new_map_node->addLeaf (new_key_node);
942943 new_map_node->addLeaf (new_value_node);
943944
944945 return new_map_node;
945946}
946947
947948Result<::avro::NodePtr> CreateUnionNodeWithFieldIds (const ::avro::NodePtr& original_node,
948- const NameMapping& name_mapping) {
949+ const NameMapping& name_mapping) {
949950 if (original_node->leaves () != 2 ) {
950951 return InvalidSchema (" Union type must have exactly two branches" );
951952 }
0 commit comments