Skip to content

Commit

Permalink
branch-3.0: [fix](catelog) Unifies partition items string #45669 (#45699
Browse files Browse the repository at this point in the history
)

Cherry-picked from #45669

Co-authored-by: walter <[email protected]>
  • Loading branch information
github-actions[bot] and w41ter authored Dec 23, 2024
1 parent 82f497c commit 381ccc8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
6 changes: 1 addition & 5 deletions fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
Original file line number Diff line number Diff line change
Expand Up @@ -6458,11 +6458,7 @@ private static void getTableMeta(OlapTable olapTable, TGetMetaDBMeta dbMeta) {
long partitionId = partition.getId();
partitionMeta.setId(partitionId);
partitionMeta.setName(partition.getName());
String partitionRange = "";
if (tblPartitionInfo.getType() == PartitionType.RANGE
|| tblPartitionInfo.getType() == PartitionType.LIST) {
partitionRange = tblPartitionInfo.getItem(partitionId).getItems().toString();
}
String partitionRange = tblPartitionInfo.getPartitionRangeString(partitionId);
partitionMeta.setRange(partitionRange);
partitionMeta.setVisibleVersion(partition.getVisibleVersion());
// partitionMeta.setTemp(partition.isTemp());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ public List<PartitionKey> getItems() {
}

public String getItemsString() {
return toString();
// ATTN: DO NOT EDIT unless unless you explicitly guarantee compatibility
// between different versions.
//
// the ccr syncer depends on this string to identify partitions between two
// clusters (cluster versions may be different).
return getItems().toString();
}

public String getItemsSql() {
Expand Down Expand Up @@ -173,11 +178,6 @@ public int hashCode() {

@Override
public String toString() {
// ATTN: DO NOT EDIT unless unless you explicitly guarantee compatibility
// between different versions.
//
// the ccr syncer depends on this string to identify partitions between two
// clusters (cluster versions may be different).
StringBuilder builder = new StringBuilder();
builder.append("partitionKeys: [");
for (PartitionKey partitionKey : partitionKeys) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ public Range<PartitionKey> getItems() {
}

public String getItemsString() {
return toString();
// ATTN: DO NOT EDIT unless unless you explicitly guarantee compatibility
// between different versions.
//
// the ccr syncer depends on this string to identify partitions between two
// clusters (cluster versions may be different).
return partitionKeyRange.toString();
}

public String getItemsSql() {
Expand Down Expand Up @@ -120,11 +125,6 @@ public boolean equals(Object obj) {

@Override
public String toString() {
// ATTN: DO NOT EDIT unless unless you explicitly guarantee compatibility
// between different versions.
//
// the ccr syncer depends on this string to identify partitions between two
// clusters (cluster versions may be different).
return partitionKeyRange.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public ProcResult fetchResult() throws AnalysisException {
}
partitionInfo.add(joiner.join(colNames)); // partition key
partitionInfo.add(
rangePartitionInfo.getItem(esShardPartitions.getPartitionId()).getItems().toString()); // range
rangePartitionInfo.getItem(esShardPartitions.getPartitionId()).getItemsString()); // range
partitionInfo.add("-"); // dis
partitionInfo.add(esShardPartitions.getShardRoutings().size()); // shards
partitionInfo.add(1); // replica num
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ private List<Pair<List<Comparable>, TRow>> getPartitionInfosInrernal() throws An
String colNamesStr = joiner.join(colNames);
partitionInfo.add(colNamesStr);
trow.addToColumnValue(new TCell().setStringVal(colNamesStr));
String itemStr = tblPartitionInfo.getItem(partitionId).getItems().toString();
String itemStr = tblPartitionInfo.getPartitionRangeString(partitionId);
partitionInfo.add(itemStr);
trow.addToColumnValue(new TCell().setStringVal(itemStr));
} else {
Expand Down

0 comments on commit 381ccc8

Please sign in to comment.