[ 
https://issues.apache.org/jira/browse/KYLIN-4315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17135098#comment-17135098
 ] 

ASF GitHub Bot commented on KYLIN-4315:
---------------------------------------

RupengWang commented on pull request #1024:
URL: https://github.com/apache/kylin/pull/1024#issuecomment-643742229


   ## Design test cases
   
   ### Prepare test env
   - create cube and build segment (2012-01-01 ~ 2013-01-01)
     - dimension : LSTG_FORMAT_NAME, ops_region, part_dt
     - measure : sum(price)
   
   ### Case-1
   
   Make sure query-1 and query-2 has the same result.
   
   - query-1 (Hive)
   ```sql
   select LSTG_FORMAT_NAME, stddev_pop(SUM_M)
   from (
         select LSTG_FORMAT_NAME, ops_region, sum(price) as SUM_M
         from KYLIN_SALES
         where part_dt >= '2012-01-01' and part_dt < '2012-06-01'
         group by LSTG_FORMAT_NAME, ops_region
   ) a
   group by LSTG_FORMAT_NAME
   order by LSTG_FORMAT_NAME
   ```
   
   - query-2 (Kylin)
   ```sql
   select LSTG_FORMAT_NAME, stddev_sum(ops_region, price)
   from KYLIN_SALES
   where part_dt >= '2012-01-01' and part_dt < '2012-06-01'
   group by LSTG_FORMAT_NAME
   order by LSTG_FORMAT_NAME
   ```
   
   ### Case-2
   
   Make sure query-1 and query-2 has the same result.
   
   - query-1 (Hive)
   ```sql
   select stddev_pop(SUM_M)
   from (
         select LSTG_FORMAT_NAME, ops_region, sum(price) as SUM_M
         from KYLIN_SALES
         where part_dt >= '2012-01-01' and part_dt < '2012-06-01'
         group by LSTG_FORMAT_NAME, ops_region
   ) a
   ```
   
   - query-2(Kylin)
   ```sql
   select stddev_sum(ops_region, price)
   from KYLIN_SALES
   where part_dt >= '2012-01-01' and part_dt < '2012-06-01'
   ```
   


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


> Use metadata numRows in beeline client for quick row counting
> -------------------------------------------------------------
>
>                 Key: KYLIN-4315
>                 URL: https://issues.apache.org/jira/browse/KYLIN-4315
>             Project: Kylin
>          Issue Type: Improvement
>          Components: Job Engine
>            Reporter: Congling Xia
>            Assignee: Congling Xia
>            Priority: Major
>             Fix For: v3.1.0
>
>
> Hi, I find that in `BeelineHiveClient`, method `getHiveTableRows` uses 
> "select count(*) from <tb_name>" for table row counting. The method is 
> invoked in flat intermediate table redistribution step in cube building.
> This stats can be loaded in metastore. It costs much less time than scanning 
> all rows in Hive table. Since intermediate tables are created and inserted by 
> Kylin, statistics will be automatically calculated and stored in metastore 
> when 
> `[hive.stats.autogather|https://cwiki.apache.org/confluence/display/Hive/Configuration+Properties#ConfigurationProperties-hive.stats.autogather]`
>  is enabled (which is the default setting for Hive). 
> ref Hive wiki for more detail about `numRows` stats: 
> [https://cwiki.apache.org/confluence/display/Hive/StatsDev#StatsDev-ExistingTables%E2%80%93ANALYZE]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to