Krisztian Kasa created HIVE-22787:
-------------------------------------

             Summary: NPE when compiling query contains intersect all
                 Key: HIVE-22787
                 URL: https://issues.apache.org/jira/browse/HIVE-22787
             Project: Hive
          Issue Type: Bug
          Components: Query Planning
            Reporter: Krisztian Kasa
            Assignee: Krisztian Kasa


The query contains INTERSECT ALL operator and one of its operands has an OUTER 
JOIN like:
{code}
SELECT ... FROM t1 RIGHT OUTER JOIN t2 ON ...
INTERSECT ALL
SELECT ...
{code}
In this case both AST trees (before and after calcite) has a TOK_INTERSECTALL 
node and it is not handled
when generating the plan in
{code}
org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
private Operator genPlan(QB parent, QBExpr qbexpr) throws SemanticException {
    if (qbexpr.getOpcode() == QBExpr.Opcode.NULLOP) {
      boolean skipAmbiguityCheck = viewSelect == null && 
parent.isTopLevelSelectStarQuery();
      return genPlan(qbexpr.getQB(), skipAmbiguityCheck);
    }
    if (qbexpr.getOpcode() == QBExpr.Opcode.UNION) {
      Operator qbexpr1Ops = genPlan(parent, qbexpr.getQBExpr1());
      Operator qbexpr2Ops = genPlan(parent, qbexpr.getQBExpr2());

      return genUnionPlan(qbexpr.getAlias(), qbexpr.getQBExpr1().getAlias(),
          qbexpr1Ops, qbexpr.getQBExpr2().getAlias(), qbexpr2Ops);
    }
    return null;
  }{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to