Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions be/src/vec/exec/format/table/hudi_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,37 @@ class HudiParquetReader final : public HudiReader {
const VExprContextSPtrs* not_single_slot_filter_conjuncts,
const std::unordered_map<int, VExprContextSPtrs>* slot_id_to_filter_conjuncts);
};

class HudiOrcReader final : public HudiReader {
public:
ENABLE_FACTORY_CREATOR(HudiOrcReader);
HudiOrcReader(std::unique_ptr<GenericReader> file_format_reader, RuntimeProfile* profile,
RuntimeState* state, const TFileScanRangeParams& params,
const TFileRangeDesc& range, io::IOContext* io_ctx)
: HudiReader(std::move(file_format_reader), profile, state, params, range, io_ctx) {};
~HudiOrcReader() final = default;

Status init_reader(
const std::vector<std::string>& read_table_col_names,
const std::unordered_map<std::string, ColumnValueRangeType>*
table_col_name_to_value_range,
const VExprContextSPtrs& conjuncts, const TupleDescriptor* tuple_descriptor,
const RowDescriptor* row_descriptor,
const VExprContextSPtrs* not_single_slot_filter_conjuncts,
const std::unordered_map<int, VExprContextSPtrs>* slot_id_to_filter_conjuncts) {
auto* orc_reader = static_cast<OrcReader*>(_file_format_reader.get());
const orc::Type* orc_type_ptr = nullptr;
RETURN_IF_ERROR(orc_reader->get_file_type(&orc_type_ptr));
RETURN_IF_ERROR(gen_table_info_node_by_field_id(
_params, _range.table_format_params.hudi_params.schema_id, tuple_descriptor,
orc_type_ptr));

return orc_reader->init_reader(&read_table_col_names, table_col_name_to_value_range,
conjuncts, false, tuple_descriptor, row_descriptor,
not_single_slot_filter_conjuncts,
slot_id_to_filter_conjuncts, table_info_node_ptr);
}
};

#include "common/compile_check_end.h"
} // namespace doris::vectorized
28 changes: 21 additions & 7 deletions be/src/vec/exec/scan/file_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1077,12 +1077,16 @@ Status FileScanner::_get_next_reader() {
break;
}
default:
return Status::InternalError("Not supported file format: {}", _params->format_type);
return Status::NotSupported("Not supported create reader for file format: {}.",
to_string(_params->format_type));
}

if (_cur_reader == nullptr) {
return Status::InternalError("Failed to create reader for file format: {}",
_params->format_type);
return Status::NotSupported(
"Not supported create reader for table format: {} / file format: {}.",
range.__isset.table_format_params ? range.table_format_params.table_format_type
: "NotSet",
to_string(_params->format_type));
}
COUNTER_UPDATE(_file_counter, 1);
// The FileScanner for external table may try to open not exist files,
Expand Down Expand Up @@ -1238,6 +1242,16 @@ Status FileScanner::_init_orc_reader(std::unique_ptr<OrcReader>&& orc_reader) {
&_slot_id_to_filter_conjuncts);
RETURN_IF_ERROR(paimon_reader->init_row_filters());
_cur_reader = std::move(paimon_reader);
} else if (range.__isset.table_format_params &&
range.table_format_params.table_format_type == "hudi") {
std::unique_ptr<HudiOrcReader> hudi_reader = HudiOrcReader::create_unique(
std::move(orc_reader), _profile, _state, *_params, range, _io_ctx.get());

init_status = hudi_reader->init_reader(
_file_col_names, _colname_to_value_range, _push_down_conjuncts, _real_tuple_desc,
_default_val_row_desc.get(), &_not_single_slot_filter_conjuncts,
&_slot_id_to_filter_conjuncts);
_cur_reader = std::move(hudi_reader);
} else if (range.__isset.table_format_params &&
range.table_format_params.table_format_type == "hive") {
std::unique_ptr<HiveOrcReader> hive_reader = HiveOrcReader::create_unique(
Expand Down Expand Up @@ -1390,10 +1404,10 @@ Status FileScanner::read_one_line_from_range(const TFileRangeDesc& range,
break;
}
default: {
return Status::InternalError(
"Failed to create one line reader for file format: {},"
"only support parquet and orc",
_params->format_type);
return Status::NotSupported(
"Not support create lines reader for file format: {},"
"only support parquet and orc.",
to_string(_params->format_type));
}
}
return Status::OK();
Expand Down
2 changes: 1 addition & 1 deletion be/test/vec/exec/vfile_scanner_exception_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ TEST_F(VfileScannerExceptionTest, failure_case) {
auto st = scanner->get_block(&_runtime_state, block.get(), &eof);
ASSERT_FALSE(st.ok());
auto msg = st.to_string();
auto pos = msg.find("Failed to create reader for");
auto pos = msg.find("Not supported create reader");
std::cout << "msg = " << msg << std::endl;
ASSERT_TRUE(pos != msg.npos);
WARN_IF_ERROR(scanner->close(&_runtime_state), "fail to close scanner");
Expand Down
Loading
Loading