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

Function MakeRandomStringArray

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

Source from the content-addressed store, hash-verified

352}
353
354Status MakeRandomStringArray(int64_t length, bool include_nulls, MemoryPool* pool,
355 std::shared_ptr<Array>* out) {
356 const std::vector<std::string> values = {"", "", "abc", "123",
357 "efg", "456!@#!@#", "12312"};
358 StringBuilder builder(pool);
359 const size_t values_len = values.size();
360 for (int64_t i = 0; i < length; ++i) {
361 int64_t values_index = i % values_len;
362 if (include_nulls && values_index == 0) {
363 RETURN_NOT_OK(builder.AppendNull());
364 } else {
365 const auto& value = values[values_index];
366 RETURN_NOT_OK(builder.Append(value));
367 }
368 }
369 return builder.Finish(out);
370}
371
372template <std::derived_from<ArrayBuilder> BuilderType>
373static Result<std::shared_ptr<Array>> MakeBinaryArrayWithUniqueValues(

Callers 1

TEST_FFunction · 0.85

Calls 4

sizeMethod · 0.45
AppendNullMethod · 0.45
AppendMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected