manuzhang commented on code in PR #13625:
URL: https://github.com/apache/iceberg/pull/13625#discussion_r2448293879
##########
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);
+ }
+
+ Object next = getDelegate(current);
+ if (next == null || next == current) {
+ break;
+ }
+
+ current = (ParserInterface) next;
+ }
+
+ return null;
+ }
+
+ private static Object getDelegate(Object parser) {
+ try {
+ for (java.lang.reflect.Field field :
parser.getClass().getDeclaredFields()) {
+ field.setAccessible(true);
+ Object value = field.get(parser);
+ if (value instanceof ParserInterface && value != parser) {
+ return value;
+ }
+ }
+ } catch (Exception e) {
+ // pass
Review Comment:
We usually say `ignore` here. BTW, is it safe to ignore all Exceptions?
--
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]