MCPcopy Create free account
hub / github.com/apache/arrow-rs / scale

Method scale

arrow-array/src/array/primitive_array.rs:1701–1745  ·  view source on GitHub ↗

Returns the decimal scale of this array

(&self)

Source from the content-addressed store, hash-verified

1699
1700 /// Returns the decimal scale of this array
1701 pub fn scale(&self) -> i8 {
1702 match T::BYTE_LENGTH {
1703 4 => {
1704 if let DataType::Decimal32(_, s) = self.data_type() {
1705 *s
1706 } else {
1707 unreachable!(
1708 "Decimal32Array datatype is not DataType::Decimal32 but {}",
1709 self.data_type()
1710 )
1711 }
1712 }
1713 8 => {
1714 if let DataType::Decimal64(_, s) = self.data_type() {
1715 *s
1716 } else {
1717 unreachable!(
1718 "Decimal64Array datatype is not DataType::Decimal64 but {}",
1719 self.data_type()
1720 )
1721 }
1722 }
1723 16 => {
1724 if let DataType::Decimal128(_, s) = self.data_type() {
1725 *s
1726 } else {
1727 unreachable!(
1728 "Decimal128Array datatype is not DataType::Decimal128 but {}",
1729 self.data_type()
1730 )
1731 }
1732 }
1733 32 => {
1734 if let DataType::Decimal256(_, s) = self.data_type() {
1735 *s
1736 } else {
1737 unreachable!(
1738 "Decimal256Array datatype is not DataType::Decimal256 but {}",
1739 self.data_type()
1740 )
1741 }
1742 }
1743 other => unreachable!("Unsupported byte length for decimal array {}", other),
1744 }
1745 }
1746}
1747
1748#[cfg(test)]

Callers 4

multiply_fixed_pointFunction · 0.45
value_as_stringMethod · 0.45

Calls 1

data_typeMethod · 0.45

Tested by

no test coverage detected