kangkaisen opened a new issue #955: Constant predicate related bug
URL: https://github.com/apache/incubator-doris/issues/955
 
 
   ## bug 1 
   ```
   select * from t1 join t2 on 1 = 2;
   ```
   
   The result is 
   ```
   mysql> select * from t1 join t2 on 1 = 2;
   +------+------+-------+------+------+-------+
   | dt   | id   | value | dt   | id   | value |
   +------+------+-------+------+------+-------+
   |    8 |    1 | one   |    9 |   11 | one   |
   |    8 |    1 | one   |    9 |   12 | NULL  |
   |    8 |    1 | one   |    8 |    1 | one   |
   |    8 |    1 | one   |    8 | NULL | two   |
   |    9 |   11 | one   |    9 |   11 | one   |
   |    9 |   11 | one   |    9 |   12 | NULL  |
   |    9 |   11 | one   |    8 |    1 | one   |
   |    9 |   11 | one   |    8 | NULL | two   |
   |    8 | NULL | two   |    9 |   12 | NULL  |
   |    8 | NULL | two   |    9 |   11 | one   |
   |    8 | NULL | two   |    8 | NULL | two   |
   |    8 | NULL | two   |    8 |    1 | one   |
   |    9 |   12 | NULL  |    9 |   12 | NULL  |
   |    9 |   12 | NULL  |    9 |   11 | one   |
   |    9 |   12 | NULL  |    8 | NULL | two   |
   |    9 |   12 | NULL  |    8 |    1 | one   |
   +------+------+-------+------+------+-------+
   16 rows in set (0.08 sec)
   ```
   **The result is wrong, the right result should be 0 row.**
   
   ## bug 2
   
   **step 1**: create the view with union:
   ```
    CREATE VIEW `union_all_view` AS SELECT `t1`.`id` AS `id`, `t1`.`value` AS 
`value` FROM `default_cluster:test`.`t1` UNION ALL SELECT `t2`.`id` AS `id`, 
`t2`.`value` AS `value` FROM `default_cluster:test`.`t2`;
   ```
   **step 2**: query the view with constant predicate and group by and order by
   
   ```
   select count(*) from union_all_view where id = 1 and 1 = 2 group by id order 
by id;
   
   ```
   there will be a exception:
   
   ```
   2019-04-18 13:50:28,781 WARN 114 [StmtExecutor.analyze():452] Analyze failed 
because
   java.lang.IllegalStateException
           at 
com.google.common.base.Preconditions.checkState(Preconditions.java:134) 
~[guava-15.0.jar:?]
           at org.apache.doris.planner.UnionNode.init(UnionNode.java:239) 
~[palo-fe.jar:?]
           at 
org.apache.doris.planner.DistributedPlanner.createUnionNodeFragment(DistributedPlanner.java:650)
 ~[palo-fe.jar:?]
           at 
org.apache.doris.planner.DistributedPlanner.createPlanFragments(DistributedPlanner.java:208)
 ~[palo-fe.jar:?]
           at 
org.apache.doris.planner.DistributedPlanner.createPlanFragments(DistributedPlanner.java:189)
 ~[palo-fe.jar:?]
           at 
org.apache.doris.planner.DistributedPlanner.createPlanFragments(DistributedPlanner.java:189)
 ~[palo-fe.jar:?]
           at 
org.apache.doris.planner.DistributedPlanner.createPlanFragments(DistributedPlanner.java:97)
 ~[palo-fe.jar:?]
           at 
org.apache.doris.planner.Planner.createPlanFragments(Planner.java:171) 
~[palo-fe.jar:?]
           at org.apache.doris.planner.Planner.plan(Planner.java:78) 
~[palo-fe.jar:?]
           at org.apache.doris.qe.StmtExecutor.analyze(StmtExecutor.java:440) 
[palo-fe.jar:?]
           at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:201) 
[palo-fe.jar:?]
           at 
org.apache.doris.qe.ConnectProcessor.handleQuery(ConnectProcessor.java:168) 
[palo-fe.jar:?]
           at 
org.apache.doris.qe.ConnectProcessor.dispatch(ConnectProcessor.java:258) 
[palo-fe.jar:?]
           at 
org.apache.doris.qe.ConnectProcessor.processOnce(ConnectProcessor.java:389) 
[palo-fe.jar:?]
           at 
org.apache.doris.qe.ConnectProcessor.loop(ConnectProcessor.java:399) 
[palo-fe.jar:?]
           at 
org.apache.doris.qe.ConnectScheduler$LoopHandler.run(ConnectScheduler.java:175) 
[palo-fe.jar:?]
           at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
[?:1.8.0_112]
           at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
[?:1.8.0_112]
           at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
[?:1.8.0_112]
           at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
[?:1.8.0_112]
           at java.lang.Thread.run(Thread.java:745) [?:1.8.0_112]
   2019-04-18 13:50:28,782 INFO 114 [StmtExecutor.execute():278] execute 
Exception.
   org.apache.doris.common.AnalysisException: Unexpected exception: null
   
   ```
   I think the root cause is we currently handle constant predicate is not very 
well.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to