Search in sources :

Example 1 with OperatorDescriptorId

use of org.apache.hyracks.api.dataflow.OperatorDescriptorId in project asterixdb by apache.

the class TestNodeController method getInsertPipeline.

public Pair<LSMInsertDeleteOperatorNodePushable, CommitRuntime> getInsertPipeline(IHyracksTaskContext ctx, Dataset dataset, IAType[] primaryKeyTypes, ARecordType recordType, ARecordType metaType, ILSMMergePolicyFactory mergePolicyFactory, Map<String, String> mergePolicyProperties, int[] filterFields, int[] primaryKeyIndexes, List<Integer> primaryKeyIndicators, StorageComponentProvider storageComponentProvider) throws AlgebricksException, HyracksDataException {
    PrimaryIndexInfo primaryIndexInfo = new PrimaryIndexInfo(dataset, primaryKeyTypes, recordType, metaType, mergePolicyFactory, mergePolicyProperties, filterFields, primaryKeyIndexes, primaryKeyIndicators, storageComponentProvider);
    IndexOperation op = IndexOperation.INSERT;
    IModificationOperationCallbackFactory modOpCallbackFactory = new PrimaryIndexModificationOperationCallbackFactory(getTxnJobId(), dataset.getDatasetId(), primaryIndexInfo.primaryKeyIndexes, TXN_SUBSYSTEM_PROVIDER, Operation.get(op), ResourceType.LSM_BTREE);
    IRecordDescriptorProvider recordDescProvider = primaryIndexInfo.getInsertRecordDescriptorProvider();
    IIndexDataflowHelperFactory indexHelperFactory = new IndexDataflowHelperFactory(storageComponentProvider.getStorageManager(), primaryIndexInfo.fileSplitProvider);
    LSMInsertDeleteOperatorNodePushable insertOp = new LSMInsertDeleteOperatorNodePushable(ctx, PARTITION, primaryIndexInfo.primaryIndexInsertFieldsPermutations, recordDescProvider.getInputRecordDescriptor(new ActivityId(new OperatorDescriptorId(0), 0), 0), op, true, indexHelperFactory, modOpCallbackFactory, null);
    CommitRuntime commitOp = new CommitRuntime(ctx, getTxnJobId(), dataset.getDatasetId(), primaryIndexInfo.primaryKeyIndexes, false, true, PARTITION, true);
    insertOp.setOutputFrameWriter(0, commitOp, primaryIndexInfo.rDesc);
    commitOp.setInputRecordDescriptor(0, primaryIndexInfo.rDesc);
    return Pair.of(insertOp, commitOp);
}
Also used : IndexOperation(org.apache.hyracks.storage.am.common.ophelpers.IndexOperation) PrimaryIndexModificationOperationCallbackFactory(org.apache.asterix.transaction.management.opcallbacks.PrimaryIndexModificationOperationCallbackFactory) LSMInsertDeleteOperatorNodePushable(org.apache.asterix.common.dataflow.LSMInsertDeleteOperatorNodePushable) OperatorDescriptorId(org.apache.hyracks.api.dataflow.OperatorDescriptorId) IIndexDataflowHelperFactory(org.apache.hyracks.storage.am.common.dataflow.IIndexDataflowHelperFactory) ActivityId(org.apache.hyracks.api.dataflow.ActivityId) IRecordDescriptorProvider(org.apache.hyracks.api.dataflow.value.IRecordDescriptorProvider) IModificationOperationCallbackFactory(org.apache.hyracks.storage.am.common.api.IModificationOperationCallbackFactory) CommitRuntime(org.apache.asterix.transaction.management.runtime.CommitRuntime) IIndexDataflowHelperFactory(org.apache.hyracks.storage.am.common.dataflow.IIndexDataflowHelperFactory) IndexDataflowHelperFactory(org.apache.hyracks.storage.am.common.dataflow.IndexDataflowHelperFactory)

Example 2 with OperatorDescriptorId

use of org.apache.hyracks.api.dataflow.OperatorDescriptorId in project asterixdb by apache.

the class AbstractPhysicalOperator method buildPipelineWithProjection.

private AlgebricksPipeline buildPipelineWithProjection(ILogicalPlan p, IOperatorSchema outerPlanSchema, AbstractOperatorWithNestedPlans npOp, IOperatorSchema opSchema, PlanCompiler pc) throws AlgebricksException {
    if (p.getRoots().size() > 1) {
        throw new NotImplementedException("Nested plans with several roots are not supported.");
    }
    JobSpecification nestedJob = pc.compilePlan(p, outerPlanSchema, null);
    ILogicalOperator topOpInSubplan = p.getRoots().get(0).getValue();
    JobGenContext context = pc.getContext();
    IOperatorSchema topOpInSubplanScm = context.getSchema(topOpInSubplan);
    opSchema.addAllVariables(topOpInSubplanScm);
    Map<OperatorDescriptorId, IOperatorDescriptor> opMap = nestedJob.getOperatorMap();
    if (opMap.size() != 1) {
        throw new AlgebricksException("Attempting to construct a nested plan with " + opMap.size() + " operator descriptors. Currently, nested plans can only consist in linear pipelines of Asterix micro operators.");
    }
    for (Map.Entry<OperatorDescriptorId, IOperatorDescriptor> opEntry : opMap.entrySet()) {
        IOperatorDescriptor opd = opEntry.getValue();
        if (!(opd instanceof AlgebricksMetaOperatorDescriptor)) {
            throw new AlgebricksException("Can only generate Hyracks jobs for pipelinable Asterix nested plans, not for " + opd.getClass().getName());
        }
        AlgebricksMetaOperatorDescriptor amod = (AlgebricksMetaOperatorDescriptor) opd;
        return amod.getPipeline();
    // we suppose that the top operator in the subplan already does the
    // projection for us
    }
    throw new IllegalStateException();
}
Also used : OperatorDescriptorId(org.apache.hyracks.api.dataflow.OperatorDescriptorId) IOperatorSchema(org.apache.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema) NotImplementedException(org.apache.hyracks.algebricks.common.exceptions.NotImplementedException) ILogicalOperator(org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator) AlgebricksException(org.apache.hyracks.algebricks.common.exceptions.AlgebricksException) AlgebricksMetaOperatorDescriptor(org.apache.hyracks.algebricks.runtime.operators.meta.AlgebricksMetaOperatorDescriptor) IOperatorDescriptor(org.apache.hyracks.api.dataflow.IOperatorDescriptor) JobSpecification(org.apache.hyracks.api.job.JobSpecification) Map(java.util.Map) JobGenContext(org.apache.hyracks.algebricks.core.jobgen.impl.JobGenContext)

