Class: ArrowFormat::DictionaryType

Inherits:
Type
  • Object
show all
Defined in:
lib/arrow-format/type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, index_type, value_type, ordered) ⇒ DictionaryType

Returns a new instance of DictionaryType.



1025
1026
1027
1028
1029
1030
1031
# File 'lib/arrow-format/type.rb', line 1025

def initialize(id, index_type, value_type, ordered)
  super()
  @id = id
  @index_type = index_type
  @value_type = value_type
  @ordered = ordered
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



1022
1023
1024
# File 'lib/arrow-format/type.rb', line 1022

def id
  @id
end

#index_typeObject (readonly)

Returns the value of attribute index_type.



1023
1024
1025
# File 'lib/arrow-format/type.rb', line 1023

def index_type
  @index_type
end

#value_typeObject (readonly)

Returns the value of attribute value_type.



1024
1025
1026
# File 'lib/arrow-format/type.rb', line 1024

def value_type
  @value_type
end

Instance Method Details

#build_array(size, validity_buffer, indices_buffer, dictionaries) ⇒ Object



1041
1042
1043
1044
1045
1046
1047
# File 'lib/arrow-format/type.rb', line 1041

def build_array(size, validity_buffer, indices_buffer, dictionaries)
  DictionaryArray.new(self,
                      size,
                      validity_buffer,
                      indices_buffer,
                      dictionaries)
end

#build_fb_field(fb_field) ⇒ Object



1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
# File 'lib/arrow-format/type.rb', line 1049

def build_fb_field(fb_field)
  fb_dictionary_encoding = FB::DictionaryEncoding::Data.new
  fb_dictionary_encoding.id = @id
  fb_int = FB::Int::Data.new
  fb_int.bit_width = @index_type.bit_width
  fb_int.signed = @index_type.signed?
  fb_dictionary_encoding.index_type = fb_int
  fb_dictionary_encoding.ordered = @ordered
  fb_dictionary_encoding.dictionary_kind = FB::DictionaryKind::DENSE_ARRAY
  fb_field.type = @value_type.to_flatbuffers
  fb_field.dictionary = fb_dictionary_encoding
end

#nameObject



1037
1038
1039
# File 'lib/arrow-format/type.rb', line 1037

def name
  "Dictionary"
end

#ordered?Boolean

Returns:

  • (Boolean)


1033
1034
1035
# File 'lib/arrow-format/type.rb', line 1033

def ordered?
  @ordered
end

#to_sObject



1062
1063
1064
1065
# File 'lib/arrow-format/type.rb', line 1062

def to_s
  "#{super}<id=#{@id}, index=#{@index_type}, value=#{@value_type}, " +
    "ordered=#{@ordered}>"
end