mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Backport #70218 to 24.9: Respect setting allow_simdjson in JSON type parser
This commit is contained in:
parent
566db64394
commit
cdf404cd1b
@ -24,7 +24,8 @@
|
||||
|
||||
#if USE_SIMDJSON
|
||||
# include <Common/JSONParsers/SimdJSONParser.h>
|
||||
#elif USE_RAPIDJSON
|
||||
#endif
|
||||
#if USE_RAPIDJSON
|
||||
# include <Common/JSONParsers/RapidJSONParser.h>
|
||||
#else
|
||||
# include <Common/JSONParsers/DummyJSONParser.h>
|
||||
@ -36,6 +37,7 @@ namespace Setting
|
||||
{
|
||||
extern const SettingsBool allow_experimental_object_type;
|
||||
extern const SettingsBool use_json_alias_for_old_object_type;
|
||||
extern const SettingsBool allow_simdjson;
|
||||
}
|
||||
|
||||
namespace ErrorCodes
|
||||
@ -127,12 +129,18 @@ SerializationPtr DataTypeObject::doGetDefaultSerialization() const
|
||||
{
|
||||
case SchemaFormat::JSON:
|
||||
#if USE_SIMDJSON
|
||||
return std::make_shared<SerializationJSON<SimdJSONParser>>(
|
||||
std::move(typed_path_serializations),
|
||||
paths_to_skip,
|
||||
path_regexps_to_skip,
|
||||
buildJSONExtractTree<SimdJSONParser>(getPtr(), "JSON serialization"));
|
||||
#elif USE_RAPIDJSON
|
||||
auto context = CurrentThread::getQueryContext();
|
||||
if (!context)
|
||||
context = Context::getGlobalContextInstance();
|
||||
if (context->getSettingsRef()[Setting::allow_simdjson])
|
||||
return std::make_shared<SerializationJSON<SimdJSONParser>>(
|
||||
std::move(typed_path_serializations),
|
||||
paths_to_skip,
|
||||
path_regexps_to_skip,
|
||||
buildJSONExtractTree<SimdJSONParser>(getPtr(), "JSON serialization"));
|
||||
#endif
|
||||
|
||||
#if USE_RAPIDJSON
|
||||
return std::make_shared<SerializationJSON<RapidJSONParser>>(
|
||||
std::move(typed_path_serializations),
|
||||
paths_to_skip,
|
||||
|
@ -0,0 +1,2 @@
|
||||
2
|
||||
2
|
11
tests/queries/0_stateless/03246_json_simd_rapid_parsers.sh
Executable file
11
tests/queries/0_stateless/03246_json_simd_rapid_parsers.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tags: no-fasttest
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
$CLICKHOUSE_LOCAL --allow_experimental_json_type=1 --stacktrace -q "select '{\"a\" : 4ab2}'::JSON" 2>&1 | grep -c -F "SimdJSON"
|
||||
$CLICKHOUSE_LOCAL --allow_experimental_json_type=1 --allow_simdjson=0 --stacktrace -q "select '{\"a\" : 4ab2}'::JSON" 2>&1 | grep -c -F "RapidJSON"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user