Class: Arrow::Decimal256DataType

Inherits:
Object
  • Object
show all
Defined in:
lib/arrow/decimal256-data-type.rb

Constant Summary collapse

MAX_PRECISION =
max_precision

Instance Method Summary collapse

Constructor Details

#initialize(precision, scale) ⇒ Decimal256DataType #initialize(description) ⇒ Decimal256DataType

Creates a new Arrow::Decimal256DataType.

Overloads:

  • #initialize(precision, scale) ⇒ Decimal256DataType

    Examples:

    Create a decimal data type for “XXXXXX.YY” decimal

    Arrow::Decimal256DataType.new(8, 2)

    Parameters:

    • precision (Integer)

      The precision of the decimal data type. It’s the number of digits including the number of digits after the decimal point.

    • scale (Integer)

      The scale of the decimal data type. It’s the number of digits after the decimal point.

  • #initialize(description) ⇒ Decimal256DataType

    Examples:

    Create a decimal data type for “XXXXXX.YY” decimal

    Arrow::Decimal256DataType.new(precision: 8,
                                  scale: 2)

    Parameters:

    • description (Hash)

      The description of the decimal data type. It must have ‘:precision` and `:scale` values.

    Options Hash (description):

    • :precision (Integer)

      The precision of the decimal data type. It’s the number of digits including the number of digits after the decimal point.

    • :scale (Integer)

      The scale of the decimal data type. It’s the number of digits after the decimal point.

Since:

  • 3.0.0



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/arrow/decimal256-data-type.rb', line 57

def initialize(*args)
  n_args = args.size
  case n_args
  when 1
    description = args[0]
    precision = description[:precision]
    scale = description[:scale]
  when 2
    precision, scale = args
  else
    message = "wrong number of arguments (given, #{n_args}, expected 1..2)"
    raise ArgumentError, message
  end
  initialize_raw(precision, scale)
end