Class: Arrow::ChunkedArray

Inherits:
Object
  • Object
show all
Includes:
GenericFilterable, GenericTakeable, Enumerable
Defined in:
lib/arrow/chunked-array.rb

Instance Method Summary collapse

Methods included from GenericTakeable

included, #take_generic

Methods included from GenericFilterable

#filter_generic, included

Instance Method Details

#[](i) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/arrow/chunked-array.rb', line 50

def [](i)
  i += length if i < 0
  chunks.each do |array|
    return array[i] if i < array.length
    i -= array.length
  end
  nil
end

#chunksObject



30
31
32
# File 'lib/arrow/chunked-array.rb', line 30

def chunks
  @chunks ||= chunks_raw
end

#chunks_rawObject



29
# File 'lib/arrow/chunked-array.rb', line 29

alias_method :chunks_raw, :chunks

#each(&block) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/arrow/chunked-array.rb', line 59

def each(&block)
  return to_enum(__method__) unless block_given?

  chunks.each do |array|
    array.each(&block)
  end
end

#each_chunk(&block) ⇒ Object



75
76
77
# File 'lib/arrow/chunked-array.rb', line 75

def each_chunk(&block)
  chunks.each(&block)
end

#null?(i) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
37
38
39
40
# File 'lib/arrow/chunked-array.rb', line 34

def null?(i)
  chunks.each do |array|
    return array.null?(i) if i < array.length
    i -= array.length
  end
  nil
end

#packObject



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/arrow/chunked-array.rb', line 79

def pack
  first_chunk = chunks.first
  data_type = first_chunk.value_data_type
  case data_type
  when TimestampDataType
    builder = TimestampArrayBuilder.new(data_type)
    builder.build(to_a)
  else
    first_chunk.class.new(to_a)
  end
end

#reverse_each(&block) ⇒ Object



67
68
69
70
71
72
73
# File 'lib/arrow/chunked-array.rb', line 67

def reverse_each(&block)
  return to_enum(__method__) unless block_given?

  chunks.reverse_each do |array|
    array.reverse_each(&block)
  end
end

#valid?(i) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
45
46
47
48
# File 'lib/arrow/chunked-array.rb', line 42

def valid?(i)
  chunks.each do |array|
    return array.valid?(i) if i < array.length
    i -= array.length
  end
  nil
end