You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/08/06 07:30:49 UTC

[GitHub] [incubator-doris] zbtzbtzbt opened a new issue #6390: wrong result in query view with an added null column

zbtzbtzbt opened a new issue #6390:
URL: https://github.com/apache/incubator-doris/issues/6390


   **Describe the bug**
   Create a view, add an extra column and assign it to null. 
   query the view with added column 'is not null' and 'order by'
   if 'is not null' and 'order by'  exist at the same time,
   **'is not null' will be ignore.**
   
   **To Reproduce**
   Steps to reproduce the behavior:
   
   1. CREATE TABLE test
   
   ````` 
   CREATE TABLE test
   (
       k1 varchar(8) NULL,
       k2 int NULL
   )
   AGGREGATE KEY(k1,k2)
   DISTRIBUTED BY HASH(k1) BUCKETS 5
   PROPERTIES("replication_num" = "1");
   ````` 
   
   2.insert data
   ````` 
   insert into test select 'a' as k1,1 as k2;
   insert into test select 'a' as k1,2 as k2;
   insert into test select 'b' as k1,3 as k2;
   insert into test select 'b' as k1,4 as k2;
   `````  
   
   3. create view and and a null column
   `````  
   create view test_view AS SELECT *,null as add_column  FROM tb_students_info;
   
   select * from test_view;
   +------+------+------------+
   | k1   | k2   | add_column |
   +------+------+------------+
   | a    |    1 | NULL       |
   | a    |    2 | NULL       |
   | b    |    3 | NULL       |
   | b    |    4 | NULL       |
   +------+------+------------+
   4 rows in set (0.01 sec)
   `````  
   
   4. reproduce 
   `````  
   --【it is right】
   select * from test_view where add_column is not null;
   Empty set (0.01 sec)
   
   --【after add order by,error!】
   select * from test_view where add_column is not null order by k1;
   +------+------+------------+
   | k1   | k2   | add_column |
   +------+------+------------+
   | a    |    1 | NULL       |
   | a    |    2 | NULL       |
   | b    |    4 | NULL       |
   | b    |    3 | NULL       |
   +------+------+------------+
   4 rows in set (0.01 sec)
   
   --【after add order by,error!】
   select * from test_view where add_column is not null order by k2;
   +------+------+------------+
   | k1   | k2   | add_column |
   +------+------+------------+
   | a    |    1 | NULL       |
   | a    |    2 | NULL       |
   | b    |    3 | NULL       |
   | b    |    4 | NULL       |
   +------+------+------------+
   4 rows in set (0.01 sec)
   --【after add order by,error!】
   select * from test_view where add_column is not null order by add_column;
   +------+------+------------+
   | k1   | k2   | add_column |
   +------+------+------------+
   | b    |    4 | NULL       |
   | a    |    2 | NULL       |
   | b    |    3 | NULL       |
   | a    |    1 | NULL       |
   +------+------+------------+
   4 rows in set (0.02 sec)
   `````


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] yangzhg closed issue #6390: [Bug] wrong result in query view with an added null column

Posted by GitBox <gi...@apache.org>.
yangzhg closed issue #6390:
URL: https://github.com/apache/incubator-doris/issues/6390


   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org