This is an automated email from the ASF dual-hosted git repository.

yiguolei 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 adc5522c9b [bug](MTMV) Fix the wrong interpretation for NEVER REFRESH 
(#19800)
adc5522c9b is described below

commit adc5522c9bea46ac4f7a49652ed23dce18f98559
Author: Adonis Ling <[email protected]>
AuthorDate: Thu May 18 23:56:56 2023 +0800

    [bug](MTMV) Fix the wrong interpretation for NEVER REFRESH (#19800)
---
 fe/fe-core/src/main/cup/sql_parser.cup             |  2 +-
 .../catalog/MultiTableMaterializedViewTest.java    | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/fe/fe-core/src/main/cup/sql_parser.cup 
b/fe/fe-core/src/main/cup/sql_parser.cup
index 75f2cedb90..8d7a45c36b 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -1731,7 +1731,7 @@ opt_mv_refersh_info ::=
     :}
     | KW_NEVER KW_REFRESH
     {:
-        RESULT = new MVRefreshInfo(false);
+        RESULT = new MVRefreshInfo(true);
     :}
     ;
 
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/catalog/MultiTableMaterializedViewTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/catalog/MultiTableMaterializedViewTest.java
index 9ba68658fe..89eab32e29 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/catalog/MultiTableMaterializedViewTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/catalog/MultiTableMaterializedViewTest.java
@@ -512,4 +512,26 @@ public class MultiTableMaterializedViewTest extends 
TestWithFeService {
                 + "INNER JOIN part p ON (p.p_partkey = 
l.lo_partkey)").execute();
         Assertions.assertNull(connectContext.getState().getErrorCode(), 
connectContext.getState().getErrorMessage());
     }
+
+    @Test
+    void testCreateNeverRefreshMaterializedView() throws Exception {
+        createTable("create table test.t1 (pk int, v1 int sum) aggregate key 
(pk) "
+                + "distributed by hash (pk) buckets 1 properties 
('replication_num' = '1');");
+        createTable("create table test.t2 (pk int, v2 int sum) aggregate key 
(pk) "
+                + "distributed by hash (pk) buckets 1 properties 
('replication_num' = '1');");
+        new StmtExecutor(connectContext, "create materialized view mv "
+                + "build immediate never refresh key (mpk) distributed by hash 
(mpk) "
+                + "properties ('replication_num' = '1') "
+                + "as select test.t1.pk as mpk from test.t1, test.t2 where 
test.t1.pk = test.t2.pk").execute();
+        Assertions.assertNull(connectContext.getState().getErrorCode(), 
connectContext.getState().getErrorMessage());
+
+        ShowExecutor showExecutor = new ShowExecutor(connectContext,
+                (ShowStmt) parseAndAnalyzeStmt("show create table mv"));
+        ShowResultSet resultSet = showExecutor.execute();
+        String result = resultSet.getResultRows().get(0).get(1);
+        Assertions.assertTrue(result.contains("CREATE MATERIALIZED VIEW `mv`\n"
+                + "BUILD IMMEDIATE NEVER REFRESH \n"
+                + "KEY(`mpk`)\n"
+                + "DISTRIBUTED BY HASH(`mpk`) BUCKETS 10"));
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to