This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new d734207a1f2 [fix](meta) fix Unknown column 'mva_SUM__CAST` (#41283)
d734207a1f2 is described below
commit d734207a1f27ba6208466b39467936f6bb1e2830
Author: 924060929 <[email protected]>
AuthorDate: Wed Sep 25 21:34:13 2024 +0800
[fix](meta) fix Unknown column 'mva_SUM__CAST` (#41283)
fix insert into select statement failed when upgrade doris, introduced
by #38012
```sql
ERROR 1054 (42S22): errCode = 2, detailMessage = Unknown column
'mva_SUM__CAST(`goods_number` AS BIGINT)' in 'dm_sales_settlement_day_goods'
```
---
.../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 2f5ce914a83..6125e033400 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]