Skip to content

Commit

Permalink
ODP-1165|HIVE-26488: Fix NPE in DDLSemanticAnalyzerFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
dishtikundra authored and shubhluck committed Apr 12, 2024
1 parent b2b0d5a commit 030155d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<properties>
<hive.path.to.root>..</hive.path.to.root>
<powermock.version>2.0.2</powermock.version>
<reflections.version>0.9.10</reflections.version>
<reflections.version>0.10.2</reflections.version>
<atlas.version>2.1.0</atlas.version>
</properties>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ public interface DDLSemanticAnalyzerCategory {
new HashMap<>();

static {
Set<Class<? extends BaseSemanticAnalyzer>> analyzerClasses1 =
Set<Class<? extends BaseSemanticAnalyzer>> analyzerClasses =
new Reflections(DDL_ROOT).getSubTypesOf(BaseSemanticAnalyzer.class);
Set<Class<? extends CalcitePlanner>> analyzerClasses2 =
new Reflections(DDL_ROOT).getSubTypesOf(CalcitePlanner.class);
Set<Class<? extends BaseSemanticAnalyzer>> analyzerClasses = Sets.union(analyzerClasses1, analyzerClasses2);
for (Class<? extends BaseSemanticAnalyzer> analyzerClass : analyzerClasses) {
if (Modifier.isAbstract(analyzerClass.getModifiers())) {
continue;
}

DDLType ddlType = analyzerClass.getAnnotation(DDLType.class);
if (ddlType == null) {
continue;
}
for (int type : ddlType.types()) {
if (TYPE_TO_ANALYZER.containsKey(type)) {
throw new IllegalStateException(
Expand All @@ -93,6 +93,9 @@ public interface DDLSemanticAnalyzerCategory {
}

DDLType ddlType = analyzerCategoryClass.getAnnotation(DDLType.class);
if (ddlType == null) {
continue;
}
for (int type : ddlType.types()) {
if (TYPE_TO_ANALYZERCATEGORY.containsKey(type)) {
throw new IllegalStateException(
Expand Down

0 comments on commit 030155d

Please sign in to comment.