duckdb 0.3.2-dev479.0 → 0.3.2-dev492.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/duckdb.cpp +444 -7
- package/src/duckdb.hpp +8 -3
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -421,7 +421,7 @@ public:
|
|
|
421
421
|
string schema_name;
|
|
422
422
|
//! Table name
|
|
423
423
|
string table_name;
|
|
424
|
-
//!
|
|
424
|
+
//! Aliases for the column names
|
|
425
425
|
vector<string> column_name_alias;
|
|
426
426
|
|
|
427
427
|
public:
|
|
@@ -2380,7 +2380,7 @@ namespace duckdb {
|
|
|
2380
2380
|
enum class AlterType : uint8_t { INVALID = 0, ALTER_TABLE = 1, ALTER_VIEW = 2 };
|
|
2381
2381
|
|
|
2382
2382
|
struct AlterInfo : public ParseInfo {
|
|
2383
|
-
AlterInfo(AlterType type, string schema, string name) : type(type), schema(schema), name(name) {
|
|
2383
|
+
AlterInfo(AlterType type, string schema, string name) : type(type), schema(move(schema)), name(move(name)) {
|
|
2384
2384
|
}
|
|
2385
2385
|
~AlterInfo() override {
|
|
2386
2386
|
}
|
|
@@ -11690,6 +11690,14 @@ const char *Exception::what() const noexcept {
|
|
|
11690
11690
|
return exception_message_.c_str();
|
|
11691
11691
|
}
|
|
11692
11692
|
|
|
11693
|
+
bool Exception::UncaughtException() {
|
|
11694
|
+
#if __cplusplus >= 201703L
|
|
11695
|
+
return std::uncaught_exceptions() > 0;
|
|
11696
|
+
#else
|
|
11697
|
+
return std::uncaught_exception();
|
|
11698
|
+
#endif
|
|
11699
|
+
}
|
|
11700
|
+
|
|
11693
11701
|
string Exception::ConstructMessageRecursive(const string &msg, vector<ExceptionFormatValue> &values) {
|
|
11694
11702
|
return ExceptionFormatValue::Format(msg, values);
|
|
11695
11703
|
}
|
|
@@ -20653,7 +20661,7 @@ public:
|
|
|
20653
20661
|
|
|
20654
20662
|
MiniZStreamWrapper::~MiniZStreamWrapper() {
|
|
20655
20663
|
// avoid closing if destroyed during stack unwinding
|
|
20656
|
-
if (
|
|
20664
|
+
if (Exception::UncaughtException()) {
|
|
20657
20665
|
return;
|
|
20658
20666
|
}
|
|
20659
20667
|
try {
|
|
@@ -40386,6 +40394,16 @@ Value Value::LIST(vector<Value> values) {
|
|
|
40386
40394
|
return result;
|
|
40387
40395
|
}
|
|
40388
40396
|
|
|
40397
|
+
Value Value::LIST(LogicalType child_type, vector<Value> values) {
|
|
40398
|
+
if (values.empty()) {
|
|
40399
|
+
return Value::EMPTYLIST(move(child_type));
|
|
40400
|
+
}
|
|
40401
|
+
for (auto &val : values) {
|
|
40402
|
+
val = val.CastAs(child_type);
|
|
40403
|
+
}
|
|
40404
|
+
return Value::LIST(move(values));
|
|
40405
|
+
}
|
|
40406
|
+
|
|
40389
40407
|
Value Value::EMPTYLIST(LogicalType child_type) {
|
|
40390
40408
|
Value result;
|
|
40391
40409
|
result.type_ = LogicalType::LIST(move(child_type));
|
|
@@ -97206,6 +97224,10 @@ struct DuckDBDependenciesFun {
|
|
|
97206
97224
|
static void RegisterFunction(BuiltinFunctions &set);
|
|
97207
97225
|
};
|
|
97208
97226
|
|
|
97227
|
+
struct DuckDBFunctionsFun {
|
|
97228
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
97229
|
+
};
|
|
97230
|
+
|
|
97209
97231
|
struct DuckDBIndexesFun {
|
|
97210
97232
|
static void RegisterFunction(BuiltinFunctions &set);
|
|
97211
97233
|
};
|
|
@@ -98921,6 +98943,420 @@ void DuckDBDependenciesFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
98921
98943
|
|
|
98922
98944
|
|
|
98923
98945
|
|
|
98946
|
+
|
|
98947
|
+
|
|
98948
|
+
namespace duckdb {
|
|
98949
|
+
|
|
98950
|
+
struct DuckDBFunctionsData : public FunctionOperatorData {
|
|
98951
|
+
DuckDBFunctionsData() : offset(0), offset_in_entry(0) {
|
|
98952
|
+
}
|
|
98953
|
+
|
|
98954
|
+
vector<CatalogEntry *> entries;
|
|
98955
|
+
idx_t offset;
|
|
98956
|
+
idx_t offset_in_entry;
|
|
98957
|
+
};
|
|
98958
|
+
|
|
98959
|
+
static unique_ptr<FunctionData> DuckDBFunctionsBind(ClientContext &context, vector<Value> &inputs,
|
|
98960
|
+
unordered_map<string, Value> &named_parameters,
|
|
98961
|
+
vector<LogicalType> &input_table_types,
|
|
98962
|
+
vector<string> &input_table_names,
|
|
98963
|
+
vector<LogicalType> &return_types, vector<string> &names) {
|
|
98964
|
+
names.emplace_back("schema_name");
|
|
98965
|
+
return_types.emplace_back(LogicalType::VARCHAR);
|
|
98966
|
+
|
|
98967
|
+
names.emplace_back("function_name");
|
|
98968
|
+
return_types.emplace_back(LogicalType::VARCHAR);
|
|
98969
|
+
|
|
98970
|
+
names.emplace_back("function_type");
|
|
98971
|
+
return_types.emplace_back(LogicalType::VARCHAR);
|
|
98972
|
+
|
|
98973
|
+
names.emplace_back("description");
|
|
98974
|
+
return_types.emplace_back(LogicalType::VARCHAR);
|
|
98975
|
+
|
|
98976
|
+
names.emplace_back("return_type");
|
|
98977
|
+
return_types.emplace_back(LogicalType::VARCHAR);
|
|
98978
|
+
|
|
98979
|
+
names.emplace_back("parameters");
|
|
98980
|
+
return_types.push_back(LogicalType::LIST(LogicalType::VARCHAR));
|
|
98981
|
+
|
|
98982
|
+
names.emplace_back("parameter_types");
|
|
98983
|
+
return_types.push_back(LogicalType::LIST(LogicalType::VARCHAR));
|
|
98984
|
+
|
|
98985
|
+
names.emplace_back("varargs");
|
|
98986
|
+
return_types.emplace_back(LogicalType::VARCHAR);
|
|
98987
|
+
|
|
98988
|
+
names.emplace_back("macro_definition");
|
|
98989
|
+
return_types.emplace_back(LogicalType::VARCHAR);
|
|
98990
|
+
|
|
98991
|
+
return nullptr;
|
|
98992
|
+
}
|
|
98993
|
+
|
|
98994
|
+
static void ExtractFunctionsFromSchema(ClientContext &context, SchemaCatalogEntry &schema,
|
|
98995
|
+
DuckDBFunctionsData &result) {
|
|
98996
|
+
schema.Scan(context, CatalogType::SCALAR_FUNCTION_ENTRY,
|
|
98997
|
+
[&](CatalogEntry *entry) { result.entries.push_back(entry); });
|
|
98998
|
+
schema.Scan(context, CatalogType::TABLE_FUNCTION_ENTRY,
|
|
98999
|
+
[&](CatalogEntry *entry) { result.entries.push_back(entry); });
|
|
99000
|
+
schema.Scan(context, CatalogType::PRAGMA_FUNCTION_ENTRY,
|
|
99001
|
+
[&](CatalogEntry *entry) { result.entries.push_back(entry); });
|
|
99002
|
+
}
|
|
99003
|
+
|
|
99004
|
+
unique_ptr<FunctionOperatorData> DuckDBFunctionsInit(ClientContext &context, const FunctionData *bind_data,
|
|
99005
|
+
const vector<column_t> &column_ids,
|
|
99006
|
+
TableFilterCollection *filters) {
|
|
99007
|
+
auto result = make_unique<DuckDBFunctionsData>();
|
|
99008
|
+
|
|
99009
|
+
// scan all the schemas for tables and collect themand collect them
|
|
99010
|
+
auto schemas = Catalog::GetCatalog(context).schemas->GetEntries<SchemaCatalogEntry>(context);
|
|
99011
|
+
for (auto &schema : schemas) {
|
|
99012
|
+
ExtractFunctionsFromSchema(context, *schema, *result);
|
|
99013
|
+
};
|
|
99014
|
+
ExtractFunctionsFromSchema(context, *context.temporary_objects, *result);
|
|
99015
|
+
|
|
99016
|
+
std::sort(result->entries.begin(), result->entries.end(),
|
|
99017
|
+
[&](CatalogEntry *a, CatalogEntry *b) { return (int)a->type < (int)b->type; });
|
|
99018
|
+
return move(result);
|
|
99019
|
+
}
|
|
99020
|
+
|
|
99021
|
+
struct ScalarFunctionExtractor {
|
|
99022
|
+
static idx_t FunctionCount(ScalarFunctionCatalogEntry &entry) {
|
|
99023
|
+
return entry.functions.size();
|
|
99024
|
+
}
|
|
99025
|
+
|
|
99026
|
+
static Value GetFunctionType() {
|
|
99027
|
+
return Value("scalar");
|
|
99028
|
+
}
|
|
99029
|
+
|
|
99030
|
+
static Value GetFunctionDescription(ScalarFunctionCatalogEntry &entry, idx_t offset) {
|
|
99031
|
+
return Value();
|
|
99032
|
+
}
|
|
99033
|
+
|
|
99034
|
+
static Value GetReturnType(ScalarFunctionCatalogEntry &entry, idx_t offset) {
|
|
99035
|
+
return Value(entry.functions[offset].return_type.ToString());
|
|
99036
|
+
}
|
|
99037
|
+
|
|
99038
|
+
static Value GetParameters(ScalarFunctionCatalogEntry &entry, idx_t offset) {
|
|
99039
|
+
vector<Value> results;
|
|
99040
|
+
for (idx_t i = 0; i < entry.functions[offset].arguments.size(); i++) {
|
|
99041
|
+
results.emplace_back("col" + to_string(i));
|
|
99042
|
+
}
|
|
99043
|
+
return Value::LIST(LogicalType::VARCHAR, move(results));
|
|
99044
|
+
}
|
|
99045
|
+
|
|
99046
|
+
static Value GetParameterTypes(ScalarFunctionCatalogEntry &entry, idx_t offset) {
|
|
99047
|
+
vector<Value> results;
|
|
99048
|
+
for (idx_t i = 0; i < entry.functions[offset].arguments.size(); i++) {
|
|
99049
|
+
results.emplace_back(entry.functions[offset].arguments[i].ToString());
|
|
99050
|
+
}
|
|
99051
|
+
return Value::LIST(LogicalType::VARCHAR, move(results));
|
|
99052
|
+
}
|
|
99053
|
+
|
|
99054
|
+
static Value GetVarArgs(ScalarFunctionCatalogEntry &entry, idx_t offset) {
|
|
99055
|
+
return entry.functions[offset].varargs.id() == LogicalTypeId::INVALID
|
|
99056
|
+
? Value()
|
|
99057
|
+
: Value(entry.functions[offset].varargs.ToString());
|
|
99058
|
+
}
|
|
99059
|
+
|
|
99060
|
+
static Value GetMacroDefinition(ScalarFunctionCatalogEntry &entry, idx_t offset) {
|
|
99061
|
+
return Value();
|
|
99062
|
+
}
|
|
99063
|
+
};
|
|
99064
|
+
|
|
99065
|
+
struct AggregateFunctionExtractor {
|
|
99066
|
+
static idx_t FunctionCount(AggregateFunctionCatalogEntry &entry) {
|
|
99067
|
+
return entry.functions.size();
|
|
99068
|
+
}
|
|
99069
|
+
|
|
99070
|
+
static Value GetFunctionType() {
|
|
99071
|
+
return Value("aggregate");
|
|
99072
|
+
}
|
|
99073
|
+
|
|
99074
|
+
static Value GetFunctionDescription(AggregateFunctionCatalogEntry &entry, idx_t offset) {
|
|
99075
|
+
return Value();
|
|
99076
|
+
}
|
|
99077
|
+
|
|
99078
|
+
static Value GetReturnType(AggregateFunctionCatalogEntry &entry, idx_t offset) {
|
|
99079
|
+
return Value(entry.functions[offset].return_type.ToString());
|
|
99080
|
+
}
|
|
99081
|
+
|
|
99082
|
+
static Value GetParameters(AggregateFunctionCatalogEntry &entry, idx_t offset) {
|
|
99083
|
+
vector<Value> results;
|
|
99084
|
+
for (idx_t i = 0; i < entry.functions[offset].arguments.size(); i++) {
|
|
99085
|
+
results.emplace_back("col" + to_string(i));
|
|
99086
|
+
}
|
|
99087
|
+
return Value::LIST(LogicalType::VARCHAR, move(results));
|
|
99088
|
+
}
|
|
99089
|
+
|
|
99090
|
+
static Value GetParameterTypes(AggregateFunctionCatalogEntry &entry, idx_t offset) {
|
|
99091
|
+
vector<Value> results;
|
|
99092
|
+
for (idx_t i = 0; i < entry.functions[offset].arguments.size(); i++) {
|
|
99093
|
+
results.emplace_back(entry.functions[offset].arguments[i].ToString());
|
|
99094
|
+
}
|
|
99095
|
+
return Value::LIST(LogicalType::VARCHAR, move(results));
|
|
99096
|
+
}
|
|
99097
|
+
|
|
99098
|
+
static Value GetVarArgs(AggregateFunctionCatalogEntry &entry, idx_t offset) {
|
|
99099
|
+
return entry.functions[offset].varargs.id() == LogicalTypeId::INVALID
|
|
99100
|
+
? Value()
|
|
99101
|
+
: Value(entry.functions[offset].varargs.ToString());
|
|
99102
|
+
}
|
|
99103
|
+
|
|
99104
|
+
static Value GetMacroDefinition(AggregateFunctionCatalogEntry &entry, idx_t offset) {
|
|
99105
|
+
return Value();
|
|
99106
|
+
}
|
|
99107
|
+
};
|
|
99108
|
+
|
|
99109
|
+
struct MacroExtractor {
|
|
99110
|
+
static idx_t FunctionCount(MacroCatalogEntry &entry) {
|
|
99111
|
+
return 1;
|
|
99112
|
+
}
|
|
99113
|
+
|
|
99114
|
+
static Value GetFunctionType() {
|
|
99115
|
+
return Value("macro");
|
|
99116
|
+
}
|
|
99117
|
+
|
|
99118
|
+
static Value GetFunctionDescription(MacroCatalogEntry &entry, idx_t offset) {
|
|
99119
|
+
return Value();
|
|
99120
|
+
}
|
|
99121
|
+
|
|
99122
|
+
static Value GetReturnType(MacroCatalogEntry &entry, idx_t offset) {
|
|
99123
|
+
return Value();
|
|
99124
|
+
}
|
|
99125
|
+
|
|
99126
|
+
static Value GetParameters(MacroCatalogEntry &entry, idx_t offset) {
|
|
99127
|
+
vector<Value> results;
|
|
99128
|
+
for (auto ¶m : entry.function->parameters) {
|
|
99129
|
+
D_ASSERT(param->type == ExpressionType::COLUMN_REF);
|
|
99130
|
+
auto &colref = (ColumnRefExpression &)*param;
|
|
99131
|
+
results.emplace_back(colref.GetColumnName());
|
|
99132
|
+
}
|
|
99133
|
+
for (auto ¶m_entry : entry.function->default_parameters) {
|
|
99134
|
+
results.emplace_back(param_entry.first);
|
|
99135
|
+
}
|
|
99136
|
+
return Value::LIST(LogicalType::VARCHAR, move(results));
|
|
99137
|
+
}
|
|
99138
|
+
|
|
99139
|
+
static Value GetParameterTypes(MacroCatalogEntry &entry, idx_t offset) {
|
|
99140
|
+
vector<Value> results;
|
|
99141
|
+
for (idx_t i = 0; i < entry.function->parameters.size(); i++) {
|
|
99142
|
+
results.emplace_back(LogicalType::VARCHAR);
|
|
99143
|
+
}
|
|
99144
|
+
for (idx_t i = 0; i < entry.function->default_parameters.size(); i++) {
|
|
99145
|
+
results.emplace_back(LogicalType::VARCHAR);
|
|
99146
|
+
}
|
|
99147
|
+
return Value::LIST(LogicalType::VARCHAR, move(results));
|
|
99148
|
+
}
|
|
99149
|
+
|
|
99150
|
+
static Value GetVarArgs(MacroCatalogEntry &entry, idx_t offset) {
|
|
99151
|
+
return Value();
|
|
99152
|
+
}
|
|
99153
|
+
|
|
99154
|
+
static Value GetMacroDefinition(MacroCatalogEntry &entry, idx_t offset) {
|
|
99155
|
+
return entry.function->expression->ToString();
|
|
99156
|
+
}
|
|
99157
|
+
};
|
|
99158
|
+
|
|
99159
|
+
struct TableFunctionExtractor {
|
|
99160
|
+
static idx_t FunctionCount(TableFunctionCatalogEntry &entry) {
|
|
99161
|
+
return entry.functions.size();
|
|
99162
|
+
}
|
|
99163
|
+
|
|
99164
|
+
static Value GetFunctionType() {
|
|
99165
|
+
return Value("table");
|
|
99166
|
+
}
|
|
99167
|
+
|
|
99168
|
+
static Value GetFunctionDescription(TableFunctionCatalogEntry &entry, idx_t offset) {
|
|
99169
|
+
return Value();
|
|
99170
|
+
}
|
|
99171
|
+
|
|
99172
|
+
static Value GetReturnType(TableFunctionCatalogEntry &entry, idx_t offset) {
|
|
99173
|
+
return Value();
|
|
99174
|
+
}
|
|
99175
|
+
|
|
99176
|
+
static Value GetParameters(TableFunctionCatalogEntry &entry, idx_t offset) {
|
|
99177
|
+
vector<Value> results;
|
|
99178
|
+
for (idx_t i = 0; i < entry.functions[offset].arguments.size(); i++) {
|
|
99179
|
+
results.emplace_back("col" + to_string(i));
|
|
99180
|
+
}
|
|
99181
|
+
for (auto ¶m : entry.functions[offset].named_parameters) {
|
|
99182
|
+
results.emplace_back(param.first);
|
|
99183
|
+
}
|
|
99184
|
+
return Value::LIST(LogicalType::VARCHAR, move(results));
|
|
99185
|
+
}
|
|
99186
|
+
|
|
99187
|
+
static Value GetParameterTypes(TableFunctionCatalogEntry &entry, idx_t offset) {
|
|
99188
|
+
vector<Value> results;
|
|
99189
|
+
for (idx_t i = 0; i < entry.functions[offset].arguments.size(); i++) {
|
|
99190
|
+
results.emplace_back(entry.functions[offset].arguments[i].ToString());
|
|
99191
|
+
}
|
|
99192
|
+
for (auto ¶m : entry.functions[offset].named_parameters) {
|
|
99193
|
+
results.emplace_back(param.second.ToString());
|
|
99194
|
+
}
|
|
99195
|
+
return Value::LIST(LogicalType::VARCHAR, move(results));
|
|
99196
|
+
}
|
|
99197
|
+
|
|
99198
|
+
static Value GetVarArgs(TableFunctionCatalogEntry &entry, idx_t offset) {
|
|
99199
|
+
return entry.functions[offset].varargs.id() == LogicalTypeId::INVALID
|
|
99200
|
+
? Value()
|
|
99201
|
+
: Value(entry.functions[offset].varargs.ToString());
|
|
99202
|
+
}
|
|
99203
|
+
|
|
99204
|
+
static Value GetMacroDefinition(TableFunctionCatalogEntry &entry, idx_t offset) {
|
|
99205
|
+
return Value();
|
|
99206
|
+
}
|
|
99207
|
+
};
|
|
99208
|
+
|
|
99209
|
+
struct PragmaFunctionExtractor {
|
|
99210
|
+
static idx_t FunctionCount(PragmaFunctionCatalogEntry &entry) {
|
|
99211
|
+
return entry.functions.size();
|
|
99212
|
+
}
|
|
99213
|
+
|
|
99214
|
+
static Value GetFunctionType() {
|
|
99215
|
+
return Value("pragma");
|
|
99216
|
+
}
|
|
99217
|
+
|
|
99218
|
+
static Value GetFunctionDescription(PragmaFunctionCatalogEntry &entry, idx_t offset) {
|
|
99219
|
+
return Value();
|
|
99220
|
+
}
|
|
99221
|
+
|
|
99222
|
+
static Value GetReturnType(PragmaFunctionCatalogEntry &entry, idx_t offset) {
|
|
99223
|
+
return Value();
|
|
99224
|
+
}
|
|
99225
|
+
|
|
99226
|
+
static Value GetParameters(PragmaFunctionCatalogEntry &entry, idx_t offset) {
|
|
99227
|
+
vector<Value> results;
|
|
99228
|
+
for (idx_t i = 0; i < entry.functions[offset].arguments.size(); i++) {
|
|
99229
|
+
results.emplace_back("col" + to_string(i));
|
|
99230
|
+
}
|
|
99231
|
+
for (auto ¶m : entry.functions[offset].named_parameters) {
|
|
99232
|
+
results.emplace_back(param.first);
|
|
99233
|
+
}
|
|
99234
|
+
return Value::LIST(LogicalType::VARCHAR, move(results));
|
|
99235
|
+
}
|
|
99236
|
+
|
|
99237
|
+
static Value GetParameterTypes(PragmaFunctionCatalogEntry &entry, idx_t offset) {
|
|
99238
|
+
vector<Value> results;
|
|
99239
|
+
for (idx_t i = 0; i < entry.functions[offset].arguments.size(); i++) {
|
|
99240
|
+
results.emplace_back(entry.functions[offset].arguments[i].ToString());
|
|
99241
|
+
}
|
|
99242
|
+
for (auto ¶m : entry.functions[offset].named_parameters) {
|
|
99243
|
+
results.emplace_back(param.second.ToString());
|
|
99244
|
+
}
|
|
99245
|
+
return Value::LIST(LogicalType::VARCHAR, move(results));
|
|
99246
|
+
}
|
|
99247
|
+
|
|
99248
|
+
static Value GetVarArgs(PragmaFunctionCatalogEntry &entry, idx_t offset) {
|
|
99249
|
+
return entry.functions[offset].varargs.id() == LogicalTypeId::INVALID
|
|
99250
|
+
? Value()
|
|
99251
|
+
: Value(entry.functions[offset].varargs.ToString());
|
|
99252
|
+
}
|
|
99253
|
+
|
|
99254
|
+
static Value GetMacroDefinition(PragmaFunctionCatalogEntry &entry, idx_t offset) {
|
|
99255
|
+
return Value();
|
|
99256
|
+
}
|
|
99257
|
+
};
|
|
99258
|
+
|
|
99259
|
+
template <class T, class OP>
|
|
99260
|
+
bool ExtractFunctionData(StandardEntry *entry, idx_t function_idx, DataChunk &output, idx_t output_offset) {
|
|
99261
|
+
auto &function = (T &)*entry;
|
|
99262
|
+
// schema_name, LogicalType::VARCHAR
|
|
99263
|
+
output.SetValue(0, output_offset, Value(entry->schema->name));
|
|
99264
|
+
|
|
99265
|
+
// function_name, LogicalType::VARCHAR
|
|
99266
|
+
output.SetValue(1, output_offset, Value(entry->name));
|
|
99267
|
+
|
|
99268
|
+
// function_type, LogicalType::VARCHAR
|
|
99269
|
+
output.SetValue(2, output_offset, Value(OP::GetFunctionType()));
|
|
99270
|
+
|
|
99271
|
+
// function_description, LogicalType::VARCHAR
|
|
99272
|
+
output.SetValue(3, output_offset, OP::GetFunctionDescription(function, function_idx));
|
|
99273
|
+
|
|
99274
|
+
// return_type, LogicalType::VARCHAR
|
|
99275
|
+
output.SetValue(4, output_offset, OP::GetReturnType(function, function_idx));
|
|
99276
|
+
|
|
99277
|
+
// parameters, LogicalType::LIST(LogicalType::VARCHAR)
|
|
99278
|
+
output.SetValue(5, output_offset, OP::GetParameters(function, function_idx));
|
|
99279
|
+
|
|
99280
|
+
// parameter_types, LogicalType::LIST(LogicalType::VARCHAR)
|
|
99281
|
+
output.SetValue(6, output_offset, OP::GetParameterTypes(function, function_idx));
|
|
99282
|
+
|
|
99283
|
+
// varargs, LogicalType::VARCHAR
|
|
99284
|
+
output.SetValue(7, output_offset, OP::GetVarArgs(function, function_idx));
|
|
99285
|
+
|
|
99286
|
+
// macro_definition, LogicalType::VARCHAR
|
|
99287
|
+
output.SetValue(8, output_offset, OP::GetMacroDefinition(function, function_idx));
|
|
99288
|
+
|
|
99289
|
+
return function_idx + 1 == OP::FunctionCount(function);
|
|
99290
|
+
}
|
|
99291
|
+
|
|
99292
|
+
void DuckDBFunctionsFunction(ClientContext &context, const FunctionData *bind_data,
|
|
99293
|
+
FunctionOperatorData *operator_state, DataChunk *input, DataChunk &output) {
|
|
99294
|
+
auto &data = (DuckDBFunctionsData &)*operator_state;
|
|
99295
|
+
if (data.offset >= data.entries.size()) {
|
|
99296
|
+
// finished returning values
|
|
99297
|
+
return;
|
|
99298
|
+
}
|
|
99299
|
+
// start returning values
|
|
99300
|
+
// either fill up the chunk or return all the remaining columns
|
|
99301
|
+
idx_t count = 0;
|
|
99302
|
+
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
|
99303
|
+
auto &entry = data.entries[data.offset];
|
|
99304
|
+
auto standard_entry = (StandardEntry *)entry;
|
|
99305
|
+
bool finished = false;
|
|
99306
|
+
|
|
99307
|
+
switch (entry->type) {
|
|
99308
|
+
case CatalogType::SCALAR_FUNCTION_ENTRY:
|
|
99309
|
+
finished = ExtractFunctionData<ScalarFunctionCatalogEntry, ScalarFunctionExtractor>(
|
|
99310
|
+
standard_entry, data.offset_in_entry, output, count);
|
|
99311
|
+
break;
|
|
99312
|
+
case CatalogType::AGGREGATE_FUNCTION_ENTRY:
|
|
99313
|
+
finished = ExtractFunctionData<AggregateFunctionCatalogEntry, AggregateFunctionExtractor>(
|
|
99314
|
+
standard_entry, data.offset_in_entry, output, count);
|
|
99315
|
+
break;
|
|
99316
|
+
case CatalogType::MACRO_ENTRY:
|
|
99317
|
+
finished = ExtractFunctionData<MacroCatalogEntry, MacroExtractor>(standard_entry, data.offset_in_entry,
|
|
99318
|
+
output, count);
|
|
99319
|
+
break;
|
|
99320
|
+
case CatalogType::TABLE_FUNCTION_ENTRY:
|
|
99321
|
+
finished = ExtractFunctionData<TableFunctionCatalogEntry, TableFunctionExtractor>(
|
|
99322
|
+
standard_entry, data.offset_in_entry, output, count);
|
|
99323
|
+
break;
|
|
99324
|
+
case CatalogType::PRAGMA_FUNCTION_ENTRY:
|
|
99325
|
+
finished = ExtractFunctionData<PragmaFunctionCatalogEntry, PragmaFunctionExtractor>(
|
|
99326
|
+
standard_entry, data.offset_in_entry, output, count);
|
|
99327
|
+
break;
|
|
99328
|
+
default:
|
|
99329
|
+
throw InternalException("FIXME: unrecognized function type in duckdb_functions");
|
|
99330
|
+
}
|
|
99331
|
+
if (finished) {
|
|
99332
|
+
// finished with this function, move to the next function
|
|
99333
|
+
data.offset++;
|
|
99334
|
+
data.offset_in_entry = 0;
|
|
99335
|
+
} else {
|
|
99336
|
+
// more functions remain
|
|
99337
|
+
data.offset_in_entry++;
|
|
99338
|
+
}
|
|
99339
|
+
count++;
|
|
99340
|
+
}
|
|
99341
|
+
output.SetCardinality(count);
|
|
99342
|
+
}
|
|
99343
|
+
|
|
99344
|
+
void DuckDBFunctionsFun::RegisterFunction(BuiltinFunctions &set) {
|
|
99345
|
+
set.AddFunction(
|
|
99346
|
+
TableFunction("duckdb_functions", {}, DuckDBFunctionsFunction, DuckDBFunctionsBind, DuckDBFunctionsInit));
|
|
99347
|
+
}
|
|
99348
|
+
|
|
99349
|
+
} // namespace duckdb
|
|
99350
|
+
|
|
99351
|
+
|
|
99352
|
+
|
|
99353
|
+
|
|
99354
|
+
|
|
99355
|
+
|
|
99356
|
+
|
|
99357
|
+
|
|
99358
|
+
|
|
99359
|
+
|
|
98924
99360
|
namespace duckdb {
|
|
98925
99361
|
|
|
98926
99362
|
struct DuckDBIndexesData : public FunctionOperatorData {
|
|
@@ -100547,6 +100983,7 @@ void BuiltinFunctions::RegisterSQLiteFunctions() {
|
|
|
100547
100983
|
|
|
100548
100984
|
DuckDBColumnsFun::RegisterFunction(*this);
|
|
100549
100985
|
DuckDBConstraintsFun::RegisterFunction(*this);
|
|
100986
|
+
DuckDBFunctionsFun::RegisterFunction(*this);
|
|
100550
100987
|
DuckDBIndexesFun::RegisterFunction(*this);
|
|
100551
100988
|
DuckDBSchemasFun::RegisterFunction(*this);
|
|
100552
100989
|
DuckDBDependenciesFun::RegisterFunction(*this);
|
|
@@ -101152,7 +101589,7 @@ BaseAppender::~BaseAppender() {
|
|
|
101152
101589
|
}
|
|
101153
101590
|
|
|
101154
101591
|
void BaseAppender::Destructor() {
|
|
101155
|
-
if (
|
|
101592
|
+
if (Exception::UncaughtException()) {
|
|
101156
101593
|
return;
|
|
101157
101594
|
}
|
|
101158
101595
|
// flush any remaining chunks, but only if we are not cleaning up the appender as part of an exception stack unwind
|
|
@@ -103436,7 +103873,7 @@ ClientContext::ClientContext(shared_ptr<DatabaseInstance> database)
|
|
|
103436
103873
|
}
|
|
103437
103874
|
|
|
103438
103875
|
ClientContext::~ClientContext() {
|
|
103439
|
-
if (
|
|
103876
|
+
if (Exception::UncaughtException()) {
|
|
103440
103877
|
return;
|
|
103441
103878
|
}
|
|
103442
103879
|
// destroy the client context and rollback if there is an active transaction
|
|
@@ -105328,7 +105765,7 @@ DatabaseInstance::DatabaseInstance() {
|
|
|
105328
105765
|
}
|
|
105329
105766
|
|
|
105330
105767
|
DatabaseInstance::~DatabaseInstance() {
|
|
105331
|
-
if (
|
|
105768
|
+
if (Exception::UncaughtException()) {
|
|
105332
105769
|
return;
|
|
105333
105770
|
}
|
|
105334
105771
|
|
|
@@ -114513,7 +114950,7 @@ public:
|
|
|
114513
114950
|
|
|
114514
114951
|
//! The subquery
|
|
114515
114952
|
unique_ptr<SelectStatement> subquery;
|
|
114516
|
-
//!
|
|
114953
|
+
//! Aliases for the column names
|
|
114517
114954
|
vector<string> column_name_alias;
|
|
114518
114955
|
|
|
114519
114956
|
public:
|
package/src/duckdb.hpp
CHANGED
|
@@ -10,8 +10,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
10
10
|
|
|
11
11
|
#pragma once
|
|
12
12
|
#define DUCKDB_AMALGAMATION 1
|
|
13
|
-
#define DUCKDB_SOURCE_ID "
|
|
14
|
-
#define DUCKDB_VERSION "0.3.2-
|
|
13
|
+
#define DUCKDB_SOURCE_ID "6d8e28328"
|
|
14
|
+
#define DUCKDB_VERSION "0.3.2-dev492"
|
|
15
15
|
//===----------------------------------------------------------------------===//
|
|
16
16
|
// DuckDB
|
|
17
17
|
//
|
|
@@ -1299,6 +1299,8 @@ public:
|
|
|
1299
1299
|
return ConstructMessageRecursive(msg, values, params...);
|
|
1300
1300
|
}
|
|
1301
1301
|
|
|
1302
|
+
DUCKDB_API static bool UncaughtException();
|
|
1303
|
+
|
|
1302
1304
|
private:
|
|
1303
1305
|
string exception_message_;
|
|
1304
1306
|
};
|
|
@@ -2621,8 +2623,11 @@ public:
|
|
|
2621
2623
|
DUCKDB_API static Value DOUBLE(double value);
|
|
2622
2624
|
//! Create a struct value with given list of entries
|
|
2623
2625
|
DUCKDB_API static Value STRUCT(child_list_t<Value> values);
|
|
2624
|
-
//! Create a list value with the given entries
|
|
2626
|
+
//! Create a list value with the given entries, list type is inferred from children
|
|
2627
|
+
//! Cannot be called with an empty list, use either EMPTYLIST or LIST with a type instead
|
|
2625
2628
|
DUCKDB_API static Value LIST(vector<Value> values);
|
|
2629
|
+
//! Create a list value with the given entries
|
|
2630
|
+
DUCKDB_API static Value LIST(LogicalType child_type, vector<Value> values);
|
|
2626
2631
|
//! Create an empty list with the specified type
|
|
2627
2632
|
DUCKDB_API static Value EMPTYLIST(LogicalType child_type);
|
|
2628
2633
|
//! Creat a map value from a (key, value) pair
|