maccamlc commented on a change in pull request #885:
URL: https://github.com/apache/avro/pull/885#discussion_r711493820



##########
File path: 
lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java
##########
@@ -282,37 +287,51 @@ public void addCustomConversion(Class<?> conversionClass) 
{
 
   public Collection<String> getUsedConversionClasses(Schema schema) {
     Collection<String> result = new HashSet<>();
-    for (Conversion<?> conversion : getUsedConversions(schema, new 
HashSet<>(), new HashSet<>())) {
+    for (Conversion<?> conversion : getUsedConversions(schema)) {
       result.add(conversion.getClass().getCanonicalName());
     }
     return result;
   }
 
-  private Set<Conversion<?>> getUsedConversions(Schema schema, 
Set<Conversion<?>> result, Set<Schema> seenSchemas) {
+  public Set<String> getUsedCustomLogicalTypeFactories(Schema schema) {
+    final Set<String> logicalTypeNames = 
getUsedLogicalTypes(schema).stream().map(LogicalType::getName)
+        .collect(Collectors.toSet());
+
+    return LogicalTypes.getCustomRegisteredTypes().entrySet().stream()
+        .filter(entry -> logicalTypeNames.contains(entry.getKey()))
+        .map(entry -> 
entry.getValue().getClass().getCanonicalName()).collect(Collectors.toSet());
+  }
+
+  private void getUsedTypes(Schema schema, Set<Conversion<?>> 
conversionResults, Set<LogicalType> logicalTypeResults,

Review comment:
       Updated 👍 




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