mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
Fix build and add comments.
This commit is contained in:
parent
797f76a187
commit
a0ca932035
@ -315,18 +315,26 @@ public:
|
||||
template <typename JSONParser>
|
||||
class IsValidJSONImpl
|
||||
{
|
||||
public:
|
||||
static DataTypePtr getType(const char * function_name, const ColumnsWithTypeAndName & arguments)
|
||||
{
|
||||
if (arguments.size() != 1)
|
||||
{
|
||||
/// IsValidJSON() shouldn't get parameters other than JSON.
|
||||
throw Exception{"Function " + String(function_name) + " needs exactly one argument",
|
||||
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH};
|
||||
}
|
||||
return std::make_shared<DataTypeUInt8>();
|
||||
}
|
||||
|
||||
using Iterator = typename JSONParser::Iterator;
|
||||
static bool addValueToColumn(IColumn & dest, const Iterator &)
|
||||
{
|
||||
JSONHasImpl<JSONParser>::addValueToColumn(dest);
|
||||
/// This function is called only if JSON is valid.
|
||||
/// If JSON isn't valid then `FunctionJSON::Executor::run()` adds default value (=zero) to `dest` without calling this function.
|
||||
ColumnVector<UInt8> & col_vec = assert_cast<ColumnVector<UInt8> &>(dest);
|
||||
col_vec.insertValue(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
static constexpr size_t num_extra_arguments = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user