EmilyMatt commented on code in PR #18812:
URL: https://github.com/apache/datafusion/pull/18812#discussion_r2541108320
##########
datafusion/datasource-avro/src/avro_to_arrow/arrow_array_reader.rs:
##########
@@ -75,14 +83,29 @@ impl<R: Read> AvroArrowArrayReader<'_, R> {
pub fn schema_lookup(schema: AvroSchema) -> Result<BTreeMap<String,
usize>> {
match schema {
AvroSchema::Record(RecordSchema {
- fields, mut lookup, ..
+ fields,
+ mut lookup,
+ name,
+ ..
}) => {
+ let mut unresolved_names = NamesResolver::default();
+ unresolved_names.in_progress.insert(name.clone());
+
for field in fields {
- Self::child_schema_lookup(&field.name, &field.schema, &mut
lookup)?;
+ Self::child_schema_lookup(
+ &field.name,
+ &field.schema,
+ &mut lookup,
+ &mut unresolved_names,
+ )?;
}
+
+ unresolved_names.in_progress.remove(&name);
+ assert!(unresolved_names.in_progress.is_empty());
Review Comment:
Should probably be debug_assert!(), this is mostly so no one changes the
code accidentally and breaks it, ensure validity, it is not something that will
happen in a real-life scenario.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]