Examples of OrderDef


Examples of com.sap.hadoop.windowing.query2.definition.OrderDef

      throw new WindowingException("Ranking Functions can take no arguments");
    }
   
    QueryInputDef inpDef = windowTableFnDef.getInput();
    InputInfo inpInfo = qDef.getTranslationInfo().getInputInfo(inpDef);
    OrderDef oDef = getTableFuncOrderDef(windowTableFnDef);
    ArrayList<OrderColumnDef> oCols = oDef.getColumns();
    for(OrderColumnDef oCol : oCols)
    {
      wFnDef.addArg(TranslateUtils.buildArgDef(qDef, inpInfo, oCol.getExpression()));
    }
  }
View Full Code Here

Examples of com.sap.hadoop.windowing.query2.definition.OrderDef

    {
      throw new WindowingException(
          sprintf("Window Function '%s' has an incompatible partition clause", wFnDef.getSpec()));
    }
   
    OrderDef tOrder = tWindow == null ? null : tWindow.getOrderDef();
    OrderDef fOrder = fWindow == null ? null : fWindow.getOrderDef();
    if ( !TranslateUtils.isCompatible(tOrder, fOrder))
    {
      throw new WindowingException(
          sprintf("Window Function '%s' has an incompatible order clause", wFnDef.getSpec()));
    }
View Full Code Here

Examples of com.sap.hadoop.windowing.query2.definition.OrderDef

        " into path='/tmp/wout2'" +
        " serde 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'" +
        " with serdeproperties('field.delim'=',')" +
        " format 'org.apache.hadoop.mapred.TextOutputFormat'");
   
    OrderDef oDef = qDef.getInput().getWindow().getOrderDef();
    assert oDef != null;
    assert oDef.getSpec().getColumns().get(0).getColumnName() == "p_mfgr";
   
  }
View Full Code Here

Examples of com.sap.hadoop.windowing.query2.definition.OrderDef

      }
      visitor.visit(pDef);
    }

   
    OrderDef oDef = window.getOrderDef();
    if(oDef != null){
      ArrayList<OrderColumnDef> ocols = oDef.getColumns();
      for(OrderColumnDef ocol : ocols)
      {
        visitor.visit(ocol);
      }
      visitor.visit(oDef);
View Full Code Here

Examples of com.sap.hadoop.windowing.query2.definition.OrderDef

   
    PartitionSpec pSpec = wSpec.getPartition();
    OrderSpec oSpec = wSpec.getOrder();
    WindowFrameSpec wFrameSpec = wSpec.getWindow();
    PartitionDef pDef = translatePartition(qDef, iInfo, pSpec);
    OrderDef oDef = translateOrder(qDef, inputDesc, iInfo, oSpec, pDef);
    WindowFrameDef wdwDef = translateWindowFrame(qDef, wFrameSpec, iInfo);
   
    wDef.setPartDef(pDef);
    wDef.setOrderDef(oDef);
    wDef.setWindow(wdwDef);
View Full Code Here

Examples of com.sap.hadoop.windowing.query2.definition.OrderDef

   
    if ( spec == null || spec.getColumns() == null || spec.getColumns().size() == 0)
    {
      if ( pDef == null )
        return null;
      return new OrderDef(pDef);
    }
   
    if ( pDef == null )
    {
      throw new WindowingException(sprintf("Input %s cannot have an Order spec w/o a Partition spec", inputDesc));
    }
   
    OrderDef oDef = new OrderDef(spec);
    for(OrderColumnSpec colSpec : spec.getColumns())
    {
      OrderColumnDef cDef = translateOrderColumn(qDef, iInfo, colSpec);
      oDef.addColumn(cDef);
    }
   
    /*
     * either all partition columns must be in Order list or none must be specified.
     * If none are specified then add them all.
     */
    int numOfPartColumns = 0;
    List<OrderColumnDef> orderCols = oDef.getColumns();
    List<ColumnDef> partCols = pDef.getColumns();
    int chkSize = partCols.size();
    chkSize = chkSize > orderCols.size() ? orderCols.size() : chkSize;
    for(int i=0; i < chkSize; i++)
    {
      if ( orderCols.get(i).getSpec().getColumnName().equals(partCols.get(i).getSpec().getColumnName()))
      {
        numOfPartColumns++;
      }
      else
        break;
    }
   
    if ( numOfPartColumns != 0 && numOfPartColumns != partCols.size())
    {
      throw new WindowingException(
          sprintf("For Input %s:n all partition columns must be in order clause or none should be specified",
              inputDesc)
          );
    }
   
    ArrayList<OrderColumnDef> combinedOrderCols = new ArrayList<OrderColumnDef>();
    if ( numOfPartColumns == 0)
    {
      for(ColumnDef cDef : partCols)
      {
        OrderColumnDef ocDef = new OrderColumnDef(cDef);
        combinedOrderCols.add(ocDef);
      }
      combinedOrderCols.addAll(orderCols);
      oDef.setColumns(combinedOrderCols);
    }
   
    return oDef;
  }
