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

Function DecimalScalarFromJSON

cpp/src/arrow/compute/kernels/test_util_internal.h:86–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86inline std::shared_ptr<Scalar> DecimalScalarFromJSON(
87 const std::shared_ptr<DataType>& type, const std::string& json) {
88 const auto& ty = checked_cast<const DecimalType&>(*type);
89 if (ty.scale() >= 0) return ScalarFromJSON(type, json);
90 auto p = ty.precision() - ty.scale();
91 auto adjusted_ty = ty.id() == Type::DECIMAL128 ? decimal128(p, 0) : decimal256(p, 0);
92 return Cast(ScalarFromJSON(adjusted_ty, json), type).ValueOrDie().scalar();
93}
94
95// Call the function with the given arguments, as well as slices of
96// the arguments and scalars extracted from the arguments.

Callers 2

TESTFunction · 0.85
TYPED_TESTFunction · 0.85

Calls 9

ScalarFromJSONFunction · 0.85
decimal256Function · 0.85
CastFunction · 0.85
ValueOrDieMethod · 0.80
decimal128Function · 0.50
scaleMethod · 0.45
precisionMethod · 0.45
idMethod · 0.45
scalarMethod · 0.45

Tested by

no test coverage detected