Class: Arrow::Decimal128DataType

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

Constant Summary collapse

MAX_PRECISION =
max_precision

Instance Method Summary collapse

Constructor Details

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

Creates a new Arrow::Decimal128DataType.

Overloads:

  • #initialize(precision, scale) ⇒ Decimal128DataType

    Examples:

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

    Arrow::Decimal128DataType.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) ⇒ Decimal128DataType

    Examples:

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

    Arrow::Decimal128DataType.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.



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

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