[Improve](compile) add __AVX2__ macro for JsonbParser (#28754)
* [Improve](compile) add `__AVX2__` macro for JsonbParser * throw exception instead of CHECK
This commit is contained in:
@ -65,6 +65,12 @@
|
||||
#include "vec/data_types/data_type_nullable.h"
|
||||
#include "vec/data_types/get_least_supertype.h"
|
||||
|
||||
#ifdef __AVX2__
|
||||
#include "util/jsonb_parser_simd.h"
|
||||
#else
|
||||
#include "util/jsonb_parser.h"
|
||||
#endif
|
||||
|
||||
namespace doris::vectorized {
|
||||
namespace {
|
||||
|
||||
@ -1155,8 +1161,14 @@ void ColumnObject::merge_sparse_to_root_column() {
|
||||
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
|
||||
root.Accept(writer);
|
||||
bool res = parser.parse(buffer.GetString(), buffer.GetSize());
|
||||
CHECK(res) << "buffer:" << std::string(buffer.GetString(), buffer.GetSize())
|
||||
<< ", row_num:" << i;
|
||||
if (!res) {
|
||||
throw Exception(ErrorCode::INVALID_ARGUMENT,
|
||||
"parse json failed, doc: {}"
|
||||
", row_num:{}"
|
||||
", error:{}",
|
||||
std::string(buffer.GetString(), buffer.GetSize()), i,
|
||||
JsonbErrMsg::getErrMsg(parser.getErrorCode()));
|
||||
}
|
||||
result_column_ptr->insert_data(parser.getWriter().getOutput()->getBuffer(),
|
||||
parser.getWriter().getOutput()->getSize());
|
||||
result_column_nullable->get_null_map_data().push_back(0);
|
||||
|
||||
@ -26,6 +26,12 @@
|
||||
#include "common/status.h"
|
||||
#include "exprs/json_functions.h"
|
||||
#include "runtime/jsonb_value.h"
|
||||
|
||||
#ifdef __AVX2__
|
||||
#include "util/jsonb_parser_simd.h"
|
||||
#else
|
||||
#include "util/jsonb_parser.h"
|
||||
#endif
|
||||
namespace doris {
|
||||
namespace vectorized {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user