Class: ArrowFormat::DurationType

Inherits:
TemporalType show all
Defined in:
lib/arrow-format/type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(unit) ⇒ DurationType

Returns a new instance of DurationType.



580
581
582
583
# File 'lib/arrow-format/type.rb', line 580

def initialize(unit)
  super()
  @unit = unit
end

Instance Attribute Details

#unitObject (readonly)

Returns the value of attribute unit.



579
580
581
# File 'lib/arrow-format/type.rb', line 579

def unit
  @unit
end

Instance Method Details

#buffer_typeObject



589
590
591
# File 'lib/arrow-format/type.rb', line 589

def buffer_type
  :s64
end

#build_array(size, validity_buffer, values_buffer) ⇒ Object



593
594
595
# File 'lib/arrow-format/type.rb', line 593

def build_array(size, validity_buffer, values_buffer)
  DurationArray.new(self, size, validity_buffer, values_buffer)
end

#nameObject



585
586
587
# File 'lib/arrow-format/type.rb', line 585

def name
  "Duration"
end

#to_flatbuffersObject



601
602
603
604
605
# File 'lib/arrow-format/type.rb', line 601

def to_flatbuffers
  fb_type = FB::Duration::Data.new
  fb_type.unit = FB::TimeUnit.try_convert(@unit.to_s.upcase)
  fb_type
end

#to_sObject



597
598
599
# File 'lib/arrow-format/type.rb', line 597

def to_s
  "#{super}(#{@unit})"
end