Search in sources :

Example 1 with RootNode

use of org.apache.ignite.internal.sql.engine.exec.rel.RootNode in project ignite-3 by apache.

the class RootQuery method run.

/**
 * Starts execution phase for the query and setup remote fragments.
 */
public void run(ExecutionContext<RowT> ctx, MultiStepPlan plan, Node<RowT> root) {
    synchronized (mux) {
        if (state == QueryState.CLOSED) {
            throw new IgniteInternalException("The query was cancelled while executing.");
        }
        RootNode<RowT> rootNode = new RootNode<>(ctx, plan.metadata().rowType(), this::tryClose);
        rootNode.register(root);
        addFragment(new RunningFragment<>(rootNode, ctx));
        this.root = rootNode;
        for (int i = 1; i < plan.fragments().size(); i++) {
            Fragment fragment = plan.fragments().get(i);
            List<String> nodes = plan.mapping(fragment).nodeIds();
            remotes.addAll(nodes);
            for (String node : nodes) {
                waiting.add(new RemoteFragmentKey(node, fragment.fragmentId()));
            }
        }
        state = QueryState.EXECUTING;
    }
}
Also used : RootNode(org.apache.ignite.internal.sql.engine.exec.rel.RootNode) IgniteInternalException(org.apache.ignite.lang.IgniteInternalException) Fragment(org.apache.ignite.internal.sql.engine.prepare.Fragment)

Aggregations

RootNode (org.apache.ignite.internal.sql.engine.exec.rel.RootNode)1 Fragment (org.apache.ignite.internal.sql.engine.prepare.Fragment)1 IgniteInternalException (org.apache.ignite.lang.IgniteInternalException)1