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

Method MakeDecimalVector

cpp/src/gandiva/tests/decimal_test.cc:49–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47};
48
49std::vector<Decimal128> TestDecimal::MakeDecimalVector(std::vector<std::string> values,
50 int32_t scale) {
51 std::vector<arrow::Decimal128> ret;
52 for (auto str : values) {
53 Decimal128 str_value;
54 int32_t str_precision;
55 int32_t str_scale;
56
57 DCHECK_OK(Decimal128::FromString(str, &str_value, &str_precision, &str_scale));
58
59 Decimal128 scaled_value;
60 if (str_scale == scale) {
61 scaled_value = str_value;
62 } else {
63 scaled_value = str_value.Rescale(str_scale, scale).ValueOrDie();
64 }
65 ret.push_back(scaled_value);
66 }
67 return ret;
68}
69
70TEST_F(TestDecimal, TestSimple) {
71 // schema for input fields

Callers

nothing calls this directly

Calls 4

FromStringFunction · 0.85
ValueOrDieMethod · 0.80
RescaleMethod · 0.80
push_backMethod · 0.80

Tested by

no test coverage detected