This is an automated email from the ASF dual-hosted git repository. panxiaolei 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 7f4f39551a [Bug](materialized-view) fix change base schema when create mv (#23607) 7f4f39551a is described below commit 7f4f39551ab2a203c438d814291515d8c17c951c Author: Pxl <pxl...@qq.com> AuthorDate: Wed Aug 30 21:00:12 2023 +0800 [Bug](materialized-view) fix change base schema when create mv (#23607) * fix change base schema when create mv * fix * fix --- .../org/apache/doris/analysis/MVColumnItem.java | 1 + .../doris/alter/MaterializedViewHandlerTest.java | 2 +- .../data/mv_p0/varchar_length/varchar_length.out | 8 +++++ .../suites/mv_p0/no_await/no_await.groovy | 2 +- .../mv_p0/varchar_length/varchar_length.groovy | 41 ++++++++++++++++++++++ 5 files changed, 52 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/MVColumnItem.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/MVColumnItem.java index 01e0b01b40..d61a3ea862 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/MVColumnItem.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/MVColumnItem.java @@ -92,6 +92,7 @@ public class MVColumnItem { this.type = defineExpr.getType(); if (this.type instanceof ScalarType && this.type.isStringType()) { + this.type = new ScalarType(type.getPrimitiveType()); ((ScalarType) this.type).setMaxLength(); } diff --git a/fe/fe-core/src/test/java/org/apache/doris/alter/MaterializedViewHandlerTest.java b/fe/fe-core/src/test/java/org/apache/doris/alter/MaterializedViewHandlerTest.java index 84bf21e8e5..4c1dd4fd93 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/alter/MaterializedViewHandlerTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/alter/MaterializedViewHandlerTest.java @@ -240,7 +240,7 @@ public class MaterializedViewHandlerTest { Assert.assertTrue(newMVColumn.isKey()); Assert.assertEquals(null, newMVColumn.getAggregationType()); Assert.assertEquals(false, newMVColumn.isAggregationTypeImplicit()); - Assert.assertEquals(Type.VARCHAR, newMVColumn.getType()); + Assert.assertEquals(Type.VARCHAR.getPrimitiveType(), newMVColumn.getType().getPrimitiveType()); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); diff --git a/regression-test/data/mv_p0/varchar_length/varchar_length.out b/regression-test/data/mv_p0/varchar_length/varchar_length.out new file mode 100644 index 0000000000..d944f69b4a --- /dev/null +++ b/regression-test/data/mv_p0/varchar_length/varchar_length.out @@ -0,0 +1,8 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select_exp -- +test1 UNIQUE_KEYS vid VARCHAR(1) VARCHAR(1) No true \N true + report_time INT INT No true \N true + +mv_test UNIQUE_KEYS mv_report_time INT INT No true \N true `report_time` + mv_vid VARCHAR(65533) VARCHAR(65533) No true \N REPLACE true `vid` + diff --git a/regression-test/suites/mv_p0/no_await/no_await.groovy b/regression-test/suites/mv_p0/no_await/no_await.groovy index 82c4d09535..1af5d60fc9 100644 --- a/regression-test/suites/mv_p0/no_await/no_await.groovy +++ b/regression-test/suites/mv_p0/no_await/no_await.groovy @@ -21,7 +21,7 @@ suite ("no_await") { def tblName = "agg_have_dup_base_no_await" def waitDrop = { - def try_times = 100 + def try_times = 1000 def result = "null" sql "sync;" while (!result.contains("FINISHED")) { diff --git a/regression-test/suites/mv_p0/varchar_length/varchar_length.groovy b/regression-test/suites/mv_p0/varchar_length/varchar_length.groovy new file mode 100644 index 0000000000..476758dec8 --- /dev/null +++ b/regression-test/suites/mv_p0/varchar_length/varchar_length.groovy @@ -0,0 +1,41 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import org.codehaus.groovy.runtime.IOGroovyMethods + +suite ("varchar_length") { + + sql """DROP TABLE IF EXISTS test1; """ + + sql """ + CREATE TABLE test1( + vid VARCHAR(1) NOT NULL COMMENT "", + report_time int NOT NULL COMMENT '' + ) + ENGINE=OLAP + UNIQUE KEY(vid, report_time) + DISTRIBUTED BY HASH(vid) BUCKETS AUTO + PROPERTIES + ( + "replication_num" = "1" + ); + """ + + createMV ("CREATE MATERIALIZED VIEW mv_test as SELECT report_time, vid FROM test1 ORDER BY report_time DESC; ") + + qt_select_exp "desc test1 all" +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org