Class: ArrowFormat::Org::Apache::Arrow::Flatbuf::DictionaryEncoding
- Inherits:
-
FlatBuffers::Table
- Object
- FlatBuffers::Table
- ArrowFormat::Org::Apache::Arrow::Flatbuf::DictionaryEncoding
- Defined in:
- lib/arrow-format/org/apache/arrow/flatbuf/dictionary_encoding.rb
Constant Summary collapse
- FIELDS =
{ id: ::FlatBuffers::Field.new(:id, 0, 4, :long, 0), index_type: ::FlatBuffers::Field.new(:index_type, 1, 6, "::ArrowFormat::Org::Apache::Arrow::Flatbuf::Int", 0), ordered?: ::FlatBuffers::Field.new(:ordered?, 2, 8, :bool, 0), dictionary_kind: ::FlatBuffers::Field.new(:dictionary_kind, 3, 10, :short, 0), }
- Data =
define_data_class
Instance Method Summary collapse
- #dictionary_kind ⇒ Object
-
#id ⇒ Object
The known dictionary id in the application where this data is used.
-
#index_type ⇒ Object
The dictionary indices are constrained to be non-negative integers.
-
#ordered? ⇒ Boolean
By default, dictionaries are not ordered, or the order does not have semantic meaning.
Instance Method Details
#dictionary_kind ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/arrow-format/org/apache/arrow/flatbuf/dictionary_encoding.rb', line 26 def dictionary_kind field_offset = @view.unpack_virtual_offset(10) if field_offset.zero? enum_value = 0 else enum_value = @view.unpack_short(field_offset) end ::ArrowFormat::Org::Apache::Arrow::Flatbuf::DictionaryKind.try_convert(enum_value) || enum_value end |
#id ⇒ Object
The known dictionary id in the application where this data is used. In the file or streaming formats, the dictionary ids are found in the DictionaryBatch messages
39 40 41 42 43 44 |
# File 'lib/arrow-format/org/apache/arrow/flatbuf/dictionary_encoding.rb', line 39 def id field_offset = @view.unpack_virtual_offset(4) return 0 if field_offset.zero? @view.unpack_long(field_offset) end |
#index_type ⇒ Object
The dictionary indices are constrained to be non-negative integers. If this field is null, the indices must be signed int32. To maximize cross-language compatibility and performance, implementations are recommended to prefer signed integer types over unsigned integer types and to avoid uint64 indices unless they are required by an application.
51 52 53 54 55 56 |
# File 'lib/arrow-format/org/apache/arrow/flatbuf/dictionary_encoding.rb', line 51 def index_type field_offset = @view.unpack_virtual_offset(6) return nil if field_offset.zero? @view.unpack_table(::ArrowFormat::Org::Apache::Arrow::Flatbuf::Int, field_offset) end |
#ordered? ⇒ Boolean
By default, dictionaries are not ordered, or the order does not have semantic meaning. In some statistical applications, dictionary-encoding is used to represent ordered categorical data, and we provide a way to preserve that metadata here
62 63 64 65 66 67 |
# File 'lib/arrow-format/org/apache/arrow/flatbuf/dictionary_encoding.rb', line 62 def ordered? field_offset = @view.unpack_virtual_offset(8) return false if field_offset.zero? @view.unpack_bool(field_offset) end |