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

Function MakeEmptyArray

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

Source from the content-addressed store, hash-verified

913}
914
915Result<std::shared_ptr<Array>> MakeEmptyArray(std::shared_ptr<DataType> type,
916 MemoryPool* memory_pool) {
917 if (type->id() == Type::EXTENSION) {
918 const auto& ext_type = checked_cast<const ExtensionType&>(*type);
919 ARROW_ASSIGN_OR_RAISE(auto storage,
920 MakeEmptyArray(ext_type.storage_type(), memory_pool));
921 storage->data()->type = std::move(type);
922 return ext_type.MakeArray(storage->data());
923 }
924 std::unique_ptr<ArrayBuilder> builder;
925 RETURN_NOT_OK(MakeBuilder(memory_pool, type, &builder));
926 RETURN_NOT_OK(builder->Resize(0));
927 return builder->Finish();
928}
929
930namespace internal {
931

Callers 8

FlattenListArrayFunction · 0.70
FlattenListViewArrayFunction · 0.70
VisitMethod · 0.70
ArangeFunction · 0.50
MakeEmptyMethod · 0.50
MakeEmptyMethod · 0.50
DropNullArrayFunction · 0.50

Calls 6

MakeBuilderFunction · 0.70
idMethod · 0.45
dataMethod · 0.45
MakeArrayMethod · 0.45
ResizeMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected