Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 56201200B2B for ; Tue, 14 Jun 2016 00:16:58 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 54ACC160A5B; Mon, 13 Jun 2016 22:16:58 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 77523160A3C for ; Tue, 14 Jun 2016 00:16:57 +0200 (CEST) Received: (qmail 73481 invoked by uid 500); 13 Jun 2016 22:16:56 -0000 Mailing-List: contact user-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hive.apache.org Delivered-To: mailing list user@hive.apache.org Received: (qmail 73471 invoked by uid 99); 13 Jun 2016 22:16:56 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jun 2016 22:16:56 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id B20061A1292 for ; Mon, 13 Jun 2016 22:16:55 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.198 X-Spam-Level: * X-Spam-Status: No, score=1.198 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id aQjx31dDmkpY for ; Mon, 13 Jun 2016 22:16:53 +0000 (UTC) Received: from mail-qg0-f41.google.com (mail-qg0-f41.google.com [209.85.192.41]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTPS id 899315F253 for ; Mon, 13 Jun 2016 22:16:53 +0000 (UTC) Received: by mail-qg0-f41.google.com with SMTP id v76so43914718qgv.3 for ; Mon, 13 Jun 2016 15:16:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=E5nLDHhFeD7KsXE921godnbJ7SarnXktE53R5mD/9xM=; b=cAo8IlQ+6QejQGExQewC58suYFc+8ZiV038AvkbVw1fzNNHDtf7ndev8TSIXL1D5dz bXapFNOVI6+9bvTpIPJV6yGXPhSFpmQvuYy+njReQpJZ75+ikuK/nEVV7TmLcliD2bsK 62XrFSXbfen2AXTFNDGp9CFs8hiamFXl6n/I0kb0t2w23oFktHzFp9kiWPprY9Tmp7M0 CoCiLlxzrz5PlhX9J1PDvXL4RpNujRzFTaMUB0yP/FieQkae7eufsL6D2xsPtdrJSv8L 3MfQW/jueDXNHF19ZIHc+HEAmrwW98giUUIsubliwaSGhpaA3bXfuOKIHNg/yP7I2QPa YM6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=E5nLDHhFeD7KsXE921godnbJ7SarnXktE53R5mD/9xM=; b=gUYGTQXI/1eTrE+LRJ6gmXNqS4T+aZez8tpjjtQcA8QCKaZ7y+u/tXZ2bmF9bdcyYg cQ5rb0/1FR0F/Yr0Vwe4S7+E+Yp94I8DolfbfGfWOrFAxkN+sGcW2oXeV0TlY4oR4eCp JXrEic4npSrvjwDZvOU7uIihewonZup87xLBgaUlSVhPerVWLzUxvSap/n28gdFGJomi foajRJfb+9lGCq6m1Pmpm+QBLvcQ8abBwx+YKvCTFJEv9v2/xa+TZPYsCl05mScqM2XN cbodNLPiOK9fILNNL1nnCYfX4VXAFuhgJcrQVzq4kZNbomoO8WHfA8+DZS03ioK+oqZE 64iw== X-Gm-Message-State: ALyK8tIi5QuvrlgiKVr8kxlFB8u+oMSSiWtGzM9B/60gfBK1DgOlFnehHG50R7LnDhljZMzVcy4UUukMcpPFJw== X-Received: by 10.140.91.244 with SMTP id z107mr15989686qgd.82.1465856212897; Mon, 13 Jun 2016 15:16:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.126.131 with HTTP; Mon, 13 Jun 2016 15:16:52 -0700 (PDT) In-Reply-To: References: From: Mich Talebzadeh Date: Mon, 13 Jun 2016 23:16:52 +0100 Message-ID: Subject: Re: Optimized Hive query To: user Content-Type: multipart/alternative; boundary=001a113a74d2dc923c0535303e50 archived-at: Mon, 13 Jun 2016 22:16:58 -0000 --001a113a74d2dc923c0535303e50 Content-Type: text/plain; charset=UTF-8 you want to flatten the query I understand. create temporary table tmp as select c from d; INSERT INTO TABLE a SELECT c from tmp where condition Is the INSERT code correct? HTH Dr Mich Talebzadeh LinkedIn * https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw * http://talebzadehmich.wordpress.com On 13 June 2016 at 17:55, Aviral Agarwal wrote: > Hi, > I would like to know if there is a way to convert nested hive sub-queries > into optimized queries. > > For example : > INSERT INTO TABLE a.b SELECT * FROM ( SELECT c FROM d) > > into > > INSERT INTO TABLE a.b SELECT c FROM D > > This is a simple example but the solution should apply is there were > deeper nesting levels present. > > Thanks, > Aviral Agarwal > > --001a113a74d2dc923c0535303e50 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
you want to flatten the query I understand.

create= temporary table tmp as select c from d;

INSERT INTO TABLE a
SELECT c = from tmp where
condition

Is the INSERT code cor= rect?

HTH

On 13 June 2016 at 17:55, Aviral Agarwal <aviral12028@gmail.com> wrote:
Hi,
I would like to know if there is a way to co= nvert nested hive sub-queries into optimized queries.

<= div>For example :
INSERT INTO TABLE a.b SELECT * FROM ( SELECT c = FROM d)=C2=A0

into

INSERT= INTO TABLE a.b SELECT c FROM D

This is a simple e= xample but the solution should apply is there were deeper nesting levels pr= esent.

Thanks,
Aviral Agarwal
=

--001a113a74d2dc923c0535303e50--