diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/DataSortInfo.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/DataSortInfo.java
index 4393dc162c..651bde7fc3 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DataSortInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DataSortInfo.java
@@ -28,6 +28,7 @@ import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.Map;
+import java.util.Objects;
public class DataSortInfo implements Writable {
public static final String DATA_SORT_PROPERTY_PREFIX = "data_sort";
@@ -86,14 +87,21 @@ public class DataSortInfo implements Writable {
return GsonUtils.GSON.fromJson(json, DataSortInfo.class);
}
- public boolean equals(DataSortInfo dataSortInfo) {
- if (this.sortType != dataSortInfo.sortType) {
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
return false;
}
- if (this.colNum != dataSortInfo.colNum) {
- return false;
- }
- return true;
+ DataSortInfo that = (DataSortInfo) o;
+ return colNum == that.colNum && sortType == that.sortType;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(sortType, colNum);
}
public String toSql() {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java
index 92887cba36..a7ca238e60 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java
@@ -565,8 +565,8 @@ public class Column implements Writable {
@Override
public int hashCode() {
- return Objects.hash(name, getDataType(), aggregationType, isAggregationTypeImplicit, isKey, isAllowNull,
- getDefaultValue(), getStrLen(), getPrecision(), getScale(), comment, visible, children);
+ return Objects.hash(name, getDataType(), getStrLen(), getPrecision(), getScale(), aggregationType,
+ isAggregationTypeImplicit, isKey, isAllowNull, defaultValue, comment, children, visible);
}
@Override
@@ -580,62 +580,20 @@ public class Column implements Writable {
Column other = (Column) obj;
- if (!this.name.equalsIgnoreCase(other.getName())) {
- return false;
- }
- if (this.getDataType() != other.getDataType()) {
- return false;
- }
- if (this.aggregationType != other.getAggregationType()) {
- return false;
- }
- if (this.isAggregationTypeImplicit != other.isAggregationTypeImplicit()) {
- return false;
- }
- if (this.isKey != other.isKey()) {
- return false;
- }
- if (this.isAllowNull != other.isAllowNull) {
- return false;
- }
- if (this.getDefaultValue() == null) {
- if (other.getDefaultValue() != null) {
- return false;
- }
- } else {
- if (!this.getDefaultValue().equals(other.getDefaultValue())) {
- return false;
- }
- }
-
- if (this.getStrLen() != other.getStrLen()) {
- return false;
- }
- if (this.getPrecision() != other.getPrecision()) {
- return false;
- }
- if (this.getScale() != other.getScale()) {
- return false;
- }
-
- if (!comment.equals(other.getComment())) {
- return false;
- }
- if (!visible == other.visible) {
- return false;
- }
-
- if (children.size() != other.children.size()) {
- return false;
- }
-
- for (int i = 0; i < children.size(); i++) {
- if (!children.get(i).equals(other.getChildren().get(i))) {
- return false;
- }
- }
-
- return true;
+ return name.equalsIgnoreCase(other.name)
+ && Objects.equals(getDefaultValue(), other.getDefaultValue())
+ && Objects.equals(aggregationType, other.aggregationType)
+ && isAggregationTypeImplicit == other.isAggregationTypeImplicit
+ && isKey == other.isKey
+ && isAllowNull == other.isAllowNull
+ && getDataType().equals(other.getDataType())
+ && getStrLen() == other.getStrLen()
+ && getPrecision() == other.getPrecision()
+ && getScale() == other.getScale()
+ && comment.equals(other.comment)
+ && visible == other.visible
+ && children.size() == other.children.size()
+ && children.equals(other.children);
}
@Override
@@ -676,8 +634,6 @@ public class Column implements Writable {
StringBuilder sb = new StringBuilder(name);
switch (dataType) {
case CHAR:
- sb.append(String.format(typeStringMap.get(dataType), getStrLen()));
- break;
case VARCHAR:
sb.append(String.format(typeStringMap.get(dataType), getStrLen()));
break;
@@ -688,11 +644,7 @@ public class Column implements Writable {
sb.append(String.format(typeStringMap.get(dataType), getPrecision(), getScale()));
break;
case ARRAY:
- sb.append(type.toString());
- break;
case MAP:
- sb.append(type.toString());
- break;
case STRUCT:
sb.append(type.toString());
break;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java
index 296aaeab0e..9f19f1de44 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java
@@ -411,7 +411,7 @@ public class Database extends MetaObject implements Writable, DatabaseIf
}
/**
- * this method is used for get existed table list by table id list, if table not exist, just ignore it.
+ * this method is used for get existed table list by table id list, if table not exist, just ignore it.
*/
public List getTablesOnIdOrderIfExist(List tableIdList) {
List tableList = Lists.newArrayListWithCapacity(tableIdList.size());
@@ -614,25 +614,12 @@ public class Database extends MetaObject implements Writable, DatabaseIf
return false;
}
- Database database = (Database) obj;
+ Database other = (Database) obj;
- if (idToTable != database.idToTable) {
- if (idToTable.size() != database.idToTable.size()) {
- return false;
- }
- for (Entry entry : idToTable.entrySet()) {
- long key = entry.getKey();
- if (!database.idToTable.containsKey(key)) {
- return false;
- }
- if (!entry.getValue().equals(database.idToTable.get(key))) {
- return false;
- }
- }
- }
-
- return (id == database.id) && (fullQualifiedName.equals(database.fullQualifiedName)
- && dataQuotaBytes == database.dataQuotaBytes);
+ return id == other.id
+ && idToTable.equals(other.idToTable)
+ && fullQualifiedName.equals(other.fullQualifiedName)
+ && dataQuotaBytes == other.dataQuotaBytes;
}
public String getClusterName() {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/DistributionInfo.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/DistributionInfo.java
index 959076f9f4..e7f66c42f1 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/DistributionInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/DistributionInfo.java
@@ -27,6 +27,7 @@ import org.apache.commons.lang.NotImplementedException;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
+import java.util.Objects;
public abstract class DistributionInfo implements Writable {
@@ -36,8 +37,6 @@ public abstract class DistributionInfo implements Writable {
}
// for Gson runtime type adaptor
- @SerializedName(value = "typeStr")
- protected String typeStr;
@SerializedName(value = "type")
protected DistributionInfoType type;
@@ -47,7 +46,6 @@ public abstract class DistributionInfo implements Writable {
public DistributionInfo(DistributionInfoType type) {
this.type = type;
- this.typeStr = this.type.name();
}
public DistributionInfoType getType() {
@@ -81,7 +79,20 @@ public abstract class DistributionInfo implements Writable {
return "";
}
- public boolean equals(DistributionInfo info) {
- return false;
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ DistributionInfo that = (DistributionInfo) o;
+ return type == that.type;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type);
}
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/FsBroker.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/FsBroker.java
index 4b20a63881..2d3a51d468 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/FsBroker.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/FsBroker.java
@@ -87,13 +87,10 @@ public class FsBroker implements Writable, Comparable {
return false;
}
- FsBroker that = (FsBroker) o;
-
- if (port != that.port) {
- return false;
- }
- return ip.equals(that.ip);
+ FsBroker other = (FsBroker) o;
+ return port == other.port
+ && ip.equals(other.ip);
}
@Override
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/HashDistributionInfo.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/HashDistributionInfo.java
index 80aced6f0a..a651b8c0ab 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/HashDistributionInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/HashDistributionInfo.java
@@ -29,6 +29,7 @@ import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
/**
* Hash Distribution Info.
@@ -90,20 +91,24 @@ public class HashDistributionInfo extends DistributionInfo {
return distributionInfo;
}
- public boolean equals(DistributionInfo info) {
- if (this == info) {
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
return true;
}
-
- if (!(info instanceof HashDistributionInfo)) {
+ if (o == null || getClass() != o.getClass()) {
return false;
}
+ if (!super.equals(o)) {
+ return false;
+ }
+ HashDistributionInfo that = (HashDistributionInfo) o;
+ return bucketNum == that.bucketNum && Objects.equals(distributionColumns, that.distributionColumns);
+ }
- HashDistributionInfo hashDistributionInfo = (HashDistributionInfo) info;
-
- return type == hashDistributionInfo.type
- && bucketNum == hashDistributionInfo.bucketNum
- && distributionColumns.equals(hashDistributionInfo.distributionColumns);
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), distributionColumns, bucketNum);
}
@Override
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/ListPartitionItem.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/ListPartitionItem.java
index 0f7d69fc69..b2ac6a43b2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/ListPartitionItem.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/ListPartitionItem.java
@@ -28,7 +28,7 @@ import java.util.List;
public class ListPartitionItem extends PartitionItem {
public static ListPartitionItem DUMMY_ITEM = new ListPartitionItem(Lists.newArrayList());
- private List partitionKeys;
+ private final List partitionKeys;
public ListPartitionItem(List partitionKeys) {
this.partitionKeys = partitionKeys;
@@ -91,20 +91,10 @@ public class ListPartitionItem extends PartitionItem {
return false;
}
- ListPartitionItem partitionItem = (ListPartitionItem) obj;
+ ListPartitionItem other = (ListPartitionItem) obj;
// check keys
- if (partitionKeys != partitionItem.getItems()) {
- if (partitionKeys.size() != partitionItem.getItems().size()) {
- return false;
- }
- for (int i = 0; i < partitionKeys.size(); i++) {
- if (!partitionKeys.get(i).equals(partitionItem.getItems().get(i))) {
- return false;
- }
- }
- }
-
- return true;
+ return partitionKeys.size() == other.partitionKeys.size()
+ && partitionKeys.equals(other.partitionKeys);
}
@Override
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/MaterializedIndex.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/MaterializedIndex.java
index 5db4a2f526..1ea42cca2b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/MaterializedIndex.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/MaterializedIndex.java
@@ -31,7 +31,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
/**
* The OlapTraditional table is a materialized table which stored as rowcolumnar file or columnar file
@@ -252,27 +251,13 @@ public class MaterializedIndex extends MetaObject implements Writable, GsonPostP
return false;
}
- MaterializedIndex table = (MaterializedIndex) obj;
+ MaterializedIndex other = (MaterializedIndex) obj;
- // Check idToTablets
- if (table.idToTablets == null) {
- return false;
- }
- if (idToTablets.size() != table.idToTablets.size()) {
- return false;
- }
- for (Entry entry : idToTablets.entrySet()) {
- long key = entry.getKey();
- if (!table.idToTablets.containsKey(key)) {
- return false;
- }
- if (!entry.getValue().equals(table.idToTablets.get(key))) {
- return false;
- }
- }
-
- return (state.equals(table.state))
- && (rowCount == table.rowCount);
+ return other.idToTablets != null
+ && idToTablets.size() == other.idToTablets.size()
+ && idToTablets.equals(other.idToTablets)
+ && (state.equals(other.state))
+ && (rowCount == other.rowCount);
}
@Override
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/MaterializedIndexMeta.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/MaterializedIndexMeta.java
index dd8ef85c6c..21f21851ce 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/MaterializedIndexMeta.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/MaterializedIndexMeta.java
@@ -165,32 +165,17 @@ public class MaterializedIndexMeta implements Writable, GsonPostProcessable {
if (!(obj instanceof MaterializedIndexMeta)) {
return false;
}
- MaterializedIndexMeta indexMeta = (MaterializedIndexMeta) obj;
- if (indexMeta.indexId != this.indexId) {
- return false;
- }
- if (indexMeta.schema.size() != this.schema.size() || !indexMeta.schema.containsAll(this.schema)) {
- return false;
- }
- if (indexMeta.schemaVersion != this.schemaVersion) {
- return false;
- }
- if (indexMeta.schemaHash != this.schemaHash) {
- return false;
- }
- if (indexMeta.shortKeyColumnCount != this.shortKeyColumnCount) {
- return false;
- }
- if (indexMeta.storageType != this.storageType) {
- return false;
- }
- if (indexMeta.keysType != this.keysType) {
- return false;
- }
- if (maxColUniqueId != maxColUniqueId) {
- return false;
- }
- return true;
+ MaterializedIndexMeta other = (MaterializedIndexMeta) obj;
+
+ return indexId == other.indexId
+ && schema.size() == other.schema.size()
+ && schema.equals(other.schema)
+ && schemaVersion == other.schemaVersion
+ && schemaHash == other.schemaHash
+ && shortKeyColumnCount == other.shortKeyColumnCount
+ && storageType == other.storageType
+ && keysType == other.keysType
+ && maxColUniqueId == other.maxColUniqueId;
}
@Override
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
index dff5a790e5..81163e68fc 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
@@ -75,6 +75,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@@ -1126,7 +1127,7 @@ public class OlapTable extends Table {
out.writeDouble(bfFpp);
}
- //colocateTable
+ // colocateTable
if (colocateGroup == null) {
out.writeBoolean(false);
} else {
@@ -1251,14 +1252,6 @@ public class OlapTable extends Table {
rebuildFullSchema();
}
- @Override
- public boolean equals(Table table) {
- if (this == table) {
- return true;
- }
- return table instanceof OlapTable;
- }
-
public OlapTable selectiveCopy(Collection reservedPartitions, IndexExtState extState, boolean isForBackup) {
OlapTable copied = new OlapTable();
if (!DeepCopy.copy(this, copied, OlapTable.class, FeConstants.meta_version)) {
@@ -1489,6 +1482,39 @@ public class OlapTable extends Table {
return getSchemaByIndexId(baseIndexId, full);
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ OlapTable other = (OlapTable) o;
+
+ if (!Objects.equals(defaultDistributionInfo, other.defaultDistributionInfo)) {
+ return false;
+ }
+
+ return Double.compare(other.bfFpp, bfFpp) == 0 && hasSequenceCol == other.hasSequenceCol
+ && baseIndexId == other.baseIndexId && state == other.state && Objects.equals(indexIdToMeta,
+ other.indexIdToMeta) && Objects.equals(indexNameToId, other.indexNameToId) && keysType == other.keysType
+ && Objects.equals(partitionInfo, other.partitionInfo) && Objects.equals(
+ idToPartition, other.idToPartition) && Objects.equals(nameToPartition,
+ other.nameToPartition) && Objects.equals(tempPartitions, other.tempPartitions)
+ && Objects.equals(bfColumns, other.bfColumns) && Objects.equals(colocateGroup,
+ other.colocateGroup) && Objects.equals(sequenceType, other.sequenceType)
+ && Objects.equals(indexes, other.indexes) && Objects.equals(tableProperty,
+ other.tableProperty);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(state, indexIdToMeta, indexNameToId, keysType, partitionInfo, idToPartition,
+ nameToPartition, defaultDistributionInfo, tempPartitions, bfColumns, bfFpp, colocateGroup,
+ hasSequenceCol, sequenceType, indexes, baseIndexId, tableProperty);
+ }
+
public Column getBaseColumn(String columnName) {
for (Column column : getBaseSchema()) {
if (column.getName().equalsIgnoreCase(columnName)) {
@@ -1884,7 +1910,7 @@ public class OlapTable extends Table {
tableProperty.buildReplicaAllocation();
}
- //for light schema change
+ // for light schema change
public void initSchemaColumnUniqueId() {
if (!getEnableLightSchemaChange()) {
return;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Partition.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Partition.java
index 75e64b6292..16a298f69f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Partition.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Partition.java
@@ -36,7 +36,7 @@ import java.io.DataOutput;
import java.io.IOException;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
+import java.util.Objects;
/**
* Internal representation of partition-related metadata.
@@ -383,25 +383,17 @@ public class Partition extends MetaObject implements Writable {
return false;
}
- Partition partition = (Partition) obj;
- if (idToVisibleRollupIndex != partition.idToVisibleRollupIndex) {
- if (idToVisibleRollupIndex.size() != partition.idToVisibleRollupIndex.size()) {
- return false;
- }
- for (Entry entry : idToVisibleRollupIndex.entrySet()) {
- long key = entry.getKey();
- if (!partition.idToVisibleRollupIndex.containsKey(key)) {
- return false;
- }
- if (!entry.getValue().equals(partition.idToVisibleRollupIndex.get(key))) {
- return false;
- }
- }
- }
+ Partition other = (Partition) obj;
- return (visibleVersion == partition.visibleVersion)
- && (baseIndex.equals(partition.baseIndex)
- && distributionInfo.equals(partition.distributionInfo));
+ return (visibleVersion == other.visibleVersion)
+ && baseIndex.equals(other.baseIndex)
+ && distributionInfo.equals(other.distributionInfo)
+ && idToVisibleRollupIndex.equals(other.idToVisibleRollupIndex);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(visibleVersion, baseIndex, idToVisibleRollupIndex, distributionInfo);
}
@Override
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionInfo.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionInfo.java
index e94a1f80ba..c97fcccaa7 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/PartitionInfo.java
@@ -38,6 +38,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
/*
@@ -376,4 +377,26 @@ public class PartitionInfo implements Writable {
return buff.toString();
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ PartitionInfo that = (PartitionInfo) o;
+ return isMultiColumnPartition == that.isMultiColumnPartition && type == that.type && Objects.equals(
+ partitionColumns, that.partitionColumns) && Objects.equals(idToItem, that.idToItem)
+ && Objects.equals(idToTempItem, that.idToTempItem) && Objects.equals(idToDataProperty,
+ that.idToDataProperty) && Objects.equals(idToStoragePolicy, that.idToStoragePolicy)
+ && Objects.equals(idToReplicaAllocation, that.idToReplicaAllocation) && Objects.equals(
+ idToInMemory, that.idToInMemory) && Objects.equals(idToTabletType, that.idToTabletType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type, partitionColumns, idToItem, idToTempItem, idToDataProperty, idToStoragePolicy,
+ idToReplicaAllocation, isMultiColumnPartition, idToInMemory, idToTabletType);
+ }
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/RandomDistributionInfo.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/RandomDistributionInfo.java
index 168b1f9f33..2e11b5cfd4 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/RandomDistributionInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/RandomDistributionInfo.java
@@ -23,6 +23,7 @@ import org.apache.doris.analysis.RandomDistributionDesc;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
+import java.util.Objects;
/**
* Random partition.
@@ -74,18 +75,23 @@ public class RandomDistributionInfo extends DistributionInfo {
return distributionInfo;
}
- public boolean equals(DistributionInfo info) {
- if (this == info) {
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
return true;
}
-
- if (!(info instanceof RandomDistributionInfo)) {
+ if (o == null || getClass() != o.getClass()) {
return false;
}
+ if (!super.equals(o)) {
+ return false;
+ }
+ RandomDistributionInfo that = (RandomDistributionInfo) o;
+ return bucketNum == that.bucketNum;
+ }
- RandomDistributionInfo randomDistributionInfo = (RandomDistributionInfo) info;
-
- return type == randomDistributionInfo.type
- && bucketNum == randomDistributionInfo.bucketNum;
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), bucketNum);
}
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java
index eea6dce796..71298db5c4 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java
@@ -389,10 +389,6 @@ public abstract class Table extends MetaObject implements Writable, TableIf {
this.createTime = in.readLong();
}
- public boolean equals(Table table) {
- return true;
- }
-
// return if this table is partitioned.
// For OlapTable ture when is partitioned, or distributed by hash when no partition
public boolean isPartitioned() {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/TempPartitions.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/TempPartitions.java
index a308a80be4..f64d5bed0c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/TempPartitions.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/TempPartitions.java
@@ -33,6 +33,7 @@ import java.io.DataOutput;
import java.io.IOException;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
// This class saved all temp partitions of a table.
@@ -155,4 +156,22 @@ public class TempPartitions implements Writable, GsonPostProcessable {
nameToPartition.put(partition.getName(), partition);
}
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ TempPartitions that = (TempPartitions) o;
+ return idToPartition.equals(that.idToPartition) && nameToPartition.equals(that.nameToPartition)
+ && Objects.equals(partitionInfo, that.partitionInfo);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(idToPartition, nameToPartition, partitionInfo);
+ }
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/cache/PartitionRange.java b/fe/fe-core/src/main/java/org/apache/doris/qe/cache/PartitionRange.java
index 038bcd138d..aa1174e75c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/cache/PartitionRange.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/cache/PartitionRange.java
@@ -215,10 +215,6 @@ public class PartitionRange {
date = key.date;
}
- public boolean equals(PartitionKeyType key) {
- return realValue() == key.realValue();
- }
-
public void add(int num) {
if (keyType == KeyType.DATE) {
date = new Date(date.getTime() + num * 3600 * 24 * 1000);