-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update vendored DuckDB sources to 51d53f8
- Loading branch information
1 parent
51d53f8
commit 4440802
Showing
108 changed files
with
4,305 additions
and
3,005 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include "json_executors.hpp" | ||
|
||
namespace duckdb { | ||
|
||
static inline string_t ValueFromVal(yyjson_val *val, yyjson_alc *alc, Vector &, ValidityMask &mask, idx_t idx) { | ||
switch (yyjson_get_tag(val)) { | ||
case YYJSON_TYPE_ARR | YYJSON_SUBTYPE_NONE: | ||
case YYJSON_TYPE_OBJ | YYJSON_SUBTYPE_NONE: | ||
mask.SetInvalid(idx); | ||
return string_t {}; | ||
default: | ||
return JSONCommon::WriteVal<yyjson_val>(val, alc); | ||
} | ||
} | ||
|
||
static void ValueFunction(DataChunk &args, ExpressionState &state, Vector &result) { | ||
JSONExecutors::BinaryExecute<string_t>(args, state, result, ValueFromVal); | ||
} | ||
|
||
static void ValueManyFunction(DataChunk &args, ExpressionState &state, Vector &result) { | ||
JSONExecutors::ExecuteMany<string_t>(args, state, result, ValueFromVal); | ||
} | ||
|
||
static void GetValueFunctionsInternal(ScalarFunctionSet &set, const LogicalType &input_type) { | ||
set.AddFunction(ScalarFunction({input_type, LogicalType::BIGINT}, LogicalType::JSON(), ValueFunction, | ||
JSONReadFunctionData::Bind, nullptr, nullptr, JSONFunctionLocalState::Init)); | ||
set.AddFunction(ScalarFunction({input_type, LogicalType::VARCHAR}, LogicalType::JSON(), ValueFunction, | ||
JSONReadFunctionData::Bind, nullptr, nullptr, JSONFunctionLocalState::Init)); | ||
set.AddFunction(ScalarFunction({input_type, LogicalType::LIST(LogicalType::VARCHAR)}, | ||
LogicalType::LIST(LogicalType::JSON()), ValueManyFunction, | ||
JSONReadManyFunctionData::Bind, nullptr, nullptr, JSONFunctionLocalState::Init)); | ||
} | ||
|
||
ScalarFunctionSet JSONFunctions::GetValueFunction() { | ||
// The value function is just like the extract function but returns NULL if the JSON is not a scalar value | ||
ScalarFunctionSet set("json_value"); | ||
GetValueFunctionsInternal(set, LogicalType::VARCHAR); | ||
GetValueFunctionsInternal(set, LogicalType::JSON()); | ||
return set; | ||
} | ||
|
||
} // namespace duckdb |
34 changes: 18 additions & 16 deletions
34
src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.