diff --git a/be/src/runtime/jsonb_value.h b/be/src/runtime/jsonb_value.h index 88abb379d9..915094c330 100644 --- a/be/src/runtime/jsonb_value.h +++ b/be/src/runtime/jsonb_value.h @@ -26,7 +26,11 @@ #include "common/status.h" #include "util/hash_util.hpp" +#ifdef __AVX2__ #include "util/jsonb_parser_simd.h" +#else +#include "util/jsonb_parser.h" +#endif namespace doris { @@ -36,7 +40,7 @@ struct JsonBinaryValue { // default nullprt and size 0 for invalid or NULL value const char* ptr = nullptr; size_t len = 0; - JsonbParserSIMD parser; + JsonbParser parser; JsonBinaryValue() : ptr(nullptr), len(0) {} JsonBinaryValue(char* ptr, int len) { from_json_string(const_cast(ptr), len); } diff --git a/be/src/util/jsonb_parser.h b/be/src/util/jsonb_parser.h index f4711f9a62..8d29b52faf 100644 --- a/be/src/util/jsonb_parser.h +++ b/be/src/util/jsonb_parser.h @@ -665,12 +665,15 @@ private: case 4: *--out = ((uc | 0x80) & 0xBF); uc >>= 6; + [[fallthrough]]; case 3: *--out = ((uc | 0x80) & 0xBF); uc >>= 6; + [[fallthrough]]; case 2: *--out = ((uc | 0x80) & 0xBF); uc >>= 6; + [[fallthrough]]; case 1: // Mask the first byte according to the standard. *--out = (uc | firstByteMark[len - 1]); diff --git a/be/src/util/jsonb_parser_simd.h b/be/src/util/jsonb_parser_simd.h index 10d19a3f57..971d06d46e 100644 --- a/be/src/util/jsonb_parser_simd.h +++ b/be/src/util/jsonb_parser_simd.h @@ -343,7 +343,7 @@ private: JsonbErrType err_; }; -using JsonbParserSIMD = JsonbParserTSIMD; +using JsonbParser = JsonbParserTSIMD; } // namespace doris diff --git a/be/src/vec/functions/function_json.cpp b/be/src/vec/functions/function_json.cpp index ccaad26a9e..9c256483c6 100644 --- a/be/src/vec/functions/function_json.cpp +++ b/be/src/vec/functions/function_json.cpp @@ -41,7 +41,11 @@ #include "common/compiler_util.h" // IWYU pragma: keep #include "common/status.h" #include "exprs/json_functions.h" +#ifdef __AVX2__ #include "util/jsonb_parser_simd.h" +#else +#include "util/jsonb_parser.h" +#endif #include "util/string_parser.hpp" #include "util/string_util.h" #include "vec/aggregate_functions/aggregate_function.h" @@ -910,7 +914,7 @@ public: vec_to.resize(size); // parser can be reused for performance - JsonbParserSIMD parser; + JsonbParser parser; for (size_t i = 0; i < input_rows_count; ++i) { if (col_from.is_null_at(i)) { null_map->get_data()[i] = 1; diff --git a/be/src/vec/functions/function_jsonb.cpp b/be/src/vec/functions/function_jsonb.cpp index 8be6536b56..a0af1e13a2 100644 --- a/be/src/vec/functions/function_jsonb.cpp +++ b/be/src/vec/functions/function_jsonb.cpp @@ -33,7 +33,11 @@ #include "udf/udf.h" #include "util/jsonb_document.h" #include "util/jsonb_error.h" +#ifdef __AVX2__ #include "util/jsonb_parser_simd.h" +#else +#include "util/jsonb_parser.h" +#endif #include "util/jsonb_stream.h" #include "util/jsonb_utils.h" #include "util/jsonb_writer.h" @@ -74,7 +78,7 @@ enum class JsonbParseErrorMode { FAIL = 0, RETURN_NULL, RETURN_VALUE, RETURN_INV template class FunctionJsonbParseBase : public IFunction { private: - JsonbParserSIMD default_value_parser; + JsonbParser default_value_parser; bool has_const_default_value = false; public: @@ -221,7 +225,7 @@ public: col_to->reserve(size); // parser can be reused for performance - JsonbParserSIMD parser; + JsonbParser parser; JsonbErrType error = JsonbErrType::E_NONE; for (size_t i = 0; i < input_rows_count; ++i) {