scovich commented on code in PR #8385:
URL: https://github.com/apache/arrow-rs/pull/8385#discussion_r2361124980


##########
arrow-avro/src/codec.rs:
##########
@@ -1386,18 +1366,20 @@ impl<'a> Maker<'a> {
                     if let Ok(tmp) = self.resolve_type(writer_non_union, 
reader, namespace) {
                         let how = Self::coercion_from(&tmp);
                         if how == Promotion::Direct {
-                            direct = Some((reader_index, how));
+                            promo = Some((reader_index, how));
                             break; // first exact match wins
-                        } else if promo.is_none() {
+                        }
+                        if promo.is_none() {
+                            // the first promo wins, unless an exact match is 
found later
                             promo = Some((reader_index, how));
                         }
                     }
                 }
-                let (reader_index, promotion) = direct.or(promo).ok_or_else(|| 
{

Review Comment:
   Can delete `direct` now (L1363 above)?



##########
arrow-avro/src/codec.rs:
##########
@@ -1857,14 +1839,14 @@ mod tests {
             .expect("promotion should resolve")
     }
 
-    fn mk_primitive(pt: PrimitiveType) -> Schema<'static> {
+    fn mk_primitive<'a>(pt: PrimitiveType) -> Schema<'a> {
         Schema::TypeName(TypeName::Primitive(pt))

Review Comment:
   Does this work, out of curiosity?
   ```suggestion
       fn mk_primitive(pt: PrimitiveType) -> Schema<'_> {
           Schema::TypeName(TypeName::Primitive(pt))
   ```



##########
arrow-avro/src/codec.rs:
##########
@@ -1857,14 +1839,14 @@ mod tests {
             .expect("promotion should resolve")
     }
 
-    fn mk_primitive(pt: PrimitiveType) -> Schema<'static> {
+    fn mk_primitive<'a>(pt: PrimitiveType) -> Schema<'a> {
         Schema::TypeName(TypeName::Primitive(pt))
     }
-    fn mk_union(branches: Vec<Schema<'static>>) -> Schema<'static> {
+    fn mk_union(branches: Vec<Schema<'_>>) -> Schema<'_> {
         Schema::Union(branches)
     }
 
-    fn mk_record_named(name: &'static str) -> Schema<'static> {
+    fn mk_record_name(name: &'_ str) -> Schema<'_> {

Review Comment:
   This _should_ work?
   ```suggestion
       fn mk_record_name(name: &str) -> Schema<'_> {
   ```



##########
arrow-avro/src/codec.rs:
##########
@@ -1857,14 +1839,14 @@ mod tests {
             .expect("promotion should resolve")
     }
 
-    fn mk_primitive(pt: PrimitiveType) -> Schema<'static> {
+    fn mk_primitive<'a>(pt: PrimitiveType) -> Schema<'a> {
         Schema::TypeName(TypeName::Primitive(pt))

Review Comment:
   Interesting... `'a` doesn't "attach" to any input arg? Not quite sure how 
that works in rust...



##########
arrow-avro/src/codec.rs:
##########
@@ -1857,14 +1839,14 @@ mod tests {
             .expect("promotion should resolve")
     }
 
-    fn mk_primitive(pt: PrimitiveType) -> Schema<'static> {
+    fn mk_primitive<'a>(pt: PrimitiveType) -> Schema<'a> {
         Schema::TypeName(TypeName::Primitive(pt))

Review Comment:
   Nope... might be a case where `'static` actually makes sense?



-- 
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