Class: Humboldt::BinaryPrefixPartitioner Deprecated

Inherits:
Object
  • Object
show all
Defined in:
lib/humboldt/prefix_grouping.rb

Overview

Deprecated.

Use Rubydoop::JobDescription::secondary_sort

Direct Known Subclasses

DropBinaryPrefixPartitioner

Instance Method Summary collapse

Constructor Details

#initialize(cutoff_index) ⇒ BinaryPrefixPartitioner

Returns a new instance of BinaryPrefixPartitioner.



9
10
11
# File 'lib/humboldt/prefix_grouping.rb', line 9

def initialize(cutoff_index)
  @cutoff_index = cutoff_index
end

Instance Method Details

#partition(key, value, num_partitions) ⇒ Object



13
14
15
16
17
# File 'lib/humboldt/prefix_grouping.rb', line 13

def partition(key, value, num_partitions)
  length = @cutoff_index > key.length ? key.length : @cutoff_index
  prefix = String.from_java_bytes(key.bytes)[0, length]
  Zlib.crc32(prefix) % num_partitions
end