Search in sources :

Example 1 with PlanGenException

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

Aggregations

JsonCreator (com.fasterxml.jackson.annotation.JsonCreator)1 JsonProperty (com.fasterxml.jackson.annotation.JsonProperty)1 IOperator (edu.uci.ics.texera.api.dataflow.IOperator)1 ISink (edu.uci.ics.texera.api.dataflow.ISink)1 Plan (edu.uci.ics.texera.api.engine.Plan)1 PlanGenException (edu.uci.ics.texera.api.exception.PlanGenException)1 Schema (edu.uci.ics.texera.api.schema.Schema)1 PredicateBase (edu.uci.ics.texera.dataflow.common.PredicateBase)1 PropertyNameConstants (edu.uci.ics.texera.dataflow.common.PropertyNameConstants)1 OneToNBroadcastConnector (edu.uci.ics.texera.dataflow.connector.OneToNBroadcastConnector)1 Join (edu.uci.ics.texera.dataflow.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