hyunw9 opened a new pull request, #4968:
URL: https://github.com/apache/zeppelin/pull/4968
### What is this PR for?
To address this issue, nested type casting logic has been extracted into a
dedicated static method (`unwrapHiveStatement`).
Since the immediate wrapper (like `DelegatingStatement`) in the Statement
chain doesn't reliably support standard `isWrapperFor` and `unwrap(Class<T>
iface)` calls (often returning `false` or throwing `SQLException` as observed
in its implementation), a `while` loop is used to iteratively unwrap the
underlying `DelegatingStatement` layers.
To prevent potential infinite loops or excessive unwrapping attempts, a
**`MAX_STATEMENT_UNWRAP_DEPTH`** constant has been introduced, limiting the
maximum unwrapping depth. Error handling and logging have also been improved to
provide clearer insights into the unwrapping process.
In `HiveStatement.class` :
```
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return false;
}
public <T> T unwrap(Class<T> iface) throws SQLException {
throw new SQLException("Cannot unwrap to " + iface);
}
```
### What type of PR is it?
Refactoring
### Todos
* [ ] - Replace nested casts and Improve readability
### What is the Jira issue?
* Open an issue on
[Jira](https://issues.apache.org/jira/secure/RapidBoard.jspa?rapidView=632&projectKey=ZEPPELIN&view=detail&selectedIssue=ZEPPELIN-6225)
### How should this be tested?
* Strongly recommended: add automated unit tests for any new or changed
behavior
* Outline any manual steps to test the PR here.
### Questions:
* Does the license files need to update?
* Is there breaking changes for older versions?
* Does this needs documentation?
--
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]