This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 391a4e29eb7 [fix](schema) Table column order is changed if add a
column and do truncate (#24981)
391a4e29eb7 is described below
commit 391a4e29eb76965e538053af1c9a6a384e3ff8b0
Author: meiyi <[email protected]>
AuthorDate: Wed Sep 27 20:59:11 2023 +0800
[fix](schema) Table column order is changed if add a column and do truncate
(#24981)
---
.../apache/doris/datasource/InternalCatalog.java | 27 +++++++++++++---------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
index c0db722e17b..8c710adc800 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
@@ -1615,17 +1615,19 @@ public class InternalCatalog implements
CatalogIf<Database> {
List<Column> oldSchema =
indexIdToMeta.get(indexId).getSchema();
List<Column> newSchema = entry.getValue().getSchema();
- oldSchema.sort((Column a, Column b) -> a.getUniqueId()
- b.getUniqueId());
- newSchema.sort((Column a, Column b) -> a.getUniqueId()
- b.getUniqueId());
if (oldSchema.size() != newSchema.size()) {
LOG.warn("schema column size diff, old schema {},
new schema {}", oldSchema, newSchema);
metaChanged = true;
break;
} else {
- for (int i = 0; i < oldSchema.size(); ++i) {
- if
(!oldSchema.get(i).equals(newSchema.get(i))) {
- LOG.warn("schema diff, old schema {}, new
schema {}",
- oldSchema.get(i),
newSchema.get(i));
+ List<Column> oldSchemaCopy =
Lists.newArrayList(oldSchema);
+ List<Column> newSchemaCopy =
Lists.newArrayList(newSchema);
+ oldSchemaCopy.sort((Column a, Column b) ->
a.getUniqueId() - b.getUniqueId());
+ newSchemaCopy.sort((Column a, Column b) ->
a.getUniqueId() - b.getUniqueId());
+ for (int i = 0; i < oldSchemaCopy.size(); ++i) {
+ if
(!oldSchemaCopy.get(i).equals(newSchemaCopy.get(i))) {
+ LOG.warn("schema diff, old schema {}, new
schema {}", oldSchemaCopy.get(i),
+ newSchemaCopy.get(i));
metaChanged = true;
break;
}
@@ -3014,15 +3016,18 @@ public class InternalCatalog implements
CatalogIf<Database> {
List<Column> oldSchema = copiedTbl.getFullSchema();
List<Column> newSchema = olapTable.getFullSchema();
- oldSchema.sort((Column a, Column b) -> a.getUniqueId() -
b.getUniqueId());
- newSchema.sort((Column a, Column b) -> a.getUniqueId() -
b.getUniqueId());
if (oldSchema.size() != newSchema.size()) {
LOG.warn("schema column size diff, old schema {}, new
schema {}", oldSchema, newSchema);
metaChanged = true;
} else {
- for (int i = 0; i < oldSchema.size(); ++i) {
- if (!oldSchema.get(i).equals(newSchema.get(i))) {
- LOG.warn("schema diff, old schema {}, new schema
{}", oldSchema.get(i), newSchema.get(i));
+ List<Column> oldSchemaCopy = Lists.newArrayList(oldSchema);
+ List<Column> newSchemaCopy = Lists.newArrayList(newSchema);
+ oldSchemaCopy.sort((Column a, Column b) -> a.getUniqueId()
- b.getUniqueId());
+ newSchemaCopy.sort((Column a, Column b) -> a.getUniqueId()
- b.getUniqueId());
+ for (int i = 0; i < oldSchemaCopy.size(); ++i) {
+ if
(!oldSchemaCopy.get(i).equals(newSchemaCopy.get(i))) {
+ LOG.warn("schema diff, old schema {}, new schema
{}", oldSchemaCopy.get(i),
+ newSchemaCopy.get(i));
metaChanged = true;
break;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]