Package com.sap.hadoop.windowing.query2.translate

Examples of com.sap.hadoop.windowing.query2.translate.InputTranslation


    {
      executor.execute(q, this);
    }
    finally
    {
      HiveTableDef hiveTable = q.getHiveTableDef();
      if ( hiveTable instanceof HiveQueryDef )
      {
        String tableName = hiveTable.getHiveTableSpec().getTableName();
        hiveQryExec.dropTable(tableName);
      }
     
    }
   
View Full Code Here


      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

    {
      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

        " 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

    throws WindowingException
  {
    WindowDef tWindow = tFnDef.getWindow();
    WindowDef fWindow = wFnDef.getWindow();
   
    PartitionDef tPart = tWindow == null ? null : tWindow.getPartDef();
    PartitionDef fPart = fWindow == null ? null : fWindow.getPartDef();
   
    if ( !TranslateUtils.isCompatible(tPart, fPart))
    {
      throw new WindowingException(
          sprintf("Window Function '%s' has an incompatible partition clause", wFnDef.getSpec()));
View Full Code Here

    qdw.walk(qDef);
  }

  protected void setupKeysWrapper(ObjectInspector inputOI) throws HiveException
  {
    PartitionDef pDef = RuntimeUtils.getFirstTableFunction(qDef).getWindow().getPartDef();
    ArrayList<ColumnDef> cols = pDef.getColumns();
    int numCols = cols.size();
    ExprNodeEvaluator[] keyFields = new ExprNodeEvaluator[numCols];
    ObjectInspector[] keyOIs = new ObjectInspector[numCols];
    ObjectInspector[] currentKeyOIs = new ObjectInspector[numCols];
   
View Full Code Here

 
  public QueryDef translate(QuerySpec qSpec, WindowingShell wShell) throws WindowingException
  {
    // clone the cfg
    HiveConf qCfg = new HiveConf(wShell.getCfg());
    QueryDef qry = new QueryDef();
    qry.setSpec(qSpec);
   
    QueryTranslationInfo transInfo = new QueryTranslationInfo();
    transInfo.setHiveCfg(qCfg);
    transInfo.setWshell(wShell);
    try
    {
      transInfo.setHive(Hive.get(qCfg));
      transInfo.setHiveMSClient(HiveUtils.getClient(qCfg));
    }
    catch(HiveException he)
    {
      throw new WindowingException(he);
    }
    qry.setTranslationInfo(transInfo);
   
    InputTranslation.translate(qry);
    WhereTranslation.translate(qry);
    OutputTranslation.translate(qry);
View Full Code Here

  @Test
  public void test() throws Exception
  {
    System.out.println("Beginning testReduceOnlyPlan");

    QueryDef qDef = wshell
        .translate("select  p_mfgr,p_name, p_size,\n"
            + "rank() as r,\n"
            + "denserank() as dr\n"
            + "from part_tiny\n"
            + "partition by p_mfgr\n"
View Full Code Here

  @Test
  public void testNPath() throws Exception
  {
    System.out.println("Beginning testReduceOnlyPlan");

    QueryDef qDef = wshell
        .translate(" select origin_city_name, fl_num, year, month, day_of_month, sz, tpath " +
            " from npath( " +
            "         flights_tiny " +
            "         partition by fl_num " +
            "        order by year, month, day_of_month, " +
View Full Code Here

  }
 
  @Test
  public void testAddInOrder() 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'");
   
    OrderDef oDef = qDef.getInput().getWindow().getOrderDef();
    assert oDef != null;
    assert oDef.getSpec().getColumns().get(0).getColumnName() == "p_mfgr";
   
  }
View Full Code Here

TOP

Related Classes of com.sap.hadoop.windowing.query2.translate.InputTranslation

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.