Class: ArrowFormat::MapType
- Inherits:
-
VariableSizeListType
- Object
- Type
- VariableSizeListType
- ArrowFormat::MapType
- Defined in:
- lib/arrow-format/type.rb
Instance Attribute Summary
Attributes inherited from VariableSizeListType
Instance Method Summary collapse
- #build_array(size, validity_buffer, offsets_buffer, child) ⇒ Object
-
#initialize(child, keys_sorted) ⇒ MapType
constructor
A new instance of MapType.
- #keys_sorted? ⇒ Boolean
- #name ⇒ Object
- #offset_buffer_type ⇒ Object
- #to_flatbuffers ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(child, keys_sorted) ⇒ MapType
Returns a new instance of MapType.
912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 |
# File 'lib/arrow-format/type.rb', line 912 def initialize(child, keys_sorted) if child.nullable? raise TypeError.new("Map entry field must not be nullable: " + child.inspect) end type = child.type unless type.is_a?(StructType) raise TypeError.new("Map entry type must be struct: #{type.inspect}") end unless type.children.size == 2 raise TypeError.new("Map entry struct type must have 2 children: " + type.inspect) end if type.children[0].nullable? raise TypeError.new("Map key field must not be nullable: " + type.children[0].inspect) end super(child) @keys_sorted = keys_sorted end |
Instance Method Details
#build_array(size, validity_buffer, offsets_buffer, child) ⇒ Object
945 946 947 |
# File 'lib/arrow-format/type.rb', line 945 def build_array(size, validity_buffer, offsets_buffer, child) MapArray.new(self, size, validity_buffer, offsets_buffer, child) end |
#keys_sorted? ⇒ Boolean
937 938 939 |
# File 'lib/arrow-format/type.rb', line 937 def keys_sorted? @keys_sorted end |
#name ⇒ Object
933 934 935 |
# File 'lib/arrow-format/type.rb', line 933 def name "Map" end |
#offset_buffer_type ⇒ Object
941 942 943 |
# File 'lib/arrow-format/type.rb', line 941 def offset_buffer_type :s32 # TODO: big endian support end |
#to_flatbuffers ⇒ Object
954 955 956 |
# File 'lib/arrow-format/type.rb', line 954 def to_flatbuffers FB::Map::Data.new end |
#to_s ⇒ Object
949 950 951 952 |
# File 'lib/arrow-format/type.rb', line 949 def to_s key, value, = child.type.children "#{name}<#{key.type}, #{value.type}>" end |