should be it

This commit is contained in:
2025-10-24 19:21:19 -05:00
parent a4b23fc57c
commit f09560c7b1
14047 changed files with 3161551 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
#include "json_executors.hpp"
namespace duckdb {
static inline bool JSONExists(yyjson_val *val, yyjson_alc *, Vector &, ValidityMask &, idx_t) {
return val;
}
static void BinaryExistsFunction(DataChunk &args, ExpressionState &state, Vector &result) {
JSONExecutors::BinaryExecute<bool, false>(args, state, result, JSONExists);
}
static void ManyExistsFunction(DataChunk &args, ExpressionState &state, Vector &result) {
JSONExecutors::ExecuteMany<bool, false>(args, state, result, JSONExists);
}
static void GetExistsFunctionsInternal(ScalarFunctionSet &set, const LogicalType &input_type) {
set.AddFunction(ScalarFunction({input_type, LogicalType::VARCHAR}, LogicalType::BOOLEAN, BinaryExistsFunction,
JSONReadFunctionData::Bind, nullptr, nullptr, JSONFunctionLocalState::Init));
set.AddFunction(ScalarFunction({input_type, LogicalType::LIST(LogicalType::VARCHAR)},
LogicalType::LIST(LogicalType::BOOLEAN), ManyExistsFunction,
JSONReadManyFunctionData::Bind, nullptr, nullptr, JSONFunctionLocalState::Init));
}
ScalarFunctionSet JSONFunctions::GetExistsFunction() {
ScalarFunctionSet set("json_exists");
GetExistsFunctionsInternal(set, LogicalType::VARCHAR);
GetExistsFunctionsInternal(set, LogicalType::JSON());
return set;
}
} // namespace duckdb