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

Function ARROW_ASSIGN_OR_RAISE

cpp/src/arrow/ipc/test_common.cc:879–928  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

877 /*indices=*/ArrayFromJSON(int16(), "[2, 1, null, null, 2, 1, 0]"),
878 /*dictionary=*/values0));
879 ARROW_ASSIGN_OR_RAISE(
880 auto outer1, StructArray::Make({inner1, inner2}, {field("a", inner1->type()),
881 field("b", inner2->type())}));
882 DCHECK_EQ(outer1->length(), length);
883
884 // Field 2: dict(int8, struct(c: dict(int8, int64), d: dict(int16, list(dict(int8,
885 // utf8)))))
886 ARROW_ASSIGN_OR_RAISE(auto nested_values2,
887 ListArray::FromArrays(
888 /*offsets=*/*ArrayFromJSON(int32(), "[0, 1, 5, 5, 7]"),
889 /*values=*/*inner0));
890 ARROW_ASSIGN_OR_RAISE(
891 auto inner3, DictionaryArray::FromArrays(
892 dictionary(int16(), nested_values2->type()),
893 /*indices=*/ArrayFromJSON(int16(), "[0, 1, 3, null, 3, 2, 1]"),
894 /*dictionary=*/nested_values2));
895 ARROW_ASSIGN_OR_RAISE(
896 auto inner4, StructArray::Make({inner1, inner3}, {field("c", inner1->type()),
897 field("d", inner3->type())}));
898 ARROW_ASSIGN_OR_RAISE(auto outer2,
899 DictionaryArray::FromArrays(
900 dictionary(int8(), inner4->type()),
901 /*indices=*/ArrayFromJSON(int8(), "[0, 2, 4, 6, 1, 3, 5]"),
902 /*dictionary=*/inner4));
903 DCHECK_EQ(outer2->length(), length);
904
905 auto schema = ::arrow::schema({
906 field("f0", outer0->type()),
907 field("f1", outer1->type()),
908 field("f2", outer2->type()),
909 });
910 *out = RecordBatch::Make(schema, length, {outer0, outer1, outer2});
911 return Status::OK();
912}
913
914Status MakeMap(std::shared_ptr<RecordBatch>* out) {
915 constexpr int64_t kNumRows = 3;
916 std::shared_ptr<Array> a0, a1;
917
918 auto key_array = ArrayFromJSON(utf8(), R"(["k1", "k2", "k1", "k3", "k1", "k4"])");
919 auto item_array = ArrayFromJSON(int16(), "[0, -1, 2, -3, 4, null]");
920 RETURN_NOT_OK(MakeRandomMapArray(key_array, item_array, kNumRows,
921 /*include_nulls=*/false, default_memory_pool(), &a0));
922 RETURN_NOT_OK(MakeRandomMapArray(key_array, item_array, kNumRows,
923 /*include_nulls=*/true, default_memory_pool(), &a1));
924 auto f0 = field("f0", a0->type());
925 auto f1 = field("f1", a1->type());
926 *out = RecordBatch::Make(::arrow::schema({f0, f1}), kNumRows, {a0, a1});
927 return Status::OK();
928}
929
930Status MakeMapOfDictionary(std::shared_ptr<RecordBatch>* out) {
931 // Exercises ARROW-9660

Callers 15

ConvertToStreamFunction · 0.70
DecompressBuffersFunction · 0.70
CreateColumnsMethod · 0.70
ReadContiguousPayloadFunction · 0.70
ReadRecordBatchInternalFunction · 0.70
DoPreBufferMetadataMethod · 0.70
ReadDictionariesMethod · 0.70
ReadFooterAsyncMethod · 0.70
ReadSchemaFunction · 0.70
ReadSparseCSFIndexFunction · 0.70

Calls 8

ArrayFromJSONFunction · 0.85
MakeRandomMapArrayFunction · 0.85
default_memory_poolFunction · 0.85
schemaFunction · 0.70
fieldFunction · 0.50
MakeFunction · 0.50
OKFunction · 0.50
typeMethod · 0.45

Tested by

no test coverage detected