Return-Path: X-Original-To: apmail-tajo-dev-archive@minotaur.apache.org Delivered-To: apmail-tajo-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9522F18413 for ; Wed, 17 Jun 2015 17:16:36 +0000 (UTC) Received: (qmail 52801 invoked by uid 500); 17 Jun 2015 17:16:36 -0000 Delivered-To: apmail-tajo-dev-archive@tajo.apache.org Received: (qmail 52758 invoked by uid 500); 17 Jun 2015 17:16:36 -0000 Mailing-List: contact dev-help@tajo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tajo.apache.org Delivered-To: mailing list dev@tajo.apache.org Received: (qmail 52747 invoked by uid 99); 17 Jun 2015 17:16:36 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jun 2015 17:16:36 +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 CACF8C096B for ; Wed, 17 Jun 2015 17:16:35 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.88 X-Spam-Level: ** X-Spam-Status: No, score=2.88 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id NnGUiSNUbt1d for ; Wed, 17 Jun 2015 17:16:24 +0000 (UTC) Received: from mail-yh0-f46.google.com (mail-yh0-f46.google.com [209.85.213.46]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id D8ED343A5B for ; Wed, 17 Jun 2015 17:16:23 +0000 (UTC) Received: by yhan67 with SMTP id n67so38457382yha.3 for ; Wed, 17 Jun 2015 10:16:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=IU+sNQg8whAo3QD6dUulkrSzKGI9Xot7dq1uYfWIj68=; b=Ixf25svrcReE2gSVgh2cLL91CAxxhCeajxfEVz07T+USzdc4curMOVTlBCimQw3CiA vIZFqCz97Uzrhk/sFNITKc8PkCuu2FuAQ1ndfaHwCIXERNw/p0a4iShZfBwycNqfmrZk 8Ps+fnZfFthj5w3SmbvwQiQG80EnGY7k1grg1W7my//6QFxAb2QW0bOsAjlZYh0rJw3U MVM8zAxiJFAeb7t51n/u8E2VEoaJCb7hFGrqhx6O9SwN85qgLHb7QCJy0ZeDwcZN4ogS uM8k84ak1OMxh/9BcTid53WXJeohq0rUUqQF8kwCs+CZG8cnBzaNAyWc7OC6FALlya0P axYA== MIME-Version: 1.0 X-Received: by 10.13.206.65 with SMTP id q62mr2596131ywd.140.1434561383586; Wed, 17 Jun 2015 10:16:23 -0700 (PDT) Received: by 10.129.133.2 with HTTP; Wed, 17 Jun 2015 10:16:22 -0700 (PDT) Received: by 10.129.133.2 with HTTP; Wed, 17 Jun 2015 10:16:22 -0700 (PDT) In-Reply-To: References: Date: Wed, 17 Jun 2015 22:46:22 +0530 Message-ID: Subject: Re: Parallel Aggregates From: Atri Sharma To: dev@tajo.apache.org Content-Type: multipart/alternative; boundary=001a114da6f4ad61860518b9d9c8 --001a114da6f4ad61860518b9d9c8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thank you. Is there any improvement in aggregates that we are looking at please? On 16 Jun 2015 17:07, "Jihoon Son" wrote: > In Tajo, aggregation is very similar to that in Hadoop MapReduce. > Let me consider an example. Given a query of "select *k*, count(*) from *= t* > group by *k*", Tajo generates a LogicalPlan as follows. > > group by (k) > | > scan (t) > > This LogicalPlan is translated into a MasterPlan as follows. > > ----------------- > Stage2 > group by *k* > ----------------- > | > shuffle tuples with *k* > | > ----------------- > Stage1 > group by *k* > | > scan *t* > ----------------- > > As you can see in this example, the query plan consists of 2 stages. Each > stage is executed subsequently because the result of Stage 1 is used as t= he > input of Stage 2. Each stage is divided into multiple tasks for each inpu= t > split as follows. > > Stage1 > > Task 1 > group by *k* > | > scan *t* (0 - 99) > > Task 2 > group by *k* > | > scan *t* (100 - 199) > ... > > Each task is executed by a TajoWorker. As you can see, tasks of the first > stage execute a local aggregation after scanning input split. This local > aggregation result is shuffled among TajoWorkers with the aggregation key > *k*. Then, the final aggregation is computed at the second stage. > > Stage1 and Stage2 are similar to Map and Reduce of MapReduce. The local > aggregation of Stage1 is similar to the Combiner of Hadoop MapReduce. > > I hope that this will be helpful to you. > If you have any further questions, please feel free to ask. > Jihoon > > 2015=EB=85=84 6=EC=9B=94 16=EC=9D=BC (=ED=99=94) =EC=98=A4=EC=A0=84 7:28,= Atri Sharma =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > Thanks. > > > > What are your thoughts on parallel aggregation? Generating query plans > that > > allow states to be generated which can be executed independently and th= en > > states recombined? > > On 16 Jun 2015 05:25, "Jihoon Son" wrote: > > > > > Hi Atri, thanks for your question. > > > > > > First of all, maybe you already did, I recommend that you read this > > article > > > < > > > > > > http://www.hadoopsphere.com/2015/02/technical-deep-dive-into-apache-tajo.= html > > > > > > > before you start implementation. This is written by Hyunsik, and > contains > > > the description of Tajo's overall infrastructure. Afterwards, I think > > that > > > you may ask more detailed question. > > > > > > Here, I'll roughly list some important classes for aggregate > > > implementation. > > > > > > - SQLParser.g4 contains our SQL parsing rules. It is written in > antlr. > > > - SQLAnalyzer is our parser based on rules defined at SQLParser.g4= . > > > - SQLAnalyzer translates a SQL query into a tree of Expr which > > > represents an algebraic expression. > > > - LogicalPlanner translates the Expr tree into a LogicalPlan that > > > logically describes how the given query will be executed. > > > - GlobalPlanner translates the LogicalPlan into a MasterPlan > > > (distributed query execution plan) that describes how the given > query > > > will > > > be executed in distributed cluster. > > > - Once a MasterPlan is created, QueryMaster starts to execute quer= y > > > processing. A query consists of multiple stages, which are > > individually > > > processed in some order. > > > - For example, a simple aggregation query is executed in two > > stages, > > > each of which is for parallel aggregation and combining > aggregates. > > > These > > > stages are executed sequentially. > > > - A stage is concurrently processed by multiple tasks, and is > executed > > > by TajoWorker. > > > - Each task contains meta information for input data and a > LogicalPlan > > > of the stage. This LogicalPlan is translated into PhysicalExec by > > > PhysicalPlanner. > > > - PhysicalExec describes how the query is actually executed. > > > - For example, there are two types of AggregationExec, > > > i.e., HashAggregateExec and SortAggregateExec, for hash-based > > > aggregation > > > and sort-based aggregation, respectively. > > > > > > Best regards, > > > Jihoon > > > > > > 2015=EB=85=84 6=EC=9B=94 15=EC=9D=BC (=EC=9B=94) =EC=98=A4=ED=9B=84 1= 1:32, Atri Sharma =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84= =B1: > > > > > > > Folks, > > > > > > > > I am looking into parallel aggregates/combining aggregates. I have = a > > plan > > > > around it which I think can work. > > > > > > > > Please update me on current infrastructure and point me around the > > > existing > > > > code base. Also, ideas would be most welcome around it. > > > > > > > > -- > > > > Regards, > > > > > > > > Atri > > > > *l'apprenant* > > > > > > > > > > --001a114da6f4ad61860518b9d9c8--