@@ -0,0 +1,1696 @@
+/*%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.facebook.presto.operator;%0A%0Aimport java.util.concurrent.Future;%0A%0Aimport static com.google.common.base.Preconditions.checkArgument;%0Aimport static io.airlift.concurrent.MoreFutures.getFutureValue;%0Aimport static java.util.Objects.requireNonNull;%0A%0Apublic class Operators%0A%7B%0A    private Operators() %7B%7D%0A%0A    // TODO replace with MoreFutures.getDone%0A    public static %3CT%3E T getDone(Future%3CT%3E future)%0A    %7B%0A        requireNonNull(future, %22future is null%22);%0A        checkArgument(future.isDone(), %22future not done yet%22);%0A        return getFutureValue(future);%0A    %7D%0A%0A    /**%0A     * Checks that the completed future completed successfully.%0A     */%0A    // TODO replace with MoreFutures.checkSuccess%0A    public static void checkSuccess(Future%3C?%3E future, String errorMessage)%0A    %7B%0A        requireNonNull(future, %22future is null%22);%0A        requireNonNull(errorMessage, %22errorMessage is null%22);%0A        checkArgument(future.isDone(), %22future not done yet%22);%0A        try %7B%0A            getFutureValue(future);%0A        %7D%0A        catch (RuntimeException e) %7B%0A            throw new IllegalArgumentException(errorMessage, e);%0A        %7D%0A    %7D%0A%7D%0A

Add utility functions aiding Operator implementations