Search in sources :

Example 1 with ObjectRegistryImpl

use of org.apache.tez.runtime.common.objectregistry.ObjectRegistryImpl in project hive by apache.

the class TestMiniTezCliDriver method testCliDriver.

@Test
public void testCliDriver() throws Exception {
    // create a new object cache for tez-based tests which rely on that
    ObjectCache.setupObjectRegistry(new ObjectRegistryImpl());
    adapter.runTest(name, qfile);
}
Also used : ObjectRegistryImpl(org.apache.tez.runtime.common.objectregistry.ObjectRegistryImpl) Test(org.junit.Test)

Example 2 with ObjectRegistryImpl

use of org.apache.tez.runtime.common.objectregistry.ObjectRegistryImpl in project hive by apache.

the class AbstractMapJoin method setupMapJoin.

protected void setupMapJoin(HiveConf hiveConf, long seed, int rowCount, VectorMapJoinVariation vectorMapJoinVariation, MapJoinTestImplementation mapJoinImplementation, String[] bigTableColumnNames, TypeInfo[] bigTableTypeInfos, int[] bigTableKeyColumnNums, String[] smallTableValueColumnNames, TypeInfo[] smallTableValueTypeInfos, int[] bigTableRetainColumnNums, int[] smallTableRetainKeyColumnNums, int[] smallTableRetainValueColumnNums, SmallTableGenerationParameters smallTableGenerationParameters) throws Exception {
    this.vectorMapJoinVariation = vectorMapJoinVariation;
    this.mapJoinImplementation = mapJoinImplementation;
    testDesc = new MapJoinTestDescription(hiveConf, vectorMapJoinVariation, bigTableTypeInfos, bigTableKeyColumnNums, smallTableValueTypeInfos, smallTableRetainKeyColumnNums, smallTableGenerationParameters, MapJoinPlanVariation.DYNAMIC_PARTITION_HASH_JOIN);
    // Prepare data.  Good for ANY implementation variation.
    testData = new MapJoinTestData(rowCount, testDesc, seed);
    ObjectRegistryImpl objectRegistry = new ObjectRegistryImpl();
    ObjectCache.setupObjectRegistry(objectRegistry);
    operator = setupBenchmarkImplementation(mapJoinImplementation, testDesc, testData);
    isVectorOutput = isVectorOutput(mapJoinImplementation);
    /*
     * We don't measure data generation execution cost -- generate the big table into memory first.
     */
    if (!isVectorOutput) {
        bigTableRows = testData.getBigTableBatchSource().getRandomRows();
    } else {
        ArrayList<VectorizedRowBatch> bigTableBatchList = new ArrayList<VectorizedRowBatch>();
        VectorRandomBatchSource batchSource = testData.getBigTableBatchSource();
        batchSource.resetBatchIteration();
        while (true) {
            VectorizedRowBatch batch = testData.createBigTableBatch(testDesc);
            if (!batchSource.fillNextBatch(batch)) {
                break;
            }
            bigTableBatchList.add(batch);
        }
        bigTableBatches = bigTableBatchList.toArray(new VectorizedRowBatch[0]);
    }
}
Also used : VectorizedRowBatch(org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch) MapJoinTestDescription(org.apache.hadoop.hive.ql.exec.vector.mapjoin.MapJoinTestDescription) VectorRandomBatchSource(org.apache.hadoop.hive.ql.exec.vector.VectorRandomBatchSource) ObjectRegistryImpl(org.apache.tez.runtime.common.objectregistry.ObjectRegistryImpl) ArrayList(java.util.ArrayList) MapJoinTestData(org.apache.hadoop.hive.ql.exec.vector.mapjoin.MapJoinTestData)

Example 3 with ObjectRegistryImpl

use of org.apache.tez.runtime.common.objectregistry.ObjectRegistryImpl in project hive by apache.

the class TestVectorLimitOperator method validateVectorLimitOperator.

