Class: ArrowFormat::Org::Apache::Arrow::Flatbuf::DictionaryBatch

Inherits:
FlatBuffers::Table
  • Object
show all
Defined in:
lib/arrow-format/org/apache/arrow/flatbuf/dictionary_batch.rb

Overview

For sending dictionary encoding information. Any Field can be dictionary-encoded, but in this case none of its children may be dictionary-encoded. There is one vector / column per dictionary, but that vector / column may be spread across multiple dictionary batches by using the isDelta flag

Constant Summary collapse

FIELDS =
{
  id: ::FlatBuffers::Field.new(:id, 0, 4, :long, 0),
  data: ::FlatBuffers::Field.new(:data, 1, 6, "::ArrowFormat::Org::Apache::Arrow::Flatbuf::RecordBatch", 0),
  delta?: ::FlatBuffers::Field.new(:delta?, 2, 8, :bool, 0),
}
Data =
define_data_class

Instance Method Summary collapse

Instance Method Details

#dataObject



30
31
32
33
34
35
# File 'lib/arrow-format/org/apache/arrow/flatbuf/dictionary_batch.rb', line 30

def data
  field_offset = @view.unpack_virtual_offset(6)
  return nil if field_offset.zero?

  @view.unpack_table(::ArrowFormat::Org::Apache::Arrow::Flatbuf::RecordBatch, field_offset)
end

#delta?Boolean

If isDelta is true the values in the dictionary are to be appended to a dictionary with the indicated id. If isDelta is false this dictionary should replace the existing dictionary.

Returns:

  • (Boolean)


47
48
49
50
51
52
# File 'lib/arrow-format/org/apache/arrow/flatbuf/dictionary_batch.rb', line 47

def delta?
  field_offset = @view.unpack_virtual_offset(8)
  return false if field_offset.zero?

  @view.unpack_bool(field_offset)
end

#idObject



37
38
39
40
41
42
# File 'lib/arrow-format/org/apache/arrow/flatbuf/dictionary_batch.rb', line 37

def id
  field_offset = @view.unpack_virtual_offset(4)
  return 0 if field_offset.zero?

  @view.unpack_long(field_offset)
end