mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Merge pull request #30228 from kitaisreal/functions-json-updated
FunctionsJSON updated
This commit is contained in:
commit
d3cb99701d
@ -1,3 +1,4 @@
|
||||
#include <type_traits>
|
||||
#include <boost/tti/has_member_function.hpp>
|
||||
|
||||
#include <base/range.h>
|
||||
@ -38,7 +39,6 @@
|
||||
#include <Functions/SimdJSONParser.h>
|
||||
#include <Functions/RapidJSONParser.h>
|
||||
#include <Functions/FunctionHelpers.h>
|
||||
#include <Functions/FunctionsJSON.h>
|
||||
|
||||
#include <Interpreters/Context.h>
|
||||
|
||||
@ -58,6 +58,11 @@ namespace ErrorCodes
|
||||
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
concept HasIndexOperator = requires (T t)
|
||||
{
|
||||
t[0];
|
||||
};
|
||||
|
||||
/// Functions to parse JSONs and extract values from it.
|
||||
/// The first argument of all these functions gets a JSON,
|
||||
@ -279,7 +284,7 @@ private:
|
||||
return true;
|
||||
}
|
||||
|
||||
if constexpr (FunctionJSONHelpersDetails::has_index_operator<typename JSONParser::Object>::value)
|
||||
if constexpr (HasIndexOperator<typename JSONParser::Object>)
|
||||
{
|
||||
if (element.isObject())
|
||||
{
|
||||
|
@ -1,17 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
namespace FunctionJSONHelpersDetails
|
||||
{
|
||||
template <class T, class = void>
|
||||
struct has_index_operator : std::false_type {};
|
||||
|
||||
template <class T>
|
||||
struct has_index_operator<T, std::void_t<decltype(std::declval<T>()[0])>> : std::true_type {};
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user