-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/25550/#review58073
-----------------------------------------------------------



ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
<https://reviews.apache.org/r/25550/#comment98968>

    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


- John Pullokkaran


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
> 
>

Reply via email to