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

Function MakeScalarForRunEndValue

cpp/src/arrow/array/util.cc:311–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309namespace {
310
311static Result<std::shared_ptr<Scalar>> MakeScalarForRunEndValue(
312 const DataType& run_end_type, int64_t run_end) {
313 switch (run_end_type.id()) {
314 case Type::INT16:
315 if (run_end > std::numeric_limits<int16_t>::max()) {
316 return Status::Invalid("Array construction with int16 run end type cannot fit ",
317 run_end);
318 }
319 return std::make_shared<Int16Scalar>(static_cast<int16_t>(run_end));
320 case Type::INT32:
321 if (run_end > std::numeric_limits<int32_t>::max()) {
322 return Status::Invalid("Array construction with int32 run end type cannot fit ",
323 run_end);
324 }
325 return std::make_shared<Int32Scalar>(static_cast<int32_t>(run_end));
326 default:
327 break;
328 }
329 DCHECK_EQ(run_end_type.id(), Type::INT64);
330 return std::make_shared<Int64Scalar>(run_end);
331}
332
333// get the maximum buffer length required, then allocate a single zeroed buffer
334// to use anywhere a buffer is required

Callers

nothing calls this directly

Calls 2

InvalidFunction · 0.50
idMethod · 0.45

Tested by

no test coverage detected