add spilled Rows
| 510 | |
| 511 | // add spilled Rows |
| 512 | void HashBuild::addSpilledRowInput(std::vector<char*>& rows, uint32_t size) { |
| 513 | if (rows.empty()) { |
| 514 | return; |
| 515 | } |
| 516 | // TODO: support directly respill rows read from spiller |
| 517 | // now direct copy spilled rows to table, increase the risic of OOM |
| 518 | |
| 519 | // even though ensureInputFits return false, we still need to spill rows |
| 520 | ensureInputFits(input_, {&rows, size}); |
| 521 | auto spillStep = 1024; |
| 522 | auto container = table_->rows(); |
| 523 | for (auto id = 0; id < rows.size(); id += spillStep) { |
| 524 | auto step = std::min<int>(spillStep, rows.size() - id); |
| 525 | activeRows_.resize(step); |
| 526 | activeRows_.setAll(); |
| 527 | for (auto j = id; j < id + step; ++j) { |
| 528 | container->copySerializedRow(rows[j], rowFormatInfo_.get()); |
| 529 | } |
| 530 | spillRowBasedInput(); |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | void HashBuild::addInput(RowVectorPtr input) { |
| 535 | checkRunning(); |