Class: Parqueteur::Types::Decimal256Type
- Inherits:
-
Parqueteur::Type
- Object
- Parqueteur::Type
- Parqueteur::Types::Decimal256Type
- Defined in:
- lib/parqueteur/types/decimal256_type.rb
Instance Attribute Summary
Attributes inherited from Parqueteur::Type
Instance Method Summary collapse
- #arrow_type_builder ⇒ Object
- #build_value_array(values) ⇒ Object
-
#initialize(options = {}, &block) ⇒ Decimal256Type
constructor
A new instance of Decimal256Type.
Methods inherited from Parqueteur::Type
Constructor Details
#initialize(options = {}, &block) ⇒ Decimal256Type
Returns a new instance of Decimal256Type.
6 7 8 9 10 11 |
# File 'lib/parqueteur/types/decimal256_type.rb', line 6 def initialize( = {}, &block) @scale = .fetch(:scale) @precision = .fetch(:precision) @format_str = "%.#{@scale}f" super(, &block) end |
Instance Method Details
#arrow_type_builder ⇒ Object
22 23 24 25 26 |
# File 'lib/parqueteur/types/decimal256_type.rb', line 22 def arrow_type_builder Arrow::Decimal256DataType.new( @precision, @scale ) end |
#build_value_array(values) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/parqueteur/types/decimal256_type.rb', line 13 def build_value_array(values) Arrow::Decimal256ArrayBuilder.build( @arrow_type, values.map do |value| Arrow::Decimal256.new(format(@format_str, BigDecimal(value))) end ) end |