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.operator;
 
 
 import java.util.List;
 
 import static com.facebook.presto.type.UnknownType.UNKNOWN;
 
 public class ChannelSet
 {
     private final GroupByHash hash;
     private final boolean containsNull;
 
     public ChannelSet(GroupByHash hashboolean containsNull)
     {
         this. = hash;
         this. = containsNull;
     }
 
     public Type getType()
     {
         return .getTypes().get(0);
     }
 
     public long getEstimatedSizeInBytes()
     {
         return .getEstimatedSize();
     }
 
     public int size()
     {
         return .getGroupCount();
     }
 
     public boolean containsNull()
     {
         return ;
     }
 
     public boolean contains(int positionPage pageBlock hashBlock)
     {
         int rawHash = (int..getLong(hashBlockposition);
         return .contains(positionpagerawHash);
     }
 
     public boolean contains(int positionPage page)
     {
         return .contains(positionpage);
     }
 
     public static class ChannelSetBuilder
     {
         private final GroupByHash hash;
         private final OperatorContext operatorContext;
         private final Page nullBlockPage;
 
         public ChannelSetBuilder(Type typeOptional<IntegerhashChannelint expectedPositionsOperatorContext operatorContext)
         {
             List<Typetypes = ImmutableList.of(type);
             this. = new GroupByHash(typesnew int[] {0}, hashChannelexpectedPositions);
             this. = operatorContext;
             this. = new Page(type.createBlockBuilder(new BlockBuilderStatus(), 1, .getFixedSize()).appendNull().build());
         }
 
         public ChannelSet build()
         {
             return new ChannelSet(.contains(0, ));
         }
 
         public long getEstimatedSize()
         {
             return .getEstimatedSize();
         }
 
         public int size()
         {
             return .getGroupCount();
         }
 
         public void addPage(Page page)
        {
            .getGroupIds(page);
            if ( != null) {
                .setMemoryReservation(.getEstimatedSize());
            }
        }
    }
New to GrepCode? Check out our FAQ X