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