private void validateVectorLimitOperator(int limit, int batchSize, int expectedBatchSize) throws HiveException {
    FakeVectorRowBatchFromObjectIterables frboi = getBatch(batchSize);
    // Get next batch
    VectorizedRowBatch vrb = frboi.produceNextBatch();
    // Create limit desc with limit value
    LimitDesc ld = new LimitDesc(limit);
    VectorLimitDesc vectorDesc = new VectorLimitDesc();
    VectorLimitOperator lo = new VectorLimitOperator(new CompilationOpContext(), ld, null, vectorDesc);
    // make sure an object registry is present for the test
    ObjectCache.setupObjectRegistry(new ObjectRegistryImpl());
    lo.initialize(new Configuration(), null);
    // Process the batch
    lo.process(vrb, 0);
    // Verify batch size
    Assert.assertEquals(vrb.size, expectedBatchSize);
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) CompilationOpContext(org.apache.hadoop.hive.ql.CompilationOpContext) ObjectRegistryImpl(org.apache.tez.runtime.common.objectregistry.ObjectRegistryImpl) FakeVectorRowBatchFromObjectIterables(org.apache.hadoop.hive.ql.exec.vector.util.FakeVectorRowBatchFromObjectIterables) VectorLimitDesc(org.apache.hadoop.hive.ql.plan.VectorLimitDesc) LimitDesc(org.apache.hadoop.hive.ql.plan.LimitDesc) VectorLimitDesc(org.apache.hadoop.hive.ql.plan.VectorLimitDesc)

Example 4 with ObjectRegistryImpl

use of org.apache.tez.runtime.common.objectregistry.ObjectRegistryImpl in project tez by apache.

the class TezChild method newTezChild.

public static TezChild newTezChild(Configuration conf, String host, int port, String containerIdentifier, String tokenIdentifier, int attemptNumber, String[] localDirs, String workingDirectory, Map<String, String> serviceProviderEnvMap, @Nullable String pid, ExecutionContext executionContext, Credentials credentials, long memAvailable, String user, TezTaskUmbilicalProtocol tezUmbilical, boolean updateSysCounters, HadoopShim hadoopShim) throws IOException, InterruptedException, TezException {
    // Pull in configuration specified for the session.
    // TODO TEZ-1233. This needs to be moved over the wire rather than localizing the file
    // for each and every task, and reading it back from disk. Also needs to be per vertex.
    Limits.setConfiguration(conf);
    TezUtilsInternal.setSecurityUtilConfigration(LOG, conf);
    // singleton of ObjectRegistry for this JVM
    ObjectRegistryImpl objectRegistry = new ObjectRegistryImpl();
    return new TezChild(conf, host, port, containerIdentifier, tokenIdentifier, attemptNumber, workingDirectory, localDirs, serviceProviderEnvMap, objectRegistry, pid, executionContext, credentials, memAvailable, user, tezUmbilical, updateSysCounters, hadoopShim);
}
Also used : ObjectRegistryImpl(org.apache.tez.runtime.common.objectregistry.ObjectRegistryImpl)

Example 5 with ObjectRegistryImpl

use of org.apache.tez.runtime.common.objectregistry.ObjectRegistryImpl in project tez by apache.

the class TestProcessorContext method testDagNumber.

