Gyeongtae Park created ZEPPELIN-6225:
----------------------------------------
Summary: Simplify nested DelegatingStatement unwrapping in
HiveUtils
Key: ZEPPELIN-6225
URL: https://issues.apache.org/jira/browse/ZEPPELIN-6225
Project: Zeppelin
Issue Type: Improvement
Reporter: Gyeongtae Park
Fix For: 1.0.0, 0.12.1, 0.13.0
In {{{}HiveUtils.startHiveMonitorThread{}}}, the current implementation
retrieves the underlying {{HiveStatement}} using a deeply nested casting of
{{{}DelegatingStatement{}}}:
{code:java}
HiveStatement hiveStmt = (HiveStatement)
((DelegatingStatement) ((DelegatingStatement)
stmt).getDelegate()).getDelegate(); {code}
This approach is fragile and hard to maintain. If the underlying connection
pool behavior changes, it may lead to {{{}ClassCastException{}}}. Additionally,
this structure reduces code readability.
This issue aims to:
* Replace nested casts with a safer and more readable unwrapping mechanism
* Optionally use {{unwrap(HiveStatement.class)}} if supported by the JDBC
driver
* Improve robustness against changes in DBCP or Hive JDBC internals
Refactoring this logic will improve maintainability and reduce the risk of
runtime failures.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)