Quanlong Huang has posted comments on this change. ( http://gerrit.cloudera.org:8080/24259 )
Change subject: IMPALA-14930: Auto comments on unused imports in Java ...................................................................... Patch Set 2: (4 comments) > Patch Set 2: Code-Review+1 > > Looks great, welcome patch. Do we have any plans to move away from custom > solutions and use something like spotless for Java? We currently enforce > rules in critic-gerrit-review.py and the .clang-format file, we could migrate > the rules to a spotless configuration and critic-gerrit-review.py could > simply call the spotless plugin. Spotless has a lot more configuration > options and we could really enforce the Impala Java code style with it. That's a good point! I just tried Checkstyle and decided to not include new dependencies since unused imports are easy to detect. Filed IMPALA-15075 to integrate Spotless. http://gerrit.cloudera.org:8080/#/c/24259/2//COMMIT_MSG Commit Message: http://gerrit.cloudera.org:8080/#/c/24259/2//COMMIT_MSG@13 PS2, Line 13: flake8 (F401), the script simply uses string parsing to extract imported > I had tried to enable linting on Java, but there were other issues I couldn Yeah, finding unused imports is easy. Just want a simple solution without new dependencies. http://gerrit.cloudera.org:8080/#/c/24259/2/bin/jenkins/critique-gerrit-review.py File bin/jenkins/critique-gerrit-review.py: http://gerrit.cloudera.org:8080/#/c/24259/2/bin/jenkins/critique-gerrit-review.py@235 PS2, Line 235: body = re.sub(r"^\s*static\s+", "", body).strip() > This looks the same as _java_star_import_body. Yeah, also moved this above so _is_java_star_import_allowed() doesn't need _java_star_import_body(). http://gerrit.cloudera.org:8080/#/c/24259/2/fe/src/main/java/org/apache/impala/hive/executor/HiveUdfInputHandler.java File fe/src/main/java/org/apache/impala/hive/executor/HiveUdfInputHandler.java: http://gerrit.cloudera.org:8080/#/c/24259/2/fe/src/main/java/org/apache/impala/hive/executor/HiveUdfInputHandler.java@20 PS2, Line 20: > nit: why the extra newline? Oops, I have a script to remove unused imports. But it doesn't remove the redundant blank lines. http://gerrit.cloudera.org:8080/#/c/24259/2/fe/src/main/java/org/apache/impala/util/FunctionUtils.java File fe/src/main/java/org/apache/impala/util/FunctionUtils.java: http://gerrit.cloudera.org:8080/#/c/24259/2/fe/src/main/java/org/apache/impala/util/FunctionUtils.java@24 PS2, Line 24: > Why an extra newline? It's the original L29. I think we tend to split the imports into groups of jdk tools, apache components and guava tools. -- To view, visit http://gerrit.cloudera.org:8080/24259 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I5a260c05e02e96aaf1331bc31ed92b0e368403bd Gerrit-Change-Number: 24259 Gerrit-PatchSet: 2 Gerrit-Owner: Quanlong Huang <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Michael Smith <[email protected]> Gerrit-Reviewer: Peter Rozsa <[email protected]> Gerrit-Reviewer: Quanlong Huang <[email protected]> Gerrit-Comment-Date: Fri, 05 Jun 2026 03:57:54 +0000 Gerrit-HasComments: Yes
