From dev-return-51820-archive-asf-public=cust-asf.ponee.io@phoenix.apache.org Thu May 17 11:39:07 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 703EE180634 for ; Thu, 17 May 2018 11:39:06 +0200 (CEST) Received: (qmail 41100 invoked by uid 500); 17 May 2018 09:39:05 -0000 Mailing-List: contact dev-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list dev@phoenix.apache.org Received: (qmail 41088 invoked by uid 99); 17 May 2018 09:39:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 May 2018 09:39:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id EE64DCC23A for ; Thu, 17 May 2018 09:39:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id oW9BU5Qbyc9K for ; Thu, 17 May 2018 09:39:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id C24115FBC5 for ; Thu, 17 May 2018 09:39:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id C7FA3E0AC1 for ; Thu, 17 May 2018 09:39:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 32101217A6 for ; Thu, 17 May 2018 09:39:00 +0000 (UTC) Date: Thu, 17 May 2018 09:39:00 +0000 (UTC) From: "Valliet (JIRA)" To: dev@phoenix.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (PHOENIX-4740) FIRST_VALUES fails when using salt_buckets and order by MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/PHOENIX-4740?page=3Dcom.atlass= ian.jira.plugin.system.issuetabpanels:all-tabpanel ] Valliet updated PHOENIX-4740: ----------------------------- Description:=20 Hi, so I'm running phoenix over a 1.2 Hbase, and found this gem: First, without salt_buckets, everything works fine: =C2=A0 {code:java} create table emp ( emp_code VARCHAR not null, bu_code VARCHAR not null, territory_codes VARCHAR, salary DOUBLE, CONSTRAINT pk PRIMARY KEY (emp_code, bu_code)); upsert into emp values('emp1', 'bu1', 'FR', 1000); upsert into emp values('emp1', 'bu2', 'EN', 1000); upsert into emp values('emp2', 'bu1', 'US', 1000); upsert into emp values('emp2', 'bu2', 'DE', 1000); upsert into emp values('emp2', 'bu3', 'AF', 1000); SELECT emp_code, first_values(territory_codes, 10) within group (order by t= erritory_codes asc), sum(salary) as total from emp group by emp_code order = by total desc limit 100; =C2=A0 +-----------+-----------------------------------------------------------+--= -------+ | EMP_CODE | FIRST_VALUES(TERRITORY_CODES, true, TERRITORY_CODES, 10) | TOT= AL | +-----------+-----------------------------------------------------------+--= -------+ | emp2 | [AF, DE, US] | 3000.0 | | emp1 | [EN, FR] | 2000.0 | +-----------+-----------------------------------------------------------+--= -------+ {code} Then I add SALT_BUCKETS on the table, and if I use the 'order by total', FI= RST_VALUES results are empty: =C2=A0 {code:java} =C2=A0 drop table emp; create table emp ( emp_code VARCHAR not null, bu_code VARCHAR not null,=20 territory_codes VARCHAR,=20 salary DOUBLE,=20 CONSTRAINT pk PRIMARY KEY (emp_code, bu_code)) SALT_BUCKETS=3D10; upsert into emp values('emp1', 'bu1', 'FR', 1000); upsert into emp values('emp1', 'bu2', 'EN', 1000); upsert into emp values('emp2', 'bu1', 'US', 1000); upsert into emp values('emp2', 'bu2', 'DE', 1000); upsert into emp values('emp2', 'bu3', 'AF', 1000); SELECT emp_code, first_values(territory_codes, 10) within group (order by t= erritory_codes asc), sum(salary) as total from emp group by emp_code order = by total desc limit 100; +-----------+-----------------------------------------------------------+--= -------+ | EMP_CODE | FIRST_VALUES(TERRITORY_CODES, true, TERRITORY_CODES, 10) | TOT= AL | +-----------+-----------------------------------------------------------+--= -------+ | emp2 | | 3000.0 | | emp1 | | 2000.0 | +-----------+-----------------------------------------------------------+--= -------+ 2 SELECT emp_code, first_values(territory_codes, 10) within group (order by t= erritory_codes asc), sum(salary) as total from emp group by emp_code limit = 100; +-----------+-----------------------------------------------------------+--= -------+ | EMP_CODE | FIRST_VALUES(TERRITORY_CODES, true, TERRITORY_CODES, 10) | TOT= AL | +-----------+-----------------------------------------------------------+--= -------+ | emp1 | [EN, FR] | 2000.0 | | emp2 | [AF, DE, US] | 3000.0 | +-----------+-----------------------------------------------------------+--= -------+ {code} =C2=A0 =C2=A0Cheers, =C2=A0 -manu =C2=A0 =C2=A0 was: Hi, so I'm running phoenix over a 1.2 Hbase, and found this gem: First, without salt_buckets, everything works fine: =C2=A0 {code:java} create table emp ( emp_code VARCHAR not null, bu_code VARCHAR not null, territory_codes VARCHAR, salary DOUBLE, CONSTRAINT pk PRIMARY KEY (emp_code, bu_code)); upsert into emp values('emp1', 'bu1', 'FR', 1000); upsert into emp values('emp1', 'bu2', 'EN', 1000); upsert into emp values('emp2', 'bu1', 'US', 1000); upsert into emp values('emp2', 'bu2', 'DE', 1000); upsert into emp values('emp2', 'bu3', 'AF', 1000); SELECT emp_code, first_values(territory_codes, 10) within group (order by t= erritory_codes asc), sum(salary) as total from emp group by emp_code order = by total desc limit 100; =C2=A0 +-----------+-----------------------------------------------------------+--= -------+ | EMP_CODE | FIRST_VALUES(TERRITORY_CODES, true, TERRITORY_CODES, 10) | TOT= AL | +-----------+-----------------------------------------------------------+--= -------+ | emp2 | [AF, DE, US] | 3000.0 | | emp1 | [EN, FR] | 2000.0 | +-----------+-----------------------------------------------------------+--= -------+ {code} Then I add SALT_BUCKETS on the table, and if I use the 'order by total', FI= RST_VALUES results are empty: =C2=A0 {code:java} =C2=A0 drop table emp; create table emp ( emp_code VARCHAR not null, bu_code VARCHAR not null,=20 territory_codes VARCHAR,=20 salary DOUBLE,=20 CONSTRAINT pk PRIMARY KEY (emp_code, bu_code)) SALT_BUCKETS=3D10; upsert into emp values('emp1', 'bu1', 'FR', 1000); upsert into emp values('emp1', 'bu2', 'EN', 1000); upsert into emp values('emp2', 'bu1', 'US', 1000); upsert into emp values('emp2', 'bu2', 'DE', 1000); upsert into emp values('emp2', 'bu3', 'AF', 1000); SELECT emp_code, first_values(territory_codes, 10) within group (order by t= erritory_codes asc), sum(salary) as total from emp group by emp_code order = by total desc limit 100; +-----------+-----------------------------------------------------------+--= -------+ | EMP_CODE | FIRST_VALUES(TERRITORY_CODES, true, TERRITORY_CODES, 10) | TOT= AL | +-----------+-----------------------------------------------------------+--= -------+ | emp2 | | 3000.0 | | emp1 | | 2000.0 | +-----------+-----------------------------------------------------------+--= -------+ 2 SELECT emp_code, first_values(territory_codes, 10) within group (order by t= erritory_codes asc), sum(salary) as total from emp group by emp_code limit = 100; +-----------+-----------------------------------------------------------+--= -------+ | EMP_CODE | FIRST_VALUES(TERRITORY_CODES, true, TERRITORY_CODES, 10) | TOT= AL | +-----------+-----------------------------------------------------------+--= -------+ | emp1 | [EN, FR] | 2000.0 | | emp2 | [AF, DE, US] | 3000.0 | +-----------+-----------------------------------------------------------+--= -------+ {code} =C2=A0 =C2=A0 =C2=A0 =C2=A0 > FIRST_VALUES fails when using salt_buckets and order by > ------------------------------------------------------- > > Key: PHOENIX-4740 > URL: https://issues.apache.org/jira/browse/PHOENIX-4740 > Project: Phoenix > Issue Type: Bug > Affects Versions: 4.13.1 > Environment: BigInsight 4.2.0.0 > HBase 1.2 > phoenix-4.13.1-HBase-1.2 > Reporter: Valliet > Priority: Major > Attachments: emp.sql > > > Hi, > so I'm running phoenix over a 1.2 Hbase, and found this gem: > First, without salt_buckets, everything works fine: > =C2=A0 > {code:java} > create table emp ( > emp_code VARCHAR not null, > bu_code VARCHAR not null, > territory_codes VARCHAR, > salary DOUBLE, > CONSTRAINT pk PRIMARY KEY (emp_code, bu_code)); > upsert into emp values('emp1', 'bu1', 'FR', 1000); > upsert into emp values('emp1', 'bu2', 'EN', 1000); > upsert into emp values('emp2', 'bu1', 'US', 1000); > upsert into emp values('emp2', 'bu2', 'DE', 1000); > upsert into emp values('emp2', 'bu3', 'AF', 1000); > SELECT emp_code, first_values(territory_codes, 10) within group (order by= territory_codes asc), sum(salary) as total from emp group by emp_code orde= r by total desc limit 100; > =C2=A0 > +-----------+-----------------------------------------------------------+= ---------+ > | EMP_CODE | FIRST_VALUES(TERRITORY_CODES, true, TERRITORY_CODES, 10) | T= OTAL | > +-----------+-----------------------------------------------------------+= ---------+ > | emp2 | [AF, DE, US] | 3000.0 | > | emp1 | [EN, FR] | 2000.0 | > +-----------+-----------------------------------------------------------+= ---------+ > {code} > Then I add SALT_BUCKETS on the table, and if I use the 'order by total', = FIRST_VALUES results are empty: > =C2=A0 > {code:java} > =C2=A0 > drop table emp; > create table emp ( > emp_code VARCHAR not null, > bu_code VARCHAR not null,=20 > territory_codes VARCHAR,=20 > salary DOUBLE,=20 > CONSTRAINT pk PRIMARY KEY (emp_code, bu_code)) SALT_BUCKETS=3D10; > upsert into emp values('emp1', 'bu1', 'FR', 1000); > upsert into emp values('emp1', 'bu2', 'EN', 1000); > upsert into emp values('emp2', 'bu1', 'US', 1000); > upsert into emp values('emp2', 'bu2', 'DE', 1000); > upsert into emp values('emp2', 'bu3', 'AF', 1000); > SELECT emp_code, first_values(territory_codes, 10) within group (order by= territory_codes asc), sum(salary) as total from emp group by emp_code orde= r by total desc limit 100; > +-----------+-----------------------------------------------------------+= ---------+ > | EMP_CODE | FIRST_VALUES(TERRITORY_CODES, true, TERRITORY_CODES, 10) | T= OTAL | > +-----------+-----------------------------------------------------------+= ---------+ > | emp2 | | 3000.0 | > | emp1 | | 2000.0 | > +-----------+-----------------------------------------------------------+= ---------+ > 2 > SELECT emp_code, first_values(territory_codes, 10) within group (order by= territory_codes asc), sum(salary) as total from emp group by emp_code limi= t 100; > +-----------+-----------------------------------------------------------+= ---------+ > | EMP_CODE | FIRST_VALUES(TERRITORY_CODES, true, TERRITORY_CODES, 10) | T= OTAL | > +-----------+-----------------------------------------------------------+= ---------+ > | emp1 | [EN, FR] | 2000.0 | > | emp2 | [AF, DE, US] | 3000.0 | > +-----------+-----------------------------------------------------------+= ---------+ > {code} > =C2=A0 > =C2=A0Cheers, > =C2=A0 > -manu > =C2=A0 > =C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005)