Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
dirtysalt committed Jul 18, 2022
1 parent 17547d7 commit 3251c87
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
12 changes: 0 additions & 12 deletions be/src/exec/vectorized/hdfs_scanner.cpp
Expand Up @@ -70,18 +70,6 @@ Status HdfsScanner::init(RuntimeState* runtime_state, const HdfsScannerParams& s
RETURN_IF_ERROR(
Expr::clone_if_not_exists(_scanner_params.min_max_conjunct_ctxs, runtime_state, &_min_max_conjunct_ctxs));

// Why we need this class? Because in above code, we clone many conjuncts from runtime_state->obj_pool()
// And if we quit execution by early abortion, ~RuntimeState() is called directly
// And those conjuncts are released befoe `HdfsScanner` class, so when we call `HdfsScanner::close`
// we will get invalid pointers. And to resolve this problem, we add this instance at the end of obj_pool.
// so this instance must be released before conjuncts, and `HdfsScanner::close` will get valid pointers.
struct ReleaseFence {
HdfsScanner* ptr;
ReleaseFence(HdfsScanner* p) : ptr(p) {}
~ReleaseFence() { ptr->finalize(); }
};
_runtime_state->obj_pool()->add(new ReleaseFence(this));

Status status = do_init(runtime_state, scanner_params);
return status;
}
Expand Down
1 change: 1 addition & 0 deletions be/test/exec/vectorized/hdfs_scanner_test.cpp
Expand Up @@ -1143,6 +1143,7 @@ TEST_F(HdfsScannerTest, TestParqueTypeMismatchDecodeMinMax) {
}
status = scanner->open(_runtime_state);
EXPECT_TRUE(!status.ok());
scanner->close(_runtime_state);
}

} // namespace starrocks::vectorized

0 comments on commit 3251c87

Please sign in to comment.