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

Function AppendDecimalBatch

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

Source from the content-addressed store, hash-verified

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