Github user jihoonson commented on a diff in the pull request:
https://github.com/apache/tajo/pull/618#discussion_r33785085
--- Diff:
tajo-plan/src/main/java/org/apache/tajo/plan/logical/AlterTableNode.java ---
@@ -124,16 +155,18 @@ public PlanString getPlanString() {
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((addNewColumn == null) ? 0 :
addNewColumn.hashCode());
- result = prime * result + ((alterTableOpType == null) ? 0 :
alterTableOpType.hashCode());
- result = prime * result + ((columnName == null) ? 0 :
columnName.hashCode());
- result = prime * result + ((newColumnName == null) ? 0 :
newColumnName.hashCode());
- result = prime * result + ((newTableName == null) ? 0 :
newTableName.hashCode());
- result = prime * result + ((tableName == null) ? 0 :
tableName.hashCode());
- result = prime * result + ((properties == null) ? 0 :
properties.hashCode());
- return result;
+ return Objects.hashCode(tableName,
+ null != addNewColumn ? Objects.hashCode(addNewColumn) : addNewColumn,
--- End diff --
Objects.hashCode() allows null parameters, so this null checking is
unnecessary.
Anyway, I think that the former way is more efficient than using
Objects.hashCode().
However, I also know that most hashCode() methods are written using
Objects.hashCode(). So, we may need to improve those hashCode() methods when
the performance issue arises later.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---