Skip to content

Commit

Permalink
Fix bug. fix materialize sink bug. (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
small-turtle-1 authored Dec 26, 2023
1 parent 46e182e commit dbf320b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,10 @@ sift_1m
test/data/benchmark/*

# ignore valgrind output file
callgrind.out.*
callgrind.out.*

# ignore vscode config file
.vscode/

# ignore vscode clangd cache file
.cache/
25 changes: 20 additions & 5 deletions src/executor/operator/physical_sink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ void PhysicalSink::FillSinkStateFromLastOperatorState(MaterializeSinkState *mate
}
case PhysicalOperatorType::kShow: {
ShowOperatorState *show_output_state = static_cast<ShowOperatorState *>(task_op_state);
materialize_sink_state->data_block_array_ = Move(show_output_state->output_);
for (auto &data_block : show_output_state->output_) {
materialize_sink_state->data_block_array_.emplace_back(Move(data_block));
}
show_output_state->output_.clear();
break;
}
case PhysicalOperatorType::kExplain: {
Expand All @@ -90,7 +93,10 @@ void PhysicalSink::FillSinkStateFromLastOperatorState(MaterializeSinkState *mate
Error<ExecutorException>("Empty explain output");
}

materialize_sink_state->data_block_array_ = Move(explain_output_state->data_block_array_);
for (auto &data_block : explain_output_state->data_block_array_) {
materialize_sink_state->data_block_array_.emplace_back(Move(data_block));
}
explain_output_state->data_block_array_.clear();
break;
}
case PhysicalOperatorType::kProjection: {
Expand All @@ -102,7 +108,10 @@ void PhysicalSink::FillSinkStateFromLastOperatorState(MaterializeSinkState *mate
Error<ExecutorException>("Empty projection output");
}
} else {
materialize_sink_state->data_block_array_ = Move(projection_output_state->data_block_array_);
for (auto &data_block : projection_output_state->data_block_array_) {
materialize_sink_state->data_block_array_.emplace_back(Move(data_block));
}
projection_output_state->data_block_array_.clear();
}
break;
}
Expand All @@ -115,7 +124,10 @@ void PhysicalSink::FillSinkStateFromLastOperatorState(MaterializeSinkState *mate
Error<ExecutorException>("Empty sort output");
}
} else {
materialize_sink_state->data_block_array_ = Move(sort_output_state->data_block_array_);
for (auto &data_block : sort_output_state->data_block_array_) {
materialize_sink_state->data_block_array_.emplace_back(Move(data_block));
}
sort_output_state->data_block_array_.clear();
}
break;
}
Expand All @@ -126,7 +138,10 @@ void PhysicalSink::FillSinkStateFromLastOperatorState(MaterializeSinkState *mate
Error<ExecutorException>("Empty knn scan output");
}

materialize_sink_state->data_block_array_ = Move(knn_output_state->data_block_array_);
for (auto &data_block : knn_output_state->data_block_array_) {
materialize_sink_state->data_block_array_.emplace_back(Move(data_block));
}
knn_output_state->data_block_array_.clear();
break;
}
default: {
Expand Down
1 change: 0 additions & 1 deletion src/storage/meta/entry/block_column_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ void BlockColumnEntry::Flush(BlockColumnEntry *block_column_entry, SizeT) {
// SizeT buffer_size = row_count * column_type->Size();
if (block_column_entry->buffer_->Save()) {
block_column_entry->buffer_->Sync();
LOG_WARN(Format("Close file {}", block_column_entry->FilePath()));
block_column_entry->buffer_->CloseFile();
}

Expand Down

0 comments on commit dbf320b

Please sign in to comment.