Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
924060929 committed Sep 25, 2024
1 parent c71871d commit 0ee504e
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -195,6 +196,24 @@ private void setColumnsDefineExpr(Map<String, Expr> 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
Expand Down

0 comments on commit 0ee504e

Please sign in to comment.