You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by GitBox <gi...@apache.org> on 2023/01/04 05:19:22 UTC

[GitHub] [avro] KhrystynaPopadyuk commented on a diff in pull request #2017: AVRO-3685 Fix class cache load type

KhrystynaPopadyuk commented on code in PR #2017:
URL: https://github.com/apache/avro/pull/2017#discussion_r1061142707


##########
lang/csharp/src/apache/main/Reflect/ClassCache.cs:
##########
@@ -300,5 +295,22 @@ public void LoadClassCache(Type objType, Schema s)
                     break;
             }
         }
+
+        /// <summary>
+        /// Check if schema has to be cached
+        /// </summary>
+        /// <param name="schema"></param>
+        /// <returns>false - not applicable schema type or has been cached before</returns>
+        protected virtual bool ToBeCached(Schema schema)

Review Comment:
   Hi @timcarterwex ,
   
   Thank you for review.
   It was my first attempt to fix bug: instead check schema name instead of field name. You can find code at one of early commits in this PR (https://github.com/apache/avro/pull/2017/commits/ced11f5cb41005af0c3747c60927fd0cbafa763b).
   
   Unfortunately, it does not works. It brings initial issue with recurse and union type. Unit test for this initial problem is at https://github.com/apache/avro/blob/05099c3263081e264eb95ee41609095d44a0acfd/lang/csharp/src/apache/test/Reflect/TestRecursive.cs#L96
   
   It is not enough change check to _nameClassMap, this check should be propagated through code for all recursive call of LoadClassCache method. There are 6 such calls, one what I try to fix and 5 other.
   
   To avoid code duplication I move check as first step of LoadClassCache  instead add it before each call of this method.



-- 
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: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org