Example 3 with OperatorDescriptorId

use of org.apache.hyracks.api.dataflow.OperatorDescriptorId in project asterixdb by apache.

the class JobSpecification method createOperatorDescriptorId.

@Override
public OperatorDescriptorId createOperatorDescriptorId(IOperatorDescriptor op) {
    OperatorDescriptorId odId = new OperatorDescriptorId(operatorIdCounter++);
    op.setOperatorId(odId);
    opMap.put(odId, op);
    return odId;
}
Also used : OperatorDescriptorId(org.apache.hyracks.api.dataflow.OperatorDescriptorId)

Example 4 with OperatorDescriptorId

use of org.apache.hyracks.api.dataflow.OperatorDescriptorId in project asterixdb by apache.

the class CCNCFunctions method writeTaskAttemptId.

private static void writeTaskAttemptId(DataOutputStream dos, TaskAttemptId taId) throws IOException {
    TaskId tid = taId.getTaskId();
    ActivityId aid = tid.getActivityId();
    OperatorDescriptorId odId = aid.getOperatorDescriptorId();
    dos.writeInt(odId.getId());
    dos.writeInt(aid.getLocalId());
    dos.writeInt(tid.getPartition());
    dos.writeInt(taId.getAttempt());
}
Also used : OperatorDescriptorId(org.apache.hyracks.api.dataflow.OperatorDescriptorId) TaskId(org.apache.hyracks.api.dataflow.TaskId) ActivityId(org.apache.hyracks.api.dataflow.ActivityId)

Example 5 with OperatorDescriptorId

use of org.apache.hyracks.api.dataflow.OperatorDescriptorId in project asterixdb by apache.

the class CCNCFunctions method readTaskAttemptId.

private static TaskAttemptId readTaskAttemptId(DataInputStream dis) throws IOException {
    int odid = dis.readInt();
    int aid = dis.readInt();
    int partition = dis.readInt();
    int attempt = dis.readInt();
    TaskAttemptId taId = new TaskAttemptId(new TaskId(new ActivityId(new OperatorDescriptorId(odid), aid), partition), attempt);
    return taId;
}
Also used : OperatorDescriptorId(org.apache.hyracks.api.dataflow.OperatorDescriptorId) TaskId(org.apache.hyracks.api.dataflow.TaskId) TaskAttemptId(org.apache.hyracks.api.dataflow.TaskAttemptId) ActivityId(org.apache.hyracks.api.dataflow.ActivityId)

Aggregations

OperatorDescriptorId (org.apache.hyracks.api.dataflow.OperatorDescriptorId)14 ActivityId (org.apache.hyracks.api.dataflow.ActivityId)7 HashMap (java.util.HashMap)5 Map (java.util.Map)5 Constraint (org.apache.hyracks.api.constraints.Constraint)4 IConnectorDescriptor (org.apache.hyracks.api.dataflow.IConnectorDescriptor)4 IOperatorDescriptor (org.apache.hyracks.api.dataflow.IOperatorDescriptor)4 TaskId (org.apache.hyracks.api.dataflow.TaskId)4 ArrayList (java.util.ArrayList)3 Pair (org.apache.commons.lang3.tuple.Pair)3 LValueConstraintExpression (org.apache.hyracks.api.constraints.expressions.LValueConstraintExpression)3 PartitionCountExpression (org.apache.hyracks.api.constraints.expressions.PartitionCountExpression)3 ConnectorDescriptorId (org.apache.hyracks.api.dataflow.ConnectorDescriptorId)3 List (java.util.List)2 AlgebricksMetaOperatorDescriptor (org.apache.hyracks.algebricks.runtime.operators.meta.AlgebricksMetaOperatorDescriptor)2 PartitionLocationExpression (org.apache.hyracks.api.constraints.expressions.PartitionLocationExpression)2 IHyracksTaskContext (org.apache.hyracks.api.context.IHyracksTaskContext)2 TaskAttemptId (org.apache.hyracks.api.dataflow.TaskAttemptId)2 IRecordDescriptorProvider (org.apache.hyracks.api.dataflow.value.IRecordDescriptorProvider)2 HyracksException (org.apache.hyracks.api.exceptions.HyracksException)2