Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package com.facebook.presto.testing;
 
 
 import java.util.List;
 
 import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.base.Preconditions.checkState;
 
 public class MaterializingOperator
         implements Operator
 {
     public static class MaterializingOperatorFactory
             implements OperatorFactory
     {
         private final int operatorId;
         private final List<TypesourceTypes;
         private boolean closed;
 
         public MaterializingOperatorFactory(int operatorIdList<TypesourceTypes)
         {
             this. = operatorId;
             this. = sourceTypes;
         }
 
         @Override
         public List<TypegetTypes()
         {
             return ImmutableList.of();
         }
 
         @Override
         public MaterializingOperator createOperator(DriverContext driverContext)
         {
             checkState(!"Factory is already closed");
             OperatorContext operatorContext = driverContext.addOperatorContext(MaterializingOperator.class.getSimpleName());
             return new MaterializingOperator(operatorContext);
         }
 
         @Override
         public void close()
         {
              = true;
         }
     }
 
     private final OperatorContext operatorContext;
     private final MaterializedResult.Builder resultBuilder;
     private boolean finished;
     private boolean closed;
 
     public MaterializingOperator(OperatorContext operatorContextList<TypesourceTypes)
     {
         this. = checkNotNull(operatorContext"operatorContext is null");
          = MaterializedResult.resultBuilder(operatorContext.getSession(), sourceTypes);
     }
 
     public boolean isClosed()
     {
         return ;
     }
 
     {
         return .build();
     }
 
     @Override
     {
         return ;
     }
 
     @Override
     public List<TypegetTypes()
     {
         return ImmutableList.of();
     }
 
     @Override
    public void finish()
    {
         = true;
    }
    @Override
    public boolean isFinished()
    {
        return ;
    }
    @Override
    public boolean needsInput()
    {
        return !;
    }
    @Override
    public void addInput(Page page)
    {
        checkNotNull(page"page is null");
        checkState(!"operator finished");
        .page(page);
    }
    @Override
    public Page getOutput()
    {
        return null;
    }
    @Override
    public void close()
    {
         = true;
    }
New to GrepCode? Check out our FAQ X