Class: Arrow::Slicer::NotColumnCondition

Inherits:
Condition
  • Object
show all
Defined in:
lib/arrow/slicer.rb

Instance Method Summary collapse

Methods inherited from Condition

#&, #^, #|

Constructor Details

#initialize(column) ⇒ NotColumnCondition

Returns a new instance of NotColumnCondition.



185
186
187
# File 'lib/arrow/slicer.rb', line 185

def initialize(column)
  @column = column
end

Instance Method Details

#!@Object



209
210
211
# File 'lib/arrow/slicer.rb', line 209

def !@
  ColumnCondition.new(@column)
end

#evaluateObject



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/arrow/slicer.rb', line 189

def evaluate
  data = @column.data
  raw_array = []
  data.each_chunk do |chunk|
    if chunk.is_a?(BooleanArray)
      boolean_array = chunk
    else
      boolean_array = chunk.cast(BooleanDataType.new, nil)
    end
    boolean_array.each do |value|
      if value.nil?
        raw_array << value
      else
        raw_array << !value
      end
    end
  end
  BooleanArray.new(raw_array)
end