This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new e6ce4a2c264 [fix](meta) fix Unknown column 'mva_SUM__CAST` (#41285)
e6ce4a2c264 is described below
commit e6ce4a2c2645a7990233a16633da5282165ec312
Author: 924060929 <[email protected]>
AuthorDate: Thu Sep 26 22:52:51 2024 +0800
[fix](meta) fix Unknown column 'mva_SUM__CAST` (#41285)
## Proposed changes
cherry pick from #41283
---
.../apache/doris/catalog/MaterializedIndexMeta.java | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
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 68077c87afd..ca52afd3b6d 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
@@ -18,6 +18,7 @@
package org.apache.doris.catalog;
import org.apache.doris.analysis.Analyzer;
+import org.apache.doris.analysis.CastExpr;
import org.apache.doris.analysis.CreateMaterializedViewStmt;
import org.apache.doris.analysis.Expr;
import org.apache.doris.analysis.SlotRef;
@@ -214,6 +215,24 @@ public class MaterializedIndexMeta implements Writable,
GsonPostProcessable {
}
}
+ boolean isCastSlot =
+ entry.getValue() instanceof CastExpr &&
entry.getValue().getChild(0) instanceof SlotRef;
+
+ // Compatibility code for older versions of mv
+ // old version:
+ // goods_number -> mva_SUM__CAST(`goods_number` AS BIGINT)
+ // new version:
+ // goods_number -> mva_SUM__CAST(`goods_number` AS bigint)
+ if (isCastSlot && !match) {
+ for (Column column : schema) {
+ if (column.getName().equalsIgnoreCase(entry.getKey())) {
+ column.setDefineExpr(entry.getValue());
+ match = true;
+ break;
+ }
+ }
+ }
+
if (!match) {
// Compatibility code for older versions of mv
// store_id -> mv_store_id
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]