use of org.apache.hyracks.api.job.resource.ClusterCapacity in project asterixdb by apache.
the class JobCapacityControllerTest method makeComputationCapacity.
private IClusterCapacity makeComputationCapacity(long memorySize, int cores) {
IClusterCapacity clusterCapacity = new ClusterCapacity();
clusterCapacity.setAggregatedMemoryByteSize(memorySize);
clusterCapacity.setAggregatedCores(cores);
return clusterCapacity;
}
use of org.apache.hyracks.api.job.resource.ClusterCapacity in project asterixdb by apache.
the class RequiredCapacityVisitorTest method testParallelGroupBy.
@Test
public void testParallelGroupBy() throws AlgebricksException {
IClusterCapacity clusterCapacity = new ClusterCapacity();
RequiredCapacityVisitor visitor = makeComputationCapacityVisitor(PARALLELISM, clusterCapacity);
// Constructs a parallel group-by query plan.
GroupByOperator globalGby = makeGroupByOperator(AbstractLogicalOperator.ExecutionMode.PARTITIONED);
ExchangeOperator exchange = new ExchangeOperator();
exchange.setPhysicalOperator(new HashPartitionExchangePOperator(Collections.emptyList(), null));
GroupByOperator localGby = makeGroupByOperator(AbstractLogicalOperator.ExecutionMode.LOCAL);
globalGby.getInputs().add(new MutableObject<>(exchange));
exchange.getInputs().add(new MutableObject<>(localGby));
// Verifies the calculated cluster capacity requirement for the test quer plan.
globalGby.accept(visitor, null);
Assert.assertTrue(clusterCapacity.getAggregatedCores() == PARALLELISM);
Assert.assertTrue(clusterCapacity.getAggregatedMemoryByteSize() == 2 * MEMORY_BUDGET * PARALLELISM + 2 * FRAME_SIZE * PARALLELISM * PARALLELISM);
}
use of org.apache.hyracks.api.job.resource.ClusterCapacity in project asterixdb by apache.
the class RequiredCapacityVisitorTest method testParallelJoin.
@Test
public void testParallelJoin() throws AlgebricksException {
IClusterCapacity clusterCapacity = new ClusterCapacity();
RequiredCapacityVisitor visitor = makeComputationCapacityVisitor(PARALLELISM, clusterCapacity);
// Constructs a join query plan.
InnerJoinOperator join = makeJoinOperator(AbstractLogicalOperator.ExecutionMode.PARTITIONED);
// Left child plan of the join.
ExchangeOperator leftChildExchange = new ExchangeOperator();
leftChildExchange.setExecutionMode(AbstractLogicalOperator.ExecutionMode.PARTITIONED);
leftChildExchange.setPhysicalOperator(new HashPartitionExchangePOperator(Collections.emptyList(), null));
InnerJoinOperator leftChild = makeJoinOperator(AbstractLogicalOperator.ExecutionMode.PARTITIONED);
join.getInputs().add(new MutableObject<>(leftChildExchange));
leftChildExchange.getInputs().add(new MutableObject<>(leftChild));
EmptyTupleSourceOperator ets = new EmptyTupleSourceOperator();
ets.setExecutionMode(AbstractLogicalOperator.ExecutionMode.PARTITIONED);
leftChild.getInputs().add(new MutableObject<>(ets));
leftChild.getInputs().add(new MutableObject<>(ets));
// Right child plan of the join.
ExchangeOperator rightChildExchange = new ExchangeOperator();
rightChildExchange.setExecutionMode(AbstractLogicalOperator.ExecutionMode.PARTITIONED);
rightChildExchange.setPhysicalOperator(new HashPartitionExchangePOperator(Collections.emptyList(), null));
GroupByOperator rightChild = makeGroupByOperator(AbstractLogicalOperator.ExecutionMode.LOCAL);
join.getInputs().add(new MutableObject<>(rightChildExchange));
rightChildExchange.getInputs().add(new MutableObject<>(rightChild));
rightChild.getInputs().add(new MutableObject<>(ets));
// Verifies the calculated cluster capacity requirement for the test quer plan.
join.accept(visitor, null);
Assert.assertTrue(clusterCapacity.getAggregatedCores() == PARALLELISM);
Assert.assertTrue(clusterCapacity.getAggregatedMemoryByteSize() == 3 * MEMORY_BUDGET * PARALLELISM + 2 * 2L * PARALLELISM * PARALLELISM * FRAME_SIZE + 3 * FRAME_SIZE * PARALLELISM);
}
use of org.apache.hyracks.api.job.resource.ClusterCapacity in project asterixdb by apache.
the class RequiredCapacityVisitorTest method testUnPartitionedJoin.
@Test
public void testUnPartitionedJoin() throws AlgebricksException {
IClusterCapacity clusterCapacity = new ClusterCapacity();
RequiredCapacityVisitor visitor = makeComputationCapacityVisitor(PARALLELISM, clusterCapacity);
// Constructs a join query plan.
InnerJoinOperator join = makeJoinOperator(AbstractLogicalOperator.ExecutionMode.UNPARTITIONED);
// Left child plan of the join.
ExchangeOperator leftChildExchange = new ExchangeOperator();
leftChildExchange.setExecutionMode(AbstractLogicalOperator.ExecutionMode.UNPARTITIONED);
leftChildExchange.setPhysicalOperator(new OneToOneExchangePOperator());
InnerJoinOperator leftChild = makeJoinOperator(AbstractLogicalOperator.ExecutionMode.UNPARTITIONED);
join.getInputs().add(new MutableObject<>(leftChildExchange));
leftChildExchange.getInputs().add(new MutableObject<>(leftChild));
EmptyTupleSourceOperator ets = new EmptyTupleSourceOperator();
ets.setExecutionMode(AbstractLogicalOperator.ExecutionMode.UNPARTITIONED);
leftChild.getInputs().add(new MutableObject<>(ets));
leftChild.getInputs().add(new MutableObject<>(ets));
// Right child plan of the join.
ExchangeOperator rightChildExchange = new ExchangeOperator();
rightChildExchange.setExecutionMode(AbstractLogicalOperator.ExecutionMode.UNPARTITIONED);
rightChildExchange.setPhysicalOperator(new OneToOneExchangePOperator());
GroupByOperator rightChild = makeGroupByOperator(AbstractLogicalOperator.ExecutionMode.UNPARTITIONED);
join.getInputs().add(new MutableObject<>(rightChildExchange));
rightChildExchange.getInputs().add(new MutableObject<>(rightChild));
rightChild.getInputs().add(new MutableObject<>(ets));
// Verifies the calculated cluster capacity requirement for the test quer plan.
join.accept(visitor, null);
Assert.assertTrue(clusterCapacity.getAggregatedCores() == 1);
Assert.assertTrue(clusterCapacity.getAggregatedMemoryByteSize() == 3 * MEMORY_BUDGET + 5L * FRAME_SIZE);
}
use of org.apache.hyracks.api.job.resource.ClusterCapacity in project asterixdb by apache.
the class SleepOperatorDescriptor method setJobCapacity.
private void setJobCapacity(JobSpecification spec) {
IClusterCapacity reqCapacity = new ClusterCapacity();
reqCapacity.setAggregatedMemoryByteSize(Long.MAX_VALUE);
spec.setRequiredClusterCapacity(reqCapacity);
}
Aggregations