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();
}
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);
}
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);
}
}
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);
}
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();
}
Aggregations