MCPcopy Create free account
hub / github.com/apache/arrow / ValidateDecimals

Method ValidateDecimals

cpp/src/arrow/array/validate.cc:952–970  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

950
951 template <typename DecimalType>
952 Status ValidateDecimals(const DecimalType& type) {
953 using CType = typename TypeTraits<DecimalType>::CType;
954 if (full_validation) {
955 const int32_t precision = type.precision();
956 return VisitArraySpanInline<DecimalType>(
957 data,
958 [&](std::string_view bytes) {
959 DCHECK_EQ(bytes.size(), DecimalType::kByteWidth);
960 CType value(reinterpret_cast<const uint8_t*>(bytes.data()));
961 if (!value.FitsInPrecision(precision)) {
962 return Status::Invalid("Decimal value ", value.ToIntegerString(),
963 " does not fit in precision of ", type);
964 }
965 return Status::OK();
966 },
967 []() { return Status::OK(); });
968 }
969 return Status::OK();
970 }
971
972 Status CheckBounds(const DataType& type, int64_t min_value, int64_t max_value) {
973 BoundsChecker checker{data, min_value, max_value};

Callers

nothing calls this directly

Calls 7

FitsInPrecisionMethod · 0.80
ToIntegerStringMethod · 0.80
InvalidFunction · 0.50
OKFunction · 0.50
precisionMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected