presto-main/src/main/java/io/prestosql/execution/SqlTaskExecution.java/CheckTaskCompletionOnBufferFinish/stateChanged
class CheckTaskCompletionOnBufferFinish:        @Override
        public void stateChanged(BufferState newState)
        {
            if (newState == BufferState.FINISHED) {
                SqlTaskExecution sqlTaskExecution = sqlTaskExecutionReference.get();
                if (sqlTaskExecution != null) {
                    sqlTaskExecution.checkTaskCompletion();
                }
            }
        }