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

Function MakeBatchArrays

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

Data generation for test case below

Source from the content-addressed store, hash-verified

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