use of org.apache.hyracks.dataflow.std.misc.SinkOperatorDescriptor in project asterixdb by apache.
the class SleepOperatorDescriptor method jobWithSleepOp.
private JobSpecification jobWithSleepOp() {
JobSpecification spec = new JobSpecification();
FileSplit[] ordersSplits = new FileSplit[] { new ManagedFileSplit(ASTERIX_IDS[0], "data" + File.separator + "tpch0.001" + File.separator + "orders-part1.tbl") };
IFileSplitProvider ordersSplitsProvider = new ConstantFileSplitProvider(ordersSplits);
RecordDescriptor recordDesc = new RecordDescriptor(new ISerializerDeserializer[] { new UTF8StringSerializerDeserializer(), new UTF8StringSerializerDeserializer(), new UTF8StringSerializerDeserializer(), new UTF8StringSerializerDeserializer(), new UTF8StringSerializerDeserializer(), new UTF8StringSerializerDeserializer(), new UTF8StringSerializerDeserializer(), new UTF8StringSerializerDeserializer(), new UTF8StringSerializerDeserializer() });
// File scan operator.
FileScanOperatorDescriptor scanOp = new FileScanOperatorDescriptor(spec, ordersSplitsProvider, new DelimitedDataTupleParserFactory(new IValueParserFactory[] { UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE }, '|'), recordDesc);
PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, scanOp, ASTERIX_IDS[0]);
// Sleep operator.
SleepOperatorDescriptor sleepOp = new SleepOperatorDescriptor(spec);
PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, sleepOp, ASTERIX_IDS);
// Sink operator.
SinkOperatorDescriptor sinkOp = new SinkOperatorDescriptor(spec, 1);
PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, sinkOp, ASTERIX_IDS);
// Hash-repartitioning connector.
IConnectorDescriptor conn1 = new MToNPartitioningConnectorDescriptor(spec, new FieldHashPartitionComputerFactory(new int[] { 0 }, new IBinaryHashFunctionFactory[] { PointableBinaryHashFunctionFactory.of(UTF8StringPointable.FACTORY) }));
spec.connect(conn1, scanOp, 0, sleepOp, 0);
// One-to-one connector.
IConnectorDescriptor conn2 = new OneToOneConnectorDescriptor(spec);
spec.connect(conn2, sleepOp, 0, sinkOp, 0);
return spec;
}
use of org.apache.hyracks.dataflow.std.misc.SinkOperatorDescriptor in project asterixdb by apache.
the class SinkPOperator method contributeRuntimeOperator.
@Override
public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op, IOperatorSchema propagatedSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema) throws AlgebricksException {
IOperatorDescriptorRegistry spec = builder.getJobSpec();
SinkOperatorDescriptor opDesc = new SinkOperatorDescriptor(spec, op.getInputs().size());
contributeOpDesc(builder, (AbstractLogicalOperator) op, opDesc);
for (int i = 0; i < op.getInputs().size(); i++) {
builder.contributeGraphEdge(op.getInputs().get(i).getValue(), 0, op, i);
}
}
use of org.apache.hyracks.dataflow.std.misc.SinkOperatorDescriptor in project asterixdb by apache.
the class SleepOperatorDescriptor method jobWithSleepSourceOp.
private JobSpecification jobWithSleepSourceOp() {
JobSpecification spec = new JobSpecification();
SleepSourceOperatorDescriptor sourceOpDesc = new SleepSourceOperatorDescriptor(spec);
PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, sourceOpDesc, ASTERIX_IDS);
SinkOperatorDescriptor sinkOpDesc = new SinkOperatorDescriptor(spec, 1);
PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, sinkOpDesc, ASTERIX_IDS);
IConnectorDescriptor conn = new OneToOneConnectorDescriptor(spec);
spec.connect(conn, sourceOpDesc, 0, sinkOpDesc, 0);
spec.addRoot(sinkOpDesc);
return spec;
}
use of org.apache.hyracks.dataflow.std.misc.SinkOperatorDescriptor in project asterixdb by apache.
the class JobFailureTest method execTest.
private void execTest() throws Exception {
JobSpecification spec = new JobSpecification();
AbstractSingleActivityOperatorDescriptor sourceOpDesc = new ExceptionOnCreatePushRuntimeOperatorDescriptor(spec, 0, 1, new int[] { 4 }, true);
PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, sourceOpDesc, ASTERIX_IDS);
SinkOperatorDescriptor sinkOpDesc = new SinkOperatorDescriptor(spec, 1);
PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, sinkOpDesc, ASTERIX_IDS);
IConnectorDescriptor conn = new OneToOneConnectorDescriptor(spec);
spec.connect(conn, sourceOpDesc, 0, sinkOpDesc, 0);
spec.addRoot(sinkOpDesc);
try {
runTest(spec);
} catch (Exception e) {
e.printStackTrace();
throw e;
}
Assert.assertTrue(ExceptionOnCreatePushRuntimeOperatorDescriptor.stats() + ExceptionOnCreatePushRuntimeOperatorDescriptor.succeed(), ExceptionOnCreatePushRuntimeOperatorDescriptor.succeed());
// should also check the content of the different ncs
}
Aggregations