Examples of BoundarySpec


Examples of com.sap.hadoop.windowing.query2.specification.WindowFrameSpec.BoundarySpec

    // $ANTLR start window_range_expression
    // QSpecBuilder2.g:182:1: window_range_expression returns [WindowFrameSpec wf] : ^( WINDOWRANGE s= rowsboundary e= rowsboundary ) ;
    public final WindowFrameSpec window_range_expression() throws RecognitionException {
        WindowFrameSpec wf = null;

        BoundarySpec s = null;

        BoundarySpec e = null;


        try {
            // QSpecBuilder2.g:182:54: ( ^( WINDOWRANGE s= rowsboundary e= rowsboundary ) )
            // QSpecBuilder2.g:183:2: ^( WINDOWRANGE s= rowsboundary e= rowsboundary )
View Full Code Here

Examples of com.sap.hadoop.windowing.query2.specification.WindowFrameSpec.BoundarySpec


    // $ANTLR start rowsboundary
    // QSpecBuilder2.g:186:1: rowsboundary returns [BoundarySpec bs] : ( ^( PRECEDING UNBOUNDED ) | ^( FOLLOWING UNBOUNDED ) | CURRENT | ^( PRECEDING n= Number ) | ^( FOLLOWING n= Number ) );
    public final BoundarySpec rowsboundary() throws RecognitionException {
        BoundarySpec bs = null;

        CommonTree n=null;


          RangeBoundarySpec rbs = new RangeBoundarySpec();
View Full Code Here

Examples of com.sap.hadoop.windowing.query2.specification.WindowFrameSpec.BoundarySpec

    // $ANTLR start window_value_expression
    // QSpecBuilder2.g:199:1: window_value_expression returns [WindowFrameSpec wf] : ^( WINDOWVALUES s= valuesboundary e= valuesboundary ) ;
    public final WindowFrameSpec window_value_expression() throws RecognitionException {
        WindowFrameSpec wf = null;

        BoundarySpec s = null;

        BoundarySpec e = null;


        try {
            // QSpecBuilder2.g:199:54: ( ^( WINDOWVALUES s= valuesboundary e= valuesboundary ) )
            // QSpecBuilder2.g:200:2: ^( WINDOWVALUES s= valuesboundary e= valuesboundary )
View Full Code Here

Examples of com.sap.hadoop.windowing.query2.specification.WindowFrameSpec.BoundarySpec


    // $ANTLR start valuesboundary
    // QSpecBuilder2.g:203:1: valuesboundary returns [BoundarySpec bs] : ( ^( PRECEDING UNBOUNDED ) | ^( FOLLOWING UNBOUNDED ) | CURRENT | ^( LESS e= expression n= Number ) | ^( MORE e= expression n= Number ) );
    public final BoundarySpec valuesboundary() throws RecognitionException {
        BoundarySpec bs = null;

        CommonTree n=null;
        CommonTree e = null;

View Full Code Here

Examples of com.sap.hadoop.windowing.query2.specification.WindowFrameSpec.BoundarySpec

    if ( wfSpec == null )
    {
      return null;
    }
   
    BoundarySpec s = wfSpec.getStart();
    BoundarySpec e = wfSpec.getEnd();
    WindowFrameDef wfDef = new WindowFrameDef(wfSpec);
   
    wfDef.setStart(translateBoundary(qDef, s, iInfo));
    wfDef.setEnd(translateBoundary(qDef, e, iInfo));
   
View Full Code Here

Examples of org.apache.hadoop.hive.ql.parse.WindowingSpec.BoundarySpec

      String desc = spec.toString();

      WindowFrameDef wdwFrame = translate(spec.getName(), inpShape, wdwSpec);
      if (!wFnInfo.isSupportsWindow())
      {
        BoundarySpec start = wdwSpec.getWindowFrame().getStart();
        if (start.getAmt() != BoundarySpec.UNBOUNDED_AMOUNT) {
          throw new SemanticException(
              String.format("Expecting left window frame boundary for " +
                  "function %s to be unbounded. Found : %d", desc, start.getAmt()));
        }
        BoundarySpec end = wdwSpec.getWindowFrame().getEnd();
        if (end.getAmt() != BoundarySpec.UNBOUNDED_AMOUNT) {
          throw new SemanticException(
              String.format("Expecting right window frame boundary for " +
                  "function %s to be unbounded. Found : %d", desc, start.getAmt()));
        }
      }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.parse.WindowingSpec.BoundarySpec

      throws SemanticException {
    if (spec == null) {
      return null;
    }

    BoundarySpec s = spec.getStart();
    BoundarySpec e = spec.getEnd();
    int cmp = s.compareTo(e);
    if (cmp > 0) {
      throw new SemanticException(String.format(
          "Window range invalid, start boundary is greater than end boundary: %s", spec));
    }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.parse.WindowingSpec.BoundarySpec

    return ws;
  }

  private WindowFrameSpec processWindowFrame(ASTNode node) throws SemanticException {
    int type = node.getType();
    BoundarySpec start = null, end = null;

    /*
     * A WindowFrame may contain just the Start Boundary or in the
     * between style of expressing a WindowFrame both boundaries
     * are specified.
View Full Code Here

Examples of org.apache.hadoop.hive.ql.parse.WindowingSpec.BoundarySpec

    return new WindowFrameSpec(start, end);
  }

  private BoundarySpec processBoundary(int frameType, ASTNode nodethrows SemanticException {
    BoundarySpec bs = frameType == HiveParser.TOK_WINDOWRANGE ?
        new RangeBoundarySpec() : new ValueBoundarySpec();
    int type = node.getType();
    boolean hasAmt = true;

    switch(type)
    {
    case HiveParser.KW_PRECEDING:
      bs.setDirection(Direction.PRECEDING);
      break;
    case HiveParser.KW_FOLLOWING:
      bs.setDirection(Direction.FOLLOWING);
      break;
    case HiveParser.KW_CURRENT:
      bs = new CurrentRowSpec();
      hasAmt = false;
      break;
    }

    if ( hasAmt )
    {
      ASTNode amtNode = (ASTNode) node.getChild(0);
      if ( amtNode.getType() == HiveParser.KW_UNBOUNDED)
      {
        bs.setAmt(BoundarySpec.UNBOUNDED_AMOUNT);
      }
      else
      {
        int amt = Integer.parseInt(amtNode.getText());
        if ( amt < 0 ) {
          throw new SemanticException(
              "Window Frame Boundary Amount must be a +ve integer, amount provide is: " + amt);
        }
        bs.setAmt(amt);
      }
    }

    return bs;
  }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.parse.WindowingSpec.BoundarySpec

    return ws;
  }

  private WindowFrameSpec processWindowFrame(ASTNode node) throws SemanticException {
    int type = node.getType();
    BoundarySpec start = null, end = null;

    /*
     * A WindowFrame may contain just the Start Boundary or in the
     * between style of expressing a WindowFrame both boundaries
     * are specified.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.