You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2023/06/06 00:31:35 UTC
[doris] branch branch-1.1-lts updated: [cherry-pick-1.1][fix](dynamic partition) partition create failed after modify comment #20455
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-1.1-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.1-lts by this push:
new 007bcec8d6 [cherry-pick-1.1][fix](dynamic partition) partition create failed after modify comment #20455
007bcec8d6 is described below
commit 007bcec8d6307a062d09a1e5ff827d5965db8a26
Author: camby <zh...@baidu.com>
AuthorDate: Tue Jun 6 08:31:28 2023 +0800
[cherry-pick-1.1][fix](dynamic partition) partition create failed after modify comment #20455
---
.../java/org/apache/doris/catalog/Catalog.java | 19 +++----
.../main/java/org/apache/doris/catalog/Column.java | 62 ++++++++++++++++++++++
.../apache/doris/catalog/HashDistributionInfo.java | 15 +++++-
3 files changed, 83 insertions(+), 13 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
index 300f143b7c..63edd31e8a 100755
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
@@ -3245,16 +3245,14 @@ public class Catalog {
if (distributionInfo.getType() == DistributionInfoType.HASH) {
HashDistributionInfo hashDistributionInfo = (HashDistributionInfo) distributionInfo;
- List<Column> newDistriCols = hashDistributionInfo.getDistributionColumns();
- List<Column> defaultDistriCols = ((HashDistributionInfo) defaultDistributionInfo)
- .getDistributionColumns();
- if (!newDistriCols.equals(defaultDistriCols)) {
- throw new DdlException("Cannot assign hash distribution with different distribution cols. "
- + "default is: " + defaultDistriCols);
- }
if (hashDistributionInfo.getBucketNum() <= 0) {
throw new DdlException("Cannot assign hash distribution buckets less than 1");
}
+ if (!hashDistributionInfo.sameDistributionColumns((HashDistributionInfo) defaultDistributionInfo)) {
+ throw new DdlException("Cannot assign hash distribution with different distribution cols. "
+ + "new is: " + hashDistributionInfo.getDistributionColumns() + " default is: "
+ + ((HashDistributionInfo) distributionInfo).getDistributionColumns());
+ }
}
} else {
// make sure partition-dristribution-info is deep copied from default-distribution-info
@@ -5890,11 +5888,10 @@ public class Catalog {
}
if (distributionInfo.getType() == DistributionInfoType.HASH) {
HashDistributionInfo hashDistributionInfo = (HashDistributionInfo) distributionInfo;
- List<Column> newDistriCols = hashDistributionInfo.getDistributionColumns();
- List<Column> defaultDistriCols = ((HashDistributionInfo) defaultDistributionInfo).getDistributionColumns();
- if (!newDistriCols.equals(defaultDistriCols)) {
+ if (!hashDistributionInfo.sameDistributionColumns((HashDistributionInfo) defaultDistributionInfo)) {
throw new DdlException("Cannot assign hash distribution with different distribution cols. "
- + "default is: " + defaultDistriCols);
+ + "new is: " + hashDistributionInfo.getDistributionColumns() + " default is: "
+ + ((HashDistributionInfo) distributionInfo).getDistributionColumns());
}
}
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 7d4407023b..41163d57ad 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
@@ -603,6 +603,68 @@ public class Column implements Writable, GsonPostProcessable {
return true;
}
+ // distribution column compare only care about attrs which affect data,
+ // do not care about attrs, such as comment
+ public boolean equalsForDistribution(Column other) {
+ if (other == this) {
+ return true;
+ }
+
+ 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 (!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;
+ }
+
@Override
public void write(DataOutput out) throws IOException {
String json = GsonUtils.GSON.toJson(this);
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 be9526a743..091fecceda 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
@@ -89,6 +89,18 @@ public class HashDistributionInfo extends DistributionInfo {
return distributionInfo;
}
+ public boolean sameDistributionColumns(HashDistributionInfo other) {
+ if (distributionColumns.size() != other.distributionColumns.size()) {
+ return false;
+ }
+ for (int i = 0; i < distributionColumns.size(); ++i) {
+ if (!distributionColumns.get(i).equalsForDistribution(other.distributionColumns.get(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
public boolean equals(DistributionInfo info) {
if (this == info) {
return true;
@@ -99,10 +111,9 @@ public class HashDistributionInfo extends DistributionInfo {
}
HashDistributionInfo hashDistributionInfo = (HashDistributionInfo) info;
-
return type == hashDistributionInfo.type
&& bucketNum == hashDistributionInfo.bucketNum
- && distributionColumns.equals(hashDistributionInfo.distributionColumns);
+ && sameDistributionColumns(hashDistributionInfo);
}
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org