[ 
https://issues.apache.org/jira/browse/HIVE-26488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17603501#comment-17603501
 ] 

Stamatis Zampetakis commented on HIVE-26488:
--------------------------------------------

I think it is worth noting that the {{NullPointerException}} is raised when the 
{{analyzerClasses}} variable contains the 
{{org.apache.hadoop.hive.ql.parse.SemanticAnalyzer}} class since the latter is 
missing the {{DDLType}} annotation. The code was written assuming that every 
class that makes it into the loop (and it is not abstract) will be annotated 
with the {{DDLType}} annotation.

As it can be seen here with the upgrade of the Reflections version to 0.9.12, 
the following callĀ 
{code:java}
new Reflections(DDL_ROOT).getSubTypesOf(BaseSemanticAnalyzer.class);
{code}

returns among others the {{SemanticAnalyzer}} class leading to the NPE.  
Reading through the Javadoc of the {{Reflections}} APIs the fact that 
{{SemanticAnalyzer}} appears in the result is the intended behavior. It seems 
that the change that led to {{SemanticAnalyzer}} becoming part of the result of 
the aforementioned call is the addition of the [expand super types 
feature|https://github.com/ronmamo/reflections/commit/ad55f7fdd7c54cd0b583ca275748e3428ece5b96]
 introduced in 0.9.11.

It is clear that an upgrade to a Reflections version higher than 0.9.10 
requires modifications to the Hive source code.

> Fix NPE in DDLSemanticAnalyzerFactory during compilation
> --------------------------------------------------------
>
>                 Key: HIVE-26488
>                 URL: https://issues.apache.org/jira/browse/HIVE-26488
>             Project: Hive
>          Issue Type: Sub-task
>            Reporter: Ayush Saxena
>            Assignee: Ayush Saxena
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> *Exception Trace:*
> {noformat}
> java.lang.ExceptionInInitializerError
>       at 
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzerFactory.getInternal(SemanticAnalyzerFactory.java:62)
>       at 
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzerFactory.get(SemanticAnalyzerFactory.java:41)
>       at org.apache.hadoop.hive.ql.Compiler.analyze(Compiler.java:209)
>       at org.apache.hadoop.hive.ql.Compiler.compile(Compiler.java:106)
>       at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:507)
>       at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:459)
>       at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:424)
>       at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:418)
> {noformat}
> *Cause:*
> {noformat}
> Caused by: java.lang.NullPointerException
>       at 
> org.apache.hadoop.hive.ql.ddl.DDLSemanticAnalyzerFactory.<clinit>(DDLSemanticAnalyzerFactory.java:84)
>       ... 40 more
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to