Class: ArrowFormat::Org::Apache::Arrow::Flatbuf::Union
- Inherits:
-
FlatBuffers::Table
- Object
- FlatBuffers::Table
- ArrowFormat::Org::Apache::Arrow::Flatbuf::Union
- Defined in:
- lib/arrow-format/org/apache/arrow/flatbuf/union.rb
Overview
A union is a complex type with children in Field By default ids in the type vector refer to the offsets in the children optionally typeIds provides an indirection between the child offset and the type id for each child ‘typeIds` is the id used in the type vector
Constant Summary collapse
- FIELDS =
{ mode: ::FlatBuffers::Field.new(:mode, 0, 4, :short, 0), type_ids: ::FlatBuffers::Field.new(:type_ids, 1, 6, [:int], 0), }
- Data =
define_data_class
Instance Method Summary collapse
Instance Method Details
#mode ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/arrow-format/org/apache/arrow/flatbuf/union.rb', line 27 def mode field_offset = @view.unpack_virtual_offset(4) if field_offset.zero? enum_value = 0 else enum_value = @view.unpack_short(field_offset) end ::ArrowFormat::Org::Apache::Arrow::Flatbuf::UnionMode.try_convert(enum_value) || enum_value end |
#type_ids ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/arrow-format/org/apache/arrow/flatbuf/union.rb', line 37 def type_ids field_offset = @view.unpack_virtual_offset(6) return nil if field_offset.zero? element_size = 4 @view.unpack_vector(field_offset, element_size) do |element_offset| @view.unpack_int(element_offset) end end |