huaxingao commented on code in PR #13625:
URL: https://github.com/apache/iceberg/pull/13625#discussion_r2464360027


##########
spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/ExtendedParser.java:
##########
@@ -66,5 +66,39 @@ static List<RawOrderField> parseSortOrder(SparkSession 
spark, String orderString
     }
   }
 
+  private static <T> T findParser(ParserInterface parser, Class<T> clazz) {
+    ParserInterface current = parser;
+    while (current != null) {
+      if (clazz.isInstance(current)) {
+        return clazz.cast(current);
+      }
+
+      ParserInterface next = getNextDelegateParser(current);
+      if (next == null || next == current) {
+        break;
+      }
+
+      current = next;
+    }
+
+    return null;
+  }
+
+  private static ParserInterface getNextDelegateParser(ParserInterface parser) 
{
+    try {
+      for (java.lang.reflect.Field field : 
parser.getClass().getDeclaredFields()) {

Review Comment:
   parser.getClass().getDeclaredFields() only inspects fields declared on the 
concrete class. Should we also scan superclasses to catch a delegate defined in 
a base class?



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

Reply via email to