Search in sources :

Example 1 with PlanGenException

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;
}
Also used : JsonProperty(com.fasterxml.jackson.annotation.JsonProperty) OneToNBroadcastConnector(edu.uci.ics.textdb.exp.connector.OneToNBroadcastConnector) HashMap(java.util.HashMap) PlanGenException(edu.uci.ics.textdb.api.exception.PlanGenException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ArrayList(java.util.ArrayList) PredicateBase(edu.uci.ics.textdb.exp.common.PredicateBase) HashSet(java.util.HashSet) LinkedHashMap(java.util.LinkedHashMap) Join(edu.uci.ics.textdb.exp.join.Join) List(java.util.List) ISink(edu.uci.ics.textdb.api.dataflow.ISink) Plan(edu.uci.ics.textdb.api.engine.Plan) JsonCreator(com.fasterxml.jackson.annotation.JsonCreator) PropertyNameConstants(edu.uci.ics.textdb.exp.common.PropertyNameConstants) LinkedHashSet(java.util.LinkedHashSet) IOperator(edu.uci.ics.textdb.api.dataflow.IOperator) ISink(edu.uci.ics.textdb.api.dataflow.ISink) IOperator(edu.uci.ics.textdb.api.dataflow.IOperator)

Aggregations

JsonCreator (com.fasterxml.jackson.annotation.JsonCreator)1 JsonProperty (com.fasterxml.jackson.annotation.JsonProperty)1 IOperator (edu.uci.ics.textdb.api.dataflow.IOperator)1 ISink (edu.uci.ics.textdb.api.dataflow.ISink)1 Plan (edu.uci.ics.textdb.api.engine.Plan)1 PlanGenException (edu.uci.ics.textdb.api.exception.PlanGenException)1 PredicateBase (edu.uci.ics.textdb.exp.common.PredicateBase)1 PropertyNameConstants (edu.uci.ics.textdb.exp.common.PropertyNameConstants)1 OneToNBroadcastConnector (edu.uci.ics.textdb.exp.connector.OneToNBroadcastConnector)1 Join (edu.uci.ics.textdb.exp.join.Join)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 List (java.util.List)1