Search in sources :

Example 6 with IPushRuntimeFactory

use of org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory in project asterixdb by apache.

the class AlgebricksMetaOperatorDescriptor method toString.

@Override
public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("Asterix { \n");
    for (IPushRuntimeFactory f : pipeline.getRuntimeFactories()) {
        sb.append("  " + f.toString() + ";\n");
    }
    sb.append("}");
    return sb.toString();
}
Also used : IPushRuntimeFactory(org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory)

Example 7 with IPushRuntimeFactory

use of org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory in project asterixdb by apache.

the class SinkWritePOperator method contributeRuntimeOperator.

@Override
public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op, IOperatorSchema propagatedSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema) throws AlgebricksException {
    WriteOperator write = (WriteOperator) op;
    int[] columns = new int[write.getExpressions().size()];
    int i = 0;
    for (Mutable<ILogicalExpression> exprRef : write.getExpressions()) {
        ILogicalExpression expr = exprRef.getValue();
        if (expr.getExpressionTag() != LogicalExpressionTag.VARIABLE) {
            throw new NotImplementedException("Only writing variable expressions is supported.");
        }
        VariableReferenceExpression varRef = (VariableReferenceExpression) expr;
        LogicalVariable v = varRef.getVariableReference();
        columns[i++] = inputSchemas[0].findVariable(v);
    }
    RecordDescriptor recDesc = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), propagatedSchema, context);
    RecordDescriptor inputDesc = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op.getInputs().get(0).getValue()), inputSchemas[0], context);
    IPrinterFactory[] pf = JobGenHelper.mkPrinterFactories(inputSchemas[0], context.getTypeEnvironment(op), context, columns);
    IMetadataProvider<?, ?> mp = context.getMetadataProvider();
    Pair<IPushRuntimeFactory, AlgebricksPartitionConstraint> runtime = mp.getWriteFileRuntime(write.getDataSink(), columns, pf, inputDesc);
    builder.contributeMicroOperator(write, runtime.first, recDesc, runtime.second);
    ILogicalOperator src = write.getInputs().get(0).getValue();
    builder.contributeGraphEdge(src, 0, write, 0);
}
Also used : LogicalVariable(org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable) RecordDescriptor(org.apache.hyracks.api.dataflow.value.RecordDescriptor) NotImplementedException(org.apache.hyracks.algebricks.common.exceptions.NotImplementedException) ILogicalOperator(org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator) IPushRuntimeFactory(org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory) AlgebricksPartitionConstraint(org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint) ILogicalExpression(org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression) IPrinterFactory(org.apache.hyracks.algebricks.data.IPrinterFactory) VariableReferenceExpression(org.apache.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression) WriteOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.WriteOperator) AlgebricksPartitionConstraint(org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint)

Example 8 with IPushRuntimeFactory

use of org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory in project asterixdb by apache.

the class PigletMetadataProvider method getWriteFileRuntime.

@Override
public Pair<IPushRuntimeFactory, AlgebricksPartitionConstraint> getWriteFileRuntime(IDataSink sink, int[] printColumns, IPrinterFactory[] printerFactories, RecordDescriptor inputDesc) throws AlgebricksException {
    PigletFileDataSink ds = (PigletFileDataSink) sink;
    FileSplit[] fileSplits = ds.getFileSplits();
    String[] locations = new String[fileSplits.length];
    for (int i = 0; i < fileSplits.length; ++i) {
        locations[i] = fileSplits[i].getNodeName();
    }
    IPushRuntimeFactory prf;
    try {
        prf = new SinkWriterRuntimeFactory(printColumns, printerFactories, fileSplits[0].getFile(null), PrinterBasedWriterFactory.INSTANCE, inputDesc);
        AlgebricksAbsolutePartitionConstraint constraint = new AlgebricksAbsolutePartitionConstraint(locations);
        return new Pair<>(prf, constraint);
    } catch (HyracksDataException e) {
        throw new AlgebricksException(e);
    }
}
Also used : SinkWriterRuntimeFactory(org.apache.hyracks.algebricks.runtime.operators.std.SinkWriterRuntimeFactory) AlgebricksAbsolutePartitionConstraint(org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint) AlgebricksException(org.apache.hyracks.algebricks.common.exceptions.AlgebricksException) FileSplit(org.apache.hyracks.api.io.FileSplit) IPushRuntimeFactory(org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory) AlgebricksPartitionConstraint(org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint) AlgebricksAbsolutePartitionConstraint(org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) Pair(org.apache.hyracks.algebricks.common.utils.Pair)

