This is an automated email from the ASF dual-hosted git repository.
zhangstar333 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 384fddb2ffa [test](case)add some debug log in mv case (#25458)
384fddb2ffa is described below
commit 384fddb2ffacfbbac10a45030a5d35ffc34d39b9
Author: zhangstar333 <[email protected]>
AuthorDate: Tue Oct 17 11:04:45 2023 +0800
[test](case)add some debug log in mv case (#25458)
* [test](case)change the insert stmt in mv case
---
.../java/org/apache/doris/alter/RollupJobV2.java | 21 +++++++++++
.../java/org/apache/doris/catalog/OlapTable.java | 2 +-
.../data/correctness_p0/test_mv_case.out | 7 ++++
.../suites/correctness_p0/test_mv_case.groovy | 41 ++++++++++++++++++++++
4 files changed, 70 insertions(+), 1 deletion(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/RollupJobV2.java
b/fe/fe-core/src/main/java/org/apache/doris/alter/RollupJobV2.java
index 7c506d7371a..3ae00e7a2ba 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/alter/RollupJobV2.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/alter/RollupJobV2.java
@@ -34,6 +34,7 @@ import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.KeysType;
import org.apache.doris.catalog.MaterializedIndex;
import org.apache.doris.catalog.MaterializedIndex.IndexState;
+import org.apache.doris.catalog.MaterializedIndexMeta;
import org.apache.doris.catalog.OlapTable;
import org.apache.doris.catalog.OlapTable.OlapTableState;
import org.apache.doris.catalog.Partition;
@@ -51,6 +52,7 @@ import org.apache.doris.common.io.Text;
import org.apache.doris.common.util.DbUtil;
import org.apache.doris.common.util.SqlParserUtils;
import org.apache.doris.common.util.TimeUtils;
+import org.apache.doris.common.util.Util;
import org.apache.doris.persist.gson.GsonPostProcessable;
import org.apache.doris.persist.gson.GsonUtils;
import org.apache.doris.qe.ConnectContext;
@@ -73,6 +75,7 @@ import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import com.google.gson.annotations.SerializedName;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -362,6 +365,23 @@ public class RollupJobV2 extends AlterJobV2 implements
GsonPostProcessable {
Preconditions.checkState(rollupIndex.getState() ==
IndexState.SHADOW, rollupIndex.getState());
partition.createRollupIndex(rollupIndex);
}
+ StringBuilder debugString = new StringBuilder();
+ if (this.partitionIdToRollupIndex.isEmpty() == false) {
+ for (MaterializedIndex rollupIdx :
partitionIdToRollupIndex.values()) {
+ debugString.append(rollupIdx.toString() + "\n");
+ }
+ }
+ Set<String> indexNames =
Sets.newTreeSet(tbl.getIndexNameToId().keySet());
+ for (String indexName : indexNames) {
+ long indexId = tbl.getIndexNameToId().get(indexName);
+ MaterializedIndexMeta indexMeta =
tbl.getIndexIdToMeta().get(indexId);
+ debugString.append(indexName);
+
debugString.append(Util.getSchemaSignatureString(indexMeta.getSchema()));
+ debugString.append(indexMeta.getShortKeyColumnCount());
+ debugString.append(indexMeta.getStorageType());
+ }
+ //now add some log for P0 test case, this debugString info could
remove after.
+ LOG.info("addRollupIndexToCatalog partition end: {}, table:{} ",
debugString.toString(), tbl.toString());
tbl.setIndexMeta(rollupIndexId, rollupIndexName, rollupSchema, 0 /*
init schema version */,
rollupSchemaHash, rollupShortKeyColumnCount,
TStorageType.COLUMN,
@@ -473,6 +493,7 @@ public class RollupJobV2 extends AlterJobV2 implements
GsonPostProcessable {
List<Replica> rollupReplicas = rollupTablet.getReplicas();
+
for (Replica rollupReplica : rollupReplicas) {
AlterReplicaTask rollupTask = new
AlterReplicaTask(rollupReplica.getBackendId(), dbId, tableId,
partitionId, rollupIndexId, baseIndexId,
rollupTabletId, baseTabletId,
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
b/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
index 16cec127bff..47557d33873 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
@@ -420,7 +420,7 @@ public class OlapTable extends Table {
// Column maybe renamed, rebuild the column name map
indexMeta.initColumnNameMap();
}
- LOG.debug("after rebuild full schema. table {}, schema size: {}", id,
fullSchema.size());
+ LOG.info("after rebuild full schema. table {}, schema size: {}", id,
fullSchema.size());
}
public boolean deleteIndexInfo(String indexName) {
diff --git a/regression-test/data/correctness_p0/test_mv_case.out
b/regression-test/data/correctness_p0/test_mv_case.out
new file mode 100644
index 00000000000..e87ee694dc1
--- /dev/null
+++ b/regression-test/data/correctness_p0/test_mv_case.out
@@ -0,0 +1,7 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !select_default --
+cib2205045_1_1s 2023-06-10T03:55:33 {"DB1":168939,"DNT":"2023-06-10
03:55:33"}
+cib2205045_1_1s 2023-06-10T03:56:33 {"DB1":168939,"DNT":"2023-06-10
03:56:33"}
+cib2205045_1_1s 2023-06-10T03:57:33 {"DB1":168939,"DNT":"2023-06-10
03:57:33"}
+cib2205045_1_1s 2023-06-10T03:58:33 {"DB1":168939,"DNT":"2023-06-10
03:58:33"}
+
diff --git a/regression-test/suites/correctness_p0/test_mv_case.groovy
b/regression-test/suites/correctness_p0/test_mv_case.groovy
new file mode 100644
index 00000000000..d8ba37208c9
--- /dev/null
+++ b/regression-test/suites/correctness_p0/test_mv_case.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.
+
+suite("test_mv_case") {
+ sql """drop table if exists test_table_aaa2;"""
+ sql """CREATE TABLE `test_table_aaa2` (
+ `ordernum` varchar(65533) NOT NULL ,
+ `dnt` datetime NOT NULL ,
+ `data` json NULL
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`ordernum`, `dnt`)
+ COMMENT 'OLAP'
+ DISTRIBUTED BY HASH(`ordernum`) BUCKETS 3
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+ );"""
+ sql """DROP MATERIALIZED VIEW IF EXISTS ods_zn_dnt_max1 ON
test_table_aaa2;"""
+ sql """create materialized view ods_zn_dnt_max1 as
+ select ordernum,max(dnt) as dnt from test_table_aaa2
+ group by ordernum
+ ORDER BY ordernum;"""
+ sql """insert into test_table_aaa2 select 'cib2205045_1_1s','2023/6/10
3:55:33','{"DB1":168939,"DNT":"2023-06-10 03:55:33"}' ;"""
+ sql """insert into test_table_aaa2 select 'cib2205045_1_1s','2023/6/10
3:56:33','{"DB1":168939,"DNT":"2023-06-10 03:56:33"}' ;"""
+ sql """insert into test_table_aaa2 select 'cib2205045_1_1s','2023/6/10
3:57:33','{"DB1":168939,"DNT":"2023-06-10 03:57:33"}' ;"""
+ sql """insert into test_table_aaa2 select 'cib2205045_1_1s','2023/6/10
3:58:33','{"DB1":168939,"DNT":"2023-06-10 03:58:33"}' ;"""
+ qt_select_default """ select * from test_table_aaa2 order by dnt;"""
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]