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 2022/05/06 14:22:08 UTC

[GitHub] [incubator-doris] morningman opened a new issue, #9419: [Bug] case when expr with abs function return null

morningman opened a new issue, #9419:
URL: https://github.com/apache/incubator-doris/issues/9419

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/incubator-doris/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Version
   
   master
   
   
   ### What's Wrong?
   
   
   ```
   CREATE TABLE IF NOT EXISTS test.dws_scan_qrcode_user_ts
   (
       dt DATE NOT NULL COMMENT "消费日期",
       hour_time INT NOT NULL COMMENT "小时",
       merchant_id INT NOT NULL COMMENT "商户id",
       channel_id char(5) NOT NULL COMMENT "渠道编码",
       station_type char(5) NULL COMMENT "站点类型",
       station_name varchar(55) NULL COMMENT "站点名",
      `source` char(5) NULL COMMENT "来源",
       passenger_flow BIGINT SUM DEFAULT '1' COMMENT "客流量",
       user_id bitmap BITMAP_UNION COMMENT "用户id集合",
       price BIGINT SUM COMMENT "金额",
       discount BIGINT SUM COMMENT "折扣后金额"
   )
   AGGREGATE KEY(dt,hour_time, merchant_id,channel_id,station_type,station_name,`source`)
   DISTRIBUTED BY HASH(dt,hour_time,merchant_id,channel_id) BUCKETS 1
   PROPERTIES("replication_num" = "1");
   
   
   INSERT INTO `dws_scan_qrcode_user_ts` (`dt`, `hour_time`, `merchant_id`, `channel_id`, `station_type`, `station_name`, `source`, `passenger_flow`, `user_id`, `price`, `discount`) VALUES ('2019-01-01', 1, 45010002, '01', '00', 'xx站', '', 1, to_bitmap(0), 300, 300);
   INSERT INTO `dws_scan_qrcode_user_ts` (`dt`, `hour_time`, `merchant_id`, `channel_id`, `station_type`, `station_name`, `source`, `passenger_flow`, `user_id`, `price`, `discount`) VALUES ('2019-01-01', 1, 45010002, '01', '00', 'xxx站', '', 3, to_bitmap(0), 400, 400);
   INSERT INTO `dws_scan_qrcode_user_ts` (`dt`, `hour_time`, `merchant_id`, `channel_id`, `station_type`, `station_name`, `source`, `passenger_flow`, `user_id`, `price`, `discount`) VALUES ('2019-01-01', 2, 45010002, '00', '01', 'xx站', 'CHL', 1, to_bitmap(0), NULL, 23);
   INSERT INTO `dws_scan_qrcode_user_ts` (`dt`, `hour_time`, `merchant_id`, `channel_id`, `station_type`, `station_name`, `source`, `passenger_flow`, `user_id`, `price`, `discount`) VALUES ('2019-01-01', 3, 45010002, '00', '00', 'xx站', 'CHL', 1, to_bitmap(0), NULL, NULL);
   INSERT INTO `dws_scan_qrcode_user_ts` (`dt`, `hour_time`, `merchant_id`, `channel_id`, `station_type`, `station_name`, `source`, `passenger_flow`, `user_id`, `price`, `discount`) VALUES ('2019-01-01', 3, 45010002, '01', '00', 'xxxx站', '', 4, to_bitmap(0), 60, 60);
   INSERT INTO `dws_scan_qrcode_user_ts` (`dt`, `hour_time`, `merchant_id`, `channel_id`, `station_type`, `station_name`, `source`, `passenger_flow`, `user_id`, `price`, `discount`) VALUES ('2019-01-01', 3, 45010002, '01', '00', 'xxxx站', '', 2, to_bitmap(0), 200, 200);
   INSERT INTO `dws_scan_qrcode_user_ts` (`dt`, `hour_time`, `merchant_id`, `channel_id`, `station_type`, `station_name`, `source`, `passenger_flow`, `user_id`, `price`, `discount`) VALUES ('2019-01-01', 4, 45010002, '01', '00', 'xxxx站', '', 5, to_bitmap(0), 1000, 1000);
   INSERT INTO `dws_scan_qrcode_user_ts` (`dt`, `hour_time`, `merchant_id`, `channel_id`, `station_type`, `station_name`, `source`, `passenger_flow`, `user_id`, `price`, `discount`) VALUES ('2019-01-01', 4, 45010002, '01', '00', 'xxx站', '', 1, to_bitmap(0), 20, 20);
   
   
   select
     hour_time as date_hour,
     station_type,
     CASE WHEN station_type = '00' THEN sum(passenger_flow)
     ELSE -ABS(sum(passenger_flow))
     end passenger_flow
   from
     test.dws_scan_qrcode_user_ts
   where
     dt = '2019-01-01'
     and merchant_id in (45010002, 45010003)
     and channel_id = '00'
   group by 
     hour_time,
       station_type;
   ```
   passenger_flow should not be null.
   Turn on vec, the result is right.
   
   
   ### What You Expected?
   
   return right result
   
   ### How to Reproduce?
   
   _No response_
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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.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] morningman closed issue #9419: [Bug] case when expr with abs function return null

Posted by GitBox <gi...@apache.org>.
morningman closed issue #9419: [Bug] case when expr with abs function return null
URL: https://github.com/apache/incubator-doris/issues/9419


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