use of edu.uci.ics.textdb.api.exception.PlanGenException in project textdb by TextDB.
the class LogicalPlan method findSinkOperator.
/*
* Finds the sink operator in the operator graph.
*
* This function assumes that the graph is valid and there is only one sink in the graph.
*/
private ISink findSinkOperator(HashMap<String, IOperator> operatorObjectMap) throws PlanGenException {
IOperator sinkOperator = adjacencyList.keySet().stream().filter(operator -> operatorPredicateMap.get(operator).getClass().toString().toLowerCase().contains("sink")).map(operator -> operatorObjectMap.get(operator)).findFirst().orElse(null);
PlanGenUtils.planGenAssert(sinkOperator != null, "Error: sink operator doesn't exist.");
PlanGenUtils.planGenAssert(sinkOperator instanceof ISink, "Error: sink operator's type doesn't match.");
return (ISink) sinkOperator;
}
Aggregations