Package com.sap.hadoop.windowing.query2.definition

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


  }
 
  @Test
  public void testWindowClause() throws WindowingException
  {
    QueryDef qDef = wshell.translate("select  p_mfgr,p_name, p_size, " +
        "sum(p_size) over w1 as s, " +
        " denserank() as dr " +
        " from part_demo " +
        " partition by p_mfgr" +
        " window w1 as rows between 2 preceding and 2 following" +
        " into path='/tmp/wout2'" +
        " serde 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'" +
        " with serdeproperties('field.delim'=',')" +
        " format 'org.apache.hadoop.mapred.TextOutputFormat'");
   
    RangeBoundaryDef rBdef = (RangeBoundaryDef) qDef.getSelectList().getWindowFuncs().get(0).getWindow().getWindow().getStart();
    assert rBdef.getAmt() == 2;
    rBdef = (RangeBoundaryDef) qDef.getSelectList().getWindowFuncs().get(0).getWindow().getWindow().getEnd();
    assert rBdef.getAmt() == 2;
   
  }
View Full Code Here


  }

  public void execute(String query, QueryOutputPrinter outP) throws WindowingException
  {
    QuerySpec qSpec = parse(query);
    QueryDef q = translator.translate(qSpec, this);
   
    ArrayList<QueryDef> componentQueries;
    executor.beforeComponentization(q, this);
    QueryComponentizer qC = new QueryComponentizer(q, this);
    componentQueries = qC.componentize();
View Full Code Here

    if (wSpec.getArgs().size() > 0)
    {
      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)
    {
View Full Code Here

  {
    if ( tblFnDef.getWindow() != null )
    {
      return tblFnDef.getWindow().getOrderDef();
    }
    QueryInputDef iDef = tblFnDef.getInput();
    if ( iDef instanceof TableFuncDef )
    {
      return getTableFuncOrderDef((TableFuncDef) iDef);
    }
    throw new WindowingException("No Order by specification on Function: " + tblFnDef.getSpec());
View Full Code Here

    }

    @Override
    public QueryInputDef next()
    {
      QueryInputDef curr = nextInput;
      if ( curr instanceof TableFuncDef)
      {
        TableFuncDef tFunc = (TableFuncDef) curr;
        nextInput = tFunc.getInput();
      }
View Full Code Here

    if ( wExpr == null ) return;
   
    WhereDef whDef = new WhereDef();
    whDef.setExpression(wExpr);
   
    QueryInputDef iDef = qDef.getInput();
    InputInfo iInfo = tInfo.getInputInfo(iDef);
   
    ExprNodeDesc exprNode = TranslateUtils.buildExprNode(wExpr, iInfo.getTypeCheckCtx());
    ExprNodeEvaluator exprEval = WindowingExprNodeEvaluatorFactory.get(tInfo, exprNode);
    ObjectInspector oi = TranslateUtils.initExprNodeEvaluator(qDef, exprNode, exprEval, iInfo);
View Full Code Here

  }
 
  public static void translateSelectExprs(QueryDef qDef) throws WindowingException
  {
    QueryTranslationInfo tInfo = qDef.getTranslationInfo();
    QueryInputDef iDef = qDef.getInput();
    InputInfo iInfo = tInfo.getInputInfo(iDef);
    SelectDef selectDef = qDef.getSelectList();
    SelectSpec selectSpec = qDef.getSpec().getSelectList();
    Iterator<Object> selectExprsAndAliases = selectSpec.getColumnListAndAlias();
    int i = 0;
View Full Code Here

   */
  public static Partition executeChain(QueryDef qDef, Partition part)
      throws WindowingException
  {
    Stack<TableFuncDef> fnDefs = new Stack<TableFuncDef>();
    QueryInputDef iDef = qDef.getInput();
    while (true)
    {
      if (iDef instanceof TableFuncDef)
      {
        fnDefs.push((TableFuncDef) iDef);
View Full Code Here

   */
  public static TableFuncDef getFirstTableFunction(QueryDef qDef){
    TableFuncDef tabDef = null;
    Iterator<QueryInputDef> it = TranslateUtils.iterateInputDefs(qDef, true);
    while(it.hasNext()){
      QueryInputDef qIn = it.next();
      if(qIn instanceof TableFuncDef){
        tabDef = (TableFuncDef) qIn;
        break;
      }
    }
View Full Code Here

  protected void walkInputChain(QueryDef qDef) throws WindowingException
  {
    Iterator<QueryInputDef> it = TranslateUtils.iterateInputDefs(qDef, true);
    while(it.hasNext())
    {
      QueryInputDef nextDef = it.next();
      if (nextDef instanceof HiveTableDef)
      {
        visitor.visit((HiveTableDef) nextDef);
      }
      else if (nextDef instanceof HiveQueryDef)
View Full Code Here

TOP

Related Classes of com.sap.hadoop.windowing.query2.definition.QueryInputDef

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.