Class: ArrowFormat::TimestampType

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(unit, time_zone) ⇒ TimestampType

Returns a new instance of TimestampType.



469
470
471
472
473
# File 'lib/arrow-format/type.rb', line 469

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

Instance Attribute Details

#time_zoneObject (readonly)

Returns the value of attribute time_zone.



468
469
470
# File 'lib/arrow-format/type.rb', line 468

def time_zone
  @time_zone
end

#unitObject (readonly)

Returns the value of attribute unit.



467
468
469
# File 'lib/arrow-format/type.rb', line 467

def unit
  @unit
end

Instance Method Details

#buffer_typeObject



479
480
481
# File 'lib/arrow-format/type.rb', line 479

def buffer_type
  :s64
end

#build_array(size, validity_buffer, values_buffer) ⇒ Object



483
484
485
# File 'lib/arrow-format/type.rb', line 483

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

#nameObject



475
476
477
# File 'lib/arrow-format/type.rb', line 475

def name
  "Timestamp"
end

#to_flatbuffersObject



493
494
495
496
497
498
# File 'lib/arrow-format/type.rb', line 493

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

#to_sObject



487
488
489
490
491
# File 'lib/arrow-format/type.rb', line 487

def to_s
  options = [@unit]
  options << @time_zone if @time_zone
  "#{super}(#{options.join(", ")})"
end