zabetak commented on code in PR #3538:
URL: https://github.com/apache/hive/pull/3538#discussion_r970539353


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/DDLSemanticAnalyzerFactory.java:
##########
@@ -65,10 +68,12 @@ public interface DDLSemanticAnalyzerCategory {
       new HashMap<>();
 
   static {
-    Set<Class<? extends BaseSemanticAnalyzer>> analyzerClasses1 =
-        new Reflections(DDL_ROOT).getSubTypesOf(BaseSemanticAnalyzer.class);
-    Set<Class<? extends CalcitePlanner>> analyzerClasses2 =
-        new Reflections(DDL_ROOT).getSubTypesOf(CalcitePlanner.class);
+    Set<Class<? extends BaseSemanticAnalyzer>> analyzerClasses1 = new 
Reflections(
+        new ConfigurationBuilder()
+            .setUrls(ClasspathHelper.forPackage(DDL_ROOT)).filterInputsBy(new 
FilterBuilder().includePackage(DDL_ROOT)).setExpandSuperTypes(false)).getSubTypesOf(BaseSemanticAnalyzer.class);
+    Set<Class<? extends CalcitePlanner>> analyzerClasses2 = new Reflections(
+        new ConfigurationBuilder().filterInputsBy(new 
FilterBuilder().includePackage(DDL_ROOT))
+            
.setUrls(ClasspathHelper.forPackage(DDL_ROOT)).setExpandSuperTypes(false)).getSubTypesOf(CalcitePlanner.class);
     Set<Class<? extends BaseSemanticAnalyzer>> analyzerClasses = 
Sets.union(analyzerClasses1, analyzerClasses2);
     for (Class<? extends BaseSemanticAnalyzer> analyzerClass : 
analyzerClasses) {

Review Comment:
   Thanks! Please delete the following lines as well; they are redundant.
   ```java
       Set<Class<? extends CalcitePlanner>> analyzerClasses2 =
           new Reflections(DDL_ROOT).getSubTypesOf(CalcitePlanner.class);
       Set<Class<? extends BaseSemanticAnalyzer>> analyzerClasses = 
Sets.union(analyzerClasses1, analyzerClasses2);
   ```
   Consider adding a null check after the following line to avoid similar 
problems in the future:
   ```java
   DDLType ddlType = analyzerCategoryClass.getAnnotation(DDLType.class);
   ```



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to