mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Merge pull request #22057 from vitlibar/update-simdjson
Update simdjson
This commit is contained in:
commit
86a293d6c8
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -93,7 +93,7 @@
|
||||
url = https://github.com/ClickHouse-Extras/libunwind.git
|
||||
[submodule "contrib/simdjson"]
|
||||
path = contrib/simdjson
|
||||
url = https://github.com/ClickHouse-Extras/simdjson.git
|
||||
url = https://github.com/simdjson/simdjson.git
|
||||
[submodule "contrib/rapidjson"]
|
||||
path = contrib/rapidjson
|
||||
url = https://github.com/ClickHouse-Extras/rapidjson
|
||||
|
2
contrib/simdjson
vendored
2
contrib/simdjson
vendored
@ -1 +1 @@
|
||||
Subproject commit 3190d66a49059092a1753dc35595923debfc1698
|
||||
Subproject commit 95b4870e20be5f97d9dcf63b23b1c6f520c366c1
|
@ -42,11 +42,11 @@ struct SimdJSONParser
|
||||
ALWAYS_INLINE bool isBool() const { return element.type() == simdjson::dom::element_type::BOOL; }
|
||||
ALWAYS_INLINE bool isNull() const { return element.type() == simdjson::dom::element_type::NULL_VALUE; }
|
||||
|
||||
ALWAYS_INLINE Int64 getInt64() const { return element.get_int64().first; }
|
||||
ALWAYS_INLINE UInt64 getUInt64() const { return element.get_uint64().first; }
|
||||
ALWAYS_INLINE double getDouble() const { return element.get_double().first; }
|
||||
ALWAYS_INLINE bool getBool() const { return element.get_bool().first; }
|
||||
ALWAYS_INLINE std::string_view getString() const { return element.get_string().first; }
|
||||
ALWAYS_INLINE Int64 getInt64() const { return element.get_int64().value_unsafe(); }
|
||||
ALWAYS_INLINE UInt64 getUInt64() const { return element.get_uint64().value_unsafe(); }
|
||||
ALWAYS_INLINE double getDouble() const { return element.get_double().value_unsafe(); }
|
||||
ALWAYS_INLINE bool getBool() const { return element.get_bool().value_unsafe(); }
|
||||
ALWAYS_INLINE std::string_view getString() const { return element.get_string().value_unsafe(); }
|
||||
ALWAYS_INLINE Array getArray() const;
|
||||
ALWAYS_INLINE Object getObject() const;
|
||||
|
||||
@ -75,7 +75,7 @@ struct SimdJSONParser
|
||||
ALWAYS_INLINE Iterator begin() const { return array.begin(); }
|
||||
ALWAYS_INLINE Iterator end() const { return array.end(); }
|
||||
ALWAYS_INLINE size_t size() const { return array.size(); }
|
||||
ALWAYS_INLINE Element operator[](size_t index) const { assert(index < size()); return array.at(index).first; }
|
||||
ALWAYS_INLINE Element operator[](size_t index) const { assert(index < size()); return array.at(index).value_unsafe(); }
|
||||
|
||||
private:
|
||||
simdjson::dom::array array;
|
||||
@ -111,7 +111,7 @@ struct SimdJSONParser
|
||||
if (x.error())
|
||||
return false;
|
||||
|
||||
result = x.first;
|
||||
result = x.value_unsafe();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ struct SimdJSONParser
|
||||
if (document.error())
|
||||
return false;
|
||||
|
||||
result = document.first;
|
||||
result = document.value_unsafe();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -155,12 +155,12 @@ private:
|
||||
|
||||
inline ALWAYS_INLINE SimdJSONParser::Array SimdJSONParser::Element::getArray() const
|
||||
{
|
||||
return element.get_array().first;
|
||||
return element.get_array().value_unsafe();
|
||||
}
|
||||
|
||||
inline ALWAYS_INLINE SimdJSONParser::Object SimdJSONParser::Element::getObject() const
|
||||
{
|
||||
return element.get_object().first;
|
||||
return element.get_object().value_unsafe();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,3 +4,7 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
|
@ -3,6 +3,8 @@ SET allow_simdjson=1;
|
||||
SELECT JSONLength('"HX-=');
|
||||
SELECT JSONLength('[9]\0\x42\xD3\x36\xE3');
|
||||
SELECT JSONLength(unhex('5B30000E06D7AA5D'));
|
||||
SELECT JSONLength('{"success"test:"123"}');
|
||||
SELECT isValidJSON('{"success"test:"123"}');
|
||||
|
||||
|
||||
SET allow_simdjson=0;
|
||||
@ -10,3 +12,5 @@ SET allow_simdjson=0;
|
||||
SELECT JSONLength('"HX-=');
|
||||
SELECT JSONLength('[9]\0\x42\xD3\x36\xE3');
|
||||
SELECT JSONLength(unhex('5B30000E06D7AA5D'));
|
||||
SELECT JSONLength('{"success"test:"123"}');
|
||||
SELECT isValidJSON('{"success"test:"123"}');
|
||||
|
Loading…
Reference in New Issue
Block a user