zeppelin
zeppelin copied to clipboard
[ZEPPELIN-6192] Enhance getHit() safety in ActionResponse and improve interface documentation
What is this PR for?
This PR improves the robustness and clarity of the Elasticsearch interpreter module in Zeppelin.
- Reimplemented
ActionResponse#getHit()to throwNoSuchElementExceptioninstead of relying on unchecked access to the first hit. - Introduced a new method
getFirstHit()which returns anOptional<HitWrapper>for safer optional access. - Added and refined Javadoc comments in:
ActionResponse.javafor bothgetHit()andgetFirstHit()ElasticsearchClient.javato improve clarity on interface usage
What type of PR is it?
Documentation Refactoring
Todos
- [x] Refactor
getHit()to throw a safe exception - [x] Add
getFirstHit()method usingOptional
What is the Jira issue?
- https://issues.apache.org/jira/browse/ZEPPELIN/ZEPPELIN-6192
How should this be tested?
- Build Test
- Elasticsearch Interpreter Test
Screenshots (if appropriate)
Questions:
- Does the license files need to update? No.
- Is there breaking changes for older versions? No.
- Does this needs documentation? No.