Module: Arrow::GenericFilterable

Included in:
Array, ChunkedArray, Table
Defined in:
lib/arrow/generic-filterable.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



21
22
23
24
# File 'lib/arrow/generic-filterable.rb', line 21

def included(base)
  base.__send__(:alias_method, :filter_raw, :filter)
  base.__send__(:alias_method, :filter, :filter_generic)
end

Instance Method Details

#filter_generic(filter, options = nil) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/arrow/generic-filterable.rb', line 27

def filter_generic(filter, options=nil)
  case filter
  when ::Array
    filter_raw(BooleanArray.new(filter), options)
  when ChunkedArray
    if respond_to?(:filter_chunked_array)
      filter_chunked_array(filter, options)
    else
      # TODO: Implement this in C++
      filter_raw(filter.pack, options)
    end
  else
    filter_raw(filter, options)
  end
end