test_class.file: tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashPartitioner.java
test_class.identifier: TestHashPartitioner
test_case.body: @Test
    public final void testGetPartition() {   
      Tuple tuple1 = new VTuple(3);    
      tuple1.put(new Datum[] {
          DatumFactory.createInt4(1),
          DatumFactory.createInt4(2),
          DatumFactory.createInt4(3)
      });
      Tuple tuple2 = new VTuple(3);    
      tuple2.put(new Datum[] {
          DatumFactory.createInt4(1),
          DatumFactory.createInt4(2),
          DatumFactory.createInt4(4)
      });
      Tuple tuple3 = new VTuple(3);    
      tuple3.put(new Datum[] {
          DatumFactory.createInt4(1),
          DatumFactory.createInt4(2),
          DatumFactory.createInt4(5)
      });
      Tuple tuple4 = new VTuple(3);    
      tuple4.put(new Datum[] {
          DatumFactory.createInt4(2),
          DatumFactory.createInt4(2),
          DatumFactory.createInt4(3)
      });
      Tuple tuple5 = new VTuple(3);    
      tuple5.put(new Datum[] {
          DatumFactory.createInt4(2),
          DatumFactory.createInt4(2),
          DatumFactory.createInt4(4)
      });
      
      int [] partKeys = {0,1};
      Partitioner p = new HashPartitioner(partKeys, 2);
      
      int part1 = p.getPartition(tuple1);
      assertEquals(part1, p.getPartition(tuple2));
      assertEquals(part1, p.getPartition(tuple3));
      
      int part2 = p.getPartition(tuple4);
      assertEquals(part2, p.getPartition(tuple5));    
    }
test_case.class_method_signature: TestHashPartitioner.testGetPartition()
test_case.full_signature: @Test public final void testGetPartition()
test_case.identifier: testGetPartition
test_case.invocations: put createInt4 createInt4 createInt4 put createInt4 createInt4 createInt4 put createInt4 createInt4 createInt4 put createInt4 createInt4 createInt4 put createInt4 createInt4 createInt4 getPartition assertEquals getPartition assertEquals getPartition getPartition assertEquals getPartition
test_case.modifiers: @Test public final
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetPartition()
focal_class.declarator: keyTuple
focal_class.modifier: private final
focal_class.original_string: private final Tuple keyTuple;
focal_class.type: Tuple
focal_class.var_name: keyTuple
focal_class.file: tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/HashPartitioner.java
focal_class.identifier: HashPartitioner
focal_class.class_method_signature: HashPartitioner.HashPartitioner(final int [] keys, final int numPartitions)
focal_class.full_signature: public  HashPartitioner(final int [] keys, final int numPartitions)
focal_class.identifier: HashPartitioner
focal_class.modifiers: public
focal_class.parameters: (final int [] keys, final int numPartitions)
focal_class.signature:  HashPartitioner(final int [] keys, final int numPartitions)
focal_class.class_method_signature: HashPartitioner.getPartition(Tuple tuple)
focal_class.full_signature: @Override public int getPartition(Tuple tuple)
focal_class.identifier: getPartition
focal_class.modifiers: @Override public
focal_class.parameters: (Tuple tuple)
focal_class.return: int
focal_class.signature: int getPartition(Tuple tuple)
focal_class.superclass: extends Partitioner
focal_method.body: @Override
    public int getPartition(Tuple tuple) {
      // In outer join, partition number can be zero because of empty tables.
      // So, we should return zero for this case.
      if (numPartitions == 0)
        return 0;
  
      // build one key tuple
      for (int i = 0; i < partitionKeyIds.length; i++) {
        keyTuple.put(i, tuple.get(partitionKeyIds[i]));
      }
      return (keyTuple.hashCode() & Integer.MAX_VALUE) %
          (numPartitions == 32 ? numPartitions-1 : numPartitions);
    }
focal_method.class_method_signature: HashPartitioner.getPartition(Tuple tuple)
focal_method.full_signature: @Override public int getPartition(Tuple tuple)
focal_method.identifier: getPartition
focal_method.invocations: put get hashCode
focal_method.modifiers: @Override public
focal_method.parameters: (Tuple tuple)
focal_method.return: int
focal_method.signature: int getPartition(Tuple tuple)