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

Function AppendDecimalBatch

cpp/src/arrow/adapters/orc/util.cc:244–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244Status AppendDecimalBatch(const liborc::Type* type,
245 liborc::ColumnVectorBatch* column_vector_batch, int64_t offset,
246 int64_t length, ArrayBuilder* abuilder) {
247 auto builder = checked_cast<Decimal128Builder*>(abuilder);
248
249 const bool has_nulls = column_vector_batch->hasNulls;
250 if (type->getPrecision() == 0 || type->getPrecision() > 18) {
251 auto batch = checked_cast<liborc::Decimal128VectorBatch*>(column_vector_batch);
252 for (int64_t i = offset; i < length + offset; i++) {
253 if (!has_nulls || batch->notNull[i]) {
254 RETURN_NOT_OK(builder->Append(
255 Decimal128(batch->values[i].getHighBits(), batch->values[i].getLowBits())));
256 } else {
257 RETURN_NOT_OK(builder->AppendNull());
258 }
259 }
260 } else {
261 auto batch = checked_cast<liborc::Decimal64VectorBatch*>(column_vector_batch);
262 for (int64_t i = offset; i < length + offset; i++) {
263 if (!has_nulls || batch->notNull[i]) {
264 RETURN_NOT_OK(builder->Append(Decimal128(batch->values[i])));
265 } else {
266 RETURN_NOT_OK(builder->AppendNull());
267 }
268 }
269 }
270 return Status::OK();
271}
272
273template <typename UnionBuilderType>
274Status AppendUnionBatchInternal(const liborc::Type* type,

Callers 1

AppendBatchFunction · 0.85

Calls 4

Decimal128Function · 0.50
OKFunction · 0.50
AppendMethod · 0.45
AppendNullMethod · 0.45

Tested by

no test coverage detected