| 388 | std::unique_ptr<ExchangeBenchmark> bm; |
| 389 | |
| 390 | void runBenchmarks() { |
| 391 | std::vector<std::string> flatNames = {"c0"}; |
| 392 | std::vector<TypePtr> flatTypes = {BIGINT()}; |
| 393 | std::vector<TypePtr> typeSelection = { |
| 394 | BOOLEAN(), |
| 395 | TINYINT(), |
| 396 | DECIMAL(20, 3), |
| 397 | INTEGER(), |
| 398 | BIGINT(), |
| 399 | REAL(), |
| 400 | DECIMAL(10, 2), |
| 401 | DOUBLE(), |
| 402 | VARCHAR()}; |
| 403 | |
| 404 | int64_t flatSize = 0; |
| 405 | // Add enough columns of different types to make a 10K row batch be |
| 406 | // flat_batch_mb in flat size. |
| 407 | while (flatSize * 10000 < static_cast<int64_t>(FLAGS_flat_batch_mb) << 20) { |
| 408 | flatNames.push_back(fmt::format("c{}", flatNames.size())); |
| 409 | assert(!flatNames.empty()); |
| 410 | flatTypes.push_back(typeSelection[flatTypes.size() % typeSelection.size()]); |
| 411 | if (flatTypes.back()->isFixedWidth()) { |
| 412 | flatSize += flatTypes.back()->cppSizeInBytes(); |
| 413 | } else { |
| 414 | flatSize += 20; |
| 415 | } |
| 416 | } |
| 417 | auto flatType = ROW(std::move(flatNames), std::move(flatTypes)); |
| 418 | |
| 419 | auto structType = ROW( |
| 420 | {{"c0", BIGINT()}, |
| 421 | {"r1", |
| 422 | ROW( |
| 423 | {{"k2", BIGINT()}, |
| 424 | {"r2", |
| 425 | ROW( |
| 426 | {{"i1", BIGINT()}, |
| 427 | {"i2", BIGINT()}, |
| 428 | {"r3}, ROW({{s3", VARCHAR()}, |
| 429 | {"i5", INTEGER()}, |
| 430 | {"d5", DOUBLE()}, |
| 431 | {"b5", BOOLEAN()}, |
| 432 | {"a5", ARRAY(TINYINT())}})}})}}); |
| 433 | |
| 434 | auto deepType = ROW( |
| 435 | {{"c0", BIGINT()}, |
| 436 | {"long_array_val", ARRAY(ARRAY(BIGINT()))}, |
| 437 | {"array_val", ARRAY(VARCHAR())}, |
| 438 | {"struct_val", ROW({{"s_int", INTEGER()}, {"s_array", ARRAY(REAL())}})}, |
| 439 | {"map_val", |
| 440 | MAP(VARCHAR(), |
| 441 | MAP(BIGINT(), |
| 442 | ROW({{"s2_int", INTEGER()}, {"s2_string", VARCHAR()}})))}}); |
| 443 | |
| 444 | std::vector<RowVectorPtr> flat10k( |
| 445 | bm->makeRows(flatType, 10, 10000, FLAGS_dict_pct)); |
| 446 | std::vector<RowVectorPtr> deep10k( |
| 447 | bm->makeRows(deepType, 10, 10000, FLAGS_dict_pct)); |