@@ -67,7 +67,7 @@ void SanitizeChar(char c, std::ostringstream& os) {
6767
6868} // namespace
6969
70- bool ValidAvroName (const std::string& name) {
70+ bool ValidAvroName (std::string_view name) {
7171 if (name.empty ()) {
7272 return false ;
7373 }
@@ -234,17 +234,17 @@ Status ToAvroNodeVisitor::Visit(const StructType& type, ::avro::NodePtr* node) {
234234 ::avro::NodePtr field_node;
235235 ICEBERG_RETURN_UNEXPECTED (Visit (sub_field, &field_node));
236236
237- std::string origFieldName = std::string (sub_field.name ());
238- bool isValidFieldName = ValidAvroName (origFieldName);
239- std::string fieldName =
240- isValidFieldName ? origFieldName : SanitizeFieldName (origFieldName);
237+ bool is_valid_field_name = ValidAvroName (sub_field.name ());
238+ std::string field_name = is_valid_field_name ? std::string (sub_field.name ())
239+ : SanitizeFieldName (sub_field.name ());
241240
242- (*node)->addName (fieldName );
241+ (*node)->addName (field_name );
243242 (*node)->addLeaf (field_node);
244243
245244 ::avro::CustomAttributes attributes = GetAttributesWithFieldId (sub_field.field_id ());
246- if (!isValidFieldName) {
247- attributes.addAttribute (std::string (kIcebergFieldNameProp ), origFieldName,
245+ if (!is_valid_field_name) {
246+ attributes.addAttribute (std::string (kIcebergFieldNameProp ),
247+ std::string (sub_field.name ()),
248248 /* addQuotes=*/ true );
249249 }
250250 (*node)->addCustomAttributesForField (attributes);
0 commit comments