@@ -61,7 +61,7 @@ Spiller::Spiller(
61
61
executor,
62
62
fileCreateConfig) {
63
63
VELOX_CHECK (
64
- type_ == Type::kOrderByInput || type_ == Type::kAggregateInput ,
64
+ type_ == Type::kOrderBy || type_ == Type::kAggregateInput ,
65
65
" Unexpected spiller type: {}" ,
66
66
typeName (type_));
67
67
VELOX_CHECK_EQ (state_.maxPartitions (), 1 );
@@ -95,7 +95,7 @@ Spiller::Spiller(
95
95
executor,
96
96
fileCreateConfig) {
97
97
VELOX_CHECK (
98
- type_ == Type::kAggregateOutput || type_ == Type::kOrderByOutput ,
98
+ type_ == Type::kAggregateOutput || type_ == Type::kOrderBy ,
99
99
" Unexpected spiller type: {}" ,
100
100
typeName (type_));
101
101
VELOX_CHECK_EQ (state_.maxPartitions (), 1 );
@@ -446,11 +446,9 @@ void Spiller::runSpill() {
446
446
VELOX_CHECK_EQ (numWritten, run.rows .size ());
447
447
run.clear ();
448
448
// When a sorted run ends, we start with a new file next time. For
449
- // aggregation output / orderby output spiller, we expect only one spill
450
- // call to spill all the rows starting from the specified row offset.
451
- if (needSort () ||
452
- (type_ == Spiller::Type::kAggregateOutput ||
453
- type_ == Spiller::Type::kOrderByOutput )) {
449
+ // aggregation output spiller, we expect only one spill call to spill all
450
+ // the rows starting from the specified row offset.
451
+ if (needSort () || (type_ == Spiller::Type::kAggregateOutput )) {
454
452
state_.finishFile (partition);
455
453
}
456
454
}
@@ -468,7 +466,7 @@ void Spiller::updateSpillSortTime(uint64_t timeUs) {
468
466
469
467
bool Spiller::needSort () const {
470
468
return type_ != Type::kHashJoinProbe && type_ != Type::kHashJoinBuild &&
471
- type_ != Type::kAggregateOutput && type_ != Type:: kOrderByOutput ;
469
+ type_ != Type::kAggregateOutput ;
472
470
}
473
471
474
472
void Spiller::spill () {
@@ -484,23 +482,15 @@ void Spiller::spill(const RowContainerIterator* startRowIter) {
484
482
CHECK_NOT_FINALIZED ();
485
483
VELOX_CHECK_NE (type_, Type::kHashJoinProbe );
486
484
487
- markAllPartitionsSpilled ();
488
-
489
- fillSpillRuns (startRowIter);
490
- runSpill ();
491
- checkEmptySpillRuns ();
492
- }
493
-
494
- void Spiller::spill (std::vector<char *>& rows) {
495
- CHECK_NOT_FINALIZED ();
496
- VELOX_CHECK_EQ (type_, Type::kOrderByOutput );
497
- if (rows.empty ()) {
498
- return ;
485
+ // Marks all the partitions have been spilled as we don't support fine-grained
486
+ // spilling as for now.
487
+ for (auto partition = 0 ; partition < state_.maxPartitions (); ++partition) {
488
+ if (!state_.isPartitionSpilled (partition)) {
489
+ state_.setPartitionSpilled (partition);
490
+ }
499
491
}
500
492
501
- markAllPartitionsSpilled ();
502
-
503
- fillSpillRun (rows);
493
+ fillSpillRuns (startRowIter);
504
494
runSpill ();
505
495
checkEmptySpillRuns ();
506
496
}
@@ -511,14 +501,6 @@ void Spiller::checkEmptySpillRuns() const {
511
501
}
512
502
}
513
503
514
- void Spiller::markAllPartitionsSpilled () {
515
- for (auto partition = 0 ; partition < state_.maxPartitions (); ++partition) {
516
- if (!state_.isPartitionSpilled (partition)) {
517
- state_.setPartitionSpilled (partition);
518
- }
519
- }
520
- }
521
-
522
504
void Spiller::spill (uint32_t partition, const RowVectorPtr& spillVector) {
523
505
CHECK_NOT_FINALIZED ();
524
506
VELOX_CHECK (
@@ -615,21 +597,6 @@ void Spiller::fillSpillRuns(const RowContainerIterator* startRowIter) {
615
597
updateSpillFillTime (execTimeUs);
616
598
}
617
599
618
- void Spiller::fillSpillRun (std::vector<char *>& rows) {
619
- VELOX_CHECK_EQ (bits_.numPartitions (), 1 );
620
- checkEmptySpillRuns ();
621
- uint64_t execTimeUs{0 };
622
- {
623
- MicrosecondTimer timer (&execTimeUs);
624
- spillRuns_[0 ].rows =
625
- SpillRows (rows.begin (), rows.end (), spillRuns_[0 ].rows .get_allocator ());
626
- for (const auto * row : rows) {
627
- spillRuns_[0 ].numBytes += container_->rowSize (row);
628
- }
629
- }
630
- updateSpillFillTime (execTimeUs);
631
- }
632
-
633
600
std::string Spiller::toString () const {
634
601
return fmt::format (
635
602
" {}\t {}\t MAX_PARTITIONS:{}\t FINALIZED:{}" ,
@@ -642,10 +609,8 @@ std::string Spiller::toString() const {
642
609
// static
643
610
std::string Spiller::typeName (Type type) {
644
611
switch (type) {
645
- case Type::kOrderByInput :
646
- return " ORDER_BY_INPUT" ;
647
- case Type::kOrderByOutput :
648
- return " ORDER_BY_OUTPUT" ;
612
+ case Type::kOrderBy :
613
+ return " ORDER_BY" ;
649
614
case Type::kHashJoinBuild :
650
615
return " HASH_JOIN_BUILD" ;
651
616
case Type::kHashJoinProbe :
0 commit comments