Class: Humboldt::BinaryPrefixComparator

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

Direct Known Subclasses

DropBinaryPrefixComparator

Instance Method Summary collapse

Constructor Details

#initialize(cutoff_index) ⇒ BinaryPrefixComparator

Returns a new instance of BinaryPrefixComparator.



28
29
30
# File 'lib/humboldt/prefix_grouping.rb', line 28

def initialize(cutoff_index)
  @cutoff_index = cutoff_index
end

Instance Method Details

#compare_raw(bytes1, start1, length1, bytes2, start2, length2) ⇒ Object



32
33
34
35
36
# File 'lib/humboldt/prefix_grouping.rb', line 32

def compare_raw(bytes1, start1, length1, bytes2, start2, length2)
  subset_length1 = @cutoff_index > length1 ? length1 : @cutoff_index
  subset_length2 = @cutoff_index > length2 ? length2 : @cutoff_index
  ::Hadoop::Io::WritableComparator.compareBytes(bytes1, start1, subset_length1, bytes2, start2, subset_length2)
end