gitedmond commented on code in PR #51401:
URL: https://github.com/apache/arrow/pull/51401#discussion_r4072868975


##########
cpp/src/parquet/arrow/reader.cc:
##########
@@ -278,12 +280,18 @@ class FileReaderImpl : public FileReader {
       records_to_read += reader_->metadata()->RowGroup(row_group)->num_rows();
     }
 #ifdef ARROW_WITH_OPENTELEMETRY
-    std::string column_name = reader_->metadata()->schema()->Column(i)->name();
-    std::string phys_type =
-        
TypeToString(reader_->metadata()->schema()->Column(i)->physical_type());
+    const auto& schema_field = manifest_.schema_fields[field_index];
+    const std::string& column_name = schema_field.field->name();
+    std::string phys_type;
+    if (schema_field.is_leaf()) {
+      phys_type = TypeToString(reader_->metadata()
+                                   ->schema()
+                                   ->Column(schema_field.column_index)
+                                   ->physical_type());
+    }
     ::arrow::util::tracing::Span span;
     START_SPAN(span, "parquet::arrow::read_column",
-               {{"parquet.arrow.columnindex", i},
+               {{"parquet.arrow.columnindex", field_index},
                 {"parquet.arrow.columnname", column_name},

Review Comment:
   I kept `field_name` for the internal variable, but restored the existing 
`parquet.arrow.columnindex` and `parquet.arrow.columnname` attribute keys. 
Renaming those keys meant the tracing tests could no longer find the emitted 
attributes, and could similarly break existing dashboards or trace queries that 
depend on those names. The attribute values still contain the corrected 
top-level Arrow field index and name.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to