EmmyMiao87 opened a new issue #1892: Enhance the speed of avg function
URL: https://github.com/apache/incubator-doris/issues/1892
 
 
   **Is your feature request related to a problem? Please describe.**
   Now, the avg function in query need to be converted into sum/count. The 
speed of avg function is slower than a single sum function. 
   
   For 70 million lines, 
   
   CREATE TABLE `store_sales_duplicate` (
     `ss_item_sk` int(11) NOT NULL COMMENT "",
     `ss_ticket_number` int(11) NOT NULL COMMENT "",
     `ss_sold_date_sk` int(11) NULL COMMENT "",
     `ss_sold_time_sk` int(11) NULL COMMENT "",
     `ss_customer_sk` int(11) NULL COMMENT "",
     `ss_cdemo_sk` int(11) NULL COMMENT "",
     `ss_hdemo_sk` int(11) NULL COMMENT "",
     `ss_addr_sk` int(11) NULL COMMENT "",
     `ss_store_sk` int(11) NULL COMMENT "",
     `ss_promo_sk` int(11) NULL COMMENT "",
     `ss_quantity` int(11) NULL COMMENT "",
     `ss_wholesale_cost` decimal(7, 2) NULL COMMENT "",
     `ss_list_price` decimal(7, 2) NULL COMMENT "",
     `ss_sales_price` decimal(7, 2) NULL COMMENT "",
     `ss_ext_discount_amt` decimal(7, 2) NULL COMMENT "",
     `ss_ext_sales_price` decimal(7, 2) NULL COMMENT "",
     `ss_ext_wholesale_cost` decimal(7, 2) NULL COMMENT "",
     `ss_ext_list_price` decimal(7, 2) NULL COMMENT "",
     `ss_ext_tax` decimal(7, 2) NULL COMMENT "",
     `ss_coupon_amt` decimal(7, 2) NULL COMMENT "",
     `ss_net_paid` decimal(7, 2) NULL COMMENT "",
     `ss_net_paid_inc_tax` decimal(7, 2) NULL COMMENT "",
     `ss_net_profit` decimal(7, 2) NULL COMMENT ""
   ) ENGINE=OLAP
   DUPLICATE KEY(`ss_item_sk`, `ss_ticket_number`)
   DISTRIBUTED BY HASH(`ss_item_sk`, `ss_ticket_number`) BUCKETS 100
   PROPERTIES (
   "storage_type" = "COLUMN"
   );
   
   mysql> select avg(ss_sales_price) from store_sales;
   +-----------------------+
   | avg(`ss_sales_price`) |
   +-----------------------+
   |          37.873307747 |
   +-----------------------+
   1 row in set (5.73 sec)
   
   mysql> select sum(ss_sales_price) from store_sales_duplicate;
   +-----------------------+
   | sum(`ss_sales_price`) |
   +-----------------------+
   |          2761762504.1 |
   +-----------------------+
   1 row in set (3.44 sec)
   
   **Describe the solution you'd like**
   The avg operator has been implemented in be while fe does not support this 
operator.
   Avg operator should be supported in fe and it will improve the speed of avg 
function.
   

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