Class: Arrow::Slicer::ColumnCondition

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

Instance Method Summary collapse

Methods inherited from Condition

#&, #^, #|

Constructor Details

#initialize(column) ⇒ ColumnCondition

Returns a new instance of ColumnCondition.



113
114
115
# File 'lib/arrow/slicer.rb', line 113

def initialize(column)
  @column = column
end

Instance Method Details

#!=(value) ⇒ Object



151
152
153
# File 'lib/arrow/slicer.rb', line 151

def !=(value)
  NotEqualCondition.new(@column, value)
end

#!@Object



135
136
137
# File 'lib/arrow/slicer.rb', line 135

def !@
  NotColumnCondition.new(@column)
end

#<(value) ⇒ Object



155
156
157
# File 'lib/arrow/slicer.rb', line 155

def <(value)
  LessCondition.new(@column, value)
end

#<=(value) ⇒ Object



159
160
161
# File 'lib/arrow/slicer.rb', line 159

def <=(value)
  LessEqualCondition.new(@column, value)
end

#==(value) ⇒ Object



147
148
149
# File 'lib/arrow/slicer.rb', line 147

def ==(value)
  EqualCondition.new(@column, value)
end

#>(value) ⇒ Object



163
164
165
# File 'lib/arrow/slicer.rb', line 163

def >(value)
  GreaterCondition.new(@column, value)
end

#>=(value) ⇒ Object



167
168
169
# File 'lib/arrow/slicer.rb', line 167

def >=(value)
  GreaterEqualCondition.new(@column, value)
end

#evaluateObject



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/arrow/slicer.rb', line 117

def evaluate
  data = @column.data

  case @column.data_type
  when BooleanDataType
    data
  else
    if data.n_chunks == 1
      data.get_chunk(0).cast(BooleanDataType.new, nil)
    else
      arrays = data.each_chunk.collect do |chunk|
        chunk.cast(BooleanDataType.new, nil)
      end
      ChunkedArray.new(arrays)
    end
  end
end

#in?(values) ⇒ Boolean

Returns:

  • (Boolean)


171
172
173
# File 'lib/arrow/slicer.rb', line 171

def in?(values)
  InCondition.new(@column, values)
end

#null?Boolean

Returns:

  • (Boolean)


139
140
141
# File 'lib/arrow/slicer.rb', line 139

def null?
  self == nil
end

#reject(&block) ⇒ Object



179
180
181
# File 'lib/arrow/slicer.rb', line 179

def reject(&block)
  RejectCondition.new(@column, block)
end

#select(&block) ⇒ Object



175
176
177
# File 'lib/arrow/slicer.rb', line 175

def select(&block)
  SelectCondition.new(@column, block)
end

#valid?Boolean

Returns:

  • (Boolean)


143
144
145
# File 'lib/arrow/slicer.rb', line 143

def valid?
  self != nil
end