Package org.apache.hadoop.hive.ql.plan.PTFDesc

Examples of org.apache.hadoop.hive.ql.plan.PTFDesc.PTFExpressionDef


      ValueBoundarySpec vBndSpec = (ValueBoundarySpec) bndSpec;
      ValueBoundaryDef vbDef = new ValueBoundaryDef();
      vbDef.setAmt(vBndSpec.getAmt());
      vbDef.setDirection(vBndSpec.getDirection());
      PTFTranslator.validateNoLeadLagInValueBoundarySpec(vBndSpec.getExpression());
      PTFExpressionDef exprDef = null;
      try {
        exprDef = buildExpressionDef(inpShape, vBndSpec.getExpression());
      } catch (HiveException he) {
        throw new SemanticException(he);
      }
      PTFTranslator.validateValueBoundaryExprType(exprDef.getOI());
      vbDef.setExpressionDef(exprDef);
      return vbDef;
    }
    else if (bndSpec instanceof RangeBoundarySpec) {
      RangeBoundarySpec rBndSpec = (RangeBoundarySpec) bndSpec;
View Full Code Here


  /*
   * Expr translation helper methods
   */
  public PTFExpressionDef buildExpressionDef(ShapeDetails inpShape, ASTNode arg)
      throws HiveException {
    PTFExpressionDef argDef = new PTFExpressionDef();

    ExprNodeDesc exprNode = semAly.genExprNodeDesc(arg, inpShape.getRr(),
        inpShape.getTypeCheckCtx());
    ExprNodeEvaluator exprEval = WindowingExprNodeEvaluatorFactory.get(llInfo, exprNode);
    ObjectInspector oi = initExprNodeEvaluator(exprEval, exprNode, inpShape);

    argDef.setExpressionTreeString(arg.toStringTree());
    argDef.setExprNode(exprNode);
    argDef.setExprEvaluator(exprEval);
    argDef.setOI(oi);
    return argDef;
  }
View Full Code Here

    ArrayList<WindowExpressionDef> windowExpressions = new ArrayList<WindowExpressionDef>();
    if ( wdwSpec.getWindowExpressions() != null ) {
      for(WindowExpressionSpec expr : wdwSpec.getWindowExpressions()) {
        if ( !(expr instanceof WindowFunctionSpec) ) {
          try {
            PTFExpressionDef eDef = buildExpressionDef(wdwOutShape, expr.getExpression());
            WindowExpressionDef wdwEDef = new WindowExpressionDef(eDef);
            wdwEDef.setAlias(expr.getAlias());
            windowExpressions.add(wdwEDef);
          }
          catch(HiveException he) {
View Full Code Here

    ArrayList<ASTNode> args = spec.getArgs();
    if (args != null)
    {
      for (ASTNode expr : args)
      {
        PTFExpressionDef argDef = null;
        try {
          argDef = buildExpressionDef(inpDef.getOutputShape(), expr);
        }
        catch(HiveException he) {
          throw new SemanticException(he);
View Full Code Here

    ArrayList<ASTNode> args = spec.getArgs();
    if (args != null)
    {
      for (ASTNode expr : args)
      {
        PTFExpressionDef argDef = null;
        try {
          argDef = buildExpressionDef(inpShape, expr);
        }
        catch(HiveException he) {
          throw new SemanticException(he);
View Full Code Here

    }

    PartitionDef pDef = new PartitionDef();
    for (PartitionExpression pExpr : spec.getExpressions())
    {
      PTFExpressionDef expDef = translate(inpShape, pExpr);
      pDef.addExpression(expDef);
    }
    return pDef;
  }
View Full Code Here

  }

  private PTFExpressionDef translate(ShapeDetails inpShape,
      PartitionExpression pExpr) throws SemanticException
  {
    PTFExpressionDef expDef = null;
    try {
      expDef = buildExpressionDef(inpShape, pExpr.getExpression());
    }
    catch(HiveException he) {
      throw new SemanticException(he);
    }
    PTFTranslator.validateComparable(expDef.getOI(),
        String.format("Partition Expression %s is not a comparable expression", pExpr.getExpression().toStringTree()));
    return expDef;
  }
View Full Code Here

          throws SemanticException
  {
    OrderExpressionDef oexpDef = new OrderExpressionDef();
    oexpDef.setOrder(oExpr.getOrder());
    try {
      PTFExpressionDef expDef = buildExpressionDef(inpShape, oExpr.getExpression());
      oexpDef.setExpressionTreeString(expDef.getExpressionTreeString());
      oexpDef.setExprEvaluator(expDef.getExprEvaluator());
      oexpDef.setExprNode(expDef.getExprNode());
      oexpDef.setOI(expDef.getOI());
    }
    catch(HiveException he) {
      throw new SemanticException(he);
    }
    PTFTranslator.validateComparable(oexpDef.getOI(),
View Full Code Here

      ValueBoundarySpec vBndSpec = (ValueBoundarySpec) bndSpec;
      ValueBoundaryDef vbDef = new ValueBoundaryDef();
      vbDef.setAmt(vBndSpec.getAmt());
      vbDef.setDirection(vBndSpec.getDirection());
      PTFTranslator.validateNoLeadLagInValueBoundarySpec(vBndSpec.getExpression());
      PTFExpressionDef exprDef = null;
      try {
        exprDef = buildExpressionDef(inpShape, vBndSpec.getExpression());
      }
      catch(HiveException he) {
        throw new SemanticException(he);
      }
      PTFTranslator.validateValueBoundaryExprType(exprDef.getOI());
      vbDef.setExpressionDef(exprDef);
      return vbDef;
    }
    else if (bndSpec instanceof RangeBoundarySpec)
    {
View Full Code Here

   * Expr translation helper methods
   */
  public PTFExpressionDef buildExpressionDef(ShapeDetails inpShape, ASTNode arg)
      throws HiveException
  {
    PTFExpressionDef argDef = new PTFExpressionDef();

    ExprNodeDesc exprNode = semAly.genExprNodeDesc(arg, inpShape.getRr(),
        inpShape.getTypeCheckCtx());
    ExprNodeEvaluator exprEval = WindowingExprNodeEvaluatorFactory.get(llInfo, exprNode);
    ObjectInspector oi = initExprNodeEvaluator(exprEval, exprNode, inpShape);

    argDef.setExpressionTreeString(arg.toStringTree());
    argDef.setExprNode(exprNode);
    argDef.setExprEvaluator(exprEval);
    argDef.setOI(oi);
    return argDef;
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.ql.plan.PTFDesc.PTFExpressionDef

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.