Search in sources :

Example 1 with MapRedTask

use of org.apache.hadoop.hive.ql.exec.MapRedTask in project SQLWindowing by hbutani.

the class MRExecutor method executePlan.

/**
	 * Invoke the MapRedTask and set the MapRedWork 
	 * query plan to be used for execution.  
	 * MapRedTask (an extension to the ExecDriver) is 
	 * used to execute the query plan on Hadoop.
	 * @param mr
	 * @param hiveConf
	 * @throws Exception
	 */
private void executePlan(MapredWork mr, HiveConf hiveConf) throws Exception {
    MapRedTask mrtask = new MapRedTask();
    DriverContext dctx = new DriverContext();
    mrtask.setWork(mr);
    mrtask.initialize(hiveConf, null, dctx);
    int exitVal = mrtask.execute(dctx);
    if (exitVal != 0) {
        System.out.println("Test execution failed with exit status: " + exitVal);
        throw new WindowingException("Test execution failed with exit status: " + exitVal);
    } else
        System.out.println("Test execution completed successfully");
}
Also used : MapRedTask(org.apache.hadoop.hive.ql.exec.MapRedTask) DriverContext(org.apache.hadoop.hive.ql.DriverContext) WindowingException(com.sap.hadoop.windowing.WindowingException)

Aggregations

WindowingException (com.sap.hadoop.windowing.WindowingException)1 DriverContext (org.apache.hadoop.hive.ql.DriverContext)1 MapRedTask (org.apache.hadoop.hive.ql.exec.MapRedTask)1