| 510 | }; |
| 511 | |
| 512 | ColumnPtr FuzzJSONSource::createColumn() |
| 513 | { |
| 514 | auto column = ColumnString::create(); |
| 515 | ColumnString::Chars & data_to = column->getChars(); |
| 516 | ColumnString::Offsets & offsets_to = column->getOffsets(); |
| 517 | |
| 518 | offsets_to.resize(block_size); |
| 519 | IColumn::Offset offset = 0; |
| 520 | |
| 521 | for (size_t row_num = 0; row_num < block_size; ++row_num) |
| 522 | { |
| 523 | WriteBufferFromOwnString out; |
| 524 | fuzzJSONObject(json_root, out, config, rnd); |
| 525 | |
| 526 | auto data = out.str(); |
| 527 | size_t data_len = data.size(); |
| 528 | |
| 529 | IColumn::Offset next_offset = offset + data_len; |
| 530 | data_to.resize(next_offset); |
| 531 | |
| 532 | std::copy(data.begin(), data.end(), &data_to[offset]); |
| 533 | |
| 534 | offsets_to[row_num] = next_offset; |
| 535 | offset = next_offset; |
| 536 | } |
| 537 | |
| 538 | return column; |
| 539 | } |
| 540 | |
| 541 | } |
| 542 | |