...
Remark: This example adds an operator to an existing bundle. See Add a new Bundle and Feature if a new bundles should be created.
...
Code Block | ||
---|---|---|
| ||
@Override
public SDFSchema getOutputSchemaIntern(int pos) {
final String start = "meta_valid_start";
final String end = "meta_valid_end";
// Create new Attributes
SDFAttribute starttimeStamp = new SDFAttribute(null, start,
SDFDatatype.TIMESTAMP, null, null, null);
SDFAttribute endtimeStamp = new SDFAttribute(null, end,
SDFDatatype.TIMESTAMP, null, null, null);
List<SDFAttribute> outputAttributes = new ArrayList<SDFAttribute>();
// Retrieve old attributes (they should all be part of the output schema)
outputAttributes.addAll(getInputSchema(0).getAttributes());
// add new Attributes
outputAttributes.add(starttimeStamp);
outputAttributes.add(endtimeStamp);
// Create new Schema with Factory, keep input Schema!
SDFSchema schema = SDFSchemaFactory.createNewWithAttributes(outputAttributes, getInputSchema(0)));
return schema;
} |
You can also create a totally new schema, e.g. if your operator creates a different output from the input. Here is an example for this:
Code Block |
---|
@Override public SDFSchema getOutputSchemaIntern(int pos) { SDFAttribute out1 = new SDFAttribute(...); SDFAttribute out2 = new SDFAttribute(...); SDFAttribute out3 = new SDFAttribute(...); List<SDFAttribute> outAttributes = new ArrayList<>(); outAttributes.add(out1); outAttributes.add(out2); outAttributes.add(out3); // Create new Schema with Factory, keep input Schema! SDFSchema schema = SDFSchemaFactory.createNewWithAttributes(outputAttributes, getInputSchema(0))); return schema; } |
Step 2: Create the physical operator
...