[fix](file_reader) bad_typeid when reading csv&json files (#18400)

PR(#18340) resolve the conflict with PR(#18301) has changed the file_reader to create, resulting in e: [E-123] std::bad_typeid exception.
This commit is contained in:
Ashin Gau
2023-04-06 10:00:29 +08:00
committed by GitHub
parent d0219180a9
commit f28c75bd80
4 changed files with 6 additions and 4 deletions

View File

@ -145,7 +145,7 @@ Status CsvReader::init_reader(bool is_load) {
io::FileCachePolicy cache_policy = FileFactory::get_cache_policy(_state);
RETURN_IF_ERROR(FileFactory::create_file_reader(_profile, _system_properties,
_file_description, &_file_system,
&_file_reader, cache_policy));
&csv_file_reader, cache_policy));
}
if (typeid_cast<io::S3FileReader*>(csv_file_reader.get()) != nullptr ||
typeid_cast<io::BrokerFileReader*>(csv_file_reader.get()) != nullptr) {

View File

@ -342,7 +342,7 @@ Status NewJsonReader::_open_file_reader() {
io::FileCachePolicy cache_policy = FileFactory::get_cache_policy(_state);
RETURN_IF_ERROR(FileFactory::create_file_reader(_profile, _system_properties,
_file_description, &_file_system,
&_file_reader, cache_policy));
&json_file_reader, cache_policy));
}
if (typeid_cast<io::S3FileReader*>(json_file_reader.get()) != nullptr ||
typeid_cast<io::BrokerFileReader*>(json_file_reader.get()) != nullptr) {

View File

@ -247,8 +247,8 @@ private:
void _collect_profile_on_close();
private:
RuntimeProfile* _profile;
RuntimeState* _state;
RuntimeProfile* _profile = nullptr;
RuntimeState* _state = nullptr;
const TFileScanRangeParams& _scan_params;
const TFileRangeDesc& _scan_range;
FileSystemProperties _system_properties;

View File

@ -205,6 +205,7 @@ Status ParquetReader::_open_file() {
_file_description.path);
}
_column_statistics.read_bytes += meta_size;
// read twice: parse magic number & parse meta data
_column_statistics.read_calls += 2;
}
return Status::OK();
@ -631,6 +632,7 @@ Status ParquetReader::_process_page_index(const tparquet::RowGroup& row_group,
RETURN_IF_ERROR(
_file_reader->read_at(page_index._offset_index_start, res, &bytes_read, _io_ctx));
_column_statistics.read_bytes += bytes_read;
// read twice: parse column index & parse offset index
_column_statistics.read_calls += 2;
for (auto& read_col : _read_columns) {
auto conjunct_iter = _colname_to_value_range->find(read_col._file_slot_name);