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

Method precision

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

Returns the decimal precision of this array

(&self)

Source from the content-addressed store, hash-verified

1652
1653 /// Returns the decimal precision of this array
1654 pub fn precision(&self) -> u8 {
1655 match T::BYTE_LENGTH {
1656 4 => {
1657 if let DataType::Decimal32(p, _) = self.data_type() {
1658 *p
1659 } else {
1660 unreachable!(
1661 "Decimal32Array datatype is not DataType::Decimal32 but {}",
1662 self.data_type()
1663 )
1664 }
1665 }
1666 8 => {
1667 if let DataType::Decimal64(p, _) = self.data_type() {
1668 *p
1669 } else {
1670 unreachable!(
1671 "Decimal64Array datatype is not DataType::Decimal64 but {}",
1672 self.data_type()
1673 )
1674 }
1675 }
1676 16 => {
1677 if let DataType::Decimal128(p, _) = self.data_type() {
1678 *p
1679 } else {
1680 unreachable!(
1681 "Decimal128Array datatype is not DataType::Decimal128 but {}",
1682 self.data_type()
1683 )
1684 }
1685 }
1686 32 => {
1687 if let DataType::Decimal256(p, _) = self.data_type() {
1688 *p
1689 } else {
1690 unreachable!(
1691 "Decimal256Array datatype is not DataType::Decimal256 but {}",
1692 self.data_type()
1693 )
1694 }
1695 }
1696 other => unreachable!("Unsupported byte length for decimal array {}", other),
1697 }
1698 }
1699
1700 /// Returns the decimal scale of this array
1701 pub fn scale(&self) -> i8 {

Callers 3

multiply_fixed_pointFunction · 0.45
value_as_stringMethod · 0.45

Calls 1

data_typeMethod · 0.45

Tested by

no test coverage detected