View Full Code Here

Examples of org.apache.drill.common.defs.OrderDef

     
      List<NamedExpression> keys = Lists.newArrayList();
      for(LogicalExpression e : segment.getExprs()){
        if( !(e instanceof SchemaPath)) throw new OptimizerException("The basic optimizer doesn't currently support collapsing aggregate where the segment value is something other than a SchemaPath.");
        keys.add(new NamedExpression(e, new FieldReference((SchemaPath) e)));
        orderDefs.add(new OrderDef(Direction.ASC, e));
      }
      Sort sort = new Sort(segment.getInput().accept(this, value), orderDefs, false);
     
      StreamingAggregate sa = new StreamingAggregate(sort, keys.toArray(new NamedExpression[keys.size()]), agg.getAggregations(), 1.0f);
      return sa;
View Full Code Here

Examples of org.apache.drill.common.defs.OrderDef

    @Override
    public PhysicalOperator visitJoin(Join join, Object value) throws OptimizerException {
      PhysicalOperator leftOp = join.getLeft().accept(this, value);
      List<OrderDef> leftOrderDefs = Lists.newArrayList();
      for(JoinCondition jc : join.getConditions()){
        leftOrderDefs.add(new OrderDef(Direction.ASC, jc.getLeft()));
      }
      leftOp = new Sort(leftOp, leftOrderDefs, false);
      leftOp = new SelectionVectorRemover(leftOp);
     
      PhysicalOperator rightOp = join.getRight().accept(this, value);
      List<OrderDef> rightOrderDefs = Lists.newArrayList();
      for(JoinCondition jc : join.getConditions()){
        rightOrderDefs.add(new OrderDef(Direction.ASC, jc.getRight()));
      }
      rightOp = new Sort(rightOp, rightOrderDefs, false);
      rightOp = new SelectionVectorRemover(rightOp);
     
      MergeJoinPOP mjp = new MergeJoinPOP(leftOp, rightOp, Arrays.asList(join.getConditions()), join.getJointType());
View Full Code Here

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

    if (partiSpec == null) {
      throw new SemanticException(
          "Invalid use of Windowing: there is no Partitioning associated with Windowing");
    }
    PartitionDef partDef = translate(inpShape, wdwSpec.getQueryPartitionSpec());
    OrderDef ordDef = translate(inpShape, wdwSpec.getQueryOrderSpec(), partDef);

    wdwTFnDef.setPartition(partDef);
    wdwTFnDef.setOrder(ordDef);

    /*
 
View Full Code Here

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

    applyConstantPartition(spec);
    if (spec.getPartition() == null) {
      return;
    }
    PartitionDef partDef = translate(def.getRawInputShape(), spec.getPartition());
    OrderDef orderDef = translate(def.getRawInputShape(), spec.getOrder(), partDef);
    def.setPartition(partDef);
    def.setOrder(orderDef);
  }
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.