From dev-return-51984-archive-asf-public=cust-asf.ponee.io@phoenix.apache.org Thu May 24 07:42:05 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 94424180636 for ; Thu, 24 May 2018 07:42:04 +0200 (CEST) Received: (qmail 20876 invoked by uid 500); 24 May 2018 05:42:03 -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 20865 invoked by uid 99); 24 May 2018 05:42:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 May 2018 05:42:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 1FC4BC042D for ; Thu, 24 May 2018 05:42:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.511 X-Spam-Level: X-Spam-Status: No, score=-109.511 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, T_RP_MATCHES_RCVD=-0.01, 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 (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 7a5AYqgwYF2N for ; Thu, 24 May 2018 05:42:01 +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 4F0025F470 for ; Thu, 24 May 2018 05:42: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 7006DE0C4B for ; Thu, 24 May 2018 05:42: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 148E621096 for ; Thu, 24 May 2018 05:42:00 +0000 (UTC) Date: Thu, 24 May 2018 05:42:00 +0000 (UTC) From: "James Taylor (JIRA)" To: dev@phoenix.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (PHOENIX-4751) Support client-side hash aggregation with SORT_MERGE_JOIN 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-4751?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16= 488452#comment-16488452 ]=20 James Taylor commented on PHOENIX-4751: --------------------------------------- Yes, you're right [~sangudi] - since the aggregation is done after the join= , the=C2=A0SORT-MERGE-JOIN will be completely done on the client (and hence= would benefit from being able to do a hash aggregation instead). The=C2=A0= SpillableGroupByCache is used on the server-side hash aggregation. It would= work on the client side as well (if you can write to the file system). It = basically tries to do everything in memory and then past a memory threshold= will spill to disk. > Support client-side hash aggregation with SORT_MERGE_JOIN > --------------------------------------------------------- > > Key: PHOENIX-4751 > URL: https://issues.apache.org/jira/browse/PHOENIX-4751 > Project: Phoenix > Issue Type: Improvement > Affects Versions: 4.14.0, 4.13.1 > Reporter: Gerald Sangudi > Priority: Major > > A GROUP BY that follows a SORT_MERGE_JOIN=C2=A0should be able to use hash= aggregation in some cases, for improved performance. > When a GROUP BY follows a SORT_MERGE_JOIN, the GROUP BY does not use hash= aggregation. It instead performs a CLIENT SORT followed by a CLIENT AGGREG= ATE. The=C2=A0performance can be improved if (a) the GROUP BY output does n= ot need to be sorted, and (b) the GROUP BY input=C2=A0is large enough and h= as low cardinality. > The hash aggregation can initially be a hint. Here is an example from Pho= enix 4.13.1 that would benefit from hash aggregation if the GROUP BY input = is large with low cardinality. > CREATE TABLE unsalted ( > keyA BIGINT NOT NULL, > keyB BIGINT NOT NULL, > val SMALLINT, > CONSTRAINT pk PRIMARY KEY (keyA, keyB) > ); > EXPLAIN > SELECT /*+ USE_SORT_MERGE_JOIN */=20 > t1.val v1, t2.val v2, COUNT(\*) c=20 > FROM unsalted t1 JOIN unsalted t2=20 > ON (t1.keyA =3D t2.keyA)=20 > GROUP BY t1.val, t2.val; > +-------------------------------------------------------------+---------= -------++------------------+ > |PLAN|EST_BYTES_READ|EST_ROWS_READ|=C2=A0| > +-------------------------------------------------------------+----------= ------++------------------+ > |SORT-MERGE-JOIN (INNER) TABLES|null|null|=C2=A0| > |=C2=A0 =C2=A0 CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER UNSALTED|null= |null|=C2=A0| > |AND|null|null|=C2=A0| > |=C2=A0 =C2=A0 CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER UNSALTED|null= |null|=C2=A0| > |CLIENT SORTED BY [TO_DECIMAL(T1.VAL), T2.VAL]|null|null|=C2=A0| > |CLIENT AGGREGATE INTO DISTINCT ROWS BY [T1.VAL, T2.VAL]|null|null|=C2=A0= | > +-------------------------------------------------------------+----------= ------++------------------+ -- This message was sent by Atlassian JIRA (v7.6.3#76005)