From 0ee504eb8c2e743460508c0f3801f4d02abd92a4 Mon Sep 17 00:00:00 2001 From: 924060929 <924060929@qq.com> Date: Wed, 25 Sep 2024 17:10:31 +0800 Subject: [PATCH] fix --- .../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 b9d4de727cd564..d2faee13788fa4 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; @@ -195,6 +196,24 @@ private void setColumnsDefineExpr(Map columnNameToDefineExpr) thro } } + 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