Skip to content

Commit

Permalink
[BugFix] Fix ut run failed in asan mode (#52824)
Browse files Browse the repository at this point in the history
Signed-off-by: Smith Cruise <[email protected]>
  • Loading branch information
Smith-Cruise authored Nov 12, 2024
1 parent 1274fa5 commit 47c59c9
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions be/test/formats/parquet/parquet_cli_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ class ParquetCLIReader {
_scanner_ctx->stats = _scan_stats.get();
_scanner_ctx->lazy_column_coalesce_counter = _pool.add(new std::atomic<int32_t>(0));
}
~ParquetCLIReader() = default;
~ParquetCLIReader() {
_file_reader = nullptr;
_file = nullptr;
_scanner_ctx = nullptr;
_scan_stats = nullptr;
_chunk = nullptr;
}

Status init() {
if (_file == nullptr) {
Expand All @@ -46,17 +52,15 @@ class ParquetCLIReader {

// create temporary reader to load schema.
FileMetaData* file_metadata = nullptr;
HdfsScannerContext ctx;
HdfsScanStats stats;
ctx.stats = &stats;
ctx.scan_range = scan_range;
ctx.lazy_column_coalesce_counter = _pool.add(new std::atomic<int32_t>(0));
std::shared_ptr<FileReader> reader =
std::make_shared<FileReader>(4096, _file.get(), std::filesystem::file_size(_filepath));
{
HdfsScannerContext ctx;
HdfsScanStats stats;
ctx.stats = &stats;
ctx.scan_range = scan_range;
ctx.lazy_column_coalesce_counter = _pool.add(new std::atomic<int32_t>(0));
RETURN_IF_ERROR(reader->init(&ctx));
file_metadata = reader->get_file_metadata();
}
RETURN_IF_ERROR(reader->init(&ctx));
file_metadata = reader->get_file_metadata();

std::vector<SlotDesc> slot_descs;
std::vector<TypeDescriptor> column_types;
Expand Down Expand Up @@ -246,11 +250,10 @@ class ParquetCLIReader {
}

const std::string _filepath;
const std::unique_ptr<RandomAccessFile> _file;
const std::shared_ptr<HdfsScannerContext> _scanner_ctx;
const std::shared_ptr<HdfsScanStats> _scan_stats;

std::shared_ptr<FileReader> _file_reader;
std::unique_ptr<RandomAccessFile> _file;
std::shared_ptr<HdfsScannerContext> _scanner_ctx;
std::shared_ptr<HdfsScanStats> _scan_stats;
std::shared_ptr<Chunk> _chunk;
ObjectPool _pool;
};
Expand Down

0 comments on commit 47c59c9

Please sign in to comment.