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

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new b7e07ee  [fix](cache) Throws ClassCastException when there are 
multiple EXCEPT, INTERSECT and UNION in the local view (#8083)
b7e07ee is described below

commit b7e07ee47244654b13bf238260968cbcf7556b14
Author: ZenoYang <[email protected]>
AuthorDate: Fri Feb 18 10:56:37 2022 +0800

    [fix](cache) Throws ClassCastException when there are multiple EXCEPT, 
INTERSECT and UNION in the local view (#8083)
    
    Issue Number: close #8082
    Throws ClassCastException when there are multiple EXCEPT, INTERSECT and 
UNION in the local view.
---
 .../org/apache/doris/qe/cache/CacheAnalyzer.java    |  2 +-
 .../org/apache/doris/qe/PartitionCacheTest.java     | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/qe/cache/CacheAnalyzer.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/cache/CacheAnalyzer.java
index 2417469..480650e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/cache/CacheAnalyzer.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/cache/CacheAnalyzer.java
@@ -469,7 +469,7 @@ public class CacheAnalyzer {
             addAllViewStmt(((SelectStmt) queryStmt).getTableRefs());
         } else if (queryStmt instanceof SetOperationStmt) {
             for (SetOperationStmt.SetOperand operand : ((SetOperationStmt) 
queryStmt).getOperands()) {
-                addAllViewStmt(((SelectStmt) 
operand.getQueryStmt()).getTableRefs());
+                addAllViewStmt(operand.getQueryStmt());
             }
         }
     }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/qe/PartitionCacheTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/qe/PartitionCacheTest.java
index 6329fad..f1a49b6 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/qe/PartitionCacheTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/qe/PartitionCacheTest.java
@@ -1097,5 +1097,26 @@ public class PartitionCacheTest {
                 "eventdate, COUNT(userid) FROM view2 WHERE 
eventdate>=\"2020-01-12\" and " +
                 "eventdate<=\"2020-01-14\" GROUP BY eventdate|select 
eventdate, userid FROM appevent");
     }
+
+    @Test
+    public void testCacheLocalViewMultiOperand() {
+        Catalog.getCurrentSystemInfo();
+        StatementBase parseStmt = parseSql(
+                "SELECT COUNT(userid)\n" +
+                        "FROM (\n" +
+                        "    (SELECT userid FROM userprofile\n" +
+                        "    INTERSECT\n" +
+                        "    SELECT userid FROM userprofile)\n" +
+                        "    UNION\n" +
+                        "    SELECT userid FROM userprofile\n" +
+                        ") as tmp"
+        );
+        ArrayList<Long> selectedPartitionIds
+                = Lists.newArrayList(20200112L, 20200113L, 20200114L, 
20200115L);
+        List<ScanNode> scanNodes = 
Lists.newArrayList(createProfileScanNode(selectedPartitionIds));
+        CacheAnalyzer ca = new CacheAnalyzer(context,parseStmt, scanNodes);
+        ca.checkCacheMode(0);
+        Assert.assertEquals(ca.getCacheMode(), CacheMode.Sql);
+    }
 }
 

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

Reply via email to