Example 9 with IPushRuntimeFactory

use of org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory in project asterixdb by apache.

the class JobBuilder method buildMetaAsterixOpDesc.

private AlgebricksMetaOperatorDescriptor buildMetaAsterixOpDesc(List<Pair<IPushRuntimeFactory, RecordDescriptor>> opContents) {
    int n = opContents.size();
    IPushRuntimeFactory[] runtimeFactories = new IPushRuntimeFactory[n];
    RecordDescriptor[] internalRecordDescriptors = new RecordDescriptor[n];
    int i = 0;
    for (Pair<IPushRuntimeFactory, RecordDescriptor> p : opContents) {
        runtimeFactories[i] = p.first;
        internalRecordDescriptors[i] = p.second;
        i++;
    }
    ILogicalOperator lastLogicalOp = revMicroOpMap.get(runtimeFactories[n - 1]);
    ArrayList<ILogicalOperator> outOps = outEdges.get(lastLogicalOp);
    int outArity = (outOps == null) ? 0 : outOps.size();
    ILogicalOperator firstLogicalOp = revMicroOpMap.get(runtimeFactories[0]);
    ArrayList<ILogicalOperator> inOps = inEdges.get(firstLogicalOp);
    int inArity = (inOps == null) ? 0 : inOps.size();
    return new AlgebricksMetaOperatorDescriptor(jobSpec, inArity, outArity, runtimeFactories, internalRecordDescriptors);
}
Also used : RecordDescriptor(org.apache.hyracks.api.dataflow.value.RecordDescriptor) ILogicalOperator(org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator) AlgebricksMetaOperatorDescriptor(org.apache.hyracks.algebricks.runtime.operators.meta.AlgebricksMetaOperatorDescriptor) IPushRuntimeFactory(org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory) AlgebricksPartitionConstraint(org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint) AlgebricksAbsolutePartitionConstraint(org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint) AlgebricksCountPartitionConstraint(org.apache.hyracks.algebricks.common.constraints.AlgebricksCountPartitionConstraint)

Example 10 with IPushRuntimeFactory

use of org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory in project asterixdb by apache.

the class SubplanRuntimeFactory method toString.

@Override
public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("Subplan { \n");
    for (IPushRuntimeFactory f : pipeline.getRuntimeFactories()) {
        sb.append("  " + f.toString() + ";\n");
    }
    sb.append("}");
    return sb.toString();
}
Also used : IPushRuntimeFactory(org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory)

Aggregations

IPushRuntimeFactory (org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory)12 RecordDescriptor (org.apache.hyracks.api.dataflow.value.RecordDescriptor)8 AlgebricksPartitionConstraint (org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint)5 ILogicalOperator (org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator)5 AlgebricksAbsolutePartitionConstraint (org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Pair (org.apache.hyracks.algebricks.common.utils.Pair)2 LogicalVariable (org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable)2 IPushRuntime (org.apache.hyracks.algebricks.runtime.base.IPushRuntime)2 AlgebricksMetaOperatorDescriptor (org.apache.hyracks.algebricks.runtime.operators.meta.AlgebricksMetaOperatorDescriptor)2 IFrameWriter (org.apache.hyracks.api.comm.IFrameWriter)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 LSMTreeInsertDeleteOperatorDescriptor (org.apache.asterix.common.dataflow.LSMTreeInsertDeleteOperatorDescriptor)1 JobId (org.apache.asterix.common.transactions.JobId)1 FeedConnectionId (org.apache.asterix.external.feed.management.FeedConnectionId)1 FeedCollectOperatorDescriptor (org.apache.asterix.external.operators.FeedCollectOperatorDescriptor)1 FeedIntakeOperatorDescriptor (org.apache.asterix.external.operators.FeedIntakeOperatorDescriptor)1 FeedMetaOperatorDescriptor (org.apache.asterix.external.operators.FeedMetaOperatorDescriptor)1