Class: Arrow::SparseUnionArrayBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/arrow/sparse-union-array-builder.rb

Instance Method Summary collapse

Instance Method Details

#append_valueObject #append_value(value) ⇒ Object

Overloads:

  • #append_valueObject

    Starts appending an union record. You need to append values of fields.

  • #append_value(value) ⇒ Object

    Appends an union record including values of fields.

    Parameters:

    • value (nil, Hash)

      The union record value.

      If this is ‘nil`, the union record is null.

      If this is ‘Hash`, it’s values of fields.

Since:

  • 12.0.0



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/arrow/sparse-union-array-builder.rb', line 38

def append_value(value)
  if value.nil?
    append_null
  else
    key = value.keys[0]
    child_info = child_infos[key]
    append_value_raw(child_info[:id])
    child_infos.each do |child_key, child_info|
      builder = child_info[:builder]
      if child_key == key
        builder.append(value.values[0])
      else
        builder.append_null
      end
    end
  end
end

#append_value_rawObject



20
# File 'lib/arrow/sparse-union-array-builder.rb', line 20

alias_method :append_value_raw, :append_value