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

Function Concatenate

cpp/src/arrow/array/concatenate.cc:921–952  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

919namespace internal {
920
921Result<std::shared_ptr<Array>> Concatenate(
922 const ArrayVector& arrays, MemoryPool* pool,
923 std::shared_ptr<DataType>* out_suggested_cast) {
924 DCHECK(out_suggested_cast);
925 *out_suggested_cast = nullptr;
926 if (arrays.size() == 0) {
927 return Status::Invalid("Must pass at least one array");
928 }
929
930 // gather ArrayData of input arrays
931 ArrayDataVector data(arrays.size());
932 for (size_t i = 0; i < arrays.size(); ++i) {
933 if (!arrays[i]->type()->Equals(*arrays[0]->type())) {
934 return Status::Invalid("arrays to be concatenated must be identically typed, but ",
935 *arrays[0]->type(), " and ", *arrays[i]->type(),
936 " were encountered.");
937 }
938 data[i] = arrays[i]->data();
939 }
940
941 std::shared_ptr<ArrayData> out_data;
942 ErrorHints hints;
943 auto status = ConcatenateImpl(data, pool).Concatenate(&out_data, &hints);
944 if (!status.ok()) {
945 if (hints.suggested_cast) {
946 DCHECK(status.IsInvalid());
947 *out_suggested_cast = std::move(hints.suggested_cast);
948 }
949 return status;
950 }
951 return MakeArray(std::move(out_data));
952}
953
954} // namespace internal
955

Callers 15

garrow_array_concatenateFunction · 0.85
CombineChunksMethod · 0.85
ASSERT_OK_AND_ASSIGNFunction · 0.85
RunGroupByFunction · 0.85
TESTFunction · 0.85
TEST_FFunction · 0.85
FlattenListArrayFunction · 0.85
FlattenListViewArrayFunction · 0.85
TEST_PFunction · 0.85
MakeArrayMethod · 0.85
DoCheckTakeCACWithArraysFunction · 0.85

Calls 10

ConcatenateImplClass · 0.85
MakeArrayFunction · 0.70
InvalidFunction · 0.50
sizeMethod · 0.45
EqualsMethod · 0.45
typeMethod · 0.45
dataMethod · 0.45
ConcatenateMethod · 0.45
okMethod · 0.45
statusMethod · 0.45

Tested by 13

ASSERT_OK_AND_ASSIGNFunction · 0.68
RunGroupByFunction · 0.68
TESTFunction · 0.68
TEST_FFunction · 0.68
TEST_PFunction · 0.68
MakeArrayMethod · 0.68
DoCheckTakeCACWithArraysFunction · 0.68
TEST_FFunction · 0.68
ASSERT_OK_AND_ASSIGNFunction · 0.68
AssertInversePermutationFunction · 0.68
PlainMethod · 0.68