Github user sohami commented on a diff in the pull request: https://github.com/apache/drill/pull/919#discussion_r135948567 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java --- @@ -1073,26 +1070,22 @@ public QueryId getQueryId() { */ private void setupRootFragment(final PlanFragment rootFragment, final FragmentRoot rootOperator) throws ExecutionSetupException { - @SuppressWarnings("resource") final FragmentContext rootContext = new FragmentContext(drillbitContext, rootFragment, queryContext, initiatingClient, drillbitContext.getFunctionImplementationRegistry()); - @SuppressWarnings("resource") - final IncomingBuffers buffers = new IncomingBuffers(rootFragment, rootContext); - rootContext.setBuffers(buffers); - - queryManager.addFragmentStatusTracker(rootFragment, true); - final ControlTunnel tunnel = drillbitContext.getController().getTunnel(queryContext.getCurrentEndpoint()); + final FragmentStatusReporter statusReporter = new FragmentStatusReporter(rootContext, tunnel); final FragmentExecutor rootRunner = new FragmentExecutor(rootContext, rootFragment, - new FragmentStatusReporter(rootContext, tunnel), - rootOperator); - final RootFragmentManager fragmentManager = new RootFragmentManager(rootFragment.getHandle(), buffers, rootRunner); + statusReporter, rootOperator); - if (buffers.isDone()) { + queryManager.addFragmentStatusTracker(rootFragment, true); + + // FragmentManager is setting buffer for FragmentContext + if (rootContext.isBuffersDone()) { --- End diff -- Inside AbstractFragmentManager constructor, since that's where the Incoming Buffers are created. https://github.com/apache/drill/pull/919/files#diff-d7418a1fd07314f268049ae9f07b7ed3 ``` + public AbstractFragmentManager(final PlanFragment fragment, final FragmentExecutor executor, final FragmentStatusReporter statusReporter, final FragmentRoot rootOperator) { + this.fragmentHandle = fragment.getHandle(); + this.fragmentContext = executor.getContext(); + this.buffers = new IncomingBuffers(fragment, fragmentContext); + this.fragmentContext.setBuffers(buffers); ```
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---