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

Method ValidateDecimals

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

Source from the content-addressed store, hash-verified

956
957 template <typename DecimalType>
958 Status ValidateDecimals(const DecimalType& type) {
959 using CType = typename TypeTraits<DecimalType>::CType;
960 if (full_validation) {
961 const int32_t precision = type.precision();
962 return VisitArraySpanInline<DecimalType>(
963 data,
964 [&](std::string_view bytes) {
965 DCHECK_EQ(bytes.size(), DecimalType::kByteWidth);
966 CType value(reinterpret_cast<const uint8_t*>(bytes.data()));
967 if (!value.FitsInPrecision(precision)) {
968 return Status::Invalid("Decimal value ", value.ToIntegerString(),
969 " does not fit in precision of ", type);
970 }
971 return Status::OK();
972 },
973 []() { return Status::OK(); });
974 }
975 return Status::OK();
976 }
977
978 Status CheckBounds(const DataType& type, int64_t min_value, int64_t max_value) {
979 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