- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.9k
 
Follow-up: Optimize support recursive delegate unwrapping to find ExtendedParser in parser chains #14497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| LOG.warn( | ||
| "Field '{}' not found in class {}. Trying superclass.", | ||
| SQL_PARSER_FIELD, | ||
| clazz.getName()); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOG lines for test ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think no need to log in tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kamcheungting-db: add log to help RCA if something goes wrong
Added logs based on suggestion, just in case.
If you feel they're unnecessary in the test class, we can remove them.
| } | ||
| 
               | 
          ||
| private static ParserInterface getNextDelegateParser(ParserInterface parser) { | ||
| Logger logger = LoggerFactory.getLogger(ExtendedParser.class); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we not declare this as private static final member of the interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interface fields cannot be private in Java.
Can the code be written like this?
public interface ExtendedParser extends ParserInterface {
  Logger LOG = LoggerFactory.getLogger(ExtendedParser.class);
| logger.warn( | ||
| "Failed to scan delegate parser in {}: {}", parser.getClass().getName(), e.toString()); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| logger.warn( | |
| "Failed to scan delegate parser in {}: {}", parser.getClass().getName(), e.toString()); | |
| logger.warn("Failed to scan delegate parser in {}", parser.getClass().getName(), e); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
…er in parser chains
…endedParser in parser chains
…endedParser in parser chains
…endedParser in parser chains
…endedParser in parser chains
…endedParser in parser chains
…endedParser in parser chains
0925665    to
    4c3fd36      
    Compare
  
    | import org.junit.jupiter.api.Test; | ||
| 
               | 
          ||
| public class TestExtendedParser { | ||
| 
               | 
          
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restored.
…endedParser in parser chains
| clazz = clazz.getSuperclass(); | ||
| } | ||
| } catch (Exception e) { | ||
| // ignore | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this comment now. This comment was there to suppress "Empty 'catch' block" warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| } | ||
| } catch (Exception e) { | ||
| // ignore | ||
| LOG.warn("Failed to scan delegate parser in {}: {}", parser.getClass().getName(), e); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to append : {} for e, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without '{}' will print the exception stacktrace, which actually makes sense here.
…endedParser in parser chains
Related PR: #13625, #14483
Some follow-up code optimizations. Thanks to @kamcheungting-db for the suggestions.