Search in sources :

Example 16 with IOperator

use of edu.uci.ics.texera.api.dataflow.IOperator in project textdb by TextDB.

the class LogicalPlan method buildOperators.

/*
     * Build the operator objects from operator properties.
     */
private void buildOperators() throws PlanGenException {
    operatorObjectMap = new HashMap<>();
    for (String operatorID : operatorPredicateMap.keySet()) {
        IOperator operator = operatorPredicateMap.get(operatorID).newOperator(context);
        operatorObjectMap.put(operatorID, operator);
    }
}
Also used : IOperator(edu.uci.ics.texera.api.dataflow.IOperator)

Example 17 with IOperator

use of edu.uci.ics.texera.api.dataflow.IOperator in project textdb by TextDB.

the class LogicalPlan method getOperatorOutputSchema.

/**
 * Updates the current plan and fetch the schema from an operator
 * @param operatorID, the ID of an operator
 * @param operatorInputSchemaMap Map of operators to their input schemas
 * @return Schema, which includes the attributes setting of the operator
 */
public Optional<Schema> getOperatorOutputSchema(String operatorID, Map<String, List<Schema>> operatorInputSchemaMap) throws PlanGenException, DataflowException {
    IOperator currentOperator = operatorObjectMap.get(operatorID);
    Optional<Schema> outputSchema = Optional.empty();
    if (currentOperator instanceof ISourceOperator) {
        outputSchema = Optional.ofNullable(currentOperator.transformToOutputSchema());
    } else if (operatorInputSchemaMap.containsKey(operatorID)) {
        List<Schema> inputSchemaList = operatorInputSchemaMap.get(operatorID);
        try {
            outputSchema = Optional.ofNullable(currentOperator.transformToOutputSchema(inputSchemaList.toArray(new Schema[inputSchemaList.size()])));
        } catch (TexeraException e) {
            System.out.println(e.getMessage());
        }
    }
    return outputSchema;
}
Also used : ISourceOperator(edu.uci.ics.texera.api.dataflow.ISourceOperator) IOperator(edu.uci.ics.texera.api.dataflow.IOperator) Schema(edu.uci.ics.texera.api.schema.Schema) TexeraException(edu.uci.ics.texera.api.exception.TexeraException)

Example 18 with IOperator

use of edu.uci.ics.texera.api.dataflow.IOperator in project textdb by TextDB.

the class LogicalPlan method getOperatorOutputSchema.

/**
 * Updates the current plan and fetch the schema from an operator
 * @param operatorID, the ID of an operator
 * @return Schema, which includes the attributes setting of the operator
 */
public Schema getOperatorOutputSchema(String operatorID) throws PlanGenException, DataflowException {
    buildOperators();
    checkGraphCyclicity();
    connectOperators(operatorObjectMap);
    IOperator currentOperator = operatorObjectMap.get(operatorID);
    currentOperator.open();
    Schema operatorSchema = currentOperator.getOutputSchema();
    currentOperator.close();
    return operatorSchema;
}
Also used : IOperator(edu.uci.ics.texera.api.dataflow.IOperator) Schema(edu.uci.ics.texera.api.schema.Schema)

Aggregations

IOperator (edu.uci.ics.texera.api.dataflow.IOperator)18 Schema (edu.uci.ics.texera.api.schema.Schema)12 Test (org.junit.Test)11 ISink (edu.uci.ics.texera.api.dataflow.ISink)8 Plan (edu.uci.ics.texera.api.engine.Plan)8 HashMap (java.util.HashMap)8 RegexMatcher (edu.uci.ics.texera.dataflow.regexmatcher.RegexMatcher)7 TupleSink (edu.uci.ics.texera.dataflow.sink.tuple.TupleSink)7 ArrayList (java.util.ArrayList)7 Tuple (edu.uci.ics.texera.api.tuple.Tuple)6 IField (edu.uci.ics.texera.api.field.IField)5 TextField (edu.uci.ics.texera.api.field.TextField)5 OneToNBroadcastConnector (edu.uci.ics.texera.dataflow.connector.OneToNBroadcastConnector)5 DateField (edu.uci.ics.texera.api.field.DateField)4 DoubleField (edu.uci.ics.texera.api.field.DoubleField)4 IntegerField (edu.uci.ics.texera.api.field.IntegerField)4 StringField (edu.uci.ics.texera.api.field.StringField)4 Attribute (edu.uci.ics.texera.api.schema.Attribute)4 Join (edu.uci.ics.texera.dataflow.join.Join)4 ConnectorOutputOperator (edu.uci.ics.texera.dataflow.connector.OneToNBroadcastConnector.ConnectorOutputOperator)3