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

Examples of org.apache.hadoop.hive.ql.plan.SelectDesc


    Operator<fileSinkDesc> op4 = OperatorFactory.get(new fileSinkDesc
                                                     (tmpdir + "mapredplan3.out",
                                                      Utilities.defaultTd, false));

    Operator<selectDesc> op5 =  OperatorFactory.get
      (new selectDesc
       (Utilities.makeList
        (getStringColumn(Utilities.ReduceField.ALIAS.toString()),
         new exprNodeFieldDesc(TypeInfoFactory.stringTypeInfo,
             new exprNodeColumnDesc(TypeInfoFactory.getListTypeInfo(
                 TypeInfoFactory.stringTypeInfo),
View Full Code Here


        PlanUtils.getDefaultTableDesc("" + Utilities.tabCode, "key,value"),
        PlanUtils.getDefaultTableDesc("" + Utilities.tabCode, "tkey,tvalue"),
        TextRecordReader.class),
     op1);

    Operator<selectDesc> op4 = OperatorFactory.get(new selectDesc(
                                     Utilities.makeList(getStringColumn("key"),
                                                        getStringColumn("value")), outputColumns), op0);

    Utilities.addMapWork(mr, src, "a", op4);
    mr.setKeyDesc(op1.getConf().getKeySerializeInfo());
View Full Code Here

        Utilities.makeList(getStringColumn("0"),
                           getStringColumn("1")),
                           outputColumns, false,
        -1, 1, -1));

    Operator<selectDesc> op4 = OperatorFactory.get(new selectDesc(
                                     Utilities.makeList(getStringColumn("key"),
                                                        getStringColumn("value")), outputColumns), op0);

    Utilities.addMapWork(mr, src, "a", op4);
    mr.setKeyDesc(op0.getConf().getKeySerializeInfo());
View Full Code Here

          PlanUtils.getDefaultTableDesc("" + Utilities.tabCode, "tkey,tvalue"),
          PlanUtils.getDefaultTableDesc("" + Utilities.tabCode, "tkey,tvalue"),
          TextRecordReader.class),
       op1);

    Operator<selectDesc> op4 = OperatorFactory.get(new selectDesc(
                                     Utilities.makeList(getStringColumn("key"),
                                                        getStringColumn("value")), outputColumns), op0);

    Utilities.addMapWork(mr, src, "a", op4);
    mr.setKeyDesc(op1.getConf().getKeySerializeInfo());
View Full Code Here

      earr.add(exprDesc1);
      earr.add(exprDesc2);
      ArrayList<String> outputCols = new ArrayList<String>();
      for (int i = 0; i < earr.size(); i++)
        outputCols.add("_col"+i);
      selectDesc selectCtx = new selectDesc(earr, outputCols);
      Operator<selectDesc> op = OperatorFactory.get(selectDesc.class);
      op.setConf(selectCtx);

      // fileSinkOperator to dump the output of the select
      //fileSinkDesc fsd = new fileSinkDesc ("file:///tmp" + File.separator + System.getProperty("user.name") + File.separator + "TestFileSinkOperator",
View Full Code Here

      earr.add(exprDesc1);
      earr.add(exprDesc2);
      ArrayList<String> outputCols = new ArrayList<String>();
      for (int i = 0; i < earr.size(); i++)
        outputCols.add("_col"+i);
      selectDesc selectCtx = new selectDesc(earr, outputCols);
      Operator<selectDesc> op = OperatorFactory.get(selectDesc.class);
      op.setConf(selectCtx);

      // scriptOperator to echo the output of the select
      tableDesc scriptOutput = PlanUtils.getDefaultTableDesc("" + Utilities.tabCode, "a,b");
