Return-Path: X-Original-To: apmail-hive-dev-archive@www.apache.org Delivered-To: apmail-hive-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2EF6317629 for ; Thu, 23 Oct 2014 20:42:53 +0000 (UTC) Received: (qmail 3931 invoked by uid 500); 23 Oct 2014 20:42:52 -0000 Delivered-To: apmail-hive-dev-archive@hive.apache.org Received: (qmail 3855 invoked by uid 500); 23 Oct 2014 20:42:52 -0000 Mailing-List: contact dev-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list dev@hive.apache.org Received: (qmail 3838 invoked by uid 99); 23 Oct 2014 20:42:52 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Oct 2014 20:42:52 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id 338431DF60E; Thu, 23 Oct 2014 20:42:57 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============0373212453881620263==" MIME-Version: 1.0 Subject: Re: Review Request 25550: HIVE-8021 CBO: support CTAS and insert ... select From: "Sergey Shelukhin" To: "John Pullokkaran" , "Ashutosh Chauhan" Cc: "Sergey Shelukhin" , "hive" Date: Thu, 23 Oct 2014 20:42:57 -0000 Message-ID: <20141023204257.1282.98572@reviews.apache.org> X-ReviewBoard-URL: https://reviews.apache.org Auto-Submitted: auto-generated Sender: "Sergey Shelukhin" X-ReviewGroup: hive X-ReviewRequest-URL: https://reviews.apache.org/r/25550/ X-Sender: "Sergey Shelukhin" References: <20141023194736.1283.75286@reviews.apache.org> In-Reply-To: <20141023194736.1283.75286@reviews.apache.org> Reply-To: "Sergey Shelukhin" X-ReviewRequest-Repository: hive-git --===============0373212453881620263== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit > On Oct. 23, 2014, 7:47 p.m., John Pullokkaran wrote: > > ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java, line 9960 > > > > > > Seems like we could refactor the code here for ease of maintanence: > > 1. Modify PreCboCtx to include error msg > > 2. processStmtForCBO(PreCboCtx, qb) > > 3. Move all of the logic below to #2 > > // Note: for now, we don't actually pass the queryForCbo to CBO, because it accepts qb, not > > // AST, and can also access all the private stuff in SA. We rely on the fact that CBO > > // ignores the unknown tokens (create table, destination), so if the query is otherwise ok, > > // it is as if we did remove those and gave CBO the proper AST. That is kinda hacky. > > queryForCbo = ast; > > if (cboCtx.type == PreCboCtx.Type.CTAS) { > > // nodeOfInterest is the query > > queryForCbo = cboCtx.nodeOfInterest; > > } > > int root = queryForCbo.getToken().getType(); > > boolean isSupportedRoot = > > root == HiveParser.TOK_QUERY || root == HiveParser.TOK_EXPLAIN || qb.isCTAS(); > > // Assumption: If top level QB is query then everything below it must also be Query > > // Can there be an insert or CTAS that wouldn't > > // be supported and would require additional checks similar to IsQuery? > > boolean isSupportedType = > > qb.getIsQuery() || qb.isCTAS() || cboCtx.type == PreCboCtx.Type.INSERT; > > runCBO = runCBO && isSupportedRoot && isSupportedType && createVwDesc == null; > > > > .3 If PreCboCtx err msg is empty then check if CBO can handle Select Query > > rename canHandleQuery to canHandleSelectQuery refactored all the checks into the method, and all the non-checks separately - Sergey ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/25550/#review58073 ----------------------------------------------------------- On Oct. 22, 2014, 8:34 p.m., Sergey Shelukhin wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/25550/ > ----------------------------------------------------------- > > (Updated Oct. 22, 2014, 8:34 p.m.) > > > Review request for hive, Ashutosh Chauhan and John Pullokkaran. > > > Repository: hive-git > > > Description > ------- > > see JIRA > > > Diffs > ----- > > ql/src/java/org/apache/hadoop/hive/ql/optimizer/index/RewriteParseContextGenerator.java dee7d7e > ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java 37cbf7f > ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java 511103b > ql/src/test/queries/clientpositive/cbo_correctness.q 4d8f156 > ql/src/test/queries/clientpositive/ctas_colname.q 5322626 > ql/src/test/queries/clientpositive/decimal_serde.q cf3a86c > ql/src/test/queries/clientpositive/insert0.q PRE-CREATION > ql/src/test/results/clientpositive/ctas_colname.q.out 97dacf6 > ql/src/test/results/clientpositive/decimal_serde.q.out e461c2e > ql/src/test/results/clientpositive/insert0.q.out PRE-CREATION > > Diff: https://reviews.apache.org/r/25550/diff/ > > > Testing > ------- > > > Thanks, > > Sergey Shelukhin > > --===============0373212453881620263==--