joonseolee commented on code in PR #8019:
URL: https://github.com/apache/gravitino/pull/8019#discussion_r2268423675
##########
core/src/main/java/org/apache/gravitino/meta/TableEntity.java:
##########
@@ -141,7 +141,7 @@ public boolean equals(Object o) {
@Override
public int hashCode() {
- return Objects.hashCode(id, name, auditInfo, columns);
+ return Objects.hashCode(id, name, auditInfo, columns, namespace);
Review Comment:
@justinmclean
Thank you for your comment :)
Just to confirm, are you suggesting that I should add test cases to verify
the scenario where TableEntities have the same name but different namespaces??
```java
@Test
public void testHashCodeWithDifferentNamespaceHavingSameValues() {
AuditInfo audit =
AuditInfo.builder().withCreator("test").withCreateTime(Instant.now()).build();
TableEntity table1 =
TableEntity.builder()
.withId(2L)
.withName("t")
.withNamespace(Namespace.of("catalog", "schema1"))
.withColumns(Collections.emptyList())
.withAuditInfo(audit)
.build();
TableEntity table2 =
TableEntity.builder()
.withId(2L)
.withName("t")
.withNamespace(Namespace.of("catalog", "schema1"))
.withColumns(Collections.emptyList())
.withAuditInfo(audit)
.build();
Assertions.assertEquals(table1.hashCode(), table2.hashCode(), "hashCode
should be the same");
}
```
--
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]