View Full Code Here

          }
        }
      }
      cols = cppCtx.genColLists(op);

      selectDesc conf = op.getConf();
      // The input to the select does not matter. Go over the expressions
      // and return the ones which have a marked column
      cppCtx.getPrunedColLists().put(op, cppCtx.getSelectColsFromChildren(op, cols));
     
      if(conf.isSelStarNoCompute())
        return null;
     
      // do we need to prune the select operator?
      List<exprNodeDesc> originalColList = op.getConf().getColList();
      List<String> columns = new ArrayList<String>();
      for (exprNodeDesc expr : originalColList)
        Utilities.mergeUniqElems(columns, expr.getCols());
      // by now, 'prunedCols' are columns used by child operators, and 'columns'
      // are columns used by this select operator.
      ArrayList<String> originalOutputColumnNames = conf.getOutputColumnNames();
      if (cols.size() < originalOutputColumnNames.size()) {
        ArrayList<exprNodeDesc> newColList = new ArrayList<exprNodeDesc>();
        ArrayList<String> newOutputColumnNames = new ArrayList<String>();
        Vector<ColumnInfo> rs_oldsignature = op.getSchema().getSignature();
        Vector<ColumnInfo> rs_newsignature = new Vector<ColumnInfo>();
        RowResolver old_rr = cppCtx.getOpToParseCtxMap().get(op).getRR();
        RowResolver new_rr = new RowResolver();
        for(String col : cols){
          int index = originalOutputColumnNames.indexOf(col);
          newOutputColumnNames.add(col);
          newColList.add(originalColList.get(index));
          rs_newsignature.add(rs_oldsignature.get(index));
          String[] tabcol = old_rr.reverseLookup(col);
          ColumnInfo columnInfo = old_rr.get(tabcol[0], tabcol[1]);
          new_rr.put(tabcol[0], tabcol[1], columnInfo);
        }
        cppCtx.getOpToParseCtxMap().get(op).setRR(new_rr);
        op.getSchema().setSignature(rs_newsignature);
        conf.setColList(newColList);
        conf.setOutputColumnNames(newOutputColumnNames);
        handleChildren(op, cols, cppCtx);
      }
      return null;
    }
View Full Code Here

      outputRS .put(nm[0], nm[1], new ColumnInfo(internalName,
          valueInfo.getType(), nm[0], valueInfo.getIsPartitionCol()));
      colExprMap.put(internalName, colDesc);
    }
   
    selectDesc select = new selectDesc(exprs, outputs, false);
   
    SelectOperator sel =
      (SelectOperator)putOpInsertMap(OperatorFactory.getAndMakeChild(
          select, new RowSchema(inputRR.getColumnInfos()), input), inputRR);
   
View Full Code Here

   * @param op The select operator.
   * @return List<String> of the internal column names.
   */
  public List<String> getColsFromSelectExpr(SelectOperator op) {
    List<String> cols = new ArrayList<String>();
    selectDesc conf = op.getConf();
    ArrayList<exprNodeDesc> exprList = conf.getColList();
    for (exprNodeDesc expr : exprList)
      cols = Utilities.mergeUniqElems(cols, expr.getCols());
    return cols;
  }
View Full Code Here

   * @param colList The list of internal column names returned by the children of the select operator.
   * @return List<String> of the internal column names.
   */
  public List<String> getSelectColsFromChildren(SelectOperator op, List<String> colList) {
    List<String> cols = new ArrayList<String>();
    selectDesc conf = op.getConf();
   
    if(conf.isSelStarNoCompute()){
      cols.addAll(colList);
      return cols;
    }
   
    ArrayList<exprNodeDesc> selectExprs = conf.getColList();
   
    // The colList is the output columns used by child operators, they are different
    // from input columns of the current operator. we need to find out which input columns are used.  
    ArrayList<String> outputColumnNames = conf.getOutputColumnNames();
    for(int i=0;i<outputColumnNames.size();i++){
      if(colList.contains(outputColumnNames.get(i))){
        exprNodeDesc expr = selectExprs.get(i);
        cols = Utilities.mergeUniqElems(cols, expr.getCols());
      }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.ql.plan.SelectDesc

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.