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

Function MakeBatchArrays

cpp/src/arrow/integration/json_integration_test.cc:935–957  ·  view source on GitHub ↗

Data generation for test case below

Source from the content-addressed store, hash-verified

933
934// Data generation for test case below
935void MakeBatchArrays(const std::shared_ptr<Schema>& schema, const int num_rows,
936 std::vector<std::shared_ptr<Array>>* arrays) {
937 const float null_prob = 0.25f;
938 random::RandomArrayGenerator rand(0x564a3bf0);
939
940 *arrays = {rand.Boolean(num_rows, 0.75, null_prob),
941 rand.Int8(num_rows, 0, 100, null_prob),
942 rand.Int32(num_rows, -1000, 1000, null_prob),
943 rand.UInt64(num_rows, 0, 1UL << 16, null_prob)};
944
945 static const int kBufferSize = 10;
946 static uint8_t buffer[kBufferSize];
947 static uint32_t seed = 0;
948 StringBuilder string_builder;
949 for (int i = 0; i < num_rows; ++i) {
950 random_ascii(kBufferSize, seed++, buffer);
951 ASSERT_OK(string_builder.Append(buffer, kBufferSize));
952 }
953 std::shared_ptr<Array> v3;
954 ASSERT_OK(string_builder.Finish(&v3));
955
956 arrays->emplace_back(v3);
957}
958
959TEST(TestJsonFileReadWrite, BasicRoundTrip) {
960 auto v1_type = boolean();

Callers 1

TESTFunction · 0.85

Calls 8

Int8Method · 0.80
Int32Method · 0.80
UInt64Method · 0.80
emplace_backMethod · 0.80
random_asciiFunction · 0.50
BooleanMethod · 0.45
AppendMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected