Class: SparkConnect::Types::DecimalType
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from DataType
#hash, #inspect, #json, #to_s
Constructor Details
#initialize(precision = 10, scale = 0) ⇒ DecimalType
Returns a new instance of DecimalType.
163
164
165
166
167
|
# File 'lib/spark_connect/types.rb', line 163
def initialize(precision = 10, scale = 0)
super()
@precision = precision
@scale = scale
end
|
Instance Attribute Details
#precision ⇒ Integer
Returns total number of digits (max 38).
159
160
161
|
# File 'lib/spark_connect/types.rb', line 159
def precision
@precision
end
|
#scale ⇒ Integer
Returns number of digits to the right of the decimal point.
161
162
163
|
# File 'lib/spark_connect/types.rb', line 161
def scale
@scale
end
|
Instance Method Details
#==(other) ⇒ Object
174
175
176
|
# File 'lib/spark_connect/types.rb', line 174
def ==(other)
other.is_a?(DecimalType) && other.precision == precision && other.scale == scale
end
|
#json_value ⇒ Object
171
|
# File 'lib/spark_connect/types.rb', line 171
def json_value = "decimal(#{precision},#{scale})"
|
#simple_string ⇒ Object
169
|
# File 'lib/spark_connect/types.rb', line 169
def simple_string = "decimal(#{precision},#{scale})"
|
#to_proto ⇒ Object
172
|
# File 'lib/spark_connect/types.rb', line 172
def to_proto = Types.wrap(decimal: Proto::DataType::Decimal.new(precision: precision, scale: scale))
|
#type_name ⇒ Object
170
|
# File 'lib/spark_connect/types.rb', line 170
def type_name = "decimal"
|