phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jifei_yang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PHOENIX-4077) Why is the order of the grouping fields affecting the results of the query?
Date Thu, 10 Aug 2017 06:22:00 GMT

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

jifei_yang commented on PHOENIX-4077:
-------------------------------------

E.g,the table statement is as follows:
{code:java}
CREATE TABLE IF NOT EXISTS  PH_HOTDOMAIN_APP 
(
CREATETIME VARCHAR(23),
DOMAINID  BIGINT NOT NULL,
DOMAIN VARCHAR(128) NOT NULL,
CDNNETID VARCHAR NOT NULL,
SRCIP BIGINT NOT NULL,
DOMAINFIRSTTIME VARCHAR(23) NOT NULL,
DOMAINACTIVENESS BIGINT NOT NULL
CONSTRAINT PH_HOTIP_APP_PK PRIMARY KEY(
DOMAINID,
DOMAIN,
CDNNETID,
SRCIP,
DOMAINFIRSTTIME,
DOMAINACTIVENESS
)
)
SALT_BUCKETS = 30, 
COMPRESSION='snappy',
MAXVERSIONS=1,
BLOCKCACHE=false,
BLOOMFILTERTYPE='ROW'
;
{code}

Check for phrases:
(1)use DOMAIN and DOMAINID
{code:java}
select DOMAIN,DOMAINID,MIN(DOMAINFIRSTTIME) as DOMAINFIRSTTIME,SUM(DOMAINACTIVENESS) as DOMAINACTIVENESS
 from PH_HOTDOMAIN_APP  where   CREATETIME='2017-08-09'  and instr(CDNNETID,'a1a') >0 
group by DOMAIN,DOMAINID ;
{code}

(2)use  DOMAINID and DOMAIN
{code:java}
select DOMAIN,DOMAINID,MIN(DOMAINFIRSTTIME) as DOMAINFIRSTTIME,SUM(DOMAINACTIVENESS) as DOMAINACTIVENESS
 from PH_HOTDOMAIN_APP  where   CREATETIME='2017-08-09'  and instr(CDNNETID,'a1a') >0 
group by DOMAINID,DOMAIN ;
{code}

The result of the output is not the same!

{noformat}
0: jdbc:phoenix:localhost:2181:/hbase03> select DOMAIN,DOMAINID,MIN(DOMAINFIRSTTIME) as
DOMAINFIRSTTIME,SUM(DOMAINACTIVENESS) as DOMAINACTIVENESS  from PH_HOTDOMAIN_APP  where  
CREATETIME='2017-08-09'  and instr(CDNNETID,'a1a') >0  group by DOMAIN,DOMAINID ;
+--------------------------+-----------+--------------------------+-------------------+
|          DOMAIN          | DOMAINID  |     DOMAINFIRSTTIME      | DOMAINACTIVENESS  |
+--------------------------+-----------+--------------------------+-------------------+
| mvvideo2.meitudata.com   | 1         | 2017-08-09 00:00:00.265  | 148713            |
| mvvideo4.meitudata.com   | 3         | 2017-08-09 00:00:00.406  | 74485             |
| www.test.com             | 2         | 2017-08-09 00:00:00.846  | 74228             |
| mvvideo4.meitudata.com   | 3         | 2017-08-09 00:00:00.979  | 74229             |
| www.test.com             | 2         | 2017-08-09 00:00:00.269  | 74485             |
| mvvideo10.meitudata.com  | 4         | 2017-08-09 00:00:00.412  | 148714            |
+--------------------------+-----------+--------------------------+-------------------+
6 rows selected (0.093 seconds)
0: jdbc:phoenix:localhost:2181:/hbase03> select DOMAIN,DOMAINID,MIN(DOMAINFIRSTTIME) as
DOMAINFIRSTTIME,SUM(DOMAINACTIVENESS) as DOMAINACTIVENESS  from PH_HOTDOMAIN_APP  where  
CREATETIME='2017-08-09'  and instr(CDNNETID,'a1a') >0  group by DOMAINID,DOMAIN ;
+--------------------------+-----------+--------------------------+-------------------+
|          DOMAIN          | DOMAINID  |     DOMAINFIRSTTIME      | DOMAINACTIVENESS  |
+--------------------------+-----------+--------------------------+-------------------+
| mvvideo2.meitudata.com   | 1         | 2017-08-09 00:00:00.265  | 148713            |
| www.test.com             | 2         | 2017-08-09 00:00:00.269  | 148713            |
| mvvideo4.meitudata.com   | 3         | 2017-08-09 00:00:00.406  | 148714            |
| mvvideo10.meitudata.com  | 4         | 2017-08-09 00:00:00.412  | 148714            |
+--------------------------+-----------+--------------------------+-------------------+

{noformat}



> Why is the order of the grouping fields affecting the results of the query?
> ---------------------------------------------------------------------------
>
>                 Key: PHOENIX-4077
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4077
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.11.0
>            Reporter: jifei_yang
>             Fix For: 4.8.0, 4.11.0
>
>
> When I use the 'group by ' group query, the order of the grouping fields affects the
output. Why is this?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message