Search in sources :

Example 21 with FileSinkDesc

use of org.apache.hadoop.hive.ql.plan.FileSinkDesc in project hive by apache.

the class TestUtilities method runRemoveTempOrDuplicateFilesTestCase.

private List<Path> runRemoveTempOrDuplicateFilesTestCase(String executionEngine, boolean dPEnabled) throws Exception {
    Configuration hconf = new HiveConf(this.getClass());
    // do this to verify that Utilities.removeTempOrDuplicateFiles does not revert to default scheme information
    hconf.set("fs.defaultFS", "hdfs://should-not-be-used/");
    hconf.set(HiveConf.ConfVars.HIVE_EXECUTION_ENGINE.varname, executionEngine);
    FileSystem localFs = FileSystem.getLocal(hconf);
    DynamicPartitionCtx dpCtx = getDynamicPartitionCtx(dPEnabled);
    Path tempDirPath = setupTempDirWithSingleOutputFile(hconf);
    FileSinkDesc conf = getFileSinkDesc(tempDirPath);
    List<Path> paths = Utilities.removeTempOrDuplicateFiles(localFs, tempDirPath, dpCtx, conf, hconf);
    String expectedScheme = tempDirPath.toUri().getScheme();
    String expectedAuthority = tempDirPath.toUri().getAuthority();
    assertPathsMatchSchemeAndAuthority(expectedScheme, expectedAuthority, paths);
    return paths;
}
Also used : Path(org.apache.hadoop.fs.Path) Configuration(org.apache.hadoop.conf.Configuration) FileSinkDesc(org.apache.hadoop.hive.ql.plan.FileSinkDesc) FileSystem(org.apache.hadoop.fs.FileSystem) DynamicPartitionCtx(org.apache.hadoop.hive.ql.plan.DynamicPartitionCtx) HiveConf(org.apache.hadoop.hive.conf.HiveConf)

Example 22 with FileSinkDesc

use of org.apache.hadoop.hive.ql.plan.FileSinkDesc in project SQLWindowing by hbutani.

the class MRExecutor method createReduceSideTree.

/**
	 * The reduce-side plan always looks like 
	 * ExtratOperator->PTFOperator->FileSinkOperator.
	 * Use the data structures initialized in MRUtils to 
	 * create the operators here.
	 * @param qdef
	 * @param mrUtils
	 * @param mr
	 * @throws WindowingException
	 */
@SuppressWarnings("unchecked")
private void createReduceSideTree(QueryDef qdef, MRUtils mrUtils, MapredWork mr) throws WindowingException {
    // reduce side work
    Operator<FileSinkDesc> op4 = OperatorFactory.get(new FileSinkDesc(mrUtils.getOutputPath(), createOutputTableDesc(qdef), false));
    Operator<PTFDesc> op3 = RuntimeUtils.createPTFOperator(new PTFDesc(SerializationUtils.serializeQueryDef(qdef)), op4);
    Operator<ExtractDesc> op2 = OperatorFactory.get(new ExtractDesc(TranslateUtils.getStringColumn(Utilities.ReduceField.VALUE.toString())), op3);
    mr.setReducer(op2);
}
Also used : FileSinkDesc(org.apache.hadoop.hive.ql.plan.FileSinkDesc) ExtractDesc(org.apache.hadoop.hive.ql.plan.ExtractDesc)

Aggregations

FileSinkDesc (org.apache.hadoop.hive.ql.plan.FileSinkDesc)22 Path (org.apache.hadoop.fs.Path)13 ArrayList (java.util.ArrayList)11 ReduceSinkDesc (org.apache.hadoop.hive.ql.plan.ReduceSinkDesc)8 ExprNodeDesc (org.apache.hadoop.hive.ql.plan.ExprNodeDesc)6 ReduceWork (org.apache.hadoop.hive.ql.plan.ReduceWork)6 SelectDesc (org.apache.hadoop.hive.ql.plan.SelectDesc)6 FileSinkOperator (org.apache.hadoop.hive.ql.exec.FileSinkOperator)4 TableScanOperator (org.apache.hadoop.hive.ql.exec.TableScanOperator)4 DynamicPartitionCtx (org.apache.hadoop.hive.ql.plan.DynamicPartitionCtx)4 FilterDesc (org.apache.hadoop.hive.ql.plan.FilterDesc)4 FileSystem (org.apache.hadoop.fs.FileSystem)3 HiveConf (org.apache.hadoop.hive.conf.HiveConf)3 CompilationOpContext (org.apache.hadoop.hive.ql.CompilationOpContext)3 TableDesc (org.apache.hadoop.hive.ql.plan.TableDesc)3 IOException (java.io.IOException)2 Serializable (java.io.Serializable)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 Context (org.apache.hadoop.hive.ql.Context)2