@Test(timeout = 5000)
public void testDagNumber() throws IOException {
    String[] localDirs = new String[] { "dummyLocalDir" };
    int appAttemptNumber = 1;
    TezUmbilical tezUmbilical = mock(TezUmbilical.class);
    String dagName = "DAG_NAME";
    String vertexName = "VERTEX_NAME";
    int vertexParallelism = 20;
    int dagNumber = 52;
    ApplicationId appId = ApplicationId.newInstance(10000, 13);
    TezDAGID dagId = TezDAGID.getInstance(appId, dagNumber);
    TezVertexID vertexId = TezVertexID.getInstance(dagId, 6);
    TezTaskID taskId = TezTaskID.getInstance(vertexId, 4);
    TezTaskAttemptID taskAttemptId = TezTaskAttemptID.getInstance(taskId, 2);
    TaskSpec mockSpec = mock(TaskSpec.class);
    when(mockSpec.getInputs()).thenReturn(Collections.singletonList(mock(InputSpec.class)));
    when(mockSpec.getOutputs()).thenReturn(Collections.singletonList(mock(OutputSpec.class)));
    Configuration conf = new Configuration();
    TezSharedExecutor sharedExecutor = new TezSharedExecutor(conf);
    LogicalIOProcessorRuntimeTask runtimeTask = new LogicalIOProcessorRuntimeTask(mockSpec, 1, conf, new String[] { "/" }, tezUmbilical, null, null, null, null, "", null, 1024, false, new DefaultHadoopShim(), sharedExecutor);
    LogicalIOProcessorRuntimeTask mockTask = spy(runtimeTask);
    Map<String, ByteBuffer> serviceConsumerMetadata = Maps.newHashMap();
    Map<String, String> auxServiceEnv = Maps.newHashMap();
    MemoryDistributor memDist = mock(MemoryDistributor.class);
    ProcessorDescriptor processorDesc = mock(ProcessorDescriptor.class);
    InputReadyTracker inputReadyTracker = mock(InputReadyTracker.class);
    ObjectRegistry objectRegistry = new ObjectRegistryImpl();
    ExecutionContext execContext = new ExecutionContextImpl("localhost");
    long memAvailable = 10000l;
    TezProcessorContextImpl procContext = new TezProcessorContextImpl(new Configuration(), localDirs, appAttemptNumber, tezUmbilical, dagName, vertexName, vertexParallelism, taskAttemptId, null, runtimeTask, serviceConsumerMetadata, auxServiceEnv, memDist, processorDesc, inputReadyTracker, objectRegistry, execContext, memAvailable, sharedExecutor);
    assertEquals(dagNumber, procContext.getDagIdentifier());
    assertEquals(appAttemptNumber, procContext.getDAGAttemptNumber());
    assertEquals(appId, procContext.getApplicationId());
    assertEquals(dagName, procContext.getDAGName());
    assertEquals(vertexName, procContext.getTaskVertexName());
    assertEquals(vertexId.getId(), procContext.getTaskVertexIndex());
    assertTrue(Arrays.equals(localDirs, procContext.getWorkDirs()));
    // test auto call of notifyProgress
    procContext.setProgress(0.1f);
    verify(mockTask, times(1)).notifyProgressInvocation();
    sharedExecutor.shutdown();
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) ObjectRegistryImpl(org.apache.tez.runtime.common.objectregistry.ObjectRegistryImpl) DefaultHadoopShim(org.apache.tez.hadoop.shim.DefaultHadoopShim) InputReadyTracker(org.apache.tez.runtime.InputReadyTracker) TezDAGID(org.apache.tez.dag.records.TezDAGID) TezVertexID(org.apache.tez.dag.records.TezVertexID) LogicalIOProcessorRuntimeTask(org.apache.tez.runtime.LogicalIOProcessorRuntimeTask) ProcessorDescriptor(org.apache.tez.dag.api.ProcessorDescriptor) ByteBuffer(java.nio.ByteBuffer) TezTaskID(org.apache.tez.dag.records.TezTaskID) ExecutionContext(org.apache.tez.runtime.api.ExecutionContext) TezSharedExecutor(org.apache.tez.common.TezSharedExecutor) MemoryDistributor(org.apache.tez.runtime.common.resources.MemoryDistributor) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) ObjectRegistry(org.apache.tez.runtime.api.ObjectRegistry) TezTaskAttemptID(org.apache.tez.dag.records.TezTaskAttemptID) Test(org.junit.Test)

Aggregations

ObjectRegistryImpl (org.apache.tez.runtime.common.objectregistry.ObjectRegistryImpl)7 CompilationOpContext (org.apache.hadoop.hive.ql.CompilationOpContext)3 LimitDesc (org.apache.hadoop.hive.ql.plan.LimitDesc)3 Configuration (org.apache.hadoop.conf.Configuration)2 HiveConf (org.apache.hadoop.hive.conf.HiveConf)2 VectorLimitDesc (org.apache.hadoop.hive.ql.plan.VectorLimitDesc)2 Test (org.junit.Test)2 ByteBuffer (java.nio.ByteBuffer)1 ArrayList (java.util.ArrayList)1 VectorRandomBatchSource (org.apache.hadoop.hive.ql.exec.vector.VectorRandomBatchSource)1 VectorizedRowBatch (org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch)1 MapJoinTestData (org.apache.hadoop.hive.ql.exec.vector.mapjoin.MapJoinTestData)1 MapJoinTestDescription (org.apache.hadoop.hive.ql.exec.vector.mapjoin.MapJoinTestDescription)1 FakeVectorRowBatchFromObjectIterables (org.apache.hadoop.hive.ql.exec.vector.util.FakeVectorRowBatchFromObjectIterables)1 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)1 TezSharedExecutor (org.apache.tez.common.TezSharedExecutor)1 ProcessorDescriptor (org.apache.tez.dag.api.ProcessorDescriptor)1 TezDAGID (org.apache.tez.dag.records.TezDAGID)1 TezTaskAttemptID (org.apache.tez.dag.records.TezTaskAttemptID)1 TezTaskID (org.apache.tez.dag.records.TezTaskID)1